36
Autonomously Indoor Mapping Quadcopter Cluster Innovation Centre University of Delhi Arvind Singh Shreyas Sachan Dissertation submitted in partial fulfilment for the degree of B.Tech. (Information Technology and Mathematical Innovations) for III.7 Summer Internship: projects drawn from the world around us

A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

Autonomously Indoor Mapping Quadcopter

Cluster Innovation Centre University of Delhi

Arvind Singh

Shreyas Sachan

Dissertation submitted in partial fulfilment for the degree of

B.Tech. (Information Technology and Mathematical Innovations)

for

III.7 Summer Internship: projects drawn from the world around us

Page 2: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

Certificate of Originality

The work embodied in this report entitled “Autonomously Indoor Mapping Quadcopter” has been carried out by us at Cluster Innovation Centre under mentorship of Dr. Shobha Baghai. We declare that the work and language included in this project report is free from any kind of plagiarism.

The work submitted is original and has not been submitted earlier to any institute or university for the award of any degree or diploma.

Arvind Singh - 11604 Shreyas Sachan - 11629

Cluster Innovation Centre University of Delhi

1

Page 3: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

ACKNOWLEDGEMENT WE would like to express my special thanks of gratitude to our mentor Dr. Shobha Bagai who gave us the golden opportunity to work on Autonomously Indoor Mapping Quadcopter , which also helped us in doing a lot of research into robotics and we came to know about so many new things, we are really thankful to him. We are also thankful to all the faculty members, who have always been a source of motivation. This project consumed huge amount of work, research and dedication. Still, implementation would not have been possible if we did not have a support of many individuals and internet. Therefore we would like to extend our sincere gratitude to all of them.

2

Page 4: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

Table of Contents Acknowledgement 3 Abstract 6 1. Introduction 7 2. Previous Work 8 3. Resources Used 12

3.1 Hardware 3.1.1 INERTIAL MEASUREMENT UNITs (IMU) ………...……………….…….... 12 3.1.2 BLDC (Brush Less Direct Current) Motors …………………………………… 12 3.1.3 LiPo BATTERIES .……………………………………………………………...

13 3.1.4 Electronic Speed Controller (ESC) …...…………………………………………. 14 3.1.5 ARDUINO ……………………………………………………………………….. 14

3.2 Software - 3.2.1 Robot Operating System (ROS) ………………………………………………... 16 3.2.2 Arduino Environment (Arduino - IDE) ………………………..……………..... 16

4. Working of A Quadcopter 17 5. Movement of A Quadcopter 18

5.1 Yaw - Pitch - Roll Control 5.1.1 Theory ………………………………………………………………………….. 18 5.1.2 Implementation ………………………………………………………………… 19

5.2 Upward - Downward Movement 5.2.1 Theory ………………………………………………………………………….. 21

5.3 PID Control 5.3.1 Theory ………………………………………………………………………….. 22 5.3.2 Proportional Control ………………………………………………………….... 24 5.3.3 Implementation ………………………………………………………………… 25

6. Review Of Literature 27 7. Methodology

4.1 Building the Quadcopter……………………... ……………………………………… 28 4.2 Simulation of Quadcopter and marker following in gazebo….……………………. . 29 4.3 Setting up the Raspberry Pi. ………………………………………………………….... 30 4.5 Calibrating the Pi Camera and detecting the marker using the Pi camera………… 30 4.6 Sending the data to Arduino to follow the marker ………………………………... 32

8. Further Work 33 9. Conclusions 34 10. References 35

3

Page 5: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

