Extend attitude setpoint message to include feedforward rates

This commit is contained in:
Jaeyoung-Lim
2024-12-17 16:41:11 +01:00
parent 93c25efb62
commit e46247e426
2 changed files with 8 additions and 0 deletions
@@ -7,6 +7,9 @@ float32 yaw_sp_move_rate # rad/s (commanded by user)
# For quaternion-based attitude control
float32[4] q_d # Desired quaternion for quaternion control
# Feedforwaredbody rate setpoints
float32[3] body_rates_ff # Feedforward
# For clarification: For multicopters thrust_body[0] and thrust[1] are usually 0 and thrust[2] is the negative throttle demand.
# For fixed wings thrust_x is the throttle demand and thrust_y, thrust_z will usually be zero.
float32[3] thrust_body # Normalized thrust command in body FRD frame [-1,1]
@@ -1456,6 +1456,11 @@ FixedwingPositionControl::control_auto_path(const float control_interval, const
navigatePathTangent(curr_pos_local, curr_wp_local, velocity_2d.normalized(), ground_speed, _wind_vel, curvature);
float roll_body = getCorrectedNpfgRollSetpoint();
float roll_rate_ff{0.0}; ///TODO: Get roll rate FF from new NPFG formulation
const matrix::Vector3f feedforward_rate{roll_rate_ff, 0.0, 0.0};
feedforward_rate.copyTo(_att_sp.body_rates_ff);
target_airspeed = _npfg.getAirspeedRef() / _eas2tas;
float yaw_body = _yaw; // yaw is not controlled, so set setpoint to current yaw