Template Class IndiController

Inheritance Relationships

Base Types

Class Documentation

template<typename P = double, int num_rotors = 4>
class IndiController : public pid_controller::PID<double>, public pid_controller::PID<double>

Incremental Nonlinear Dynamic Inversion (INDI) controller.

Convert the desired thrust and angular velocity to motor angular velocity.

Template Parameters:
  • P – Precision type of the controller

  • num_rotors – Number of rotors of the multirotor

Public Functions

inline IndiController(const Matrix3 &inertia, const Matrix4 &mixer_matrix_inverse, const PIDParams &pid_params)

Construct a new Indi Controller object.

Parameters:
  • inertia – Vehicle inertia matrix (kg m^2)

  • mixer_matrix_inverse – Mixer matrix inverse [num_rotors x 6]

  • pid_params – PID parameters

inline explicit IndiController(const IndiControllerParams<P> &params = IndiControllerParams<P>())

Construct a new Indi Controller object.

Parameters:

paramsIndiControllerParams parameters

inline ~IndiController()

Destroy the Indi Controller object.

inline VectorN acro_to_motor_angular_velocity(const Vector3 &current_vehicle_angular_velocity, const Scalar thrust, const Vector3 &desired_angular_velocity, const Scalar dt)

Compute the control action.

Parameters:
  • current_vehicle_angular_velocity – Vector3 with the current vehicle angular velocity (rad/s) in body frame

  • thrust – Scalar with the desired thrust (N) in body frame

  • desired_angular_velocity – Vector3 with the desired angular velocity (rad/s) in body frame

  • dt – Scalar with the time step (s)

Returns:

VectorN with the desired motor angular velocity squared (rad^2/s^2)

inline void update_inertia(const Matrix3 &inertia)

Update inertial.

Parameters:

inertia – Matrix3 Inertia matrix (kg m^2)

inline void update_mixer_matrix_inverse(const Matrix4 &mixer_matrix_inverse)

Update mixer matrix inverse.

Parameters:

mixer_matrix_inverse – MatrixN Mixer matrix inverse

inline void update_params(const IndiControllerParams<P> &params)

Update controller parameters.

Parameters:

paramsIndiControllerParams

inline const Matrix3 &get_inertia() const

Get the inertia.

Returns:

Matrix3 Inertia matrix (kg m^2)

inline const Matrix4 &get_mixer_matrix_inverse() const

Get the mixer matrix inverse.

Returns:

MatrixN Mixer matrix inverse

inline const Vector3 &get_desired_angular_acceleration() const

Get the desired angular acceleration.

Returns:

constVector3& Desired angular acceleration (rad/s^2)

inline const Vector3 &get_desired_thrust() const

Get the desired thrust.

Returns:

const Vector3& Desired thrust (N)

inline const Vector3 &get_desired_torque() const

Get the desired torque.

Returns:

const Vector3& Desired torque (N m)

inline const VectorN &get_motor_angular_velocity() const

Get the motor angular velocity.

Returns:

const VectorN& Motor angular velocity squared (rad^2/s^2)

inline const Vector3 &get_angular_velocity_error() const

Get the angular velocity error.

Returns:

Vector3& Angular velocity error (rad/s)

inline IndiController(const Matrix3 &inertia, const Matrix4 &mixer_matrix_inverse, const PIDParams &pid_params)

Construct a new Indi Controller object.

Parameters:
  • inertia – Vehicle inertia matrix (kg m^2)

  • mixer_matrix_inverse – Mixer matrix inverse [num_rotors x 6]

  • pid_params – PID parameters

inline explicit IndiController(const IndiControllerParams<P> &params = IndiControllerParams<P>())

Construct a new Indi Controller object.

Parameters:

paramsIndiControllerParams parameters

inline ~IndiController()

Destroy the Indi Controller object.

inline VectorN acro_to_motor_angular_velocity(const Vector3 &current_vehicle_angular_velocity, const Scalar thrust, const Vector3 &desired_angular_velocity, const Scalar dt)

Compute the control action.

Parameters:
  • current_vehicle_angular_velocity – Vector3 with the current vehicle angular velocity (rad/s) in body frame

  • thrust – Scalar with the desired thrust (N) in body frame

  • desired_angular_velocity – Vector3 with the desired angular velocity (rad/s) in body frame

  • dt – Scalar with the time step (s)

Returns:

VectorN with the desired motor angular velocity squared (rad^2/s^2)

inline void update_inertia(const Matrix3 &inertia)

Update inertial.

Parameters:

inertia – Matrix3 Inertia matrix (kg m^2)

inline void update_mixer_matrix_inverse(const Matrix4 &mixer_matrix_inverse)

Update mixer matrix inverse.

Parameters:

mixer_matrix_inverse – MatrixN Mixer matrix inverse

inline void update_params(const IndiControllerParams<P> &params)

Update controller parameters.

Parameters:

paramsIndiControllerParams

inline const Matrix3 &get_inertia() const

Get the inertia.

Returns:

Matrix3 Inertia matrix (kg m^2)

inline const Matrix4 &get_mixer_matrix_inverse() const

Get the mixer matrix inverse.

Returns:

MatrixN Mixer matrix inverse

inline const Vector3 &get_desired_angular_acceleration() const

Get the desired angular acceleration.

Returns:

constVector3& Desired angular acceleration (rad/s^2)

inline const Vector3 &get_desired_thrust() const

Get the desired thrust.

Returns:

const Vector3& Desired thrust (N)

inline const Vector3 &get_desired_torque() const

Get the desired torque.

Returns:

const Vector3& Desired torque (N m)

inline const VectorN &get_motor_angular_velocity() const

Get the motor angular velocity.

Returns:

const VectorN& Motor angular velocity squared (rad^2/s^2)

inline const Vector3 &get_angular_velocity_error() const

Get the angular velocity error.

Returns:

Vector3& Angular velocity error (rad/s)

Protected Attributes

Matrix3 inertia_ = Matrix3::Zero()
Matrix4 mixer_matrix_inverse_ = Matrix4::Zero()
Vector3 desired_thrust_ = Vector3::Zero()
Vector3 desired_torque_ = Vector3::Zero()
VectorN motor_angular_velocity_ = VectorN::Zero()