List of Figures & Tables Fig 1. A simple quadcopter ……………………………………………………………………………….. 7 Fig 2. Some examples of application of quadcopters in live video/ photo shooting ……………………… 8 Fig 3. Some examples of application of quadcopters in surveillances…………………………………….. 9 Fig 4. Application of quadcopters in agriculture ……………………………………………………….... 10 Fig 5. Applications of quadcopter in military……………………………………………………………. 11 Fig 3.1.1 IMU ……………………………………………………………………………………………. 12 Fig 3.1.2 BLDC Motor ………………………………………………………………………………….. 13 Fig 3.1.2 LiPo Batteries …………………………...…………………………………………………….. 13 Fig 3.1.4 ESC 30A……………………………………………………………………………………….. 14 Fig 3.1.5 arduino pin diagram …………………………………………………………………………… 15 Fig 6. A simple figure illustrating the various connections in a quadcopter …………………………….. 17 Fig 7. An illustration of Yaw, Pitch and Roll rotation …………………………………………………… 19 Fig 5.2.1 different movements of the quadcopter………………………………………………………... 21 Figure 9 PID control for a general system ………………………………………………………………. 23 Figure 10 showing the working of the PID algorithm ………………………………………………….. 25 Fig 7.1 Schematic for Drone ……………………………………………………………………………. 28 Fig 7.4.1 calibration photos ……………………………………………………………………………… 31 Fig 7.4.2 Whycon marker ……………………………………………………………………………… .. 32

4

Page 6: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

ABSTRACT Nowadays, UAVs (Unmanned Aerial Vehicles) are used in almost every field be it in

military operations, agricultural surveillance, infrastructure inspection, film production etc. Their

use have been increased dramatically as they are cheaper to purchase, smaller in size, and easy to

operate. This paper aims to design the system and algorithms necessary to allow a quadcopter to

follow a marker autonomously. We built our own quadcopter which is capable of carrying a

payload, such as a camera (used to determine the location of the marker). A system was devised

such that quadcopter can correctly determine the location of the target (marker) while hovering

and then follow the marker accordingly. Only commercially available components and open

source softwares were used in this project making it easily accessible to future researchers and

UAV enthusiasts.

5

Page 7: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

1. INTRODUCTION

Nowadays, various researchers and scientists are interested in exploring the vast world of UAVs(Unmanned Aerial Vehicle). The quadcopter is a UAV propelled by four rotors. Although it seems similar to a helicopter. But the propellers of a quadcopter have a fixed pitch making it mechanically more steady than an ordinary helicopter. However a quadcopter is intrinsically unstable, and hence its control is difficult. We chose the Quadcopter platform as the weight in it is well distributed i.e. balanced (among its 4 propellers).As we all know that quadcopter has 4 rotors attached at the end of the frame, and it is controlled by these motors via propellers. The 2 diagonally opposite rotors rotate in clockwise direction and the other 2 in the anticlockwise direction. Therefore the resultant torque acting on the quadcopter is zero. And, in order to keep the quadcopter aerial, these rotors are used to push the air downwards and thus, creating a thrust. The orientation is controlled by the FCU (Flight Control Unit). It is also termed as "Heart of the Quadcopter control system", as it controls different motors with relatively different outputs.

Fig 1. Our own made quadcopter

6

Page 8: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

2. PREVIOUS WORK Before moving further we should familiarize with what has already been done in the constantly evolving field of quadcopter. 1) Quadcopter providing live videos This project focuses on providing a live feed from quadcopter to any smartphone, computer,etc. via internet.The demand for Aerial photography has increased exponentially, we see quadcopters taking aerial shots in weddings, events, concerts, etc. A drone equipped with a hd camera can provide breathtaking aerial photos. With such rapid evolving field of robotics, quadcopters are now capable of registering all your adventures autonomously from the sky. Numerous researches have contributed towards providing a thrilling aerial photographic experience, the results of which are quadcopters like dji phantom 4, parrot behop, yuneec typhoon,etc. These quadcopters come with many astonishing features such as

● Follow me- feature follows a person wherever he/she goes this means that quadcopter will avoid all obstacles and maintain a fixed distance from the person.

● Taply feature allows the person to fly the quadcopter by just tapping on the point where he/.she wants the quadcopter to go.

The following images are a proof about how aerial photography is more advantageous and why it is beneficial to have a wider angle photographs.

Fig 2. Some examples of application of quadcopters in live video/ photo shooting

7

Page 9: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

2) Quadcopter built for surveillances This project aims to make quadcopter a surveillance tool. Quadcopters are agile and thus can cover large distances in short period of time. In this project quadcopters can follow a path with the help of GPS and provide live video feed. Quadcopters are aerial vehicles they can provide footages that have a wide angle in a single frame not possible from a ground camera thus we can see a large area in a single frame. Human effort is saved and it's less time consuming if we use quadcopters as a surveillance device. The project has many applications like-

● Quadcopters can used for crowd monitoring. ● Farmers can use them to see what going on their farm without actually going there. This

