modelcontrolModule
Information
This is a discrete PID controller. It has inputs that account for the dictated position of the quadcopter and yaw. It compares the actual XYZ position of the quadcopter to the commanded XYZ position and controls the current applied to each of the motors as a result.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.Time | samplePeriod | 0.01 | |
| Real | maxTilt | 2 | Upper limits of input signals |
| Yaw PID | |||
| Real | Yaw_ki | 0 | I gain for yaw |
| Real | Yaw_kd | 0.08 | D gain for yaw |
| Real | Yaw_kp | 0.04 | P gain for yaw |
| X position PID | |||
| Real | x_ki | 0.03 | I gain for x position |
| Real | x_kd | 0.1 | D gain for x position |
| Real | x_kp | 0.1 | P gainfor x position |
| Y position PID | |||
| Real | y_ki | 0.03 | I gain for y position |
| Real | y_kd | 0.1 | D gain for y position |
| Real | y_kp | 0.1 | P gain for y position |
| Z position PID | |||
| Real | z_ki | 1 | I gain for z position |
| Real | z_kd | 2 | D gain for z position |
| Real | z_kp | 1.5 | P gain for z position |
| Gyroscope PID | |||
| Real | gyro_x_ki | 2 | I gain for gyroscope measurements in the x direction |
| Real | gyro_x_kd | 1 | D gain for the gyroscope measurements in the x direction |
| Real | gyro_x_kp | 1 | P gain for the gyroscope measurements in the x dire3ction |
| Real | gyro_y_ki | 2 | I gain for the gyroscope measurements in the y direction |
| Real | gyro_y_kd | 1 | D gain for the gyroscope measurements in the y direction |
| Real | gyro_y_kp | 1 | P gain for the gyroscope measurements in the y direction |