External YAW does not work with GPS_INPUT

Hello

I am trying to provide external position and heading to Ardupilot. I used ArduSub framework as it seems it is often used in that case.
I got GPS_Input working as described in ardusub book GPS_INPUT , however the last Extension parameter provided in latest Mavlink GPS_INPUT ( #232 ) (pymavlink 2.4.39), which is Yaw, does not seem to be used by the ardupilot for heading.
And this is the problem. I need to use external heading to run the vehicle.

I can see via Mavlink inspector that the yaw is decoded in Ardupilot, but the vehicle is not using it for navigation.

Over the past few days I fiddled with several parameters below at no avail.

GPS_TYPE = MAV(14)
EK3_SRC1_YAW 6 - External Nav
AHRS_EKF_TYPE 11 tried 0 and 3
FS_EKF_THRESH 0
AHRS_GPS_USE 1, tried 2 as well

Also tried
GPS_type2 14 - 2nd GPSExternal MAV
FS_EKF_THRESH 0 (changed to 0 just to Off failsafe actions)
GPS_AUTO_CONFIG 0 - disable automatic GPS config

I can disable the onboard INS with
INS_USE 0
INS_USE2 0
INS_USE3 0
All it did is to disabled the internal yaw, but still is not using the one provided by GPSP_INPUT.

Also tried
COMPASS_ENABLE 0
COMPASS_USE 0
COMAPSS_USE2 0
COMAPSS_USE3 0
COMPASS_EXTERNAL 2
COMPASS_EXTERN 0 - force internal compass
COMPASS_EXTERN2 2 - force use extremal compass
COMPASS_EXTERN3 2 - force use extremal compass

EK3_ENABLE 0 tried with 1
EK2_ENABLE 0 tried with 1

Nothing what I do seems to force the vehicle to use the heading coming from external GPS_Input message.

Can anybody help? How to make ardupilot using the yaw from GPS_Input?
I have been spinning wheels for days now. Also posted on ardusub but no response.

thanks in advance.
Pawel

Hi @Yuri_Rage

Do you think you could help?
Thanks

Pawel

So you’ve disabled every nav source and you’re wondering why your sub won’t navigate?

Enable the IMUs and EKF3. Set EK3_YAW_SRC1 to GPS.

1 Like

Yaw support has been improved and extended in ArduSub 4.5.0-dev from yesterday. Can you test that version once you enabled Nav source like Yuri said?

1 Like

Hi @PawelP,

From a peek at the AP_GPS_MAV library it looks like it should accept the yaw field.

Also I think you should then be able to set EK3_SRC1_YAW = 2 (GPS) and it should try and consume the yaw from the GPS.

@amilcarlucas, I think the ArduSub yaw changes you’re referring to were more related to control rather than estimation.

1 Like

@PawelP,

By the way, using the GPS_INFO mavlink message is not the recommended way to get an external position and attitude estimate into ArduPilot. Instead we recommend using the AP_VisualOdometry library that accepts many similarly but slightly different mavlink messages including VISION_POSITION_ESTIMATE and VISION_SPEED_ESTIMATE. The advantage of doing it this way is that GPS/Non-GPS transitions will work.

1 Like

@Yuri_Rage
thank you for the response.
I have tried with the suggestion and still the yaw does not seem to be used:

I noticed that AHRS2 item in the MavLink inspector shows the yaw/roll/pitch from the on-board INS, yet the lat/lon is the one I provide with GPS_Input.
Could that be a hint?

also, I am sending GPS_Input at 4Hz as it seems. Could it be that EKF does not like the fact the data comes so slow and forces use of the internal gyros?

Looking forward to your suggestions

Pawel

Hi @amilcarlucas
I tried to locate the 4.5.0-dev you mentioned but I cannot find it on ArduPilot firmware : /Sub
would you be able to provide a link?
thank you

Hi @rmackay9
I enabled the EK3_SRC1_YAW = 2 (GPS) and there is no change it seems.
But I am starting to think that what I see on the screen is a bit confusing, as it could be that KF is fusing the internal gyros with externally provided yaw from GPS_Input. And what I see on the screen is just some sort of combination of these two.
I tried to play with other parameters forcing the GPS yaw to be more dominant, but this effort failed.

Is there a way to completely disable internal gyro and only use external yaw?
How do I see what EKF uses for it’s computation? Is there any hook for that?

thanks
Pawel

Hi @Yuri_Rage @amilcarlucas @rmackay9

I think I got that working. The key for me was to understand that the internal gyro cannot be disabled (this link) and it is always blended with the externally provided yaw. So the KF will just take its time to blend them and I was not patient enough to see that happening.

I still would like to demote the internal gyro and promote externally provided yaw if you knew how to do that?

thanks again
Pawel

1 Like

You don’t do that. The internal gyro doesn’t have its own yaw reference and aligns to due north without an external one. Once aligned, it helps fill in the gaps between external updates. That’s the crux of EKF sensor fusion.

2 Likes

Hi @Yuri_Rage

That is an excellent point. It allows me to send the GPS_Input at lower rate and yet keep autopilot navigating with the help of internal gyro.

thanks again for all the help.

1 Like

@PawelP,

Great that it’s working!

It is possible to change the balance between the absolute yaw sensor (e.g. compass, external yaw) and the gyro so that one or the other has more of an impact. The parameter is EK3_YAW_M_NSE (I think). So lowering it says that the yaw measurement can be trusted more so it will have a large impact on the attitude estimate. That’s the theory at least… I haven’t played with it myself.

1 Like

Hi @rmackay9

Thank you

I will play with it soon and see the impact.

Thanks

1 Like