mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 13:03:34 +08:00
vehicle_local_position: rename yaw -> heading and add reset logic
- vehicle_global_position yaw removed (redundant)
This commit is contained in:
committed by
Mathieu Bresciani
parent
33fb9d0c62
commit
97fc1db768
@@ -294,8 +294,9 @@ bool MavlinkStreamHighLatency2::write_geofence_result(mavlink_high_latency2_t *m
|
||||
bool MavlinkStreamHighLatency2::write_global_position(mavlink_high_latency2_t *msg)
|
||||
{
|
||||
vehicle_global_position_s global_pos;
|
||||
vehicle_local_position_s local_pos;
|
||||
|
||||
if (_global_pos_sub.update(&global_pos)) {
|
||||
if (_global_pos_sub.update(&global_pos) && _local_pos_sub.update(&local_pos)) {
|
||||
msg->latitude = global_pos.lat * 1e7;
|
||||
msg->longitude = global_pos.lon * 1e7;
|
||||
|
||||
@@ -310,7 +311,7 @@ bool MavlinkStreamHighLatency2::write_global_position(mavlink_high_latency2_t *m
|
||||
|
||||
msg->altitude = altitude;
|
||||
|
||||
msg->heading = static_cast<uint8_t>(math::degrees(wrap_2pi(global_pos.yaw)) * 0.5f);
|
||||
msg->heading = static_cast<uint8_t>(math::degrees(wrap_2pi(local_pos.heading)) * 0.5f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1534,7 +1534,7 @@ protected:
|
||||
mavlink_vfr_hud_t msg{};
|
||||
msg.airspeed = airspeed_validated.equivalent_airspeed_m_s;
|
||||
msg.groundspeed = sqrtf(lpos.vx * lpos.vx + lpos.vy * lpos.vy);
|
||||
msg.heading = math::degrees(wrap_2pi(lpos.yaw));
|
||||
msg.heading = math::degrees(wrap_2pi(lpos.heading));
|
||||
|
||||
if (armed.armed) {
|
||||
actuator_controls_s act0{};
|
||||
@@ -2469,7 +2469,7 @@ protected:
|
||||
msg.vy = lpos.vy * 100.0f;
|
||||
msg.vz = lpos.vz * 100.0f;
|
||||
|
||||
msg.hdg = math::degrees(wrap_2pi(lpos.yaw)) * 100.0f;
|
||||
msg.hdg = math::degrees(wrap_2pi(lpos.heading)) * 100.0f;
|
||||
|
||||
mavlink_msg_global_position_int_send_struct(_mavlink->get_channel(), &msg);
|
||||
|
||||
@@ -4870,7 +4870,7 @@ protected:
|
||||
|
||||
vehicle_local_position_s lpos{};
|
||||
_lpos_sub.copy(&lpos);
|
||||
msg.yaw_absolute = math::degrees(matrix::wrap_2pi(lpos.yaw + mount_orientation.attitude_euler_angle[2]));
|
||||
msg.yaw_absolute = math::degrees(matrix::wrap_2pi(lpos.heading + mount_orientation.attitude_euler_angle[2]));
|
||||
|
||||
mavlink_msg_mount_orientation_send_struct(_mavlink->get_channel(), &msg);
|
||||
|
||||
|
||||
@@ -2600,7 +2600,7 @@ MavlinkReceiver::handle_message_hil_state_quaternion(mavlink_message_t *msg)
|
||||
hil_local_pos.vz = hil_state.vz / 100.0f;
|
||||
|
||||
matrix::Eulerf euler{matrix::Quatf(hil_state.attitude_quaternion)};
|
||||
hil_local_pos.yaw = euler.psi();
|
||||
hil_local_pos.heading = euler.psi();
|
||||
hil_local_pos.xy_global = true;
|
||||
hil_local_pos.z_global = true;
|
||||
hil_local_pos.vxy_max = INFINITY;
|
||||
|
||||
Reference in New Issue
Block a user