can be extremely useful in countries like usa were farm size is in the range of 100-500 hectares. A farmer sitting in his house can find out about is any unusual activity is going on his farm or not.

● Quadcopter can be used for monitoring criminal activities as they can move in and out of places quickly therefore they can assess a region for criminal activities.

● Quadcopters can be used as first responders to an emergency call. They can go before our helpers and provide some vital beforehand information so that they can deal with the crisis better.

Images shown below depict how various law enforcement authorities use drones as a surveillance tool.

Fig 3. Some examples of application of quadcopters in surveillances

8

Page 10: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

3)Precision Agriculture Precision Farming is about managing variations in the field accurately to grow more food using fewer resources and reducing production costs. Precision Farming can make a difference to food production facing the challenge of a rising world population and can help farmers to achieve-

● Greater sustainability, ● Higher productivity, ● Economic benefits ● Environmental protection

In this project quadcopters were used to help farmers to improve their crop yield by having a quadcopter monitor their crops. The quadcopter will fly between the crops and over the crop lines, getting 3d information about every plant and fruits growing on every plant. Quadcopter will capture infrared images, images captured by laser sensors and a NDVI map. The infrared image is used to determine the healthy foliage of the plant. The laser sensor helps in providing 3D information and give volume metric information about each plant.the ndvi map will tell us about the vigor of every plant. This information about the crops will help us to determine which crops need to be watered and will help the owner for resource allocation. This can be one of the commercial use of a quadcopter.

Fig 4. Application of quadcopters in agriculture. The first image on the bottom left is obtained using infrared imagery. The one in the middle is a ndvi map. The one on the right is obtained by using a laser sensor.

9

Page 11: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

4)Quadcopter as a military asset Many research has been done on making drone a military asset. Drone are a new face of modern warfare, a warfare in which armies do not want human casualties. Countries like usa have spent a lot on development of drones and they are capable of ordering a bomb strike anywhere in the world by just a flip of a button and with no human casualties thus Drones at present have proved they are a profitable and powerful military asset. There has been tremendous work going on making quadcopters more profitable. Quadcopters have many applications in warfare like -

● They are used for border patrolling. Quadcopter can provide live videos of the border and it will be useful to our country where tensions between the neighbours is high.

● They are used a mine defusal squad. Mines cause heavy and unforeseen loss of life. Also after the war some live mines remain undetected in the battlefield and cause loss of civilian lives. A team of quadcopters can survey a battlefield

● They are used as bombing squad. Quadcopters are used a bombing squad. They can be controlled from a long distance and provide same results without putting human lives in danger.

● They are used a getting a live feed of the battlefield. Quadcopters provide real time videos of the war this can help in making strategies. It will also help in getting victory with minimal loss of lives.

Fig 5. Applications of quadcopter in military

10

Page 12: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

3. RESOURCES USED

3.1 HARDWARES 3.1.1 INERTIAL MEASUREMENT UNITs (IMU): It is a motion sensor that measures the linear and angular motion of the quadcopter. The IMU actually contains 2 different sensors. The first one is an accelerometer triad. It produces 3 analog signals describing the acceleration along the 3 axes of the quadcopter. The second one is the angular rate sensor triad. It also outputs 3 analog signals. These signals describe the angular rate of the quadcopter about each of the sensor axes.

Fig 3.1.1 IMU

3.1.2 BRUSHLESS DC (BLDC) MOTORS: BLDC motors may be described as an electronically driven motor that doesn't have brushes. They are the most efficient motors as they produce a large amount of torque over a vast range of speed. In this, the permanent magnets rotate around a fixed armature. They are well known for smooth operation and holding torque when stationary.

11

Page 13: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

Fig 3.1.2 BLDC Motor

3.1.3 LiPo BATTERIES: These are a type of rechargeable battery that has taken the electric RC world by storm, especially for planes and multicopters/drones. The three main reasons that make them the perfect battery choice for our quadcopter are : i) They are lightweight and can be made in almost any shape and size. ii) They have large capacities, i.e. they hold lots of energy. iii) They have high discharge rates hence provides power to even most demanding electric motors.

Fig 3.1.3- lipo batteries

12

Page 14: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

3.1.4 Electronic Speed Controller (ESC): As the name suggests ESC are electronic devices that control how fast the quadcopter motors spin. It has three sets of wire. One lead will plug into the LiPo battery. The second lead plugs into the throttle channel of the receiver. The third lead will power the motor.

Fig 3.1.4 ESC 30A

3.1.5 ARDUINO: Arduino Uno, Arduino Mega[1] were the 2 major prototyping boards which we used, both consists of ATMEGA series microcontroller which are of AVR based architecture. Arduino provides IDE to program their boards, programming language is based on C/C++.The board consists of digital, PWM, analog pins along with serial communication ports. The pins can be configured in half-duplex mode, i.e. both as INPUT and OUTPUT. ● Memory

➢ Flash Memory: 32 KB (ATmega328) of which 0.5 KB used by bootloader ➢ SRAM: 2 KB (ATmega328) ➢ EEPROM: 1 KB (ATmega328)

● Clock: 16 MHz crystal frequency

Arduino is capable of communicating with multiple devices with just 2 wires, called Serial Clock (or SCL – Pin 5) and Serial Data (or SDA – Pin 4). The SCL line is the clock signal which synchronize the data transfer between the devices on the I2C bus and it’s generated by the master device. The other line is the SDA line which carries the data. The data is sent in form of a packet

13

Page 15: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

consisting of Start, Slave Address, Acknowledgement, Internal Register Address, Data and Stop bits.

The other method of data transmission used was serial data transmission, via the Tx (transmit) and Rx (Receive) pins, paving way for putting GPRS, wifi, zigbee and bluetooth communications in the system. The data is sent and received in form of message byte, as the whole data is sent at once across the components.

Fig 3.1.5 Arduino pin diagram

14

Page 16: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

3.2 SOFTWARES 3.2.1 ROBOT OPERATING SYSTEM (ROS)

The Robot Operating System (ROS) is a flexible framework, which is completely open source, for writing robot software. It provides us with services that you would expect an operating system, including hardware abstraction, low-level device control, implementation of commonly used functionality, message-passing between processes, and package management. It is a collection of tools, libraries, and conventions that aim to simplify and accomplish the task of creating complex and robust robot behaviour across a wide variety of robotic platforms.

ROS was built to encourage collaborative robotics software development. So, it is build not from one organization or one person but by a very big community of robotics which have expertise in different fields of robotics. It has seen many development through these and is a well developed robotic system. Therefore, we preferred to use ROS over any other systems. We are using ROS-Indigo instead of the latest version as it has many tools and libraries which are not yet implemented in the newer version.

3.2.2 ARDUINO ENVIRONMENT (ARDUINO-IDE)

Arduino Integrated Development Environment (IDE) is an open source software which has a text editor for writing and debugging programs. It helps in connecting the Arduino and Genuino hardware and uploading programs to Arduino. It establishes a connection with the Arduino which helps in communicating (that is reading input and giving output to the hardware components that are connected to the Arduino).

15

Page 17: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

4. WORKING OF A QUADCOPTER All the BLDC (BrushLess Direct Current) motors are connected in parallel to each other. The power from LiPo (Lithium Ion Polymer) battery is distributed to the power distribution board. Power was then distributed equally to the ESC(Electronic Speed Controller) and from there it is transferred to each BrushLess DC motor.

Fig 6. A simple figure illustrating the various connections in a quadcopter

16

Page 18: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

5. MOVEMENT OF A QUADCOPTER 5.1 YAW - PITCH - ROLL CONTROL 5.1.1 THEORY The motion of a quadcopter is totally different from that of a mobile robot. A mobile robot can move only in X or Y axis i.e. in the plane of the surface in which it is moving however, the quadcopter can move up, down, forward or backward. The three axes of rotation of a quadcopter are : 1) Yaw Axis: It is the rotation of quadcopter along the vertically parallel axis to the quadcopter plane. To move the quadcopter in front or back direction the resultant forces must be directed in the corresponding direction. The rotational force vector must act at the center of the quadcopter in order to make it hover stably.[3][4]

Fig 7. An illustration of Yaw, Pitch and Roll rotation

2) Pitch Axis: It is the rotation of quadcopter along the front to back direction. To move the quadcopter in front or back direction the resultant forces must be directed in the corresponding

17

Page 19: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

