Hi @dbhowmick,
Here’s the relevant code function - it does two different things:
- If the positioning system is not initialised it sets the global origin for the vehicle’s position estimates
- This allows the vehicle’s position estimate to maintain high precision by only storing small number offsets from the configured origin, instead of having to store large numbers that have small variations
- If there is an established origin, it just sends the specified position to the autopilot as a new position estimate
There’s been some previous discussion about surface GPS integration, but there hasn’t yet been a definitively established best/stable way of handling it.
The options that come to mind are:
- Connecting a GPS to the autopilot and then using a Lua script to selectively enable it at the surface
- The GPS connection could either be wired with a serial connection to the flight controller board, or using the BlueOS NMEA injector to provide positions from an NMEA GPS
- Modifying ArduSub to have a “surface GPS” mode that handles that switching by itself
- This could yield nice results, but could be somewhat complex to implement, and would require custom firmware builds until the feature gets merged into the main codebase
- Connecting a GPS to your own BlueOS Extension (or modifying the Water Linked DVL extension to accept a GPS input), and using that to send its position estimates to the autopilot via visual odometry messages (like the existing “set position” functionality), thus pretending it’s part of the DVL
- This would avoid needing to change parameters, but may also cause issues if the readings are inconsistent with the DVL, because the autopilot doesn’t know that there are actually two different devices involved