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

Fix: Stop gimbal from spinning when an angular velocity setpoint stream times out #23825

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MaEtUgR
Copy link
Member

@MaEtUgR MaEtUgR commented Oct 17, 2024

Solved Problem

When an angular velocity setpoint (gimbal_manager_set_manual_control) stops streaming while still commanding non-zero velocity, the gimbal continues turning indefinitely.

Context:
I found this when working with a gimbal that can be steered by a lever but also a "level out" button it's crucial to not constantly send the lever-based angular velocity setpoint (gimbal_manager_set_manual_control) because that overrides any button-based attitude setpoint (gimbal_manager_set_attitude) immediately again. Solution: only send angular velocity setpoints when the lever is actually deflected and stop sending them when they are zero. But what happens if you lose connection?

Solution

  1. Little refactor (optional)
  2. Save the timestamp of the last received setpoint for every single input case.
  3. Implement a timeout to stop the gimbal if the last non-zero angular velocity setpoint was too long ago

Changelog Entry

Fix: Stop gimbal from spinning when an angular velocity setpoint stream times out

Alternatives

@julianoes I'm eager to find out if you have any better idea or implementation architecture in mind to solve this problem.

Test coverage

I tested using MAVLink gimbal V2 as in- and output. I mapped a lever to gimbal pitch-rate and shut the input MAVLink connection while the lever was deflected and gimbal moving. Before the change it would continue spinning indefinitely, with my pr there is no update anymore for 2 seconds and then there is one single update that commands the gimbal to 0 pitch-rate and it stops. Note: When I tried NAN that caused the gimbal to reset its orientation which I consider undesired e.g. during connection dropouts.

To enable implementing a timeout when there's no new setpoint coming in.
The gimbal would otherwise continue to spin with whatever velocity was commanded
before the input connection was lost.
@MaEtUgR MaEtUgR self-assigned this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant