mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 09:33:33 +08:00
mavlink receiver remove unnecessary attitude setpoint class member
This commit is contained in:
@@ -147,7 +147,6 @@ MavlinkReceiver::MavlinkReceiver(Mavlink *parent) :
|
|||||||
_hil_local_alt0(0.0f),
|
_hil_local_alt0(0.0f),
|
||||||
_hil_local_proj_ref{},
|
_hil_local_proj_ref{},
|
||||||
_offboard_control_mode{},
|
_offboard_control_mode{},
|
||||||
_att_sp{},
|
|
||||||
_rates_sp{},
|
_rates_sp{},
|
||||||
_time_offset_avg_alpha(0.8),
|
_time_offset_avg_alpha(0.8),
|
||||||
_time_offset(0),
|
_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 */
|
/* Publish attitude setpoint if attitude and thrust ignore bits are not set */
|
||||||
if (!(_offboard_control_mode.ignore_attitude)) {
|
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
|
if (!ignore_attitude_msg) { // only copy att sp if message contained new data
|
||||||
mavlink_quaternion_to_euler(set_attitude_target.q,
|
mavlink_quaternion_to_euler(set_attitude_target.q, &att_sp.roll_body, &att_sp.pitch_body, &att_sp.yaw_body);
|
||||||
&_att_sp.roll_body, &_att_sp.pitch_body, &_att_sp.yaw_body);
|
att_sp.yaw_sp_move_rate = 0.0;
|
||||||
_att_sp.yaw_sp_move_rate = 0.0;
|
memcpy(att_sp.q_d, set_attitude_target.q, sizeof(att_sp.q_d));
|
||||||
memcpy(_att_sp.q_d, set_attitude_target.q, sizeof(_att_sp.q_d));
|
att_sp.q_d_valid = true;
|
||||||
_att_sp.q_d_valid = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_offboard_control_mode.ignore_thrust) { // dont't overwrite thrust if it's invalid
|
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) {
|
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 {
|
} 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;
|
float _hil_local_alt0;
|
||||||
struct map_projection_reference_s _hil_local_proj_ref;
|
struct map_projection_reference_s _hil_local_proj_ref;
|
||||||
struct offboard_control_mode_s _offboard_control_mode;
|
struct offboard_control_mode_s _offboard_control_mode;
|
||||||
struct vehicle_attitude_setpoint_s _att_sp;
|
|
||||||
struct vehicle_rates_setpoint_s _rates_sp;
|
struct vehicle_rates_setpoint_s _rates_sp;
|
||||||
double _time_offset_avg_alpha;
|
double _time_offset_avg_alpha;
|
||||||
int64_t _time_offset;
|
int64_t _time_offset;
|
||||||
|
|||||||
Reference in New Issue
Block a user