mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 19:33:33 +08:00
Merge pull request #1752 from PX4/log_thrust_sp
log velocity - and acceleration/thrust setpoint
This commit is contained in:
@@ -1011,22 +1011,6 @@ MulticopterPositionControl::task_main()
|
||||
control_auto(dt);
|
||||
}
|
||||
|
||||
/* fill local position setpoint */
|
||||
_local_pos_sp.timestamp = hrt_absolute_time();
|
||||
_local_pos_sp.x = _pos_sp(0);
|
||||
_local_pos_sp.y = _pos_sp(1);
|
||||
_local_pos_sp.z = _pos_sp(2);
|
||||
_local_pos_sp.yaw = _att_sp.yaw_body;
|
||||
|
||||
/* publish local position setpoint */
|
||||
if (_local_pos_sp_pub > 0) {
|
||||
orb_publish(ORB_ID(vehicle_local_position_setpoint), _local_pos_sp_pub, &_local_pos_sp);
|
||||
|
||||
} else {
|
||||
_local_pos_sp_pub = orb_advertise(ORB_ID(vehicle_local_position_setpoint), &_local_pos_sp);
|
||||
}
|
||||
|
||||
|
||||
if (!_control_mode.flag_control_manual_enabled && _pos_sp_triplet.current.valid && _pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_IDLE) {
|
||||
/* idle state, don't run controller and set zero thrust */
|
||||
R.identity();
|
||||
@@ -1327,6 +1311,11 @@ MulticopterPositionControl::task_main()
|
||||
|
||||
_att_sp.thrust = thrust_abs;
|
||||
|
||||
/* save thrust setpoint for logging */
|
||||
_local_pos_sp.acc_x = thrust_sp(0);
|
||||
_local_pos_sp.acc_x = thrust_sp(1);
|
||||
_local_pos_sp.acc_x = thrust_sp(2);
|
||||
|
||||
_att_sp.timestamp = hrt_absolute_time();
|
||||
|
||||
|
||||
@@ -1335,6 +1324,23 @@ MulticopterPositionControl::task_main()
|
||||
}
|
||||
}
|
||||
|
||||
/* fill local position, velocity and thrust setpoint */
|
||||
_local_pos_sp.timestamp = hrt_absolute_time();
|
||||
_local_pos_sp.x = _pos_sp(0);
|
||||
_local_pos_sp.y = _pos_sp(1);
|
||||
_local_pos_sp.z = _pos_sp(2);
|
||||
_local_pos_sp.yaw = _att_sp.yaw_body;
|
||||
_local_pos_sp.vx = _vel_sp(0);
|
||||
_local_pos_sp.vy = _vel_sp(1);
|
||||
_local_pos_sp.vz = _vel_sp(2);
|
||||
|
||||
/* publish local position setpoint */
|
||||
if (_local_pos_sp_pub > 0) {
|
||||
orb_publish(ORB_ID(vehicle_local_position_setpoint), _local_pos_sp_pub, &_local_pos_sp);
|
||||
} else {
|
||||
_local_pos_sp_pub = orb_advertise(ORB_ID(vehicle_local_position_setpoint), &_local_pos_sp);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* position controller disabled, reset setpoints */
|
||||
_reset_alt_sp = true;
|
||||
|
||||
Reference in New Issue
Block a user