-
Notifications
You must be signed in to change notification settings - Fork 18.6k
AP_ExternalAHRS: Add Advanced Navigation Driver Support #30057
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
base: master
Are you sure you want to change the base?
AP_ExternalAHRS: Add Advanced Navigation Driver Support #30057
Conversation
This commit includes support for the Advanced Navigation devices using the [Advanced Navigation Packet Protocol](https://docs.advancednavigation.com/certus/ANPP/Advanced%20Nav igation%20Packet.htm). It replaces the earlier version of the driver which has now become stale (see [here](ArduPilot#23267)). The driver has had some major rework, fixing many critical bugs and refactoring for better readability. Core functionality of the driver remains the same and includes a SITL for development and testing purposes. The driver has been validated through numerous Certus Evo GNSS aided flights on an Aurelia X8 Standard copter. The feature also includes serveral modifications outside of the AP_ExternalAHRS library. These include: - The addition of yaw to AP_ExternalAHRS::gps_data_message_t message, allowing for dual antenna GNSS yaw to be passed from the ExternalAHRS library - The completion of the get_variance method to the AP_AHRS_External backend. Without this, the mandatory_gps_checks will always fail within the ArduCopter pre-arm checks.
This commit includes the following fixes: - Invalid index for packet request identifiers - Moved logging name convention from `ANx` to `ADx` due to conflicts with newly added logs - Added a `has_compass` method for handling devices that do not have magnetometers (i.e. Boreas series)
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.
please split the PR into per-subsystem commits (you may find Tools/gittools/ useful)
see ArduPilot coding guide
Location loc; | ||
get_location(loc); | ||
|
||
// @LoggerMessage: ANG |
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.
typo, ADG
"QffffLLfffff", | ||
AP_HAL::micros64(), | ||
this->velocity_ned[0], this->velocity_ned[1], this->velocity_ned[2], | ||
this->has_yaw() ? degrees(this->heading): 0.0f, |
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.
maybe NaN better when no yaw?
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.
also, is it yaw or heading? (ie. is it ground course or where the nose is pointing?) if it is yaw then call it yaw in the message
|
||
https://docs.advancednavigation.com/certus/ANPP/PacketTimerPeriodPackets.htm | ||
*/ | ||
struct PACKED AN_PacketTimerPeriod |
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.
this is naturally packed, I suspect the compiler will do better without PACKED
if(pkt.has_yaw) | ||
{ | ||
state.have_gps_yaw = true; | ||
state.gps_yaw = pkt.yaw; |
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.
is this a yaw or a heading?
uint16_t filter_status; | ||
uint32_t unix_time_seconds; | ||
uint32_t microseconds; | ||
double llh[3]; // rad,rad,m |
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.
can declare as a Vector3d
if ((AP_HAL::millis() - _last_pkt_ms) > AN_TIMEOUT) | ||
{ | ||
static char buf[50]; | ||
hal.util->snprintf(buf, 30, "AdNav: No Connection (last packet %8ums ago)", (unsigned int)(AP_HAL::millis() - _last_pkt_ms)); |
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.
this is not what get_name() is for, it should just be "AdNav"
{ | ||
if (!send_airspeed_aiding()) | ||
{ | ||
GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "ExternalAHRS: Unable to send airspeed aiding."); |
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.
please review all GCS_SEND_TEXT() calls - this and several others could flood the telemetry link. eg. if airspeed went unhealthy then it would flood the link, possibly making control of the vehicle impossible
{ | ||
const auto *acknowledge = reinterpret_cast<const AN_Acknowledge *>(&packet.payload); | ||
|
||
GCS_SEND_TEXT(MAV_SEVERITY_INFO, |
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.
flooding link
|
||
last_raw_gnss_packet.copy(&packet); | ||
|
||
auto *raw_gnss = reinterpret_cast<AN_RawGnss *>(&packet.payload); |
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.
why the heavy use of casts instead of the more usual union structure?
*/ | ||
struct PACKED AN_RequestPacket | ||
{ | ||
AN_PacketId packet_id[(AN_PacketPayload::AN_MAXIMUM_PACKET_SIZE) / sizeof(uint8_t)]; |
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.
sizeof(uint8_t) just makes the code harder to read
This pull request includes support for the Advanced Navigation devices using the Advanced Navigation Packet
Protocol. It replaces the earlier version of the driver which has now become stale (see here).
The driver has had some major rework, fixing many critical bugs and refactoring for better readability. Core functionality of the driver remains the same and includes a SITL for development and testing purposes. The driver has been validated through numerous Certus Evo GNSS aided flights on an Aurelia X8 Standard copter.
The feature also includes several modifications outside of the AP_ExternalAHRS library. These include:
If desired, the additional modifications can be moved to a separate pull request.