direction. The rotational force vector must act at the center of the quadcopter in order to make it hover stably.[1][2] 3) Roll Axis: It is the rotation of quadcopter along the left to right axis. To move the quadcopter to the left or right direction the resultant forces must be directed in the corresponding direction. The rotational force vector must act at the center of the quadcopter in order to make it hover stably. The movement of the quadcopter is greatly influenced by the resultant forces acting on it. If the net forces acting on the quadcopter are balanced then it will hover stably in space at anytime time period. If there will be any change in the forces along any axis then it will start moving in the direction where the net resultant of those forces will act. This is the whole mechanism behind the movement of the quadcopter. 5.1.2 IMPLEMENTATION

18

Page 20: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

The code is written so as to take receiver inputs and when this code is implemented then the pid loop is stopped. The different channels of the receiver control translation if the quadcopter in different axis Channel 1 - Roll Channel 2 - Pitch Channel 3 -Throttle Channel 4 - Yaw

19

Page 21: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

5.2 UPWARD - DOWNWARD MOVEMENT 5.2.1 THEORY i) UPWARD / DOWNWARD DIRECTION: The thrust produced by the propellers is responsible for this type of movement. This happens by having 2 propellers going clockwise and 2 going counter-clockwise and being configured opposite to each other. By varying the speed it can be made to hover in upward or downward direction. The thrust is directly proportional to the altitude i.e. greater the thrust higher the quadcopter will go and smaller the thrust the lower it goes.

Fig 5.2.1 different movements of the quadcopter

ii) ROTATION ALONG YAW AXIS: This happens by giving more speed to the 2 propellers rotating in clockwise direction. iii) FORWARD / BACKWARD DIRECTION: The difference in the thrusts along the pitch axis is responsible for this type of motion. By varying the thrust in front and back pair of propellers it can be made to hover in front or backward direction. In order to move the quadcopter forward,

20

Page 22: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

the backside propeller must be given higher thrust than the front one. And vice-versa for making it move backward. iv) SIDEWARD DIRECTION: The difference in the thrusts along the roll axis is responsible for this type of motion. By varying the thrust in left and right pair of propellers it can be made to hover in left or backward direction. In order to move the quadcopter leftward, the right side propeller must be given higher thrust than the left one. And vice-versa for making it move rightward. Apart from the internal forces acting on the quadcopter, there are some external factors that affect its motion, like the wind. In order to tackle these problems, we make use of PID controller. It is a function in flight controller that reads data from sensors and tells the motor how fast they need to move.

5.3 PID CONTROL 5.3.1 THEORY Control system plays an important role in the development and advancement of modern civilization and technology. Practically every aspect of our day-to-day activities is affected by some type of control systems. Automatic control system is found in abundance in all sectors of industry, such as quality control of manufactured products, automatic assembly line, machine-tool control, space technology and weapon system, computer control, transportation systems, power systems, robotics and many others. It is essential in such industrial operations as controlling pressure, temperature, humidity, flow in the process industries and can be used to stabilize motion of mobile robots in field of robotics such that robot can move on defined path accurately. A proportional–integral–derivative controller (PID controller) is a generic control loop feedback mechanism (controller) widely used in industrial control systems – a PID is the most commonly used feedback controller. A PID controller calculates an "error" value as the difference between a measured process variable and a desired set point. The controller attempts to minimize the error by adjusting the process control inputs.

21

Page 23: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

Figure 9 PID control for a general system

The PID controller calculation (algorithm) involves three separate constant parameters, and is accordingly sometimes called three-term control: the proportional, the integral and derivative values, denoted P, I, and D. Heuristically, these values can be interpreted in terms of time: P depends on the present error, I on the accumulation of past errors, and D is a prediction of future errors, based on current rate of change. The weighted sum of these three actions is used to adjust the process via a control element such as the position of a control valve or the power supply of a heating element.

In the absence of knowledge of the underlying process, a PID controller is the best controller. By tuning the three parameters in the PID controller algorithm, the controller can provide control action designed for specific process requirements. The response of the controller can be described in terms of the responsiveness of the controller to an error, the degree to which the controller overshoots the setpoint and the degree of system oscillation.

As for our tracked robot, it has inertial measurement unit (IMU) package, and therefore can measure the rotation of the robot from inertial (base) position.

The closed loop PID control algorithm uses feedback from IMU to adjust the raw power to provide consistent speed to motors so that robot can move straight from its inertial position. Closed loop control continuously adjusts the motor raw power to maintain a motor speed relative to the maximum regulated speed.

Presently we are using only P controller to move robot straight to its inertial position.

22

Page 24: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

5.3.2 PROPORTIONAL CONTROL A proportional control system is a linear feedback control system. In the proportional control algorithm, the controller output is proportional to the error signal, which is the difference between the set point and the process variable. In other words, the output of a proportional controller is the multiplication product of the error signal and the proportional gain. This can be mathematically expressed as

Pout = Kp e(t) Where Pout: Output of the proportional controller Kp: Proportional gain e(t): Instantaneous process error at time 't'.

e(t) = BASE − PV BASE: inertial position (base) PV: Process variable (change in inertial position in degrees) With increase in Kp : Response speed of the system increases. Overshoot of the closed-loop system increases. Steady-state error decreases. But with high Kp value, closed-loop system becomes unstable.

Figure 10 showing the working of the PID algorithm

PID stands for Proportional-Integral-Derivative. It is a closed loop control system that tries to minimise the error function. P depends on the present error; I on the accumulation of past errors; while D is a prediction of future errors based on the current rate of change. The whole PID (for quadcopter) in short.

23

Page 25: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

i) P Gain: This coefficient determines the strength of correction. The higher the coefficient, the more sensitive and stronger the quadcopter reacts to angular change. If it is too low, the quadcopter will appear to be more stagnant and soft, harder to stay steady. When the P gain is too high it makes the quadcopter to oscillate. ii) I Gain This coefficient influences the precision of angular position. Higher I gain is especially beneficial in a windy environment. However, with lower, I gain the quadcopter will simply drift away with the wind because it won’t hold the angle.However, in a perfect environment, I gain is not required.When I gain gets too high the quadcopter becomes stiff i.e. it's reaction time decreases. iii) D Gain : D gain works as a dampener and reduces the over-correcting and overshoots caused by P term. It makes the quadcopter fly smoother. However higher D value can introduce vibration in the quad. In the attempt to make the quadcopter fly smoother it will tell the motors to spin faster or slower at the rate that the motor cannot keep up, and eventually cause motor overheat. 5.3.3 IMPLEMENTATION

24

Page 26: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

The code above is implementation of pid. The yaw and pitch pids have more or less same implementation. The roll pid is bit different. The first error is calculate between the gyro and receiver. This error is used to calculate the roll pid output. The output can be calculated because we know the pid input value for roll. The max setpoint is set for all yaw, pitch and roll pid because we don't want the quadcopter to go haywire. The roll output is divided by 3 it can be changed to change the roll rotation speed. The yaw and pitch are calculated similarly but without rotation speed adjustment. The d gain is calculated by finding the error and then multiplying it by d input.

25

Page 27: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

6. REVIEW OF LITERATURE Prof.A.V.Javir, Ketan Pawar, Santosh Dhudum, et al. [4], this paper focuses on the aerodynamic effects of the quadcopter and discusses all the important components of it. It also addresses all the concepts of quadcopter ranging from mechanical design to the dynamic stability. The best part was it's clear results with respect to the weight of component to their respective costs. Yiwen Luo, Meng Joo Er, et al. [3], conferred the development of a stabilized flight controller technique using low budget components such as Raspberry Pi microprocessor to handle the processing, and some optimization algorithms such as PID controller to optimize the overall performance, also Depth cameras and other sensors were also used to facilitate semi-autonomous control. It Nun Thiang, et al. [8], presents a simple and efficient vision algorithms for autonomous object tracking of a quadcopter using some onboard camera. The vision tracker also estimates the position error between the Drone and the object using Opencv tools. The data received from the vision algorithms are used to control roll and pitch angle while the data received from front camera is used to control the yaw angle and the altitude of the quadcopter. Gordon Ononiwu, Arinze Okoye, et al. [5], describes the design and implementation of an aerial surveillance quadcopter for search and rescue applications. It aims to develop real-time, compact and cost-effective quadcopter. The first phase of the paper considered modelling of the quadcopter while the second phase involved system implementation and simulation. It results in surveillance and reconnaissance quadcopter capable of taking photographs from environment captured through the aid of an on-board camera.

