Drone Simulation in MotionSolve and Twin Activate


Enjoyed by hobbyists and utilized by industries for their mobility, drones have become commonplace. Their ability to access hard-to-reach areas and capture high-resolution imagery has revolutionized fields like environmental monitoring and infrastructure inspection. In agriculture, they facilitate crop monitoring and resource management, driving efficiency and sustainability. Meanwhile, distributors are using drones for commercial delivery and photographers are taking fantastic shots while hobbyists enjoy smooth flights.
With a demand for bigger and better drones, simulation allows designers and engineers to accelerate the design process and optimize performance. Computation fluid dynamics (CFD) can provide insight into propeller performance and drone aerodynamics. Multibody dynamics (MBD) allows users to simulate drone flight. In combination with digital twin software, a drone can be recreated in a virtual environment with a realistic control system. Engineers can test control algorithms on the digital twin, where there isn’t risk of destroying an expensive drone. It is possible to go a step further and build the control algorithm as a functional mock-up unit. This lets engineers test the control system on any drone (quadrotor, hexacopter, octorotor, etc) after quick drone assembly in an MBD program.
In this demonstration, we will build MBD models of two drones, a 2 kg quadcopter and a 3 kg octocopter. Altair’s MotionSolve will allow for quick model assembly and easy integration with a control system. The control system will allow users to draw any curve in altitude, pitch, or roll directions and the drone will follow the curve using a PID control scheme. The controller will be built as a functional mock-up unit (FMU) in Twin Activate, an intuitive 1D modeling software for multi-physics and controls systems. Once complete, the drones will navigate through space guided by the controller and provide insights into the power the propellers require, thrust generated, propeller RPM, and motor torque.
Understanding the ModelThe model begins with curves defining the drone’s desired position over time. MotionSolve passes the drone’s current position and desired position at the current timestep to Twin Activate. The plot below shows the desired and actual positions over time once the simulation is completed.
Twin Activate calculates the error in position in each direction. This Twin Activate controller treats each direction as independent. The altitude controller uses 1 PID controller to estimate the propeller velocity necessary to approach the desired position.
The roll and pitch controllers consist of a series of 3 PID controllers: position, velocity, and angle. The position and velocity PID controllers output the reference velocity and angle, respectively. The output of the final controller, angle, is the adjustment to the propeller velocity required to move the drone laterally.
This simple approach to control works well for altitude. However, the drone experiences a significant delay in the response for lateral movement. A more complete controller may implement adaptive PID gains or feedforward control to make lateral movement more responsive. While not necessary, it can also be beneficial to consider the coupled nature of altitude, yaw, pitch, and roll. The plot below demonstrates lateral position control; however, the target position is set to 0 for the final results.
The Twin Activate controller is a functional mock-up unit. This allows it to be imported into any MotionSolve model. Users can edit the PID gains and change the target paths in MotionSolve to alter controller performance. After calculating the velocity at each propeller, the Twin Activate controller passes this information to MotionSolve.
Thrust is calculated by rearranging the equation for the thrust coefficient. This means it is necessary to determine or estimate the thrust coefficient, which can be determined via physical propeller testing or CFD.
T = C_T ρn^2 D^4
T - Thrust (N)
C_T - Thrust Coefficient (Unitless)
ρ - Air Density (kg ⁄ m^3 )
n - Propeller Velocity (rotations per second)
D - Propeller Diameter (m)
MotionSolve applies the thrust forces at each propeller and gravitational forces at the drone’s center of gravity. Normal force due to the ground is modeled as a contact, where force is dependent on interference. Lastly, disturbances due to wind can be modeled as forces or torques on the drone to simulate realistic conditions. MotionSolve solves the dynamics of the system over a small timestep to calculate the drone’s new state and the cycle repeats until the end time is reached.
SOFTWARE REQUIREMENTSMotionView (2024 or newer)
MotionSolve (2024 or newer)
Twin Activate (2024 or newer)
MODEL FILES MODEL SETUP & SIMULATION STEPSOpen Quadcopter.mdl or Octocopter.mdl in MotionView.
Edit the altitude, Y position, and X position curves to draw a path the drone will follow.
Run a motion analysis.
Select the results folder as the output directory.
Analyze the animation by opening the h3d file in HyperView.
Review drone performance with plots in HyperGraph by opening the plt file.
RESULTSFour Rotor (2 kg) Results
Eight Rotor (3 kg) Results
CONCLUSION
In this example, we demonstrated a multibody dynamics model of two different drones with an FMU controller. This approach allows engineers to test control algorithms on digitized drones and gather information on motor requirements. This example showed a very simple control algorithm in the early phases of development, however, this same approach can be applied to complex algorithms, including those intended for collision avoidance. MotionSolve facilitates model scalability allowing engineers to easily add rotors or change drone geometry and study the effect on drone performance.
AUTHORSJohn Dagg, Systems Engineering Intern
Christopher Fadanelli, Solutions Engineer – Systems Integration
Ananth Kamath Kota, General Technical Manager – Systems Integration