Skip to content

Commit

Permalink
FlightTaskOrbit: don't apply yaw feed forward in circle approach
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MaEtUgR committed Aug 31, 2019
1 parent 7774b15 commit d3c7d06
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/lib/FlightTasks/tasks/Orbit/FlightTaskOrbit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -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)
Expand All @@ -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;
}

0 comments on commit d3c7d06

Please sign in to comment.