26

Page 28: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

7. METHODOLOGY

7.1 BUILDING THE QUADCOPTER The quadcopter used is a custom built quadcopter and has been built by the team from the scratch. The chassis of the quadcopter is has 2 pcbs and 4 legs. on the end of each leg is a 1400kv brushless DC motor which are connected to the chassis by 4 screws. The speed of each motor is controlled by a 30A ESC which takes digital inputs from the arduino board. The ESCs are connected to a 2200mah, 25c lipo battery which is the only source of power on the quadcopter. The pcb is used to connect all 4 ESCs to lipo battery. the quadcopter has many on board devices necessary for it flight. they are all connected to each other by a pcb designed by the team. This pcb connects the arduino uno board, a mpu6050 imu and a 6 channel 2.5ghz receiver to each other. The schematic for all the connection can be seen in the diag shown below. the power to imu and receiver is given by the arduino which in turn is connected to the lipo battery. after this we test all the motors and the sensors on the board if nothing is wrong then we place the propellers on the motors. the propellers are to be selected based on motors and ESC used in the quadcopter. for our quadcopter we used a 1045 propellor. a pair of clockwise as well as anticlockwise oriented propellers is required. same orientation propellers are placed on opposite side of the quadcopter. this orientation should be matched by the rotating direction of the motors. this is important as it balances the torques that make the quadcopter to yaw.

Fig 7.1 Schematic for Drone

27

Page 29: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

7.2 SIMULATION OF QUADCOPTER AND MARKER FOLLOWING IN GAZEBO Simulation to follow a marker is a intermediary task for achieving our goal of indoor mapping using a quadcopter. In this scenario, marker acts as a fixed point in plane and our quadcopter calculates its position with respect to the marker. Afterwards we will work on making our quadcopter to locate itself with respect to its surroundings. For marker following we followed the following procedure.

1. Loading a simulation world containing our quadcopter and a few markers. 2. Setting up tum simulator for our quadcopter. Tum simulator is required to simulate a

flying drone in ros environment. It has 4 main functions:

1) cvg_sim_gazebo: contains object models, sensor models, quadrocopter models, flying environment information and individual launch files for each objects and pure environment without any other objects.

2) cvg_sim_gazebo_plugins: contains gazebo plugins for the quadrocopter model.

quadrotor_simple_controller is used to control the robot motion and deliver navigation information, such as: /ardrone/navdata. Others are plugins for sensors in the quadrocopter, such as: IMU sensor, sonar sensor, GPS sensor.

3) message_to_tf: is a package used to create a ros node, which transfers the ros topic

/ground_truth/state to a /tf topic. 4) cvg_sim_msgs: contains message forms for the simulator.

The tum simulator creates a environment where we load our quadcopter model and markers. Programming was done in python. To achieve the desirable task. 3. Controlling the quadcopter via keyboard- for this we need to create a node that publishes data between keyboard and ros. Control from keyboard is required because we will manually fly the drone to a marker so that it can detect the pose of the marker. 4. Marker pose detection - this task is the most important task. We downloaded ardrone packages for this. These packages were used for getting raw camera view and detecting the pose for the marker.

28

Page 30: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

7.3 SETTING UP THE RASPBERRY PI

The Raspberry Pi is a microprocessor. It is the main processing unit which will process the video being streamed from the Pi Camera and detect the marker and calculate the distance from it. We need to boot up an operating system in it. We used Ubuntu mate as the operating system to be used in the Raspberry Pi. Then we need to install ROS-Indigo on it. Now we need to install the usb_cam package which we will use to the run the Pi Camera.

7.4 CALIBRATING THE PI CAMERA AND DETECTING THE MARKER USING THE PI CAMERA

We followed a procedure for calibrating the camera. Calibration is required to remove the distortion in the images. For calibrating the camera, we need a square checker board whose each square size should be known to us. After that we need to run the camera calibration node of ROS, which will open the camera output screen. At this point, we have to move the checker board in front of the camera in different angles as shown below -

29

Page 31: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

Fig 7.4.1 calibration photos

