mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 06:14:14 +08:00
mc_pos_control: correct sign of acceleration state
Non-functional change, just change the sign in the correct place to avoid further confusion.
This commit is contained in:
committed by
Mathieu Bresciani
parent
74e99faedf
commit
38093e4887
@@ -145,7 +145,7 @@ void PositionControl::_velocityControl(const float dt)
|
||||
{
|
||||
// PID velocity control
|
||||
Vector3f vel_error = _vel_sp - _vel;
|
||||
Vector3f acc_sp_velocity = vel_error.emult(_gain_vel_p) + _vel_int + _vel_dot.emult(_gain_vel_d);
|
||||
Vector3f acc_sp_velocity = vel_error.emult(_gain_vel_p) + _vel_int - _vel_dot.emult(_gain_vel_d);
|
||||
|
||||
// For backwards compatibility of the gains to non-acceleration based control, needs to be overcome with configuration conversion
|
||||
acc_sp_velocity *= CONSTANTS_ONE_G / _hover_thrust;
|
||||
|
||||
@@ -480,8 +480,8 @@ MulticopterPositionControl::set_vehicle_states(const float &vel_sp_z)
|
||||
if (PX4_ISFINITE(_local_pos.vx) && PX4_ISFINITE(_local_pos.vy) && _local_pos.v_xy_valid) {
|
||||
_states.velocity(0) = _local_pos.vx;
|
||||
_states.velocity(1) = _local_pos.vy;
|
||||
_states.acceleration(0) = _vel_x_deriv.update(-_states.velocity(0));
|
||||
_states.acceleration(1) = _vel_y_deriv.update(-_states.velocity(1));
|
||||
_states.acceleration(0) = _vel_x_deriv.update(_states.velocity(0));
|
||||
_states.acceleration(1) = _vel_y_deriv.update(_states.velocity(1));
|
||||
|
||||
} else {
|
||||
_states.velocity(0) = _states.velocity(1) = NAN;
|
||||
|
||||
Reference in New Issue
Block a user