Class QuadrotorDynamics

Inheritance Relationships

Base Type

Class Documentation

class QuadrotorDynamics : public bitrl::dynamics::MotionModelDynamicsBase<SysState<12>, DynamicsMatrixDescriptor, RealVec>

The QuadrotorDynamics class. Implements quadrotor dynamics The implementation of this class follows the System Modeling section at https://wilselby.com/research/arducopter/modeling/ and https://scholarsarchive.byu.edu/cgi/viewcontent.cgi?article=2324&context=facpub The quadrotor is assumed to have four rotors Each rotor consists of a brushless DC motor and rotor with a fixed pitch. It is assumed that the quadrotor can move in 6 degrees of freedom; 3-translational and 3-rotational, The motion of the quadrotor is controlled via 4 inputs namely the speeds of the 4 motors. The quadrotor model that this class implements assumes the following:

  • The quadrotor structure is rigid and symmetrical with a center of mass aligned with the center of the body frame of the vehicle.

  • The thrust and drag of each motor is proportional to the square of the motor velocity.

  • The propellers are considered to be rigid and therefore blade flapping is negligible (deformation of propeller blades due to high velocities and flexible material).

  • The Earth is flat and non-rotating (difference of gravity by altitude or the spin of the earth is negligible)

  • Surrounding fluid velocities (wind) are negligible.

  • Ground effect is negligible

The class integrates the translational and rotational dynamics equations on the body frame

Public Types

typedef MotionModelDynamicsBase<SysState<12>, DynamicsMatrixDescriptor, RealVec> base_type
typedef base_type::state_type state_type

The type of the state handled by this dynamics object.

typedef base_type::input_type input_type

input_t The type of the input for solving the dynamics

typedef base_type::matrix_type matrix_type

matrix_t Matrix type that describes the dynamics

typedef base_type::vector_type vector_type

vector_t

Public Functions

QuadrotorDynamics(QuadrotorDynamicsConfig config, SysState<12> &state)

QuadrotorDynamics Constructor. Specify the configuration parameters of the simulated quadrotor. It is assumed that the mass of the quadrotor remains fixed and the system state to be tracked.

virtual state_type &evaluate(const input_type &input) override

Evaluate the new state using the given input it also updates the various matrices if needed.

void integrate(const RealVec &motor_w)

Integrate the new state. It also uses error terms.

void translational_dynamics(const RealVec &motor_w)

Implements the translational dynamics. It accepts the motors angular velocities. Notice that this model will squared and input velocities.

void rotational_dynamics(const RealVec &motor_w)

Implements the translational dynamics. It accepts the motors angular velocities. Notice that this model will squared and input velocities.

inline RealColVec3d get_position() const

Returns the current position NED frame. Note that the z-coordinate has to be multiplied with -1 in order to represent an upwards looking z-axis.

inline RealColVec3d get_velocity() const

Returns the current linear velocity (body frame)

inline RealColVec3d get_angular_velocity() const

Returns the current angular velocity (body frame)

inline RealColVec3d get_euler_angles() const

Returns the Euler angles (0: phi, 1: theta, 2:psi)

inline real_t phi() const noexcept

The phi Euler angle in rad.

inline real_t theta() const noexcept

The theta Euler angle in rad.

inline real_t psi() const noexcept

The psi Euler angle in rad.