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

WIP: mavlink GPS_INPUT support #10093

Closed
wants to merge 1 commit into from
Closed

WIP: mavlink GPS_INPUT support #10093

wants to merge 1 commit into from

Conversation

dagar
Copy link
Member

@dagar dagar commented Jul 30, 2018

No description provided.

@Antiheavy
Copy link
Contributor

Related comment in the dual GPS PR:
#9765 (comment)

@Antiheavy
Copy link
Contributor

One issue that came up is how to handle GPS modules that do not send the expected altitude datum format for PX4/EKF2. For example, we might use a GPS receiver that only outputs wgs84 altitude, this is a problem for PX4/EKF2 which is expecting whatever uBlox "amsl" datum is (I think egm96?).

  • One idea is to send the MAVlink message to ignore the GPS altitude from the secondary MAVlink GPS source (param 1): https://mavlink.io/en/messages/common.html#GPS_INPUT_IGNORE_FLAGS

  • Another idea is that we send a artificially very large EPV value from the secondary MAVlink GPS source so that the driver and/or estimator will effectively ignore the GPS altitude, but use the other information from the secondary GPS.

Both of the above ideas would only be useful when switching to the secondary GPS, the primary GPS would need to have proper altitude and everything else for system initialization, pre-flight checks, pre-arm checks, etc.

Another approach could be to add a parameter to select which uBlox altitude value to use. Default to the current (egm96?), but allow an advanced user to select the wgs84 altitude so that it could match the wgs84 altitude on a secondary GPS module.

@jonrwat @priseborough @dagar

@LorenzMeier
Copy link
Member

Could you please rebase? Thanks!

@dagar dagar force-pushed the pr-mavlink_GPS_INPUT branch from c6429cb to 9cd5f30 Compare August 18, 2018 02:36
@jonrwat
Copy link
Contributor

jonrwat commented Aug 23, 2018

Several updates are recommended:

  1. Scaling of values is incorrect (e.g. vel-ned). It looks like the majority of the GPS_INPUT handler was copied from the HIL_GPS handler, which has a different scaling of data. Scaling of parameters is specified at: https://github.com/mavlink/c_library_v2/blob/master/common/mavlink_msg_gps_input.h#L7

  2. All data has not been copied to the "vehicle_gps_position" structure and published (e.g. hdop, vdop). This is apparent when looking at GPS status in QGC (both GUI display and MAVLink Inspector), as fields are missing (i.e. locked as zero).

  3. The software doesn't use the GPS_INPUT message 'ignore_flags' field. This causes the system (and EKF) to potentially use data which is invalid. This likely isn't as great of a concern on platforms where all source data is supplied in a single message (e.g. u-blox UBX_NAV_PVT) but has greater concern on platforms where source data is fragmented across multiple messages (e.g. Swift Piksi). I'm not sure what the final solution is; but it seems harmful to feed known invalid data into the EKF.

@dagar

@TSC21
Copy link
Member

TSC21 commented Nov 25, 2018

Jenkins test this please.

@TSC21 TSC21 closed this Nov 25, 2018
@TSC21 TSC21 reopened this Nov 25, 2018
@TSC21
Copy link
Member

TSC21 commented Nov 25, 2018

@dagar maybe we can rebase this on master?

@jonrwat we are probably bringing this as is now. We thank you if you can issue a PR with the changes you propose after it. Thanks!

@dagar dagar force-pushed the pr-mavlink_GPS_INPUT branch from 9cd5f30 to ab23494 Compare February 4, 2019 16:06
@dagar
Copy link
Member Author

dagar commented Feb 4, 2019

Rebased on master. We could probably do a quick pass and get this in safely.

@stale
Copy link

stale bot commented Jul 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Antiheavy
Copy link
Contributor

Still a valid issue

@stale
Copy link

stale bot commented Oct 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Oct 9, 2019
gps.lon = gps_input.lon;
gps.alt = gps_input.alt;
gps.eph = (float)gps_input.horiz_accuracy * 1e-2f; // from cm to m
gps.epv = (float)gps_input.vert_accuracy * 1e-2f; // from cm to m
Copy link
Contributor

Choose a reason for hiding this comment

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

The spec says this is all meters, not cm.

https://mavlink.io/en/messages/common.html#GPS_INPUT

//gps.vel_m_s = (float)gps_input.vel * 1e-2f; // from cm/s to m/s
gps.vel_n_m_s = gps_input.vn * 1e-2f; // from cm to m
gps.vel_e_m_s = gps_input.ve * 1e-2f; // from cm to m
gps.vel_d_m_s = gps_input.vd * 1e-2f; // from cm to m
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

gps.vel_e_m_s = gps_input.ve * 1e-2f; // from cm to m
gps.vel_d_m_s = gps_input.vd * 1e-2f; // from cm to m
gps.vel_ned_valid = true;
//gps.cog_rad = ((gps_input.cog == 65535) ? NAN : wrap_2pi(math::radians(gps_input.cog * 1e-2f)));
Copy link
Contributor

Choose a reason for hiding this comment

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

That's not a thing right?

//gps.cog_rad = ((gps_input.cog == 65535) ? NAN : wrap_2pi(math::radians(gps_input.cog * 1e-2f)));

gps.fix_type = gps_input.fix_type;
gps.satellites_used = gps_input.satellites_visible; //TODO: rename mavlink_hil_gps_t sats visible to used?
Copy link
Contributor

Choose a reason for hiding this comment

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

Too late now, I think.

@stale
Copy link

stale bot commented Jan 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Jan 7, 2020
@LorenzMeier
Copy link
Member

Stale, closing.

@LorenzMeier LorenzMeier deleted the pr-mavlink_GPS_INPUT branch January 10, 2021 17:11
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.

6 participants