PX4 Firmware
PX4 Autopilot Software http://px4.io
FlightTaskTransition Class Reference

#include <FlightTaskTransition.hpp>

Inheritance diagram for FlightTaskTransition:
Collaboration diagram for FlightTaskTransition:

Public Member Functions

 FlightTaskTransition ()=default
 
virtual ~FlightTaskTransition ()=default
 
bool activate (vehicle_local_position_setpoint_s last_setpoint) override
 Call once on the event where you switch to the task. More...
 
bool updateInitialize () override
 Call before activate() or update() to initialize time and input data. More...
 
bool update () override
 To be called regularly in the control loop cycle to execute the task. More...
 
- Public Member Functions inherited from FlightTask
 FlightTask ()
 
virtual ~FlightTask ()=default
 
virtual void reActivate ()
 Call this to reset an active Flight Task. More...
 
virtual bool applyCommandParameters (const vehicle_command_s &command)
 To be called to adopt parameters from an arrived vehicle command. More...
 
virtual bool updateFinalize ()
 Call after update() to constrain the generated setpoints in order to comply with the constraints of the current mode. More...
 
const vehicle_local_position_setpoint_s getPositionSetpoint ()
 Get the output data. More...
 
const vehicle_constraints_sgetConstraints ()
 Get vehicle constraints. More...
 
const landing_gear_sgetGear ()
 Get landing gear position. More...
 
const vehicle_trajectory_waypoint_sgetAvoidanceWaypoint ()
 Get avoidance desired waypoint. More...
 
void handleParameterUpdate ()
 Call this whenever a parameter update notification is received (parameter_update uORB message) More...
 
virtual void setYawHandler (WeatherVane *ext_yaw_handler)
 Sets an external yaw handler which can be used by any flight task to implement a different yaw control strategy. More...
 
void updateVelocityControllerIO (const matrix::Vector3f &vel_sp, const matrix::Vector3f &thrust_sp)
 

Private Member Functions

void checkSetpoints (vehicle_local_position_setpoint_s &setpoints)
 
void updateAccelerationEstimate ()
 

Private Attributes

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

Additional Inherited Members

- Static Public Attributes inherited from FlightTask
static const vehicle_local_position_setpoint_s empty_setpoint = {0, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, {NAN, NAN, NAN}, {NAN, NAN, NAN}, {NAN, NAN, NAN}, {}}
 Empty setpoint. More...
 
static const vehicle_constraints_s empty_constraints = {0, NAN, NAN, NAN, NAN, NAN, NAN, NAN, false, {}}
 Empty constraints. More...
 
static const landing_gear_s empty_landing_gear_default_keep = {0, landing_gear_s::GEAR_KEEP, {}}
 default landing gear state More...
 
- Protected Member Functions inherited from FlightTask
void _resetSetpoints ()
 Reset all setpoints to NAN. More...
 
void _evaluateVehicleLocalPosition ()
 Check and update local position. More...
 
virtual void _setDefaultConstraints ()
 Set constraints to default values. More...
 
virtual bool _checkTakeoff ()
 Determine when to trigger a takeoff (ignored in flight) More...
 
void _initEkfResetCounters ()
 Monitor the EKF reset counters and call the appropriate handling functions in case of a reset event. More...
 
void _checkEkfResetCounters ()
 
virtual void _ekfResetHandlerPositionXY ()
 
virtual void _ekfResetHandlerVelocityXY ()
 
virtual void _ekfResetHandlerPositionZ ()
 
virtual void _ekfResetHandlerVelocityZ ()
 
virtual void _ekfResetHandlerHeading (float delta_psi)
 
- Protected Attributes inherited from FlightTask
uORB::SubscriptionData< vehicle_local_position_s_sub_vehicle_local_position {ORB_ID(vehicle_local_position)}
 
uORB::SubscriptionData< vehicle_attitude_s_sub_attitude {ORB_ID(vehicle_attitude)}
 
float _time = 0
 passed time in seconds since the task was activated More...
 
float _deltatime = 0
 passed time in seconds since the task was last updated More...
 
hrt_abstime _time_stamp_activate = 0
 time stamp when task was activated More...
 
hrt_abstime _time_stamp_current = 0
 time stamp at the beginning of the current task update More...
 
hrt_abstime _time_stamp_last = 0
 time stamp when task was last updated More...
 
matrix::Vector3f _position
 current vehicle position More...
 
matrix::Vector3f _velocity
 current vehicle velocity More...
 
float _yaw = 0.f
 current vehicle yaw heading More...
 
