WOLFRAM SYSTEM MODELER

HoverPID

Control the attitude and height of the quadrotor through PID controllers

Diagram

Wolfram Language

In[1]:=
SystemModel["Aircraft.ControlSystems.MultiRotorControllers.HoverPID"]
Out[1]:=

Information

This model takes roll, pitch and yaw angles and vertical position (z), as inputs and produces voltage commands for the DC motors to control the quadrotor in its three degrees of freedom (DoF): roll (φ), pitch (θ) and height (z). To obtain the moment and throttle commands, the measured angles (roll (φ measured), pitch (θ measured), yaw (Ψ measured)) and height (z measured) are subtracted from their respective reference values. The resulting error values are then passed through the PID controllers to obtain the moments (L: roll moment, M: pitch moment, N: yaw moment) and force (throttle) increment; the moments are subsequently directed to the mixer for the distribution of force and moments to each DC motor. In the case of the throttle command, the additional thrust increment should be added to the base thrust, which represents the minimum required thrust to overcome the weight of the quadrotor.

Figure 1: Controller block diagram

Note: This controller is just applicable on the 3DoF quadrotor dynamic as it does not control the longitudinal and lateral positions of the quadcopter.

Note: The controller gains should be tuned based on the specific quadrotor and mission requirements.

Parameters (12)

propGainRollPID

Value: 10

Type: Real

Description: Gain of controller (PIDRoll.k)

intTimeConstRollPID

Value: 100

Type: Time (s)

Description: Time constant of Integrator block (PIDRoll.Ti)

propGainPitchPID

Value: 10

Type: Real

Description: Gain of controller (PIDPitch.k)

intTimeConstPitchPID

Value: 100

Type: Time (s)

Description: Time constant of Integrator block (PIDPitch.Ti)

derTimeConstPitchPID

Value: 0.1

Type: Time (s)

Description: Time constant of Derivative block (PIDPitch.Td)

propGainYawPID

Value: 100

Type: Real

Description: Gain of controller (PIDYaw.k)

intTimeConstYawPID

Value: 20

Type: Time (s)

Description: Time constant of Integrator block (PIDYaw.Ti)

derTimeConstYawPID

Value: 0.1

Type: Time (s)

Description: Time constant of Derivative block (PIDYaw.Td)

propGainZPID

Value: 50

Type: Real

Description: Gain of controller (PIDHeight.k)

intGainZPID

Value: 2

Type: Time (s)

Description: Time constant of Integrator block (PIDHeight.Ti)

derGainZPID

Value: 0.1

Type: Time (s)

Description: Time constant of Derivative block (PIDHeight.Td)

derTimeConstRollPID

Value: 0.1

Type: Time (s)

Description: Time constant of Derivative block (PIDRoll.Td)

Connectors (5)

angleRef

Type: RealInput[3]

Description: Reference angle vector

motor

Type: RealOutput[4]

Description: Voltage command vector to electric motor

zRef

Type: RealInput

Description: Reference z position (height)

positionM

Type: RealInput[3]

Description: Measured position of the quadrotors

angleM

Type: RealInput[3]

Description: Measured angles of the quadrotor

Components (15)

voltage2

Type: Add4

Description: Voltage command of the northwest propeller motor

voltage3

Type: Add4

Description: Voltage command of the northeast propeller motor

voltage4

Type: Add4

Description: Voltage command of the southeeast propeller motor

voltage1

Type: Add4

Description: Voltage command of the southwest propeller motor

zPID

Type: LimPID

Description: PID controller generates z position (height) control command

yawPID

Type: LimPID

Description: PID controller generates yaw angle control command

pitchPID

Type: LimPID

Description: PID controller generates pitch angle control command

rollPID

Type: LimPID

Description: PID controller generates roll angle control command

rotationDirection2

Type: Gain

Description: Change rotation of the propeller to clockwise direction

rotationDirection1

Type: Gain

Description: Change rotation of the propeller to clockwise direction

rollM

Type: RealExpression

Description: Measured roll angle

yawM

Type: RealExpression

Description: Measured yaw angle

pitchM

Type: RealExpression

Description: Measured pitch angle

thrustSum

Type: Add

Description: The total of the basic thrust and the incremental thrust

base

Type: Constant

Description: Base thrust value equivalent to the quadrotor weight

Used in Examples (1)

VerticalMotion

Aircraft.Examples

Vertical motion of quadrotor system in 3DOF, constrained in z axis