mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 16:48:52 +08:00
FlightTask: activate tasks with setpoints in use
This commit is contained in:
committed by
Lorenz Meier
parent
389f897b04
commit
216279b576
@@ -100,6 +100,7 @@ void FlightTaskAutoLine::_reset()
|
||||
// Set setpoints equal current state.
|
||||
_velocity_setpoint = _velocity;
|
||||
_position_setpoint = _position;
|
||||
_yaw_setpoint = _yaw;
|
||||
_destination = _target;
|
||||
_origin = _prev_wp;
|
||||
_speed_at_target = 0.0f;
|
||||
|
||||
@@ -43,6 +43,9 @@ using namespace matrix;
|
||||
bool FlightTaskManualAltitude::activate()
|
||||
{
|
||||
bool ret = FlightTaskManualStabilized::activate();
|
||||
_thrust_setpoint(2) = NAN; // altitude is controlled from position/velocity
|
||||
_position_setpoint(2) = _position(2);
|
||||
_velocity_setpoint(2) = 0.0f;
|
||||
_setDefaultConstraints();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,10 @@ bool FlightTaskManualPosition::activate()
|
||||
_constraints.speed_xy = MPC_VEL_MANUAL.get();
|
||||
}
|
||||
|
||||
_position_setpoint(0) = _position(0);
|
||||
_position_setpoint(1) = _position(1);
|
||||
_velocity_setpoint(0) = _velocity_setpoint(1) = 0.0f;
|
||||
_velocity_scale = _constraints.speed_xy;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,8 @@ bool FlightTaskManualStabilized::activate()
|
||||
{
|
||||
bool ret = FlightTaskManual::activate();
|
||||
_thrust_setpoint = matrix::Vector3f(0.0f, 0.0f, -_throttle_hover.get());
|
||||
_yaw_setpoint = _yaw;
|
||||
_yawspeed_setpoint = 0.0f;
|
||||
_constraints.tilt = math::radians(_tilt_max_man.get());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@ bool FlightTaskOffboard::initializeSubscriptions(SubscriptionArray &subscription
|
||||
bool FlightTaskOffboard::activate()
|
||||
{
|
||||
bool ret = FlightTask::activate();
|
||||
_position_setpoint = _position;
|
||||
_velocity_setpoint *= 0.0f;
|
||||
_position_lock *= NAN;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user