float _dist_to_bottom = 0.0f
 current height above ground level More...
 
matrix::Vector3f _position_setpoint
 Setpoints which the position controller has to execute. More...
 
matrix::Vector3f _velocity_setpoint
 
matrix::Vector3f _acceleration_setpoint
 
matrix::Vector3f _jerk_setpoint
 
matrix::Vector3f _thrust_setpoint
 
float _yaw_setpoint
 
float _yawspeed_setpoint
 
matrix::Vector3f _velocity_setpoint_feedback
 
matrix::Vector3f _thrust_setpoint_feedback
 
struct {
   uint8_t   xy = 0
 
   uint8_t   vxy = 0
 
   uint8_t   z = 0
 
   uint8_t   vz = 0
 
   uint8_t   quat = 0
 
_reset_counters
 
vehicle_constraints_s _constraints {}
 Vehicle constraints. More...
 
landing_gear_s _gear {}
 
vehicle_trajectory_waypoint_s _desired_waypoint {}
 Desired waypoints. More...
 
- Static Protected Attributes inherited from FlightTask
static constexpr uint64_t _timeout = 500000
 maximal time in us before a loop or data times out More...
 

Detailed Description

Definition at line 44 of file FlightTaskTransition.hpp.

Constructor & Destructor Documentation

◆ FlightTaskTransition()

FlightTaskTransition::FlightTaskTransition ( )
default

◆ ~FlightTaskTransition()

virtual FlightTaskTransition::~FlightTaskTransition ( )
virtualdefault

Member Function Documentation

◆ activate()

bool FlightTaskTransition::activate ( vehicle_local_position_setpoint_s  last_setpoint)
overridevirtual

Call once on the event where you switch to the task.

Parameters
stateof the previous task
Returns
true on success, false on error

Reimplemented from FlightTask.

Definition at line 45 of file FlightTaskTransition.cpp.

References FlightTask::_acceleration_setpoint, _transition_altitude, _transition_yaw, FlightTask::_velocity, _velocity_prev, FlightTask::activate(), checkSetpoints(), f(), matrix::Matrix< Type, M, N >::setAll(), vehicle_local_position_setpoint_s::yaw, and vehicle_local_position_setpoint_s::z.

Here is the call graph for this function:

◆ checkSetpoints()

void FlightTaskTransition::checkSetpoints ( vehicle_local_position_setpoint_s setpoints)
private

Definition at line 55 of file FlightTaskTransition.cpp.

References FlightTask::_position, FlightTask::_yaw, vehicle_local_position_setpoint_s::yaw, and vehicle_local_position_setpoint_s::z.

Referenced by activate().

Here is the caller graph for this function:

◆ update()

bool FlightTaskTransition::update ( )
overridevirtual

To be called regularly in the control loop cycle to execute the task.

Returns
true on success, false on error

Implements FlightTask.

Definition at line 78 of file FlightTaskTransition.cpp.

References FlightTask::_position_setpoint, FlightTask::_thrust_setpoint, _transition_altitude, _transition_yaw, FlightTask::_velocity_setpoint, FlightTask::_yaw_setpoint, and updateAccelerationEstimate().

Here is the call graph for this function:

◆ updateAccelerationEstimate()

void FlightTaskTransition::updateAccelerationEstimate ( )
private

Definition at line 63 of file FlightTaskTransition.cpp.

References FlightTask::_acceleration_setpoint, FlightTask::_deltatime, FlightTask::_velocity, _velocity_prev, f(), and matrix::Matrix< Type, M, N >::setAll().

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateInitialize()

bool FlightTaskTransition::updateInitialize ( )
overridevirtual

Call before activate() or update() to initialize time and input data.

Returns
true on success, false on error

Reimplemented from FlightTask.

Definition at line 40 of file FlightTaskTransition.cpp.

References FlightTask::updateInitialize().

Here is the call graph for this function:

Member Data Documentation

◆ _transition_altitude

float FlightTaskTransition::_transition_altitude = 0.0f
private

Definition at line 58 of file FlightTaskTransition.hpp.

Referenced by activate(), and update().

◆ _transition_yaw

float FlightTaskTransition::_transition_yaw = 0.0f
private

Definition at line 59 of file FlightTaskTransition.hpp.

Referenced by activate(), and update().

◆ _velocity_prev

matrix::Vector3f FlightTaskTransition::_velocity_prev {}
private

Definition at line 60 of file FlightTaskTransition.hpp.

Referenced by activate(), and updateAccelerationEstimate().


The documentation for this class was generated from the following files: