-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
Add acceptance_radius back to MissionItem #1443
Conversation
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.
I am fine with adding it, but you should do it by adding it to the mission.proto
definition and generate the code.
E.g. mission.h
is not a file you change manually, right?
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.
Oh, did this get lost? I wonder how? Thanks for the contribution @bazfp. And as @JonasVautherin wrote, please change it in the proto repo:
https://github.com/mavlink/MAVSDK-Proto/blob/main/protos/mission/mission.proto#L175
Thanks guys |
a099080
to
8d14d2f
Compare
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.
LGTM, thanks a lot!
if (item.is_fly_through) { | ||
if (std::isfinite(item.acceptance_radius_m)) { | ||
acceptance_radius_m = item.acceptance_radius_m; | ||
} else if (item.is_fly_through) { | ||
// _acceptance_radius_m is 0, determine the radius using fly_through |
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.
Not related to this PR, but I don't get this comment. @julianoes would you have some insights about it?
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.
Me neither 🤔
@bazfp: some integration tests are still failing, actually. Please pull my latest changes, I updated your branch and the proto submodule 👍 |
Seems to be failing due to the I could try and work backwards and set the |
@julianoes are 1 and 3 some "standard" defaults? I guess MAVSDK does that because sending NAN to PX4 results in an invalid waypoints? @bazfp would you mind trying to remove the logic that sets it to 1 or 3 and leave it to NAN instead? I would be tempted to say that if there is a default, it should be set on the PX4 side, not in MAVSDK... 🤔 |
I've removed the offending section that was setting the acceptance radius. I could set the acceptance radius default to be 1.0m in the proto definition. It wouldn't account for flythrough waypoints anymore but that logic could go anywhere else. |
I understand the idea, but I still believe that if the user does not set it, then it should be the responsibility of the autopilot to have a sane default (which may differ from a frame to the other). So I would keep it set to NAN and send that to the autopilot. |
For some reason |
@bazfp looks like it's still timing out. I'm gonna have a look tomorrow to see what's going on. |
Ok, I can reproduce it with PX4 v1.10. It looks like it's something that has been fixed on master. It never accepts the first mission item as "reached" although it is basically hovering there. |
This reverts commit 9ed0a20. It turns out these defaults are actually required because PX4 v1.9, v1.10, v1.11 do not handle NAN properly and will be stuck forever at a waypoint. Also, it probably makes sense to keep the current implementation not to break anyone using it that way.
@bazfp I've added the defaults back in. It turns out they are required for PX4 v1.9, v1.10, v1.11 because PX4 gets stuck indefinitely with NAN. In PX4 master/v1.12 the acceptance radius is completely ignored which is wrong in my opinion and I'm going to fix. |
Oh, my bad then 😅. Do you agree that PX4 should have a sane default if NAN is sent? |
@JonasVautherin yes, I agree. It should but it will take some time until we can rely on that. Or we need to have a version check to check for it. |
No need for a version check, but it's good to see that it is fixed upstream. Will come some day 😊 |
Aha, now CI fails because the check back for acceptance radius is not correct. Because we don't know if 1 or 3 meters are set on purpose or because of NAN 🤦. This is harder than expected. |
One solution? |
@JonasVautherin the suggestion by @bazfp would work, right? |
Yes, we could define to 1 in the proto, and then should we return an error code if the user sets it (explicitly) to NAN, since we know that it crashes on the PX4 side? |
@JonasVautherin hm, I would accept NAN but change it to |
But in that case, should it be a default in the proto definition, or should we just hardcode that behavior? Because it seems like anyway we will hardcode parts of it... |
Hard-coding like we do right now is fine but the problem is that the test fails which checks if the downloaded items are equal to the ones uploaded. |
But the proto file won't fix that, right? |
We would change the test not to use NAN, I suppose, but we could also do that already. |
I would vote for that: the default in the proto file is "NAN", because it means "let PX4 choose", and that's what we want. And for versions earlier than 1.12, we have a fix that says "if it is NAN, set to 1". And in the test we don't use NAN, I guess we don't have a choice. So:
How does that sound? |
Yes, that's great. I'll make the change. |
We need to set the acceptance radius to something other than NAN. Otherwise, NAN gets converted to a default and then fails the validation if the mission items are still the same after an upload and download cycle.
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.
Great! Thanks 🚀
Appears this added in a previous PR but disappeared during a refactor. It's a useful option to have as sometimes the defaults are causing some items to never be achieved in our SITL testing (We've now swapped to MissionRaw)
Happy to update the factory funcs + proto to include this, unless there's a reason it was removed :)