mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-26 01:00:36 +08:00
fix(uavcannode): report a zero baseline with an invalid heading (#29002)
ArduPilot takes every RelPosHeading whose baseline matches its configured one as a heading and never reads reported_heading_acc_available. An invalid heading goes out as NaN, so with a real baseline (a float solution, after every boot and reacquisition) the NaN became its GPS yaw: EKF3 latches a constraining_nan internal error that blocks arming, or aligns its yaw to NaN. A zero baseline fails ArduPilot's minimum antenna separation check in every release; PX4 flight controllers drop the sample on heading_valid before looking at the baseline. Assisted-by: Claude:claude-opus-5-5
This commit is contained in:
1 parent
729de5237b
commit
6e0bd88c35
1 file changed
+7
-2
@@ -83,10 +83,15 @@ public:
|
||||
rel_pos_heading.timestamp.usec = bus_timestamp_usec(getNode(), sensor_gnss_relative.timestamp_sample);
|
||||
}
|
||||
|
||||
rel_pos_heading.reported_heading_acc_available = sensor_gnss_relative.heading_valid; // bool
|
||||
const bool heading_valid = sensor_gnss_relative.heading_valid && PX4_ISFINITE(sensor_gnss_relative.heading);
|
||||
|
||||
rel_pos_heading.reported_heading_acc_available = heading_valid; // bool
|
||||
rel_pos_heading.reported_heading_deg = math::degrees(sensor_gnss_relative.heading); // float32
|
||||
rel_pos_heading.reported_heading_acc_deg = math::degrees(sensor_gnss_relative.heading_accuracy); // float32
|
||||
rel_pos_heading.relative_distance_m = sensor_gnss_relative.position_length; // float16
|
||||
|
||||
// ArduPilot ignores reported_heading_acc_available and takes any heading whose baseline matches its
|
||||
// configured one, so an invalid heading also reports a zero baseline, which fails its minimum separation
|
||||
rel_pos_heading.relative_distance_m = heading_valid ? sensor_gnss_relative.position_length : 0.f; // float16
|
||||
rel_pos_heading.relative_down_pos_m = sensor_gnss_relative.position[2]; // float16
|
||||
|
||||
uavcan::Publisher<ardupilot::gnss::RelPosHeading>::broadcast(rel_pos_heading);
|
||||
|
||||
Reference in new issue
Block a user