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

Add relposheading in process fix uavcan driver (AP Periph Dronecan Dual RTK support) #23821

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

Conversation

dirksavage88
Copy link
Contributor

@dirksavage88 dirksavage88 commented Oct 16, 2024

Solved Problem

Adds support for dual RTK heading via AP Periph, which publishes heading as a distinct message (RelPosHeading) instead of via the ecef position fields.

Fixes #22520

Solution

  • Add sub callback for relposheading within GNSS sensor uavcan driver
  • Process heading information and validity in process fixx method

Changelog Entry

For release notes:

Feature: Add support for AP Periph (dronecan) dual GPS heading setups
New parameter: EKF2_GPS_YAW_OFF
Documentation:  Updates merged in PX4 user guide https://github.com/PX4/PX4-user_guide/pull/3406

Alternatives

Create a sub to the sensor gnss relative uORB topic directly in EKF2

Test coverage

  • Tested using dual Holybro ZED-F9P dronecan nodes and pixhawk 6xrt

Context

TODO: post log
Pending doc update PR: PX4/PX4-user_guide#3406

@dirksavage88
Copy link
Contributor Author

@vincentpoont2

@vincentpoont2
Copy link
Member

@dirksavage88 Anything we can assist on our end?

@dirksavage88
Copy link
Contributor Author

@vincentpoont2 I am having issues getting the rover RTK F9P to get Fix type of fixed (6). It only reports fix type of 3 or 4 even after sitting for a while. (Similar issue to this post: https://discuss.ardupilot.org/t/heading-informations-via-moving-baseline-configuration-gnss-antenna-setup/113674/8)

Other than this issue, I have some questions for the maintainers on how to integrate the gps yaw offset correctly, since it is handled differently in PX4 than what ardupilot is doing.

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-oct-23-2024/42053/1

@dirksavage88
Copy link
Contributor Author

@vincentpoont2 I was able to get the dual F9P working with the correct heading offset. The offset had to be applied manually since it only occurs in the serial GPS driver and not in PX4.

The rest is just architecture changes from maintainer feedback.

@dirksavage88 dirksavage88 marked this pull request as ready for review October 23, 2024 20:39
src/modules/ekf2/EKF2.hpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF2.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF2.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/module.yaml Outdated Show resolved Hide resolved
src/modules/ekf2/EKF2.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF2.cpp Outdated Show resolved Hide resolved
@dagar
Copy link
Member

dagar commented Oct 30, 2024

@bresch FYI this adds an optional EKF2_GPS_YAW_OFF that we can add if there's incoming GPS yaw data from UAVCAN (or any source) that doesn't have the correct offset.

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-oct-30-2024/42184/1

@dirksavage88
Copy link
Contributor Author

dirksavage88 commented Oct 30, 2024

@dagar could we revert the param changes? It was working within EKF2.cpp where the offset was applied. With the param changes the offset no longer is applied and the estimator was complaining

E.g. commit d61c069 works, but estimator errors on 74b1f1d

Looks like it had to do with the conditional, fixed it and tested.

@dakejahl
Copy link
Contributor

Do we really need to check the fix_type to decide if we include the heading? I would leave that out, and always include the heading if it's being published.

@dirksavage88
Copy link
Contributor Author

dirksavage88 commented Oct 31, 2024

gps_heading_rtk

Fix type on the left, heading on the right (rads)

@dakejahl
Copy link
Contributor

Tested this on a frame with 2 ARK RTK GPS. Working as expected.

Screenshot from 2024-10-30 16-25-15

Copy link
Contributor

@dakejahl dakejahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to make a few changes to simplify the logic. I'll re-test it.

@dakejahl
Copy link
Contributor

One of my GPS antennas was loose, looks good now.

@dirksavage88 @dagar can you guys do one more pass and if it looks good hit the merge button

image

dakejahl
dakejahl previously approved these changes Oct 31, 2024
@dirksavage88
Copy link
Contributor Author

Looks good to me

report.heading_offset = heading_offset;
report.heading_accuracy = heading_accuracy;
// Use heading from RelPosHeading message if available and we have RTK Fixed solution.
if (_rel_heading_valid && (fix_type == sensor_gps_s::FIX_TYPE_RTK_FIXED)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should also have a timestamp associated with the rel_heading. I'm not sure if this can happen, but I'm imagining a case where we have heading from moving base, but then it goes away and comes back as an RTK fix but without the heading...

src/modules/ekf2/EKF2.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF2.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF2.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF2.cpp Outdated Show resolved Hide resolved
dirksavage88 and others added 2 commits November 5, 2024 11:10
Co-authored-by: Mathieu Bresciani <[email protected]>
Co-authored-by: Mathieu Bresciani <[email protected]>
bresch
bresch previously approved these changes Nov 6, 2024
@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-nov-6-2024/42264/1

{
_rel_heading_valid = msg.reported_heading_acc_available;
_rel_heading = matrix::wrap_pi(math::radians(msg.reported_heading_deg));
_rel_heading_accuracy = matrix::wrap_2pi(math::radians(msg.reported_heading_acc_deg));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_rel_heading_accuracy = matrix::wrap_2pi(math::radians(msg.reported_heading_acc_deg));
_rel_heading_accuracy = math::radians(msg.reported_heading_acc_deg);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

uavcan::ReceivedDataStructure<ardupilot::gnss::RelPosHeading> &msg)
{
_rel_heading_valid = msg.reported_heading_acc_available;
_rel_heading = matrix::wrap_pi(math::radians(msg.reported_heading_deg));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_rel_heading = matrix::wrap_pi(math::radians(msg.reported_heading_deg));
_rel_heading = math::radians(msg.reported_heading_deg);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

if (_rel_heading_valid && (fix_type == sensor_gps_s::FIX_TYPE_RTK_FIXED)) {
report.heading = _rel_heading;
report.heading_offset = NAN;
report.heading_accuracy = _rel_heading_accuracy;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
report.heading_accuracy = _rel_heading_accuracy;
report.heading_accuracy = _rel_heading_accuracy;
_rel_heading = NAN;
_rel_heading_accuracy = NAN;
_rel_heading_valid = false;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@dirksavage88
Copy link
Contributor Author

@dagar
heading_acc

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.

[CAN GPS] Dual F9P Heading Support for CAN GPS (Non-PX4 CAN FW)
6 participants