-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
AP_GPS: Add configurable baud rate/port for AP_GPS_GSOF #25449
Conversation
// @DisplayName: Baud rate for the first GSOF GPS | ||
// @Description: What baud rate to configure the first GSOF GPS to | ||
// @Values: 7:115k, 11:230k | ||
// @User: Advanced |
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.
Perhaps this needs information that the flight controller needs a reboot if this is changed since the baud command is only sent during the constructor of the GPS instance?
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.
Reboot required is probably needed,
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.
It seems like we already have parameters that let us specify what baud rate to use with the SERIALx_BAUD
params. This adds more confusion for ways to get there. It's already odd that the GPS library mostly neglects these, but we have the free params that let us pick it up from there.
Can we either grab DRV_OPTIONS bits for this, or start to make some backend specific param instances? Maybe a DRV_OPTIONS bit that says "use the baud rate the user set the serial port at" and then the GSOF driver can use that information in it's config?
// @DisplayName: Baud rate for the first GSOF GPS | ||
// @Description: What baud rate to configure the first GSOF GPS to | ||
// @Values: 7:115k, 11:230k | ||
// @User: Advanced |
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.
Reboot required is probably needed,
Yea. I agree it's a bit confusing. Perhaps @Hwurzburg could suggest what he thinks the most intuitive approach would be from a user perspective to configuring the desired baud rate of a GPS is. Some things to note:
|
d3a2693
to
51a0c8e
Compare
That's a really important point actually. We use (and rely) upon the same ideas with the SBF driver among others.
That would be quite reasonable, but also a bit problematic for not breaking setups on upgrading firmware. |
What is the expected behavior currently if a user sets this to zero? IE, what would we break? |
GPS_DRV_OPTION would be a good place to enable this, make sure it overrides bit 2 |
Can you elaborate? The GSOF device currently supports 8 baud rates. I only exposed the two highest. I expect them to add support for 460k baud in the next revision. Microstrain supports 920k, so this bit doesn't make sense. Use 115k or something else? |
After a discussion with Tridge and Henry, the desired approach is Add another options bit to GPS_DRV_OPTIONS to bypass GPS baud detection and use serial manager" Requirements:
TODO:
|
In further research, there are some complexities in baud rates in the UBX driver caused by moving baseline. There are two snippets. The proposed use of SERIALN_BAUD would conflict with the custom baud rate options here. I am not confident adding support for disabling GPS auto baud without a better plan for how this will all fit. The easiest would be to say the new option bit takes priority over all other options. ardupilot/libraries/AP_GPS/AP_GPS.cpp Lines 627 to 639 in 369f369
ardupilot/libraries/AP_GPS/AP_GPS.cpp Lines 834 to 857 in 369f369
|
The two use cases
|
* Add in ability to support 115k and 230k baud rates through AP params * Default behavior is preserved at 115k * Removed support (bug?) for trying to output GSOF on the NMEA port * Modified function signature to take in port as a param * Added a baud rate validation helper to validate the AP param is a supported baud rate Signed-off-by: Ryan Friedman <[email protected]>
51a0c8e
to
de718ef
Compare
Moving to Ethernet EAHRS instead which doesn't have these difficult baud problems. |
Overview
Demo
You can see in the screenshot, the config UI shows the device is now configured on COM2 for 230k, which is the desired behavior when the user sets the parameter correctly. COM2 is the TTL level serial port that users typically connect to a flight controller.
Preserving behavior
Old behavior was to configure the NTRIP Caster 3 and COM1 (RS232) for GSOF output, which wasn't useful on most drones. This breaks that behavior. I think it's obvious no one was using this.
Testing
I've tested this on my bench with a PX1 connected to SITL. The configuration at both baud rates works, and this improves the default port assignment to work with the right COM port at TTL level logic. The validity checks for GSOF pass in SITL.
To decide before merge
One thing to discuss is how this parameter should interact with
GPS_DRV_OPTIONS
. Perhaps this approach:Future work
In a future PR, I will implement the support for checking acknowledgment of commands. This is blocked due to some usage issues in the Linux serial HAL.