mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-06 19:00:27 +08:00
GCS_MAVLink: create a pointer to hold the secondary estimates
... rather than using the state structure to hold values
This commit is contained in:
committed by
Peter Barker
parent
ea9bb165ea
commit
09d2e8dfa5
@@ -616,20 +616,20 @@ void GCS_MAVLINK::send_proximity()
|
||||
// report AHRS2 state
|
||||
void GCS_MAVLINK::send_ahrs2()
|
||||
{
|
||||
const AP_AHRS &ahrs = AP::ahrs();
|
||||
Vector3f euler;
|
||||
Location loc {};
|
||||
// we want one or both of these, use | to avoid short-circuiting:
|
||||
if (uint8_t(ahrs.get_secondary_attitude(euler)) |
|
||||
uint8_t(ahrs.get_secondary_position(loc))) {
|
||||
const auto *estimates = AP::ahrs().get_secondary_estimates();
|
||||
if (estimates == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Location &loc = estimates->location;
|
||||
|
||||
mavlink_msg_ahrs2_send(chan,
|
||||
euler.x,
|
||||
euler.y,
|
||||
euler.z,
|
||||
estimates->roll_rad,
|
||||
estimates->pitch_rad,
|
||||
estimates->yaw_rad,
|
||||
loc.alt*1.0e-2f,
|
||||
loc.lat,
|
||||
loc.lng);
|
||||
}
|
||||
}
|
||||
#endif // AP_AHRS_ENABLED
|
||||
|
||||
|
||||
Reference in New Issue
Block a user