Skip to content

Commit

Permalink
FlightTaskTransition: control z and yaw velocity to 0
Browse files Browse the repository at this point in the history
instead of setting an altitude setpoint and going full effort to
exactly come back to it.
  • Loading branch information
MaEtUgR committed Oct 29, 2019
1 parent 07eb3d3 commit 6cc5b3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
15 changes: 5 additions & 10 deletions src/lib/FlightTasks/tasks/Transition/FlightTaskTransition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ bool FlightTaskTransition::updateInitialize()
bool FlightTaskTransition::activate(vehicle_local_position_setpoint_s last_setpoint)
{
checkSetpoints(last_setpoint);
_transition_altitude = last_setpoint.z;
_transition_yaw = last_setpoint.yaw;
_acceleration_setpoint.setAll(0.f);
_velocity_prev = _velocity;
return FlightTask::activate(last_setpoint);
Expand Down Expand Up @@ -77,15 +75,12 @@ void FlightTaskTransition::updateAccelerationEstimate()

bool FlightTaskTransition::update()
{
// level wings during the transition, altitude should be controlled
_thrust_setpoint(0) = _thrust_setpoint(1) = 0.0f;
_thrust_setpoint(2) = NAN;
_position_setpoint *= NAN;
_velocity_setpoint *= NAN;
_position_setpoint(2) = _transition_altitude;
// level wings during the transition
_thrust_setpoint = matrix::Vector3f(0.f, 0.f, NAN);
// altitude and yaw should be controlled to slow down/stop
_velocity_setpoint = matrix::Vector3f(NAN, NAN, 0.f);
_yawspeed_setpoint = 0.f;

updateAccelerationEstimate();

_yaw_setpoint = _transition_yaw;
return true;
}
2 changes: 0 additions & 2 deletions src/lib/FlightTasks/tasks/Transition/FlightTaskTransition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,5 @@ class FlightTaskTransition : public FlightTask
void checkSetpoints(vehicle_local_position_setpoint_s &setpoints);
void updateAccelerationEstimate();

float _transition_altitude = 0.0f;
float _transition_yaw = 0.0f;
matrix::Vector3f _velocity_prev{};
};

0 comments on commit 6cc5b3c

Please sign in to comment.