-
Notifications
You must be signed in to change notification settings - Fork 15.7k
feat(gimbal): support mount gimbal manager #27121
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
Open
minhleGremsy
wants to merge
7
commits into
PX4:main
Choose a base branch
from
minhleGremsy:gremsy-solutions-feature-support-mount-gimbal-manager
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d108361
Ready for committing to PX4 community
22c60e5
feat(gimbal): support mount to gimbal manager
minhleGremsy effda02
[Fix] Cannot build for zenoh board
16036b4
Disable unnecessary module in zenoh due to constrained flash size
minhleGremsy 6611087
Disable unnecessary to avoid overflow memory issue
9063b3e
Disable SIH due to flash constrained
minhleGremsy 1ad1073
Merge branch 'main' into gremsy-solutions-feature-support-mount-gimba…
minhleGremsy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #Bridge-private information received from external gimbal manager | ||
| uint64 timestamp # time since system start (microseconds) | ||
|
|
||
| uint8 source_system | ||
| uint8 source_component | ||
|
|
||
| uint32 cap_flags | ||
|
|
||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_HAS_RETRACT = 1 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_HAS_NEUTRAL = 2 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_HAS_ROLL_AXIS = 4 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_HAS_ROLL_FOLLOW = 8 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_HAS_ROLL_LOCK = 16 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_HAS_PITCH_AXIS = 32 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_HAS_PITCH_FOLLOW = 64 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_HAS_PITCH_LOCK = 128 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_HAS_YAW_AXIS = 256 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_HAS_YAW_FOLLOW = 512 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_HAS_YAW_LOCK = 1024 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_SUPPORTS_INFINITE_YAW = 2048 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_CAN_POINT_LOCATION_LOCAL = 65536 | ||
| uint32 GIMBAL_MANAGER_CAP_FLAGS_CAN_POINT_LOCATION_GLOBAL = 131072 | ||
|
|
||
| uint8 gimbal_device_id | ||
|
|
||
| float32 roll_min # [rad] | ||
| float32 roll_max # [rad] | ||
|
|
||
| float32 pitch_min # [rad] | ||
| float32 pitch_max # [rad] | ||
|
|
||
| float32 yaw_min # [rad] | ||
| float32 yaw_max # [rad] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #Bridge private set-attitude command for an external gimbal manager | ||
| uint64 timestamp # time since system start (microseconds) | ||
|
|
||
| uint8 origin_sysid | ||
| uint8 origin_compid | ||
|
|
||
| uint8 target_system | ||
| uint8 target_component | ||
|
|
||
| uint32 EXTERNAL_GIMBAL_MANAGER_FLAGS_RETRACT = 1 | ||
| uint32 EXTERNAL_GIMBAL_MANAGER_FLAGS_NEUTRAL = 2 | ||
| uint32 EXTERNAL_GIMBAL_MANAGER_FLAGS_ROLL_LOCK = 4 | ||
| uint32 EXTERNAL_GIMBAL_MANAGER_FLAGS_PITCH_LOCK = 8 | ||
| uint32 EXTERNAL_GIMBAL_MANAGER_FLAGS_YAW_LOCK = 16 | ||
| uint32 EXTERNAL_GIMBAL_MANAGER_FLAGS_YAW_IN_VEHICLE_FRAME = 32 | ||
| uint32 EXTERNAL_GIMBAL_MANAGER_FLAGS_YAW_IN_EARTH_FRAME = 64 | ||
| uint32 EXTERNAL_GIMBAL_MANAGER_FLAGS_ACCEPTS_YAW_IN_EARTH_FRAME = 128 | ||
| uint32 EXTERNAL_GIMBAL_MANAGER_FLAGS_RC_EXCLUSIVE = 256 | ||
| uint32 EXTERNAL_GIMBAL_MANAGER_FLAGS_RC_MIXED = 512 | ||
|
|
||
| uint32 flags | ||
| uint8 gimbal_device_id | ||
|
|
||
| float32[4] q | ||
|
|
||
| float32 angular_velocity_x | ||
| float32 angular_velocity_y | ||
| float32 angular_velocity_z | ||
|
|
||
| uint8 ORB_QUEUE_LENGTH = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #Bridge-private status received from an external gimbal manager | ||
| uint64 timestamp # time since system start (microseconds) | ||
|
|
||
| uint32 flags | ||
| uint8 gimbal_device_id | ||
|
|
||
| uint8 primary_control_sysid | ||
| uint8 primary_control_compid | ||
|
|
||
| uint8 secondary_control_sysid | ||
| uint8 secondary_control_compid | ||
|
|
||
| uint8 source_system | ||
| uint8 source_component |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting. In theory, it should be possible to have two gimbal managers in a system: e.g. PX4 is a gimbal manager talking to its gimbal device while there is a second gimbal manager such as the integrated camera/gimbal.
Everything should then flow seamlessly through mavlink, so any gimbal command should just be sent or forwarded to the gimbal manager. I need to think more about that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @julianoes , that works in theory. But, PX4 default find a gimbal device with COMP_ID=MNT_MAV_COMPID which is default as 154, similar to most mavlink gimbal device. It might make the gimbal device confuse, so I made this to prevent this situation.
Also, PX4 always broadcast it as a gimbal manager even if it does not find any its gimbal device. I think this behavior is not correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, so that might be the first thing to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @julianoes , I tried to fix the issue PX4 always act as a gimbal manager even when a gimbal device is not belong to it.
After deep dive to the code https://github.dev/PX4/PX4-Autopilot/blob/d5f5c503309c14321934602b037148cd3756c465/src/modules/gimbal/gimbal.cpp#L568-L569 I found params MNT_MAV_SYSID, MNT_MAV_COMPID are only use for gimbal protocol v1, which not support gimbal device discovering.
In gimbal protocol v2, https://github.dev/PX4/PX4-Autopilot/blob/d5f5c503309c14321934602b037148cd3756c465/src/modules/gimbal/output_mavlink.cpp#L191-L199 PX4 auto discover for gimbal device by gimbal_device_information, so it steal our gimbal device. Of course, we can modify our gimbal device to reject PX4 gimbal_manager message, but can not apply widely. I'd like to hear your thought about this. How would we decide which gimbal device below to which gimbal manager in a complex system with multiple gimbal or multi component want to act as gimbal manager. Currently, mavlink has not have any message field for the gimbal_device to public who is its manager.
Another comment, in our setup, our gimbal manager is successfully integrated with the GCS via standard mavlink GCS <-> gimbal_manger, tested with QGC and our NexGCS. We need integration to PX4, because we want to have manual control via RC input and control in a flight mission with precise control and gps. For now, PX4 support only one gimbal, if PX4 support mount to a gimbal manager, I think there is no meaning to keep PX4's gimbal_manager anymore. How do you think?