Firmware
Public Member Functions | Protected Member Functions | List of all members
PositionControl Class Reference

Core Position-Control for MC. More...

#include <PositionControl.hpp>

Inheritance diagram for PositionControl:
ModuleParams ListNode< ModuleParams *>

Public Member Functions

 PositionControl (ModuleParams *parent)
 
void overwriteParams ()
 Overwrites certain parameters. More...
 
void updateState (const PositionControlStates &states)
 Update the current vehicle state. More...
 
bool updateSetpoint (const vehicle_local_position_setpoint_s &setpoint)
 Update the desired setpoints. More...
 
void updateConstraints (const vehicle_constraints_s &constraints)
 Set constraints that are stricter than the global limits. More...
 
void generateThrustYawSetpoint (const float dt)
 Apply P-position and PID-velocity controller that updates the member thrust, yaw- and yawspeed-setpoints. More...
 
void resetIntegralXY ()
 Set the integral term in xy to 0. More...
 
void resetIntegralZ ()
 Set the integral term in z to 0. More...
 
const matrix::Vector3f & getThrustSetpoint ()
 Get the. More...
 
const float & getYawSetpoint ()
 Get the. More...
 
const float & getYawspeedSetpoint ()
 Get the. More...
 
const matrix::Vector3f getVelSp ()
 Get the. More...
 
const matrix::Vector3f getPosSp ()
 Get the. More...
 
- 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
 

Protected Member Functions

void updateParams () override
 Call this method whenever the module gets a parameter change notification. More...
 
- Protected Member Functions inherited from ModuleParams
virtual void updateParamsImpl ()
 The implementation for this is generated with the macro DEFINE_PARAMETERS()
 

Additional Inherited Members

- Protected Attributes inherited from ListNode< ModuleParams *>
ModuleParams_sibling
 

Detailed Description

Core Position-Control for MC.

This class contains P-controller for position and PID-controller for velocity. Inputs: vehicle position/velocity/yaw desired set-point position/velocity/thrust/yaw/yaw-speed constraints that are stricter than global limits Output thrust vector and a yaw-setpoint

If there is a position and a velocity set-point present, then the velocity set-point is used as feed-forward. If feed-forward is active, then the velocity component of the P-controller output has priority over the feed-forward component.

A setpoint that is NAN is considered as not set. If there is a position/velocity- and thrust-setpoint present, then the thrust-setpoint is ommitted and recomputed from position-velocity-PID-loop.

Member Function Documentation

§ generateThrustYawSetpoint()

void PositionControl::generateThrustYawSetpoint ( const float  dt)

Apply P-position and PID-velocity controller that updates the member thrust, yaw- and yawspeed-setpoints.

See also
_thr_sp
_yaw_sp
_yawspeed_sp
Parameters
dtthe delta-time

§ getPosSp()

const matrix::Vector3f PositionControl::getPosSp ( )
inline

Get the.

See also
_pos_sp
Returns
The position set-point that was executed in the control-loop. Nan if the position control-loop was skipped.

§ getThrustSetpoint()

const matrix::Vector3f& PositionControl::getThrustSetpoint ( )
inline

Get the.

See also
_thr_sp
Returns
The thrust set-point member.

§ getVelSp()

const matrix::Vector3f PositionControl::getVelSp ( )
inline

Get the.

See also
_vel_sp
Returns
The velocity set-point that was executed in the control-loop. Nan if velocity control-loop was skipped.

§ getYawSetpoint()

const float& PositionControl::getYawSetpoint ( )
inline

Get the.

See also
_yaw_sp
Returns
The yaw set-point member.

§ getYawspeedSetpoint()

const float& PositionControl::getYawspeedSetpoint ( )
inline

Get the.

See also
_yawspeed_sp
Returns
The yawspeed set-point member.

§ overwriteParams()

void PositionControl::overwriteParams ( )

Overwrites certain parameters.

Overwrites are required for unit-conversion. This method should only be called if parameters have been updated.

§ resetIntegralXY()

void PositionControl::resetIntegralXY ( )
inline

Set the integral term in xy to 0.

See also
_thr_int

§ resetIntegralZ()

void PositionControl::resetIntegralZ ( )
inline

Set the integral term in z to 0.

See also
_thr_int

§ updateConstraints()

void PositionControl::updateConstraints ( const vehicle_constraints_s &  constraints)

Set constraints that are stricter than the global limits.

Parameters
constraintsa PositionControl structure with supported constraints

§ updateParams()

void PositionControl::updateParams ( )
overrideprotectedvirtual

Call this method whenever the module gets a parameter change notification.

It will automatically call updateParams() for all children, which then call updateParamsImpl().

Reimplemented from ModuleParams.

§ updateSetpoint()

bool PositionControl::updateSetpoint ( const vehicle_local_position_setpoint_s &  setpoint)

Update the desired setpoints.

Parameters
setpointa vehicle_local_position_setpoint_s structure
Returns
true if setpoint has updated correctly

§ updateState()

void PositionControl::updateState ( const PositionControlStates states)

Update the current vehicle state.

Parameters
PositionControlStatesstructure

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