FlightTaskOrbit: don't apply yaw feed forward in circle approach

The yaw pointing towards the center makes sense since that's the approach
direction anyways. But with the yaw feed forward results in a weird looking
bias when not orbiting yet.
This commit is contained in:
Matthias Grob
2019-08-12 11:36:03 +02:00
parent 7774b150a9
commit d3c7d06288

View File

@@ -183,6 +183,8 @@ bool FlightTaskOrbit::update()
Vector2f center_to_position = Vector2f(_position) - _center;
// make vehicle front always point towards the center
_yaw_setpoint = atan2f(center_to_position(1), center_to_position(0)) + M_PI_F;
if (_in_circle_approach) {
generate_circle_approach_setpoints();
@@ -191,12 +193,7 @@ bool FlightTaskOrbit::update()
generate_circle_setpoints(center_to_position);
}
// make vehicle front always point towards the center
_yaw_setpoint = atan2f(center_to_position(1), center_to_position(0)) + M_PI_F;
// yawspeed feed-forward because we know the necessary angular rate
_yawspeed_setpoint = _v / _r;
// publish telemetry
// publish information to UI
sendTelemetry();
return true;
@@ -217,6 +214,9 @@ void FlightTaskOrbit::generate_circle_approach_setpoints()
// follow the planned line and switch to orbiting once the circle is reached
_circle_approach_line.generateSetpoints(_position_setpoint, _velocity_setpoint);
_in_circle_approach = !_circle_approach_line.isEndReached();
// yaw stays constant
_yawspeed_setpoint = NAN;
}
void FlightTaskOrbit::generate_circle_setpoints(Vector2f center_to_position)
@@ -232,4 +232,7 @@ void FlightTaskOrbit::generate_circle_setpoints(Vector2f center_to_position)
_velocity_setpoint(0) = velocity_xy(0);
_velocity_setpoint(1) = velocity_xy(1);
_position_setpoint(0) = _position_setpoint(1) = NAN;
// yawspeed feed-forward because we know the necessary angular rate
_yawspeed_setpoint = _v / _r;
}