-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
FlightTask Subscription Initialization #13293
Comments
When changing nav states there's a race condition here with navigator. Without a larger change what do you want the FlightTask to do before the position_setpoint_triplet is available? |
without any larger refactor, I see two options: replace lazy publisherCurrently, triplets are implemented as a lazy publisher, where the triplets are only published if a new triplet is available and the navigator is running (not sure about the latter). A solution could be to replace the lazy publisher with a stream where the messages are invalid if the navigator is not running. subscriber ability to flush out the current messageAnother option could be the ability to reset uorb-data to its default whenever requested. This way the Flighttask or any other subscriber can reset the data if no longer needed. |
We can't figure it out based on metadata? There's the timestamp of the triplet (publication), but also the individual timestamps of the current, prev, and next. The timestamp of when the control mode first enabled auto would be the thing to compare it again from the FlightTaskAuto activation perspective. |
it turns out that it is not as simple as originally hoped.
is true within FlightTasks because a newer |
In |
yep, that would work. Or the navigator just sends out a |
Related idea to this, but beyond the scope of the immediate fix.
The end result would be when changing into Auto the flight task would first run (activation) right after the actual position_setpoint_triplet publication. @MaEtUgR FYI |
@MaEtUgR and I just ran into another race condition with this. This time the culprit is that we never "unpublish" the issue, so we don't publish if valid is not true here: |
Can you expand on the details? I'd like to think about a complete solution we can work towards that will get us beyond race condition whack-a-mole. |
I think the root of the race condition whack-a-mole is the way the modules trust the commander. The way it is implemented right now, the commander would have to know everything to actually make a valid state-transition. |
That's what I meant with having an outdated triplet. |
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
Describe the bug
FlightTaskAuto depends on the
position_setpoint_triplet
-msg. During the activation of FlightTaskAuto, it can happen that FlightTaskAuto is activated with an oldposition_setpoint_triplet
msg from a previous publification.To Reproduce
Steps to reproduce the behavior in simulation:
Add a print for the type of triplet-msg during activation here:
PX4_INFO("triplet type: %d", _sub_triplet_setpoint.get().current.type);
Start simulation
Wait until the vehicle has a GPS lock and can be put into
Hold
Arm
Give thrust-input to takeoff which also puts the vehicle into Manual Position-mode
Do a
GoTo
maneuver: observe the prints, where the triplets are of type 5, which is equal to IDLE and hence zero thrust (https://github.com/PX4/Firmware/blob/master/src/lib/FlightTasks/tasks/AutoMapper/FlightTaskAutoMapper.cpp#L114-L119)Expected behavior
During the initialization, old triplets should be ignored.
Additional context
A solution to this problem could be to reset a specific uorb-message once a FlightTask has been exited to prevent an initialization with an old message.
Depending on the delay between the activation and a new triplet, the vehicle might enter free fall due to zero thrust.
The text was updated successfully, but these errors were encountered: