The general idea revolves around providing the PID controller with 3 coefficients - Position, Integral, and Derivative. The PID controller is a control loop approach that continuously supplies a system with an input (like thrust, voltage, resistance, etc.) and adjusts this input based on how well the system performs over time. These are the values that the PID controller needs to determine. This is typically expressed in terms of u1 and u2, where u1 dictates total thrust and u2 the total moment. The dynamics above allow for a fairly simple control system where only the overall thrust for the quadcopter’s linear acceleration and the difference in forces between the rotors for rotation need to be determined. Luckily with only 2D there is no third dimension for the drone to yaw around. NOTE: Quadcopters in 3 dimensions also need to control yaw, which is torque (or moment) arising from the motors spinning. This moment is proportional to the difference between the forces and the distance between the rotors. Lastly, in order to change the angular orientation of the quadcopter (or roll), the thrust between the rotors needs to vary in order to produce torque (or moment ). Maintaining thrust in this orientation increases horizontal velocity (y-axis). When the quadcopter is tilted at an angle (we will call this angle phi or □) relative to the ground the force from the propellers begins to apply both horizontal and vertical acceleration. Increasing the thrust of the rotors in this orientation causes the quadcopter to accelerate up and decreasing thrust causes it to accelerate down. When the quadcopter is level with the ground, acceleration is only applied along the y axis. The force (or thrust) of the rotors is what the control system has to manage.Īcceleration of the simulated quadcopter can be controlled by changing the thrust of the rotors. A constant force of gravity directly downwards regardless of the frame’s orientation.Īs long as the quadcopter is defined as a rigid body with mass, Unity takes care of the gravitational force.A variable upward force for each propeller perpendicular to the frame and upwards.The drone has 3 total forces acting on it at any given time: In standard notation, the horizontal axis would be referred to as y and the vertical axis as z (or x => y and y => z ). This is done to keep consistency with the x-y 2D axis in Unity. IMPORTANT: In this article, the vertical axis is referred to as y and the horizontal axis as x. Basics of a Quadcopter in 2Dīy starting with simulation in 2 dimensions instead of 3, the complexity is significantly reduced. PID controllers are the go-to control loops for self-regulating systems. The goal is to use a controller that translates to the real world. Why the PID Controller ? Experienced Unity developers might wonder why use PID control over classic pathing techniques. Once control in 2 dimensions is mastered, 3 dimensions can be tackled. Why Only 2 Dimensions? The problem of rotorcraft control is complex and removing a dimension allows for significant simplification. Why Unity? Unity comes with a sophisticated physics engine and makes rapid development and experimentation quick and easy. Before getting startedĪ few decisions were made for this simulation. If you don’t care about the walkthrough of how and why you can grab the code and skip right to The Simulation section. Basics on rotorcraft 2-dimensional dynamics.Īll the covered code as well as the working project can be found in this GitHub repository.A basic understanding of how PID controllers can be used in Unity (and elsewhere) as control systems.A Unity environment simulating 2-dimensional quadcopter flight ready for experimentation.Expected Outcomesįollow the walkthrough in this tutorial should hopefully provide the following: This was a recent implementation and the details are documented here in hopes that others find some of this helpful. This post covers the implementation of a 2-dimensional quadcopter using the Unity game engine and PID controllers for flight control.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |