mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 10:13:34 +08:00
mc_att_control: add an optional stick tilt input filter
This commit is contained in:
@@ -154,8 +154,12 @@ MulticopterAttitudeControl::generate_attitude_setpoint(float dt, bool reset_yaw_
|
||||
* This allows a simple limitation of the tilt angle, the vehicle flies towards the direction that the stick
|
||||
* points to, and changes of the stick input are linear.
|
||||
*/
|
||||
const float x = _manual_control_sp.x * _man_tilt_max;
|
||||
const float y = _manual_control_sp.y * _man_tilt_max;
|
||||
_man_x_input_filter.setParameters(dt, _param_mc_man_tilt_tau.get());
|
||||
_man_y_input_filter.setParameters(dt, _param_mc_man_tilt_tau.get());
|
||||
_man_x_input_filter.update(_manual_control_sp.x * _man_tilt_max);
|
||||
_man_y_input_filter.update(_manual_control_sp.y * _man_tilt_max);
|
||||
const float x = _man_x_input_filter.getState();
|
||||
const float y = _man_y_input_filter.getState();
|
||||
|
||||
// we want to fly towards the direction of (x, y), so we use a perpendicular axis angle vector in the XY-plane
|
||||
Vector2f v = Vector2f(y, -x);
|
||||
@@ -322,6 +326,10 @@ MulticopterAttitudeControl::Run()
|
||||
|
||||
generate_attitude_setpoint(dt, _reset_yaw_sp);
|
||||
attitude_setpoint_generated = true;
|
||||
|
||||
} else {
|
||||
_man_x_input_filter.reset(0.f);
|
||||
_man_y_input_filter.reset(0.f);
|
||||
}
|
||||
|
||||
control_attitude();
|
||||
|
||||
Reference in New Issue
Block a user