Drones, also known as unmanned aerial vehicles (UAVs), have gained significant interest in recent years from both academia and industry. They are increasingly relied upon to perform various tasks and applications, ranging from simple to complex missions. Remotely piloted drone come in different designs and sizes, including rotary-wing drones and fixed-wing drones. They are used for purposes such as aerial photography, land surveying, package delivery, search and rescue operations, as well as other applications like assisting humans in carrying out hazardous tasks in different dynamic environments. The control of drones relies on remote sensing through onboard devices. With advancements in technology and reduced production costs, drones have become accessible to many individuals and companies. Specialized industries anticipate their increased use in the future across fields such as transportation, delivery services, agriculture, aerial photography, security, defense, and rescue operations, among others.
Principle of Drone MotionThe motion of a drone relies on a set of physical and mechanical principles.
To maneuver the drone, the rotation speed of each motor is altered individually, resulting in a change in the generated thrust force by each motor. For instance, when the rotation speed of a motor is increased in a clockwise direction, the thrust force generated by that motor increases, causing the drone to move in the opposite direction. By adjusting the rotation speed of specific motors, the drone can be rotated around an axis passing through the center of the drone.
The dynamic model of droneThe dynamic model of drone motion can be described by a set of mathematical equations that describe the drone's motion in three-dimensional space. This model incorporates various fundamental factors that affect the drone's motion, such as thrust forces, resistive forces, torques, and angles.
The dynamic model of the drone can be divided into two sections: the first section describes the drone's motion in three-dimensional space, and the second section describes the rotational motion around the drone's axis.
The first section of the dynamic model consists of a set of equations that describe the drone's motion in three-dimensional space, where the thrust forces generated by the motors are converted into motion in space. The drone's motion can be represented by a set of complex mathematical equations that describe the motion in the three primary directions: forward and backward, lateral, and vertical.
The second section of the dynamic model describes the rotational motion around the drone's axis and consists of a set of equations that describe the angles and torques. The rotation around the drone's axis can be controlled by altering the rotation speed of each motor and changing the pitch angle of the generated thrust forces.
In general, the dynamic model of the drone relies on various different variables, such as velocity, altitude, and angles, which are determined using a variety of sensors onboard the drone, such as pressure sensors, accelerometers, and gyroscopes. These variables are utilized to precisely and effectively control and manipulate the drone's motion.
The drone frame is designed to be sturdy and robust, capable of withstanding various weather conditions and lateral impacts. It is also designed in a way that allows for easy assembly and disassembly of components, making it convenient for maintenance and any necessary updates or modifications.
2. Propellers:Propellers are lightweight, durable, and highly efficient. They play a crucial role in the drone's design and determine its performance in the air. Drone users need to choose the appropriate propellers based on the size and intended use of the drone to achieve optimal performance, safe and stable flight.
3.BLDC MOTORBrushless motors are a type of electric motors used in industries such as drones that require high thrust. These motors are characterized by the following features:
- High dynamics
- Excellent speed-torque characteristics
- Lower noise levels
- Ability to operate at high-speed ranges
- High torque-to-volume ratio, making them suitable for applications that prioritize size and weight considerations.
The function of an Electronic Speed Controller (ESC) is to convert the speed control signal generated by the main control unit into a power control signal, which regulates the amount of power supplied to the motor. It sends the necessary signal to the motor to determine its speed and controls the intensity of the electrical current supplied to the motor. This enables efficient and safe operation of the motors and ensures excellent performance for the drone.
5.STM32G0B1CEU6NIt utilizes the ARM Cortex-M0+ core, operating at speeds of up to 64 megahertz.
It features a wide range of communication interfaces, including UART, SPI, I2C, USB, and more.
It incorporates a built-in DC-DC converter for efficient power generation.
It includes ADC and DAC units for high-precision analog-to-digital and digital-to-analog conversions.
It boasts low power consumption to optimize battery life and reduce costs.
6.FTDI USB to UART Serial cableThe 4.pin USB 2.0 TO UART serial cable is an indispensable tool for Hexabitz development! it incorporates FTDI’s USB to UART interface
7.STLINK-V3MODS Programmer (H40Rx)H40Rx is a programmer module which contains STLINK-V3MODS stand-alone debugging and programming mini probe for STM32 microcontrollers (Hexabitz modules and other MCUs)
Sensors3-axis IMU and 3-axis Compass Module(H0BR41)This module operates by utilizing a set of electronic sensors to measure triaxial motion and orientation.
LSM303AGR:
- Accelerometer: Measures acceleration.
The accelerometer sensor is a device that measures linear acceleration changes in a specific body in space. Simply put, it detects acceleration or changes in linear velocity in the three directions (horizontal, vertical, and lateral axes).
LSM6DS3:
- Gyroscope: Measures angular velocity.
The gyroscope sensor is a device used to measure the speed and direction of rotation or angular velocity of an object. It consists of a rotating axis and motion-sensitive elements that detect changes in angular orientation when moving or rotating.
Gyroscope and accelerometer sensors are often used together in many applications to achieve a more comprehensive understanding of motion, orientation, and acceleration for objects and systems.
Why do we need a filter when obtaining values from accelerometers and gyroscopes?We need to use a filter when reading values from accelerometers and gyroscopes for several reasons:
1. Noise: Accelerometers and gyroscopes are prone to noise and disturbances in the data they provide. Vibrations, electronic interference, and environmental effects can introduce distortions to the measured values. A filter is used to clean the data and remove the noise, resulting in more accurate and stable values.
2. Temporal Smoothing: The use of a filter can improve the representation of motion or temporal changes in the measured values. Filtering techniques such as moving average filtering or other temporal filtering methods can smooth out the values and make them more consistent and analyzable.
3. Accuracy and Relevance Enhancement: Filters can be used to improve the accuracy of the measured values and make them more meaningful. Sensor readings may contain slight errors or unwanted fluctuations, and filtering can help correct these errors and improve the accuracy of the measured data.
4. Outlier Rejection: Sometimes, sensor readings may include outlier values or invalid data due to sensor distortion or malfunction. Filtering can exclude these outlier values and consider them as invalid, thus improving the accuracy and reliability of the measured values.
In general, the use of filtering in extracting values from accelerometers and gyroscopes helps improve the accuracy of the measured data and provide more reliable and stable readings for control systems, robotics applications, smart vehicles, and other applications relying on these sensors.
Types of filtering techniques that have been used.- Complementary Filter
- Kalman Filter
- New Way
Note: The filters were tested by setting the drone at a zero angle, running the motors, and taking samples under the influence of motor noise
Complementary FilterThe Complementary Filter is used with the following equation:
θ = α * GyroAngle + (1 - α) * AccAngle
Where α represents the confidence ratio in the sensor. If α is equal to 1, we give full confidence to the gyroscope, and if α is equal to 0, we give full confidence to the accelerometer.
One of the existing methods in control engineering is used to estimate the system state and its variables based on available and limited data.
The Kalman filter is one of the most commonly used methods in various engineering and scientific fields to improve control accuracy and enhance system performance. This filter is used in various applications such as navigation systems, aviation, robotics, and industrial control.
The Kalman filter relies on the statistical modeling of the system and is considered a type of linear filtering that determines the system's state based on the available and limited measurements of the system. The Kalman filter utilizes the available information about the current system state and updates its estimate of the system state based on the new available measurements.
The Kalman filter is primarily applied in three main steps:
1: Statistical model determination of the system, and defining the mathematical equations that describe the current system state and the impact of inputs on the system state.
2: Initial estimation of the system state, which relies on the available information at the first instance, such as the previous system state and the current available values of the system state.
3: Updating the estimation of the system state using the new available measurements by applying the statistical rules specific to the Kalman filter.
The Kalman filter can be applied in various different applications. However, without a detailed description of the mathematics involved, understanding the workings of the filter can be challenging. Nevertheless, grasping the basics related to statistical modeling and the statistical rules employed in the Kalman filter can help in understanding how this technique operates.
Building a Kalman model for the studied system:
We have the following general form of the time-discrete state-space equations for the linear dive model of the inertial measurement unit:
θ_k = θ_(k-1) + (θ_k ̇ - θ_bias ̇) * ∆t_k + w_k (Equation 1)
z_k = (θ_yawk ) ̇ + v_k (Equation 2)
Corresponding to the general form of the Kalman equation:
x_k = Ax_(k-1) + BU_k + w_k (Equation 3)
z_k = Hx_k + v_k (Equation 4)
Where:
x_k = [θ, θ_bias ̇]_k represents the state vector of the studied system at time k.
A = [1, -∆t; 0, 1] is the transition matrix.
B = [∆t; 0] is the control matrix.
H = [1, 0] is the measurement matrix.
u_k represents the input signal to the system at time k.
z_k represents the measured values from the sensor at time k.
w_k represents the process noise, and its covariance matrix is given by
Q_N = [Q_θ, 0; 0, Q_θb] * ∆t (Equation 5)
The third method for obtaining the angle relies on combining the advantages of the accelerometer and gyro sensors. Initially, the method takes an average of several readings from the accelerometer to determine the initial angle of the drone.
Once the motors are running, their noise affects the accelerometer readings, leading to distorted measurements. At this point, the angle is read from the gyro sensor. However, gyro sensors suffer from continuous drift in their readings, which causes the measurements to deviate from the actual values over time.
To address this, an average of the accelerometer readings is taken, allowing for the correction of gyro readings. This process is repeated iteratively, ensuring that the angle measurements are more accurate.
This method has shown success in signal filtering and has been relied upon to obtain the drone's tilt angle.
This figure shows comparing the three filters responses and notes that the New Way is the best:
- PID Controller
- Sliding Mode Controller
The PID control relies on comparing the desired reference value with the current actual value and generating a control signal to achieve the desired value. In our system, the reference value is the desired tilt angle in the case of tilt control, and the desired altitude in the case of altitude control. The actual value in the case of tilt control is the filtered angle, and in the case of altitude control, it is the actual altitude.
To better understand this, let's take a practical example of balancing a drone's wing. Wing balance is a crucial factor in controlling the drone and maintaining its stability during flight. In this example, we will use a PID control system to monitor the wing's balance.
A sensor will be installed on the wing to measure the wing's angle relative to the aircraft axis. The digital scale of the wing will be adjusted to the desired horizontal position.
When the drone moves, the wing's angle will change, and this change will be measured using the sensor. This reading will be sent to the central processing unit (CPU), which will compare it with the desired angle and use the PID control to generate a control signal that adjusts the wing's angle to return to the desired angle.
The proportional component (P) :
will directly and proportionally respond to the current error between the desired angle and the actual angle of the wing. It will adjust the wing's angle by an amount equal to the pre-determined proportional gain (Kp). For example, if the desired wing angle is 0 degrees and the actual angle is 2 degrees, the PID control will adjust the wing's angle by (Kp * 2) to return to the desired angle.
The integral component (I):
will be used to compensate for steady-state errors in the system. For example, if there is a sensor or digital scale malfunction, the integral component can compensate for these steady-state errors. The value of this component will be calculated based on the accumulated error over a certain period of time. A constant value (Ki) will be added to continuously adjust the wing's angle and correct the steady-state errors in the system.
The derivative component (D):
is used to improve the responsiveness of the PID control to rapid changes in the system and to reduce excessive oscillations. It determines the rate of change of the error over a specified time period. The value of this component is multiplied by the derivative gain constant (Kd) to add the effect of improving the response in the control system.
For example, if we have values of Kp = 1.5, Ki = 0.2, and Kd = 0.1, we can use PID control to balance the wing of a drone. If the desired angle is 0 degrees and the actual angle is 2 degrees, the proportional component (P) will adjust the wing angle by an amount equal to (2 * 1.5) = 3 degrees. The integral component (I) will adjust the wing angle by an amount equal to (0.2 * accumulated error) in each update. The derivative component (D) will adjust the wing angle by an amount equal to (0.1 * rate of change of the error) in each update. The values of the three components will be combined to produce the control signal that will adjust the wing angle and improve the balance of the aircraft.
In this way, PID control can be used to monitor and improve the balance of the drone's wing, achieving the necessary stability during flight.
At first, we used a single-loop PID control system as illustrated in the following diagram.
It was unsatisfactory, so we resorted to using a two-loop PID control system. The inner loop, which takes the reference value from the PD control law, compares it with the angular velocity and produces the control signal for the BLDC. The outer loop, which takes the reference value representing the desired angle, compares it with the measured angle and produces the control signal for the PI system.
As shown in the following diagram:
Sliding Mode Control (SMC) is employed in various applications, including the control of drones to achieve dynamic balance of the drone.
The balance of the drone's wings can be controlled through state transformations of the system, such as the angle of deviation, and by studying disturbances such as the airspeed flowing over the wing. The sliding surface is then defined to move and maintain the system's balance.
Control laws are designed to maneuver the drone on the sliding surface by adjusting the state transformations of the drone, allowing it to move on and remain on the sliding surface using sliding mode control laws.
To clarify, a reference signal can be used to determine the desired angle of deviation and the desired airspeed over the wing. The appropriate control law is then used to determine the desired values for maneuvering on the sliding surface by adjusting the state transformations of the drone.
When the drone moves on the sliding surface, the motion becomes stable and quickly reaches the desired goal, enabling the drone to maintain dynamic balance.
To implement the sliding mode control system, the following steps are followed:
1. First, write the error equation:
e = value(reference) - value(real)
2. Write the sliding variable equation:
s = c*e + e_dot
3. Find the equation for s_dot and connect it with the mathematical model equation that relates the measured variable to the input variable of the system.
4. Obtain the equation for s_dot and add the term ks + Q*sgn(s).
5. Isolate the input variable.
By following these steps, the desired control system is derived. In this context, the function sgn(s) equals 1 when s > 0, -1 when s < 0, and 0 when s = 0.
Finally, calibrate the constants K, Q, and c to achieve the desired response, while considering small values for the Q constant.
As shown in the following diagram:
This figure shows comparing the three control system responses and notes that the Sliding Mode control system is the best:
Note: The tilt angle of the drone did not maintain its zero value due to the application of an external force on it.
MATLAB/SimulinkThe system was built in the MATLAB/Simulink using the mathematical model of the Drone, as in the following figure:
Then we controlled the angle of rotation around the X axis, the angle of rotation around the Y axis,, and the height Z using the PID control system, as in the following figure:
We then control using the Sliding Mode system as in the following figure:
Comments
Please log in or sign up to comment.