After some time when sufficient data for camera calibration is acquired, the calibrate button on the camera output screen gets highlighted, calibrate the camera and click save and commit. This will create a camera calibration file containing a set of parameters which corrects the distortion produced by the image i.e, rectifies the image. Now we will run the usb_cam package of ROS which will use the file containing the correction parameters produced by the calibration process to rectify the images received from the camera. Now, as the camera calibration is done. We need to detect the marker so that the drone is able to follow it. For this project we are using the marker as shown below -

30

Page 32: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

Fig 7.4.2 Whycon marker

For detection, we are using the Irse/whycon package of ROS, which was developed by the University of Buenos Aires, Czech Technical University and University of Lincoln, UK. It is a vision-based localization system which helps to detect the marker shown above using the Pi camera. This package helps in detecting the above marker and publishes the position of the marker with respect to the Quadcopter on the ros topic - transformer/poses.

7.5 SENDING DATA TO ARDUINO TO FOLLOW THE MARKER

After we have detected the marker and its position with respect to the drone using the Pi camera, we need to send this data from the Raspberry Pi to the Arduino which will control the Quadcopter using this data. For sending the data, we need to create a ROS node which will subscribe for the data published by ROS on the ROS topic - transformer/poses and then establish communication between Raspberry and Arduino to send the data. As the Arduino receIves the respective position of the marker with respect to the Quadcopter, it will now move the Quadcopter towards the marker so that it follows the marker and maintains a certain distance with the marker.

31

Page 33: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

8. FURTHER WORK Recent developments in the field of robotics have opened a new dimension for applications of quadcopters. The goal of the project completed can find uses in different fields and in near future we will to explore a few ourselves. These goals are as follows -

1. Architecture- 3d mapping of under construction buildings can provide day to day developments in construction and can also be used to rectify problems.

2. Fire and rescue operations - quadcopters can go and map the area so as to provide best entry locations and shortest paths.

3. 3d mapping in the outdoor environment- this

32

Page 34: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

9. CONCLUSION Technology advances with time things that were impossible in the past have now become the truth of the present. We have taken a big steps towards the goal of the project. The tasks completed involve making a stable indigenous quadcopter from scratch simulation of marker following quadcopter in ros which required us to understand a very vast software i.e. ROS. marker following is an intermediary step toward indoor mapping. This project introduced us to the importance of simulation as well as the uncertainties in the mechanics of a quadcopter and has shaped our mindsets in believing that there is a lot possibilities in the field of quadcopters and we will like to explore them. If time and resources were available we would have completed the task.

33

Page 35: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

10. REFERENCES [1] Castillo, P., Dzul, A., Lozano, R., Stabilization of a Mini Rotorcraft with Four Rotors, IEEE Control Systems Magazine December 2005. [2] Castillo P., Lara D., Lozano R., Sanchez A., Real-Time Embedded Control System for VTOL, Aircraft: Application to stabilize a quad-rotor helicopter, Proceedings of the 2006 IEEE Conference on Control Applications Munich, Germany, October 4-6, 2006 [3] Yiwen Luo, Meng Joo Er, et al., “Intelligent Control and Navigation of an Indoor Quad-copter”, IEEE, 2014, 1700- 1705. [4] Prof.A.V.Javir, Ketan Pawar, Santosh Dhudum, et al., “Design, Analysis and Fabrication of Quadcopter”, Journal of The International Association of Advanced Technology and Science, vol. 16, 2015 [5] Gordon Ononiwu, Arinze Okoye, et al., “Design and Implementation of a Real Time Wireless Quadcopter for Rescue Operations”, American Journal of Engineering Research, 5(9), 2016, 130-138. [8] It Nun Thiang, Dr.LuMaw, Hla Myo Tun, “Vision-Based Object Tracking Algorithm With AR. Drone”, INTERNATIONAL JOURNAL OF SCIENTIFIC & TECHNOLOGY RESEARCH, 5(6), 2016, 135-139 [9] M. Nitsche, T. Krajník et al.: WhyCon: An Efficient, Marker-based Localization System. IROS Workshop on Open Source Aerial Robotics, 2015.

34

Page 36: A u ton omou s l y I n d oor M ap p i n g Q u ad c op te rducic.ac.in/cdn/ducic/Projects/EL_0002.pdf · A CKNOWLED GEMENT WE would like to express my special thanks of gratitude to

35