mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
mavlink receiver remove unnecessary attitude setpoint class member
This commit is contained in:
parent
cf2d794da9
commit
fe22b856d6
@ -147,7 +147,6 @@ MavlinkReceiver::MavlinkReceiver(Mavlink *parent) :
|
||||
_hil_local_alt0(0.0f),
|
||||
_hil_local_proj_ref{},
|
||||
_offboard_control_mode{},
|
||||
_att_sp{},
|
||||
_rates_sp{},
|
||||
_time_offset_avg_alpha(0.8),
|
||||
_time_offset(0),
|
||||
@ -1252,25 +1251,25 @@ MavlinkReceiver::handle_message_set_attitude_target(mavlink_message_t *msg)
|
||||
|
||||
/* Publish attitude setpoint if attitude and thrust ignore bits are not set */
|
||||
if (!(_offboard_control_mode.ignore_attitude)) {
|
||||
_att_sp.timestamp = hrt_absolute_time();
|
||||
vehicle_attitude_setpoint_s att_sp = {};
|
||||
att_sp.timestamp = hrt_absolute_time();
|
||||
|
||||
if (!ignore_attitude_msg) { // only copy att sp if message contained new data
|
||||
mavlink_quaternion_to_euler(set_attitude_target.q,
|
||||
&_att_sp.roll_body, &_att_sp.pitch_body, &_att_sp.yaw_body);
|
||||
_att_sp.yaw_sp_move_rate = 0.0;
|
||||
memcpy(_att_sp.q_d, set_attitude_target.q, sizeof(_att_sp.q_d));
|
||||
_att_sp.q_d_valid = true;
|
||||
mavlink_quaternion_to_euler(set_attitude_target.q, &att_sp.roll_body, &att_sp.pitch_body, &att_sp.yaw_body);
|
||||
att_sp.yaw_sp_move_rate = 0.0;
|
||||
memcpy(att_sp.q_d, set_attitude_target.q, sizeof(att_sp.q_d));
|
||||
att_sp.q_d_valid = true;
|
||||
}
|
||||
|
||||
if (!_offboard_control_mode.ignore_thrust) { // dont't overwrite thrust if it's invalid
|
||||
_att_sp.thrust = set_attitude_target.thrust;
|
||||
att_sp.thrust = set_attitude_target.thrust;
|
||||
}
|
||||
|
||||
if (_att_sp_pub == nullptr) {
|
||||
_att_sp_pub = orb_advertise(ORB_ID(vehicle_attitude_setpoint), &_att_sp);
|
||||
_att_sp_pub = orb_advertise(ORB_ID(vehicle_attitude_setpoint), &att_sp);
|
||||
|
||||
} else {
|
||||
orb_publish(ORB_ID(vehicle_attitude_setpoint), _att_sp_pub, &_att_sp);
|
||||
orb_publish(ORB_ID(vehicle_attitude_setpoint), _att_sp_pub, &att_sp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -256,7 +256,6 @@ private:
|
||||
float _hil_local_alt0;
|
||||
struct map_projection_reference_s _hil_local_proj_ref;
|
||||
struct offboard_control_mode_s _offboard_control_mode;
|
||||
struct vehicle_attitude_setpoint_s _att_sp;
|
||||
struct vehicle_rates_setpoint_s _rates_sp;
|
||||
double _time_offset_avg_alpha;
|
||||
int64_t _time_offset;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user