Firmware
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
FlightTask Class Referenceabstract
Inheritance diagram for FlightTask:
ModuleParams ListNode< ModuleParams *> FlightTaskAuto FlightTaskFailsafe FlightTaskManual FlightTaskOffboard FlightTaskTransition FlightTaskAutoFollowMe FlightTaskAutoMapper FlightTaskAutoMapper2 FlightTaskManualAltitude FlightTaskAutoLine FlightTaskAutoLineSmoothVel FlightTaskManualAltitudeSmooth FlightTaskManualAltitudeSmoothVel FlightTaskManualPosition FlightTaskOrbit FlightTaskManualPositionSmooth FlightTaskManualPositionSmoothVel FlightTaskSport

Public Member Functions

virtual bool initializeSubscriptions (SubscriptionArray &subscription_array)
 Initialize the uORB subscriptions using an array. More...
 
virtual bool activate ()
 Call once on the event where you switch to the task. More...
 
virtual void reActivate ()
 Call this to reset an active Flight Task.
 
virtual bool applyCommandParameters (const vehicle_command_s &command)
 To be called to adopt parameters from an arrived vehicle command. More...
 
virtual bool updateInitialize ()
 Call before activate() or update() to initialize time and input data. More...
 
virtual bool update ()=0
 To be called regularly in the control loop cycle to execute the task. 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_s & getConstraints ()
 Get vehicle constraints. More...
 
const landing_gear_s & getGear ()
 Get landing gear position. More...
 
const vehicle_trajectory_waypoint_s & getAvoidanceWaypoint ()
 Get avoidance desired waypoint. More...
 
void handleParameterUpdate ()
 Call this whenever a parameter update notification is received (parameter_update uORB message)
 
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)
 
- Public Member Functions inherited from ModuleParams
 ModuleParams (ModuleParams *parent)
 
void setParent (ModuleParams *parent)
 Sets the parent module. More...
 
 ModuleParams (const ModuleParams &)=delete
 
ModuleParamsoperator= (const ModuleParams &)=delete
 
 ModuleParams (ModuleParams &&)=delete
 
ModuleParamsoperator= (ModuleParams &&)=delete
 
- Public Member Functions inherited from ListNode< ModuleParams *>
void setSibling (ModuleParams * sibling)
 
const ModuleParamsgetSibling () const
 

Static Public Attributes

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, {}}
 Empty constraints. More...
 
static const landing_gear_s empty_landing_gear_default_keep = {0, landing_gear_s::GEAR_KEEP, {}}
 default landing gear state
 
static const vehicle_trajectory_waypoint_s empty_trajectory_waypoint
 Empty desired waypoints. More...
 

Protected Member Functions

void _resetSetpoints ()
 Reset all setpoints to NAN.
 
void _evaluateVehicleLocalPosition ()
 Check and update local position.
 
virtual void _setDefaultConstraints ()
 Set constraints to default values.
 
- Protected Member Functions inherited from ModuleParams
virtual void updateParams ()
 Call this method whenever the module gets a parameter change notification. More...
 
virtual void updateParamsImpl ()
 The implementation for this is generated with the macro DEFINE_PARAMETERS()
 

Protected Attributes

uORB::Subscription< vehicle_local_position_s > * _sub_vehicle_local_position {nullptr}
 
uORB::Subscription< vehicle_attitude_s > * _sub_attitude {nullptr}
 
uint8_t _heading_reset_counter {0}
 estimator heading reset
 
float _time = 0
 passed time in seconds since the task was activated
 
float _deltatime = 0
 passed time in seconds since the task was last updated
 
hrt_abstime _time_stamp_activate = 0
 time stamp when task was activated
 
hrt_abstime _time_stamp_current = 0
 time stamp at the beginning of the current task update
 
hrt_abstime _time_stamp_last = 0
 time stamp when task was last updated
 
matrix::Vector3f _position
 current vehicle position
 
matrix::Vector3f _velocity
 current vehicle velocity
 
float _yaw = 0.f
 current vehicle yaw heading
 
float _dist_to_bottom = 0.0f
 current height above ground level
 
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
 
vehicle_constraints_s _constraints {}
 Vehicle constraints. More...
 
landing_gear_s _gear {}
 
vehicle_trajectory_waypoint_s _desired_waypoint {}
 Desired waypoints. More...
 
- Protected Attributes inherited from ListNode< ModuleParams *>
ModuleParams_sibling
 

Static Protected Attributes

