-
-
Notifications
You must be signed in to change notification settings - Fork 512
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
Added function to query SYS_STATUS present/enabled/health flags #2383
base: main
Are you sure you want to change the base?
Conversation
Not sure what the |
Thanks! I guess the question is whether it should expose an Does it always make sense to expose all those values, or are some values fundamentally "internal"? I could imagine for instance that if What do you think?
I think it would be the style check. Try running |
I did run fix_style.sh, it's only failing on 24.04 🤔
I thought about this but decided to expose them all since PX4 currently doesn't implement all of them but could at any point in the future. It would just be a pain to have to updated mavsdk again if for example I decided to add the flags for a VIO system, or optical flow, or precision landing. So I figured just expose the raw 3 flags and we get everything in one go. |
I usually don't want to expose bitflags like this but make the API clearer. I know that's a pain but otherwise we might as well expose all over MAVLink directly and we're back to square one. So generally the idea is to have boolean flags that actually mean something instead and can be queried. For logloader specifically, could you use passthrough instead? |
You need to fix the style on 24.04 or use the docker helper. |
I could use passthrough but then my code becomes disorderly. Okay if I changed it to a boolean flag for each of those mentioned sensors, what pattern should I follow? This isn't doing anything more
|
also part of why I was avoiding the specific flags.. PX4 makes it hard to use the sys_status_sensor flags directly since they're coupled to the HealthAndArmingChecks Report. I can't remember exact details, but when I implemented the loggerCheck I wasn't able to set the present/enabled flags directly, and as a result they toggle true/false together. I think the expectation would be that |
Quality Gate passedIssues Measures |
I would think something like the winch status flags? https://github.com/mavlink/MAVSDK-Proto/blob/517fef5a3a673e9b50f65a56dff350c6af515564/protos/winch/winch.proto#L77-L101: /*
* Winch Status Flags.
*
* The status flags are defined in mavlink
* https://mavlink.io/en/messages/common.html#MAV_WINCH_STATUS_FLAG.
*
* Multiple status fields can be set simultaneously. Mavlink does
* not specify which states are mutually exclusive.
*/
message StatusFlags {
bool healthy = 1; // Winch is healthy
bool fully_retracted = 2; // Winch line is fully retracted
bool moving = 3; // Winch motor is moving
bool clutch_engaged = 4; // Winch clutch is engaged allowing motor to move freely
bool locked = 5; // Winch is locked by locking mechanism
bool dropping = 6; // Winch is gravity dropping payload
bool arresting = 7; // Winch is arresting payload descent
bool ground_sense = 8; // Winch is using torque measurements to sense the ground
bool retracting = 9; // Winch is returning to the fully retracted position
bool redeliver = 10; // Winch is redelivering the payload. This is a failover state if the line tension goes above a threshold during RETRACTING.
bool abandon_line = 11; // Winch is abandoning the line and possibly payload. Winch unspools the entire calculated line length. This is a failover state from REDELIVER if the number of attempts exceeds a threshold.
bool locking = 12; // Winch is engaging the locking mechanism
bool load_line = 13; // Winch is spooling on line
bool load_payload = 14; // Winch is loading a payload
} |
I think it will either be a Status struct per component:
Or a flat enum:
|
The StatusFlags struct with 3 booleans is a lot more intuitive to me, I would say 🙈 |
Added function to query SYS_STATUS present/enabled/health. This allows applications to look at specific sensor statuses, such as logloader which looks at the MAV_SYS_STATUS_LOGGING flag