-
Notifications
You must be signed in to change notification settings - Fork 197
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 NMEA-0183 Protocol GPS Driver #58
Conversation
Co-authored-by: WeiPeng Guo <guoweipeng1990@sina.com>
Thanks @bys1123
Where do you see that limitation? |
@bkueng On M8N, you could see GGA message description in u-center. |
We use the ubx driver for u-blox devices, so I don't see the use for this. |
Agree, never use NMEA on U-Blox GPS, I just say you could test with it, I know you must at least have one. There is a batch of GPS brand is using NMEA protocol as it's a industrial standard, and their performance is enough for drones, some models even better than U-blox. |
And they all restricted by GGA message. But with this driver, they work perfect. |
Ok, that is helpful to know. Can we extend the ashtech driver to support these? What difference is required? |
|
Ok that is fine. A few points:
|
I do something similar for my own and it is not universal, I can't share it. But I have some thoughts for you, hope they would be useful.
where _bytes_parsed is GPSDriverNmea member variable and is cleared in the same places as _bytes_readed. Or you will miss data on handling satellite info message in future. Take care to increase _bytes_parsed immediately to avoid sending same byte to parcer. |
@lukegluke Thanks for review and these nice suggestions, I'll take research on those. |
|
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.
Hi @bys1123,
Thanks for your work! I don't have time to test your code, but I surely will (someday :).
I just took a look through code and I think this aspect I mentioned before is still in charge:
1. To be truly universal, nmea driver should somehow autodetect what sentence is last in set to return 1 (it could easy be RMC or VTG for example) .
The most difficult thing here I think will be not be broken by possible rare sentences.
For example as I see if HDT message is last in set (and it is easy can be) it will not be parsed within same block with lat and lon, so heading can be fall one message behind of coordinates - it's not good.
Another aspect:
Universally there can be used different messages sets:
For example GGA+RMC or GGA+ZDA+VTG for full date+time and velocity.
But in fact any of those message can be set with its own frequency not necessary equal to each other. Maybe it's too much to handle and just add a note to configure them with same frequency is enough.
But regarding to GSV message - first of all it is optional and also I saw real cases when GSV is sent rare than other messages (one time in several seconds) due to its size. Now it is necessity to have _SVINFO_received in your driver to get gps position at all.
_DOP_received = false; | ||
_VEL_received = false; | ||
_EPH_received = false; | ||
_HEAD_received = false; |
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.
missed
_TIME_received = false;
src/nmea.cpp
Outdated
_gps_position->vel_m_s = velocity_ms; | ||
_gps_position->vel_n_m_s =velocity_north; | ||
_gps_position->vel_e_m_s =velocity_east; | ||
_gps_position->cog_rad =track_rad; |
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.
_gps_position->cog_rad = matrix::wrap_pi(track_rad);
because track_rad is [0, 2π], while cog_rad needs to be [-π, π]
src/nmea.cpp
Outdated
_gps_position->vel_m_s = velocity_ms; | ||
_gps_position->vel_n_m_s =velocity_north; | ||
_gps_position->vel_e_m_s =velocity_east; | ||
_gps_position->cog_rad =track_rad; |
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.
same here
There no problems with current pull request, it is adopted for PX4 and works correctly, while the code you linked at is quite separate thing and also under GPL license. I don't get it why you mentioned it? |
can you correct this driver? |
@lukegluke I'm very busy on my work these days, I invited you to my project, can you help optimize the code, thanks! |
@bys1123 Thanks, but unfortunately I'm also very busy :(, but at least on next week I will add those modifications I mentioned previously in comments. |
This comment has been minimized.
This comment has been minimized.
10920ea
to
e7f3489
Compare
I've pushed commit with fixes I mentioned and also several optimizations and fix code style. Also I tried to add same modifications as it was done in latest ashtech. But I don't think this should be merged as separate driver. I see this as general nmea driver with probably additional subsystem flag (ashtech or other receivers for future use). Also it occupy quite a space and needs more optimizations. |
VTG parsing has an issue, I forgot to fix it here. It should be fixed to 8 commas: @siddux try this |
most of GNSS receivers don't have additional positioning system mode indicator in the end
I have been trying to test this pull request but unfortunately, we found some issues because of the new format in the constructor and the fact that messages don't necessarily have the same rates. The current implementation waits until all the messages arrive before returning OK, which causes the The implementation, based on DimianZhan:add_nmea_driver is at: https://github.com/OpenAgriTech/PX4-GPSDrivers/tree/nmea_support. However, due to the changes in the master branch, I had to fork it from the master and I am not sure how to reflect my changes from DimianZhan:add_nmea_driver. This seems to work well and we have now RTK and heading without any issues using an RTKite with a dual antenna. |
@jajberni can you open a pull request? |
I suppose you meant the configure() function, not the constructor. Yes, there is a minor change GPSConfig.
Yes, I mentioned this aspect here previously #58 (review) and it is not so easy to solve this correctly in general case.
You make a workaround. By ignoring correct grouping of nmea messages, the heading and error information in Regarding this pull request to px4 as itself I would like to repeat myself: |
@lukegluke very good points and thank you for your feedback!
This is right and I am now observing this in the bag files where the GPS topics come grouped in two (I'm returning 1 on valid position and velocity messages): I guess it makes more sense to wait until you have position, velocity and error before returning a valid position. Satellite information is not that critical and I don't think it would cause any trouble to have a delay in the number of satellites. Heading is trickier because it doesn't even have a timestamp. I am not so sure about the GPSBaseStationSupport requirement because this is quite specific and I don't follow why this should be part of the PX4 driver. The base station support is meant to enable SurveryIn and transmission of RTCM messages for RTK correction. Why should this be implemented on the vehicle (rover) and not just on the base station? I haven't followed up on the discussions (I am sure there has to be a reason for it beyond the support of dual GNSS systems for heading). In my opinion, the astech driver is quite specific to the astech/trimble dialect, with heaps of non-standard messages. Maybe what is required is just a command for custom initialization (very common on generic GPS software) that is passed to the GPS, but only read/interpret standard NMEA sentences to keep it generic. Despite all the limitations of NMEA, most high-end GPS units can provide NMEA sentences. Also, how can you keep back compatibility with astech GPS type? The safer solution in the mid-term is to add a new type and eventually deprecate astech if both get merged. |
Let me do some more testing in the coming days and try to implement the comments from @lukegluke. |
I agree about number of sats. Probably about errors too. But I really suppose that their should not be delaying in heading information, because it is separately get fused in ekf2 filter.
Here we are in PX4-GPSDrivers repository that is used not only for PX4-Autopilot, but also in QGC. And it exactly uses this drivers for working with RTK receivers as SurveryIn/Fixed base station. Maybe for now px4 community used limited number of well known receivers, I would like to recommend to already make enough scalable solution for future. But also speaking about implementing RTCM messages on the vehicle (rover). It obviously useful to make post processing (PPK). I even wonder why it is not implemented in px4, while architecturally there is already a GPSCallbackType::gotRTCMMessage? I thought that PPK is essential to aerophotography and aerophotogrammetry.
Agree, but still there is quite of common code that can be combined. Code in this PR was quite copied from astech.
I suppose there can be implemented an autodetect by requesting particular astech get version command or something like this. But in first place if GPS_DRIVER_MODE_ASHTECH we can just pass additional specific nmea_flags in one general nmea driver (or specific type var) that is tell us that receiver is astech (or any other specific further).
Or like this, yes. |
I have created a pull request in #74 Now the code works nicely at 10Hz and a valid Unfortunately, HDT and VTG don't have UTC information. I guess we'll need to live with that and update as they arrive. I am not sure if there are any NMEA order defined (I haven't found any clear indication) to determine if HDT is sent at the beginning or end of the NMEA block. |
Indeed, but they have gps_absolute_time on receive to distinguish the order (if assuming that output rate of these messages is the same as main ones GGA/RMC) |
Added in #87 |
Support standard NMEA messages.
Such as support more than 15 satellites which ashtech driver restricted in GGA message, and GSA also not working well.
Not implement baud rate detection yet.
Due to
sensor_gps_s
changes, not tested with current master.