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

EKF: Match handling of MAV_CMD_EXTERNAL_POSITION_ESTIMATE to common MAVLink dialect #26387

Merged
merged 2 commits into from
Mar 7, 2024

Conversation

Maarrk
Copy link
Contributor

@Maarrk Maarrk commented Mar 4, 2024

This is a minor follow up to #23903. The feature works great, thanks a lot! I ran into some minor surprises when implementing support for it in our GCS. I initially wrote the code based on the MAVLink docs for MAV_CMD_EXTERNAL_POSITION_ESTIMATE, and found that frame and accuracy weren't handled as I expected.

Accuracy is explicitly advised to be set to NaN if unknown:

estimated one standard deviation accuracy of the measurement. Set to NaN if not known. source

But I found that it was stopping the whole autopilot when I tried that in SITL (Connection reset or closed by peer on TCP socket)


I assume that MAV_FRAME sent in COMMAND_INT should behave the same way for MAV_FRAME_GLOBAL and MAV_FRAME_GLOBAL_INT (a search of the repo shows them together), but only the first one was accepted in the check.

(Contribution on behalf of @FlyfocusUAV)

@rmackay9
Copy link
Contributor

rmackay9 commented Mar 5, 2024

Hi @Maarrk,

Thanks for this.

Could you update the commit title so that it starts with "AP_NavEKF3:"? Adding the prefix makes backporting easier because we can immediately see what subsystem is affected by a change. To be clear, I'm talking about the commit title not the PR title.

@rmackay9
Copy link
Contributor

rmackay9 commented Mar 5, 2024

@Maarrk,

Could you also tell us what testing has been done? Knowing this will give us more confidence that merging is safe.

@Maarrk Maarrk force-pushed the pr-external-pos-cmd branch from 5e0c026 to 24d2631 Compare March 5, 2024 11:01
@Maarrk
Copy link
Contributor Author

Maarrk commented Mar 5, 2024

Hello @rmackay9,
thanks for the quick reply. I rebased onto master and changed the commit message as requested.

I have tested the code in SITL with ArduPlane. During flight, I disabled GPS with MAV_CMD_DO_AUX_FUNCTION, and then sent the command through GCS.

Didn't change interacting through MAVProxy "Set Position" (sending MAV_FRAME_GLOBAL and accuracy 50), and worked as expected with our custom QGroundControl (sending MAV_FRAME_GLOBAL_INT and accuracy NaN).

At the moment it's hard for me to give you a precise date when I'd have a chance to fly this code on real hardware. Do let me know if you'd like me to change one of the calls in autotest to use these newly supported values, for example here:

self.run_cmd_int(
mavutil.mavlink.MAV_CMD_EXTERNAL_POSITION_ESTIMATE,
p1=self.get_sim_time()-1, # transmit time
p2=0.5, # processing delay
p3=50, # accuracy
p5=gpi.lat+1,
p6=gpi.lon+1,
p7=float("NaN"), # alt
frame=mavutil.mavlink.MAV_FRAME_GLOBAL,
want_result=mavutil.mavlink.MAV_RESULT_ACCEPTED
)

@rmackay9 rmackay9 removed the DevCallEU label Mar 6, 2024
@peterbarker
Copy link
Contributor

I've fixed up the commit list and marked this as MergeOnCIPass. Thanks!

@tridge tridge merged commit baf0da7 into ArduPilot:master Mar 7, 2024
89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants