CopterMotorModel Module Documentation¶
Toolbox: RflySim Model

Introduction¶
One-sentence Description: Simulates the dynamic response of multirotor drone motors to input control signals, outputting normalized motor speed signals.
This module belongs to the RflySim Model interface library and serves as a core actuator-level modeling component in multirotor drone dynamics simulation. It replicates in Simulink the first-order dynamic response characteristic of real multirotor motors—from throttle control input to actual speed output—and supports modeling up to 8-rotor multirotor drones. Given a 16-dimensional actuator control input, combined with configured throttle-to-speed conversion parameters and first-order lag response parameters, the module outputs 8 channels of motor speed signals, with units in rad/s and rpm (revolutions per minute).
Typically used in conjunction with the PX4 firmware simulation model and multirotor dynamics model, the motor speed outputs can be directly fed into the CopterSim dynamics solver engine, or transmitted via the RflySim3D interface to the Unity visualization environment to drive 3D animations of multirotor arms and propellers, thereby completing the full toolchain loop from PX4 control output to drone motion simulation and 3D visualization.
Port Descriptions¶
Input Ports¶
| Port Name | Data Type | Dimension | Description |
|---|---|---|---|
pwm |
double |
1×16 |
Actuator control input |
Output Ports¶
| Port Name | Data Type | Dimension | Description |
|---|---|---|---|
ActuatorToUE |
double |
1×8 |
8 motor speed outputs, unit: rpm, intended for transmission to the simulation visualization engine |
MotorRads |
double |
1×8 |
8 motor speed outputs, unit: rad/s, intended for subsequent dynamics calculations |
Parameter Configuration¶
The following parameters can be configured in the Mask dialog box opened by double-clicking the module:
| Parameter Name | Type | Default Value | Available Values/Range | Description |
|---|---|---|---|---|
Param_motorWb |
double |
None | >0 |
Zero-offset (bias) of the throttle-to-speed fitting curve, unit: rad/s |
Param_motorCr |
double |
None | >0 |
Slope of the throttle-to-speed fitting curve |
Param_motorT |
double |
None | >0 |
Time constant of the motor’s first-order response |
ModelParam_motorMinThr |
double |
0.05 |
0~1 |
Minimum throttle threshold; motor output is cut off when throttle falls below this value |
Parameter Configuration Details¶
Param_motorWb¶
This parameter represents the intercept term in the linear fit between throttle input and motor speed:
$\(\omega = \text{Param_motorCr} \times thr + \text{Param_motorWb}\)$
where \(thr\) is the normalized throttle input and \(\omega\) is the steady-state motor speed in rad/s.
Param_motorCr¶
This parameter is the slope term in the linear fit between throttle input and motor speed, representing the change in motor speed per unit change in throttle input.
Param_motorT¶
This module employs a first-order lag element to model the motor’s dynamic response. This parameter is the time constant of the first-order element; a smaller value indicates faster motor response.
ModelParam_motorMinThr¶
When the input throttle falls below this threshold, the module sets the motor speed output to zero, simulating the real-world behavior of the flight controller cutting off motor output. Default value is 0.05.
Module Characteristics¶
| Characteristic | Value |
|---|---|
| Supported Data Types | double, single |
| Direct Feedthrough | No |
| Sample Time | Inherited |
| Code Generation Support | No |
Data Communication Protocol¶
This module does not involve network communication.
Related Modules¶
| Module Name | Description |
|---|---|
FixedWingPropulsionModel |
Simulates the propulsion system response of fixed-wing aircraft |
VehicleDynamicsCopter |
Implements rigid-body flight dynamics calculation for multirotor drones |
MixMultirotor |
Implements control allocation and mixing for multirotor drones |
Notes and Common Issues¶
- Initialization Sequence: This module must be used in conjunction with the RflySim platform’s simulation initialization workflow. Simulation must only be started after completing RflySim task initialization and firmware link configuration; otherwise, initial motor speed outputs may exhibit abnormal deviations.
- Input Dimension Matching: Designed to support up to 8-rotor multirotors, the
pwminput is a fixed 16-dimensional vector. The first 8 dimensions correspond to throttle controls for the 8 motors. For multirotors with fewer than 8 rotors, unused motor input channels must be set to 0—leaving them unconnected or inputting invalid values will cause abnormal speed outputs. - Minimum Throttle Logic: When the input throttle is below
ModelParam_motorMinThr, the module sets motor speed output to zero. To maintain idle rotation, adjust this threshold downward according to the actual aircraft requirements. - Unit Conversion: The two speed outputs use different units:
MotorRadsis in rad/s, whileActuatorToUEis in rpm. When interfacing with subsequent dynamics modules or visualization interfaces, ensure the correct output port is selected to avoid simulation errors due to unit mismatch. - Parameter Physical Consistency:
Param_motorWbrepresents the baseline motor speed at zero throttle input;Param_motorCrrepresents the throttle-to-speed gain. These parameters must match the actual motor and ESC specifications; excessive deviation can lead to incorrect total thrust calculation and simulation instability (e.g., drone “explosive drift”). - First-Order Lag Response: The module models motor speed response using a first-order lag element. The time constant
Param_motorTgoverns motor response speed. Setting it to 0 reduces the model to an ideal, delay-free system; setting it too large results in sluggish motor response and may cause instability in the closed-loop control simulation.
Changelog¶
v4.0.0(2023-01-01): Initial release. Supports multirotor motor response simulation, providing standard throttle-to-speed curves and first-order lag response modeling, with support for up to 8-rotor multirotor motor outputs.