static constexpr uint64_t _timeout = 500000
 maximal time in us before a loop or data times out
 

Member Function Documentation

§ activate()

bool FlightTask::activate ( )
virtual

§ applyCommandParameters()

virtual bool FlightTask::applyCommandParameters ( const vehicle_command_s &  command)
inlinevirtual

To be called to adopt parameters from an arrived vehicle command.

Parameters
commandreceived command message containing the parameters
Returns
true if accepted, false if declined

Reimplemented in FlightTaskManual, and FlightTaskOrbit.

§ getAvoidanceWaypoint()

const vehicle_trajectory_waypoint_s& FlightTask::getAvoidanceWaypoint ( )
inline

Get avoidance desired waypoint.

Returns
desired waypoints

§ getConstraints()

const vehicle_constraints_s& FlightTask::getConstraints ( )
inline

Get vehicle constraints.

The constraints can vary with task.

Returns
constraints

§ getGear()

const landing_gear_s& FlightTask::getGear ( )
inline

Get landing gear position.

The constraints can vary with task.

Returns
landing gear

§ getPositionSetpoint()

const vehicle_local_position_setpoint_s FlightTask::getPositionSetpoint ( )

Get the output data.

Returns
task output setpoints that get executed by the positon controller

§ initializeSubscriptions()

bool FlightTask::initializeSubscriptions ( SubscriptionArray subscription_array)
virtual

Initialize the uORB subscriptions using an array.

Parameters
subscription_arrayhandling uORB subscribtions externally across task switches
Returns
true on success, false on error

Reimplemented in FlightTaskAuto, FlightTaskManual, FlightTaskManualPosition, FlightTaskManualAltitude, and FlightTaskOffboard.

§ setYawHandler()

virtual void FlightTask::setYawHandler ( WeatherVane ext_yaw_handler)
inlinevirtual

Sets an external yaw handler which can be used by any flight task to implement a different yaw control strategy.

This method does nothing, each flighttask which wants to use the yaw handler needs to override this method.

Reimplemented in FlightTaskAuto, and FlightTaskManualPosition.

§ update()

virtual bool FlightTask::update ( )
pure virtual

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

Returns
true on success, false on error

Implemented in FlightTaskOrbit, FlightTaskManualAltitude, FlightTaskTransition, FlightTaskAutoMapper, FlightTaskAutoMapper2, FlightTaskOffboard, FlightTaskAutoFollowMe, and FlightTaskFailsafe.

§ updateFinalize()

virtual bool FlightTask::updateFinalize ( )
inlinevirtual

Call after update() to constrain the generated setpoints in order to comply with the constraints of the current mode.

Returns
true on success, false on error

Reimplemented in FlightTaskAuto.

§ updateInitialize()

bool FlightTask::updateInitialize ( )
virtual

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

Returns
true on success, false on error

Reimplemented in FlightTaskAuto, FlightTaskManual, FlightTaskManualPosition, FlightTaskOffboard, FlightTaskManualAltitude, and FlightTaskTransition.

Member Data Documentation

§ _constraints

vehicle_constraints_s FlightTask::_constraints {}
protected

Vehicle constraints.

The constraints can vary with tasks.

§ _desired_waypoint

vehicle_trajectory_waypoint_s FlightTask::_desired_waypoint {}
protected

Desired waypoints.

Goals set by the FCU to be sent to the obstacle avoidance system.

§ _position_setpoint

matrix::Vector3f FlightTask::_position_setpoint
protected

Setpoints which the position controller has to execute.

Setpoints that are set to NAN are not controlled. Not all setpoints can be set at the same time. If more than one type of setpoint is set, then order of control is a as follow: position, velocity, acceleration, thrust. The exception is _position_setpoint together with _velocity_setpoint, where the _velocity_setpoint is used as feedforward. _acceleration_setpoint and _jerk_setpoint are currently not supported.

§ empty_constraints

const vehicle_constraints_s FlightTask::empty_constraints = {0, NAN, NAN, NAN, NAN, NAN, NAN, NAN, {}}
static

Empty constraints.

All constraints are set to NAN.

§ empty_setpoint

const vehicle_local_position_setpoint_s FlightTask::empty_setpoint = {0, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, {NAN, NAN, NAN}}
static

Empty setpoint.

All setpoints are set to NAN.

§ empty_trajectory_waypoint

const vehicle_trajectory_waypoint_s FlightTask::empty_trajectory_waypoint
static

Empty desired waypoints.

All waypoints are set to NAN.


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