Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Improve gimbal support #10667

Closed
wants to merge 87 commits into from
Closed

[WIP] Improve gimbal support #10667

wants to merge 87 commits into from

Commits on Jan 15, 2024

  1. Configuration menu
    Copy the full SHA
    9435c63 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6e43a8e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    83f983a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0a36146 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    cdb706a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    71aee1e View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f18b5ff View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e6f6147 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    da15818 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    aa25601 View commit details
    Browse the repository at this point in the history
  11. provisional commit, enable Ardupilot ROI:

    Due to how Ardupilot manages cancel ROI, we can not use
    the standard ROI indicator. Hopefully it will be solved
    in AP in short
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    e71d61b View commit details
    Browse the repository at this point in the history
  12. Vehicle: implement gimbal control acquisition

    Before commanding a gimbal we need to acquire control of it. If
    someone else is in control, we should ask the user if they really want
    to take over control or not. For instance the gimbal could be controlled
    by a companion computer or the autopilot itself as part of a mission and
    a user might not want to interfere.
    
    If no-one else is in control, then we silently acquire control.
    
    This control acquisition only works if the gimbal_manager_status message
    is sent out. We might have to request it at a certain rate.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    89737dc View commit details
    Browse the repository at this point in the history
  13. Vehicle: don't filter gimbal device messages

    I don't think we're supposed to filter messages coming from the gimbal
    device as they could be sent directly from a gimbal rather than the
    autopilot.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    57f8a54 View commit details
    Browse the repository at this point in the history
  14. Vehiclee: use M_PI constant

    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    b37a752 View commit details
    Browse the repository at this point in the history
  15. Vehicle: guard ArduPilot specific commands

    This still needs implementation in some way for PX4.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    3a140f2 View commit details
    Browse the repository at this point in the history
  16. Add gimbal class to list and manage gimbals

    This is just a first skeleton. So far, all it does, is request the
    gimbal information message.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    944d633 View commit details
    Browse the repository at this point in the history
  17. Gimbal: rename Gimbal class to GimbalController

    We don't want to use the term GimbalManager because that gets confusing
    because the MAVLink protocol also uses the GimbalManager term.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    7907cb6 View commit details
    Browse the repository at this point in the history
  18. Gimbal: implement gimbal message requests

    We now request and handle
    - GIMBAL_MANAGER_INFORMATION
    - GIMBAL_MANAGER_STATUS
    - GIMBAL_DEVICE_ATTITUDE_STATUS
    in the GimbalController class.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    c28c263 View commit details
    Browse the repository at this point in the history
  19. libs: update mavlink submodule

    I needed the updated gimbal flags.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    43949a9 View commit details
    Browse the repository at this point in the history
  20. Gimbal: trying to move funcionality to Gimbal class

    This is an intermediate work in progress state trying to move the gimbal
    functionality over to the separate class.
    
    What's currently missing is the selection mechanism to chose between
    multiple gimbals and an API to then command a specific gimbal.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    362f1a0 View commit details
    Browse the repository at this point in the history
  21. Vehicle: remove debug messages

    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    3f79d4b View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    a7955a7 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    f006ac7 View commit details
    Browse the repository at this point in the history
  24. Gimbal: prevent printing garbage

    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    c72dfd8 View commit details
    Browse the repository at this point in the history
  25. Gimbal: don't forget to set all flags

    The attitude one was missing.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    7c94e70 View commit details
    Browse the repository at this point in the history
  26. Gimbal: emit signal when gimbal is discovered

    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    dc1c619 View commit details
    Browse the repository at this point in the history
  27. Gimbal: don't use requestMessage helper

    Somehow this caused trouble loading the connection bar. I don't quite
    appreciate or like the implementation of this helper and decided to just
    ignore it and send the command directly.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    deabcc8 View commit details
    Browse the repository at this point in the history
  28. Gimbal: don't continue with nothing

    Early return missing return, duh.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    8b8eff3 View commit details
    Browse the repository at this point in the history
  29. Joystick: remove some outdated gimbal stuff

    I believe we can add that back in properly soon.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    01b332b View commit details
    Browse the repository at this point in the history
  30. FlightDisplay: add button for gimbal selection

    Work in progress. It doesn't do anything yet.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    6f6369b View commit details
    Browse the repository at this point in the history
  31. GimbalController: After 3 attempts to set default rate, request gimba…

    …l_manager_status at 0.2 Hz:
    
    In case the autopilot doesn't have a default rate for this message
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    2d0a12e View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    15ee0c7 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    f8069ab View commit details
    Browse the repository at this point in the history
  34. GimbalController.h: increase requestStatus retries to 6:

    For Ardupilot this wasn't enough sometimes if QGC connects right
    when vehicle is connected.
    
    For some reason the request isn't processed, probably because of
    some issue with the request messages implementation in Ardupilot,
    so it should be fixed at the Ardupilot level, but incresing it
    from 4 to 6 isn't a big deal as it will only happen in the
    initial handshake, and it allows us to continue working
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    6ea1edb View commit details
    Browse the repository at this point in the history
  35. Gimbal Controller rework, use gimbal_device_id instead of compid, see…

    … long notes:
    
    Implementation was based on the assumption that all the gimbal managers would
    have a different compId, which is not always the case. As per mavlink documentation:
    
    https://mavlink.io/en/services/gimbal_v2.html
    
    Discovery should be based on GCS sending a MAV_CMD_REQUEST_MESSAGE for GIMBAL_MANAGER_INFORMATION
    and we should instantiate gimbals when we receive response to this message.
    
    This commit introduces several modifications toi allow this.
    
    This was needed because otherwise the existent implementation would not allow multi gimbal
    systems with gimbals belonging to the same compid to work correctly
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    0a271e6 View commit details
    Browse the repository at this point in the history
  36. Gimbal: properly handle attitude

    This includes:
    - Respecting the flags which determine the yaw frame of reference.
    - Using the Euler angle conversion ZXY which has a singularity at high
      roll but not at pitch down which is used much more often.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    5967781 View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    ac73c78 View commit details
    Browse the repository at this point in the history
  38. GimbalController: Provisionally emit vehicle gimbalpitch/yawChanged:

    This is needed for UI to detect changes in that vehicle's property.
    It is returning now gimbal 1 from gimbalController, and maybe the
    architecture on that regard will change, hence marking this as provisional
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    382b5ad View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    1a852ae View commit details
    Browse the repository at this point in the history
  40. GimbalController: make Gimbal class Q_OBJECT:

    This is needed in order to do nicer the frontend, so we can
    access Q_PROPERTY's from each gimbal to display on the UI.
    It potentially opens the possibility of calling Q_INVOKABLES
    on the gimbal itself as well.
    
    GimbalController was declared as a friend class of Gimbal, it is
    the only class that will actually modify values and it makes the
    code more compact overall
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    acceca3 View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    f9696b3 View commit details
    Browse the repository at this point in the history
  42. GimbalController: fix wrong yaw in quat to euler conversion:

    For some reason the Eigen based conversion was odd in yaw. It would
    only represent 0-180, and when passed that, it would go to 0-180 again
    instead of representing the negative (left) part of it
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    4d5ba39 View commit details
    Browse the repository at this point in the history
  43. Configuration menu
    Copy the full SHA
    2b8366c View commit details
    Browse the repository at this point in the history
  44. Configuration menu
    Copy the full SHA
    ae165a5 View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    20553fb View commit details
    Browse the repository at this point in the history
  46. GimbalController: move here some gimbal related functionality from ve…

    …hicle. Needs rework:
    
    it needs to account for adquirecontrol, etc and also some functions are using APM custom commands
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    4a5f517 View commit details
    Browse the repository at this point in the history
  47. Configuration menu
    Copy the full SHA
    06470a7 View commit details
    Browse the repository at this point in the history
  48. Configuration menu
    Copy the full SHA
    011cc80 View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    2e93b31 View commit details
    Browse the repository at this point in the history
  50. Configuration menu
    Copy the full SHA
    648e756 View commit details
    Browse the repository at this point in the history
  51. FlyViewVideoToolStrip.qml: disabled in Video view, disable get from m…

    …ap when hidden:
    
    In video view there is no point on having this enabled. Also when
    we hide this panel, we automatically remove the take coords from map
    feature, it was confusing otherwise
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    b572439 View commit details
    Browse the repository at this point in the history
  52. FlyViewVideoToolStrip.qml: provisionally add new button to manually r…

    …elease gimbal control
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    1cc84b1 View commit details
    Browse the repository at this point in the history
  53. Configuration menu
    Copy the full SHA
    ec81bac View commit details
    Browse the repository at this point in the history
  54. GimbalController: Implement adquire gimbal control mechanism:

    There is a new signal showAcquireGimbalControlPopup that
    qml takes to show a popup asking the user if desiring
    to take control.
    
    In gimbal controller, we have a new method _tryGetGimbalControl()
    which we invoke prior to attempting any kind of gimbal control.
    
    This function emits the signal to show the popup if needed, returning
    false so the actual action isn't sent, and it returns true if the
    actual action could be sent ( if we are in control or if nobody
    is, although in the later it will also adquire control )
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    80c9e2e View commit details
    Browse the repository at this point in the history
  55. Configuration menu
    Copy the full SHA
    0c6069b View commit details
    Browse the repository at this point in the history
  56. Configuration menu
    Copy the full SHA
    fb68a3f View commit details
    Browse the repository at this point in the history
  57. GimbalController.cc: substitute gimbals()[0] by new _activeGimbal:

    Moving towards multigimbal support
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    8bbfa2b View commit details
    Browse the repository at this point in the history
  58. GimbalController.cc: use _activeGimbal->deviceId in Mav commands:

    So we no longer use by default gimbal 0
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    0daf8bd View commit details
    Browse the repository at this point in the history
  59. Configuration menu
    Copy the full SHA
    e81faf9 View commit details
    Browse the repository at this point in the history
  60. Configuration menu
    Copy the full SHA
    6335881 View commit details
    Browse the repository at this point in the history
  61. Configuration menu
    Copy the full SHA
    f14116f View commit details
    Browse the repository at this point in the history
  62. FlyViewVideoToolStrip.qml: acquire/release button automatic behaviour:

    it will show acquire or release depending on if we are or not in control
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    c900985 View commit details
    Browse the repository at this point in the history
  63. Configuration menu
    Copy the full SHA
    b4c58c4 View commit details
    Browse the repository at this point in the history
  64. Configuration menu
    Copy the full SHA
    19c9825 View commit details
    Browse the repository at this point in the history
  65. Configuration menu
    Copy the full SHA
    1d64f9e View commit details
    Browse the repository at this point in the history
  66. New qml class FakeToolStripHoverButton.qml:

    This qml class is meant to be used to aesthetically
    match the looks of ToolStripHoverButton, but without
    depending on the whole concept of ToolStripAction,
    which is handy to work on toolbars with simpler action
    Complexity
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    3a14bcd View commit details
    Browse the repository at this point in the history
  67. FlyViewVideoToolStrip.qml: Multi-gimbal selector working:

    Whenever we have a gimbal active, a button will appear in the
    gimbal toolbar to select between the available gimbals. This will
    set the new gimbal as active gimbal, and all the commands will
    control it instead
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    bf8627d View commit details
    Browse the repository at this point in the history
  68. Configuration menu
    Copy the full SHA
    2df8be8 View commit details
    Browse the repository at this point in the history
  69. Configuration menu
    Copy the full SHA
    98276ce View commit details
    Browse the repository at this point in the history
  70. Configuration menu
    Copy the full SHA
    d81f8e5 View commit details
    Browse the repository at this point in the history
  71. Configuration menu
    Copy the full SHA
    29bb8c6 View commit details
    Browse the repository at this point in the history
  72. Configuration menu
    Copy the full SHA
    89f49a5 View commit details
    Browse the repository at this point in the history
  73. Configuration menu
    Copy the full SHA
    9a965e4 View commit details
    Browse the repository at this point in the history
  74. Configuration menu
    Copy the full SHA
    9eff61a View commit details
    Browse the repository at this point in the history
  75. Configuration menu
    Copy the full SHA
    2204167 View commit details
    Browse the repository at this point in the history
  76. Configuration menu
    Copy the full SHA
    f8aa063 View commit details
    Browse the repository at this point in the history
  77. GimbalController: change order of sendGimbalManagerPitchYaw arguments:

    so they are aligned with the name of the function
    Davidsastresas authored and julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    1e81148 View commit details
    Browse the repository at this point in the history
  78. Configuration menu
    Copy the full SHA
    676c933 View commit details
    Browse the repository at this point in the history
  79. Configuration menu
    Copy the full SHA
    8fdb1d5 View commit details
    Browse the repository at this point in the history
  80. Configuration menu
    Copy the full SHA
    152d08f View commit details
    Browse the repository at this point in the history
  81. Configuration menu
    Copy the full SHA
    055947d View commit details
    Browse the repository at this point in the history
  82. Configuration menu
    Copy the full SHA
    d947597 View commit details
    Browse the repository at this point in the history
  83. Configuration menu
    Copy the full SHA
    2f4735f View commit details
    Browse the repository at this point in the history
  84. Fixup after Qt6 rebase

    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    de944da View commit details
    Browse the repository at this point in the history
  85. FlightDisplay: remove trailing whitespace

    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    f73cfe2 View commit details
    Browse the repository at this point in the history
  86. FlightDisplay: remove gimbal yaw lock call

    We don't need this separate yaw lock call as the flags are already sent
    as part of sendGimbalManagerPitchYaw which uses follow mode.
    
    This caused problems because it leads to the situation where two
    consequtive GIMBAL_MANAGER_DO_PITCH_YAW commands are sent, first for the
    flags, second for the pitch and yaw values. The second one is dropped
    with a warning because the "same command" is still pending.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    4228b3f View commit details
    Browse the repository at this point in the history
  87. gimbal: split relative/absolute yaw angle, cleanup

    This is my attempt at getting gimbal relative and absolute control
    working, using a joystick and by point and click.
    
    It cleans up a couple of methods that I believe were not actually used.
    
    Signed-off-by: Julian Oes <[email protected]>
    julianoes committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    d3d6d8e View commit details
    Browse the repository at this point in the history