Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
29 views42 pages

Report

Uploaded by

Sastika Ilango
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views42 pages

Report

Uploaded by

Sastika Ilango
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Design and Development of Autonomous

UAV Vehicle

INTERNSHIP REPORT – IV YEAR

Submitted
by

SASTIKA.I (2008019)

Dotworld Technologies Private Ltd., Coimbatore

In partial fulfillment for the award of the degree of


BACHELOR OF ENGINEERING

in
AERONAUTICAL ENGINEERING

SRI RAMAKRISHNA ENGINEERING COLLEGE


[Educational Service : SNR Sons Charitable Trust]
[Autonomous Institution, Re Accredited by NAAC with ‘A+’ Grade]
[Approved by AICTE and Permanently Affiliated to Anna University, Chennai]
[ISO 9001:2015 Certified and all eligible programmes Accredited byNBA
VATTAMALAIPALAYAM, N.G.G.O. COLONY POST, COIMBATORE – 641 022

FEBRUARY 2024

ANNA UNIVERSITY::CHENNAI 600 025


BONAFIDE CERTIFICATE

This is to certify that the Internship Training Report entitled “Design and
Development Of Autonomous UAV Vehicle ” is a record of SASTIKA.I
(2008019) who carried out the internship training work under my supervision.

SIGNATURE SIGNATURE
MR C.DINESH, ME., Dr.DAVID RATHNARAJ, M.E., Ph.D.,
ACADEMIC COORDINATOR, HEAD OF THE DEPARTMENT,
Associate Professor, Professor and Head,
Department of aeronautical, Department of aeronautical
Sri Ramakrishna Engineering College, Sri Ramakrishna Engineering College,
Vattamalaipalayam, Vattamalaipalayam,
N.G.G.O.Colony Post, N.G.G.O.Colony Post,
Coimbatore - 641 022. Coimbatore - 641 022.

------------------------- ---------------------------------
Faculty Incharge Signature of the Evaluator

Place: Coimbatore
Date:
ACKNOWLEDGEMENT

I put forth my heart and soul to thank the ALMIGHTY for being with me
throughout my achievements and success. I would like to express my
unfathomable thanks to our esteemed and Honorable Managing Trustee Sri
D.LAKSHMI NARAYANASAMY and Joint Managing Trustee Sri
R.SUNDAR for giving me the chance to be a part of this elite team at Sri
Ramakrishna Engineering College, Coimbatore.

I would like to express our sincere thanks to our honorable Principal,


Dr.N.R.ALAMELU, M.E.,Ph.D., for the facilities provided to complete
this training.

I take the privilege to thank the Professor and Head of the Department of
Aeronautical Engineering, Dr.DAVID RATHNARAJ, M.E., Ph.D., for his
consistent support and encouragement at every step of my Internship work.

I wish to convey my special thanks to our Academic Coordinator


MR.C.DINESH, ME., Associate Professor, Internship Coordinator,
Dr.R.Ranga Raj , M.E., Ph.D., Assistant Professor, Department of
Aeronautical Engineering for their consistent support, timely help and valuable
suggestions during the entire period of my Internship work.

I would like to express my sincere thanks to Mr.Aravind Ravichandran,Chief


Operating Officer, Dotworld technologies, Private Limited, Coimbatore, for
their valuable support for the completion of this Internship work.

I extend our sincere gratitude to all the teaching and non-teaching staff
members of our department who helped us during this internship.

iii
OVERVIEW OF THE COMPANY

Dotworld Technologies is a leading technology company specializing in a wide range of


services, including software development, web design and development, robotics, and
augmented and virtual reality (AR/VR). Founded in 2009 by two enthusiastic software
engineers, the company has grown to become a well-respected name in the Indian tech
industry.

Dotworld Technologies offers a variety of services to clients across different industries.


Some of their core offerings include:

● Software development: The company develops custom software applications for


businesses of all sizes. They have experience in developing web, mobile, and desktop
applications.

● Web design and development: Dotworld Technologies designs and develops user-
friendly and visually appealing websites that help businesses establish a strong online
presence.

● Robotics: The company is a leading developer of cutting-edge robotics technology.


They offer a variety of robotics solutions, including autonomous mobile robots,
industrial robots, and service robots.

● AR/VR: Dotworld Technologies is a pioneer in the development of AR/VR solutions.


They offer a variety of AR/VR experiences for businesses, including training
simulations, marketing campaigns, and product demonstrations.

iv
TABLE OF CONTENTS

CHAPTER PAGE
TITLE
NO. NO.
iii
ACKNOWLEDGEMENT

OVERVIEW OF THE COMPANY iv

LIST OF FIGURES viii

INTRODUCTION 1
1
1.1COMPANY PROFILE
2
1.2PRODUCTS MANUFACTURED
3

FUNCTIONING OF VARIOUS
2
DEPARTMENTS

2.1 TECHNICAL BACKGROUND 7


2.1.1 HARDWARE ENGINEERING
7
2.1.2 SOFTWARE ENGINEERING 7

2.1.3 SYSTEM ENGINEERING 8

2.1.4 AERODYNAMICS AND FLIGHT 11


DYNAMICS
2.1.5. REGULATIONS AND
COMPLIANCE

2.2 BASICS OF QUADCOPTER


8
TECHNOLOGYY

2.2.1 BASIC COMPONENTS OF


13
MULTIROTOR

2.2.2 HOW QUADCOPTER FLY 13

2.2.3 BASICS OF SLAM 14

v
1
3 HARDWARE AND ASSEMBLY OF BASIC DRONE
5

1
3.1 THE FRAME
5

1
3.2 THE FLIGHT CONTROLLER
6

1
3.3 TRANSMITTER AND RECEIVER 8

1
3.4 BATTERIES 9

2
3.5 ASSEMBLY
0

2
3.6 ADDITIONAL HARDWARE
4

3.6.1 COMPANION COMPUTER

3.6.2 ULTRASONIC RANGE SENSOR

3.6.3 LASER RANGE SCANNER

2
4 .SOFTWARE STACK
4

2
4.1 FLIGHT CONTROLLER FIRM
4

4.1.1 INSTALLING AND CONFIGURING APM 2


FIRMWARE 5

2
4.2. RASPBERRY PI OPERATING SYSTEM
7

vi
4.3 DRONE KIT-PYTHON 28

4.4 SOFTWARE TO RUN SLAM 29

5 AUTONOMOUS OPERATIONS 31

5.1 TAKING OFF TO TARGET ALTITUDE 32

5.2 HOLDING THE QUADCOPTER AT CURRENT ALTITUDE


32

5.3 MOVING THE QUADCOPTER


FORWARDS.BACKWARD,LEFT RIGHT, ORIENTATION

5.4 LANDING THE QUADCOPTER

33
6 CONCLUSION

7 WEB REFERENCES

vii
LIST OF FIGURES

Figure 2.1.DotWaiter

Figure 2.2 Hotel Robot

Figure 2.3. Assembly line robots

Figure 2.5. Logistics and delivery

Figure 2.6. Quadcopter Basic Components[15]

Figure 2.7. Quadcopter Motor Rotation[5]

Figure 2.8. Movements on Quadcopters Axes[5]

Figure 3.1. DJI Flamewheel F450 ARF Kit[1]

Figure 3.2. 3DR Pixhawk Mini Flight Controller[2]

Figure 3.3. RC Transmitter and Receiver

Figure 3.4. Typical Quadcopter Wiring Layout[5]

Figure 3.5. Wiring between RPI and Pixhawk[6]

Figure 3.6. HC-SR04 Ultrasonic Range Finder Sensor[8]

Figure 3.7. A Basic Voltage Divider Circuit[8]

Figure 3.8. Equation for Voltage Divider Circuit

Figure 3.9. Connections between Ultrasonic Sensor and Raspberry Pi[8]

Figure 3.10. RPLidar A2 Laser Range Scanner[20]

viii
CHAPTER 1
INTRODUCTION

The ever-expanding field of Unmanned Aerial Vehicles (UAVs) has witnessed


a surge in the development of autonomous capabilities. These intelligent
systems hold immense potential for diverse applications, ranging from
environmental monitoring and disaster relief to search and rescue operations
and precision agriculture. This internship project delves into the design and
development of an autonomous UAV vehicle, pushing the boundaries of its
capabilities and exploring its potential impact on [mention specific field or
application].

This report will document the entire journey, starting with the
conceptualization of the UAVs design and specification based on the chosen
application and mission requirements. It will detail the selection of hardware
components, including the airframe, propulsion system, sensors, and onboard
computer. The development process will be meticulously described, covering
the assembly, integration, and testing of each component and subsystem.

The core of this project lies in the implementation of the autonomous flight
control system. This report will delve into the chosen algorithms and software
frameworks used for navigation, path planning, obstacle avoidance, and
decision-making. The challenges encountered during the development and
implementation of these functionalities will be discussed, along with the
solutions devised to overcome them.

The report will further showcase the rigorous testing and evaluation conducted
to ensure the UAVs safe and reliable operation.Finally, the report will conclude
by summarizing the key achievements of the project, outlining the lessons
learned, and discussing the future potential of the developed autonomous UAV
vehicle.

1
1.1 COMPANY PROFILE

CIN U72501TZ2021PTC0377
81
Company Name
DOTWORLD
TECHNOLOGIES
PRIVATE LIMITED

Company Status ACTIVE


Roc Roc-Coimbatore
Registration Number
37781

Company Category Company limited by


Shares
Company Sub Category Non-government
company
Class of Company Private
Date of Incorporation 09 December 2021
Age of Company 2 years
Activity Maintenance and repair of
office, accounting and
computing machinery

2
1.2 PRODUCTS MANUFACTURED:

DoKat Robots

These robots are designed for a variety of applications, including education,

entertainment, and security. They can be used to teach children about robotics,

provide entertainment at events, or patrol buildings for security purposes.

F1 Motion Simulator

This simulator provides a realistic and immersive experience of driving a

Formula One car. It is perfect for racing enthusiasts or anyone who wants to

experience the thrill of driving a high-performance car.

Flight Motion Simulator

This simulator provides a realistic and immersive experience of flying an

airplane. It is perfect for aviation enthusiasts or anyone who wants to


experience the thrill of flying.

Hot Air Balloon

This hot air balloon provides a unique and unforgettable way to see the world.

It is perfect for special occasions or anyone who wants to experience the beauty

of flying

DotKeeper

This is a security robot that can be used to patrol buildings and deter crime. It is

equipped with a variety of sensors, including cameras and motion detectors,

that can help it to identify and track potential threats.

3
DotWaiter

This robot is designed to serve food and drinks in restaurants. It can follow a
pre-programmed or be controlled by a human operator.

Figure 1.1.DotWaiter

Hotel Robot

This robot is designed to help hotels with a variety of tasks, such as delivering
room service, greeting guests, and cleaning rooms. It can also be used to
provide information to guests and answer their questions.

Figure 1.2 Hotel Robot

4
DotTeleport

This is a telepresence robot that can be used to allow people to attend meetings

or events remotely. It is equipped with a camera and microphone that allow the

user to see and hear what is happening around them.

Assembly line robots

These tirelessly automate repetitive tasks like welding, painting, and material
handling, improving efficiency and consistency.

Figure 1.3. Assembly line robots

Warehouse robots

They navigate autonomously within warehouses, retrieving, sorting, and


transporting goods, accelerating logistics and order fulfillment.

Figure 1.4.Warehouse robots

5
Logistics and delivery

Delivery drones: These unmanned aerial vehicles (UAVs) deliver packages to


designated locations, bypassing traffic congestion and reaching remote areas,
revolutionizing last-mile delivery.

Figure 1.5. Logistics and delivery

6
CHAPTER 2
2. Technical Background

2 .1 Functioning of Various Departments in Autonomous Drone


Construction:

Developing an autonomous drone involves the collaboration of several key


departments, each contributing their expertise to create a complex system.
Here's a breakdown of their roles:

2.1.1 Hardware Engineering:

● Design and development: Responsible for designing and assembling the


physical components of the drone, including frame, motors, propellers, sensors,
and communication systems.
● Testing and calibration: Conducts rigorous testing to ensure the drone's
mechanical integrity, sensor functionality, and overall performance.
● Integration and maintenance: Integrates various hardware components into
a cohesive system and handles repairs and upgrades throughout the drone's
lifespan.

2.1.2. Software Engineering:

● Flight control system: Develops the software responsible for autonomous


flight, including navigation, path planning, obstacle avoidance, and decision-
making.
● Sensor data processing: Creates algorithms to analyze data from sensors
like GPS, LiDAR, and cameras, providing relevant information for autonomous
flight.
● Payload software: Writes software for specific tasks the drone performs,
such as mapping, inspection, or delivery.
● Security and communication: Implements security measures to protect the
drone from cyberattacks and establishes reliable communication channels with
ground control.

7
2. 1.3.Systems Engineering:

● Project management: Oversees the entire development process, ensuring


all departments work together seamlessly and meeting deadlines and budget
constraints.

● System integration: Ensures various hardware and software components


work in harmony, achieving the desired functionality of the autonomous drone.
● Testing and validation: Conducts comprehensive testing of the entire
system in simulated and real-world environments, identifying and addressing
any issues.

2.1.4. Aerodynamics and Flight Dynamics:

● Aerodynamic design: Optimizes the drone's shape and components to


achieve efficient flight characteristics, considering factors like lift, drag, and
stability.
● Flight dynamics analysis: Studies the drone's flight behavior in various
conditions, including wind, turbulence, and sensor data, to ensure controlled
and predictable flight.
● Testing and refinement: Validates the aerodynamic design through wind
tunnel testing and real-flight data, making adjustments for optimal performance.

2.1.5. Regulations and Compliance:

● Legal and regulatory expertise: Ensures the autonomous drone complies


with all relevant aviation regulations and safety standards.
● Obtaining permits and licenses: Secures necessary permissions for testing
and operation in specific airspace and adheres to data privacy regulations.
● Continuous monitoring and updates: Stays updated on evolving
regulations and adapts the drone's operation accordingly.

2.2 Basics of Quadcopter Technology

A quadcopter is essentially a helicopter which has motors that are equally


spaced, arranged on the corners of a square (X) body. Unlike helicopters,
multirotors are inherently very unstable without electronic assistance because it
is extremely herculean to control multiple rotors manually. The decrease in cost
of modern microprocessors led to these machines getting popular in recent
years [15].

8
2.2.1 Basic Components of a Multirotor

A visual representation of the basic components is shown in Figure 2.1.

The Body/Frame The frame or body is what holds everything together. They
are generally designed to be strong and lightweight and consist of a center plate
where the main flight controller chip and sensors are mounted and arms where
the motors are mounted.

Motors The motivation behind using motors is to turn the propellers, which are
responsible

Figure 2.1. Quadcopter Basic Components[15]

for providing thrust for countering gravity and drag. Each motor, depending on
the style of frame, should be controlled separately by an electronic speed
controller. The brushless motors, which are the style motors most quadcopters
use, are rated using kilovolts. The kV rating in a motor demonstrates how
various RPMs(Revolutions per Minute) the motor will do per volt. The higher
the kV rating is the quicker the motors rotate at a steady voltage.

Electronic Speed Controllers (ESCs)

Since each motor on the quadcopter must spin at various speeds, each motor
has its own ESC. The ESC is what tells the motor how to spin or more
specifically how fast or slow to spin. The ESCs are typically connected to the
batteries via a power distribution board within the multirotors frame, and
receive an input signal from the flight controller.

9
Flight Controller

The Flight controller is the mind or brains of the multirotor. This board is what
sits at the center, controlling the firmware within the ESCs which controls the
speed at which each motor spins. The Flight controller takes the inputs from a
receiver or an onboard 5 companion computer and adjusts the motor RPM
accordingly. Flight controller systems also house additional sensors to enhance
control and stability of the craft. Best Flight controllers contain a gyroscope, an
accelerometer, and a barometer. A GPS module is usually added externally to
provide coordinate and altitude information.

Transmitter and Receiver

The radio transmitter and receiver are used to control the quadcopter. At a
minimum for a quadcopter to work, four channels (Throttle, Yaw, Roll, Pitch)
are required. However most transmitters and receivers have more than the
required four channels allowing for additional functionality, such as switching
between flight modes or controlling an onboard camera gimbal.

Batteries

Lithium Polymer (LiPo) batteries seem to be the most preferred power source
for powering multirotors currently. However for larger quadcopters even the
LiPo batteries don't allow for extended flight times.

2.2.2 How Quadcopters Fly

In a quadcopter there are four motors placed at the edge of four arms of the
frame. The direction of each motor's rotation is such that it counteracts the
torque generated by the motor that is placed at the opposite side as shown in
Figure 2.2. This is how the quadcopter keeps from spinning due to torque e ect.
Since the motors are spinning the propellers in two different directions, there
are two different types of propellers. For the motors that spin clockwise there
are pusher propellers, which push the air down in order to generate thrust.
Likewise for the counterclockwise motors there are puller propellers, which
pull the air down in order to generate thrust.

10
Hover

In order for a quadcopter to hover in place, it requires that:

Figure 2.2. Quadcopter Motor Rotation[5]

Figure 2.3. Movements on Quadcopters Axes[5]

1. All the motors rotate at the same speed.

2. The rotation speed must be sufficient enough to generate lift which


counteracts the weight of the quadcopter.

3. The torque e ect acting on the body of the quadcopter by each motor should
cancel out.

Gaining and Losing Altitude

In order for the quadcopter to gain altitude, all four of the motors must increase
the speed of rotation simultaneously. Likewise to lose altitude all four of the
motors must decrease speed of rotation simultaneously.

11
Pitch

The pitch control tells the quadcopter to y forward or backward. In order to


pitch forward, the speed of the motors at the rear of the quadcopter must
increase relative to the speed of the motors on the front. This pitches the nose
of the quadcopter down making the quadcopter move forward. Likewise to
pitch backwards, the speed of the front motors must increase relative to the
speed of the back motors.

Roll

Theroll control tells the quadcopter to move side to side. In order to roll the
quadcopter to the right, the speed of the motors at the left must increase relative
to the motors on the right. This rolls the quadcopter to the right resulting in
side-ways movement to the right. Likewise to roll the quadcopter to the left, the
motors on the right of the quadcopter must increase relative to the motors on
the left. This rolls the quadcopter to the left, resulting in a side-ways movement
to the left.

Yaw

The yaw is the rotational movement of the quadcopter along the z-axis. This is
accomplished by increasing or decreasing two motors that spin in the same
direction. 8 This results in the quadcopter rotating in the direction of the
increased torque. An illustration of pitch, roll, and yaw can be seen in Figure
2.3.

2.3Basics of SLAM

The Simultaneous Localization and Mapping (SLAM) problem asks if it is


possible for a mobile robot to be placed at an unknown location in an unknown
environment and for the robot to incrementally build a consistent map of this
environment while simultaneously determining its location within this map. A
solution to the SLAM problem provides the means to make a robot truly
autonomous. The solution of the SLAM problem has been one of the notable
successes of the robotics community. SLAM has been formulated and solved as
a theoretical problem in a number of different forms. SLAM has also been
implemented in a number of different domains from indoor robots, to outdoor,
underwater, and airborne systems.

12
CHAPTER 3
METHODOLOGY
HARDWARE AND ASSEMBLY OF BASIC DRONE

Instead of buying and using a high end pre-built quadcopter, we opted to build
a quadcopter from the ground up. Although it would have been much simpler
and faster to buy a pre-built drone, by building our own we had more control
over which parts the drone was made up of as well as the functionality of the
finished drone itself. In this portion of the document I will explain which parts
the drone is composed of, and how everything is assembled.

3.1 The Frame

First of all we started with a frame kit from the popular drone company DJI.
The kit we settled on was the DJI Flamewheel F450 ARF Kit. As seen in
Figure 3.1. The DJI Flamewheel F450 ARFKit includes a quadcopter frame,
ESCs (Electronic Speed Controllers), propellers, and motors. After reading the
user manual [7], the kit was straightforward to assemble. The frame itself
shipped in 6 pieces and was assembled using the supplied hardware. Next it
was just a matter of installing the motors, ESCs and soldering the connections
to the power distribution board. The power distribution board was integrated
into the bottom portion of 1 the frame making it somewhat difficult to get the
soldering iron in to make a good solder joint.

Figure 3.1. DJI Flamewheel F450 ARF Kit[1]

The diagonal wheelbase of the frame is 450mm which is a little large for
indoor use, and the frame's weight is 282g by itself which could easily break

13
things if crashed into. Well after we purchased the kit we found out that the DJI
ESCs are pre-calibrated from the factory and do not have the ability to be
recalibrated, which caused some problems for us that I will address later in the
document.

3.2 The Flight Controller

The next part for the quadcopter that was needed was a flight controller. A
flight controller is a small circuit board of varying complexity. Its function is to
direct the RPM of each motor in response to input. A command from the pilot
for the multi-rotor to move forward is fed into the flight controller, which
determines how to manipulate the motors accordingly. Flight controllers also
employ sensors to supplement their calculations. These range from simple
gyroscopes for orientation to barometers for automatically holding altitudes.

Figure 3.2. 3DR Pixhawk Mini Flight Controller[2]

The flight controller we settled on was the 3DR Pixhawk Mini, which can be
seen in Figure 3.2. The Pixhawk Mini comes with a built in gyroscope,
accelerometer, barometer, as well as an external GPS/Compass unit. Along
with all the sensors, the flight controller came with a quad power distribution
board as well as all the wiring and connectors to connect the Pixhawk to the
quadcopter. I will describe in more detail later how all the wiring for the
quadcopter is assembled.

14
3.3 Transmitter and Receiver

Now that we had the basic frame and the flight controller for the quadcopter,
we needed a way for an operator to control the drone for basic ying purposes.
For this we purchased the FrSky Taranis X9D Radio Transmitter and the FrSky
Delta 8 2.4Ghz 8CH Multi-Brand Receiver as shown in Figure 3.3. The FrSky
Taranis is a very good all-purpose RC Transmitter running the open source
OpenTX software and comes with many configurable switches and dials. The
FrSky Delta 8 is a good all-purpose RC Receiver that is PPM-Sum compatible.
PPM Sum is needed by the Pixhawk and just means that all of the channels
from the receiver can be sent to the Pixhawk along a single connection.

(
a
)

F
r
S
k
y
Taranis Transmitter[3] (b) FrSky Delta 8 Receiver[4]

Figure 3.3. RC Transmitter and Receiver

3.4 Batteries

The last part that is needed for a basic functioning quadcopter that can be
controlled by an operator using the RC transmitter is a power source. For this
we purchased 3 Lumenier 1800mAh 4s 75c Lipo batteries. This size battery is
what the DJI kit called for and o ers around 15 minutes of flight time before
needing to be recharged.

3.5 Assembly

Refer to Figure 3.4 for a visual representation of how a typical quadcopter is


wired. Although the diagram does not show exactly how our setup is wired, it
is a good visual of how a typical quadcopter should be wired. From the
diagram you can see that each motor should be connected to its own ESC.

15
The ESCs in turn are supplied power directly from the Lipo battery, with a
third wire connected to the flight controller. This third wire that connects the
flight controller to the ESCs is the signal wire. The flight controller flight,
depending on input from the operator or sensor input, will send a PWM (Pulse
Width Modulation) signal to the ESC telling it what RPM to turn the motor.
The motors themselves must be connected to the flight controller in a certain
way, if you look back at Figure 2.2 the numbers on each propeller corresponds
to the output number on the flight controller. This makes sense because the
flight controller must know the position of each motor it is controlling as well
as the direction that the motor is spinning.

Figure 3.4. Typical Quadcopter Wiring Layout[5]

Not shown in the diagram is how the flight controller is powered. In our setup
the Pixhawk came with its own power distribution board. This board is
connected to the battery by soldering power and ground wires to the power
distribution board integrated into the frame, it then supplies the Pixhawk with
its required 5V. Finally the GPS and RC receiver are connected to the flight
controller by simply plugging the connectors into their corresponding sockets
which are labeled on the flight controller.

16
3.6 Additional Hardware

In order to give the quadcopter the ability to fly autonomously indoors we


needed to add some additional hardware.

Figure 3.5. Wiring between RPI and Pixhawk[6]

3.6.1 Companion Computer

For starters we needed a brain to be able to instruct the quadcopter to perform


actions within certain circumstances. While the flight controller does have the
ability to do this to some extent, in more extreme circumstances like when
reading additional sensor data and constructing a map of the environment the
flight controller doesn't have the processing power needed. To x this we added
a companion computer. The companion computer we settled on was a
Raspberry Pi 3. The Raspberry Pi is connected to the flight controller directly
and communicates with it via UART serial communication. UART stands for
Universal Asynchronous Receiver/Transmitter. A UART serial connection only
requires a 4 wire connection and doesn't require a shared clock. The Raspberry
Pi has a UART connection built into its normal GPIO (General Purpose Input
Output) and connects to the flight controller on Figure 3.4. Typical Quadcopter
Wiring Layout[5] controllers telemetry port. While the iFigure 3.4. Typical
Quadcopter Wiring Layout[5] controllers telemetry port is not meant to be
used in this fashion, peripheral suppliers have been able to use the UART
connection of the telemetry port to create interfaces to communicate with the
flight controller directly. The wiring between the Raspberry Pi and the Pixhawk
is shown in Figure 3.5. The original Pixhawk had 2 telemetry ports and it was

17
standard to connect a companion computer via 20 port Telem2. However the
Pixhawk Mini only has one telemetry port, so the UART connection has been
made using the Pixhawk Minis only telemetry port. It is stated in the
documentation [6] that the 5V from the Pixhawk telemetry port is sufficient to
power the Raspberry Pi. However in our experimentation we found that the
Raspberry Pi would not boot because of low voltage when only receiving
power from the Pixhawk telemetry port. Instead of powering the Raspberry Pi
via its GPIO, we were able to pull 5V from the flight controllers power
distribution board. Since that was possible we soldered a micro USB cable to
the power distribution board and can power the Raspberry Pi via micro USB,
which is how the Raspberry Pi is normally powered since that is where all the
protective circuitry is located.

3.6.2 UltraSonic Range Sensor

While the Pixhawk flight controller does have a built-in barometer, which is an
instrument that measures atmospheric pressure in order to determine altitude,
we had problems with getting an accurate reading for the altitude when
performing experimental tests, a problem I will discuss in more detail later. For
this reason we added an HC-SR04 ultrasonic range finder sensor that sits on the
bottom of the quadcopter pointing straight down to give us an accurate
measurement for the distance to the ground. The ultrasonic range finder sensor
plugs directly into the Raspberry Pi's GPIO ports, however the signal it outputs
needs to be converted from 5V to 3.3V so as not to damage the Raspberry Pi.

Sound consists of oscillating waves through a medium (such as air) with the
pitch being determined by the closeness of those waves to each other, de ned as
the frequency. Only some of the sound spectrum is audible to the human ear, de
ned as the Acoustic range. Very low frequency sound below Acoustic is de ned
as Infrasound , with high frequency sounds above, called Ultrasound.
Ultrasonic sensors are designed to sense object proximity or range using
ultrasound reaction, similar to radar, to calculate the time it takes to react to
ultrasound waves between the sensor and a solid object. Ultrasound is mainly
used because

18
Figure 3.6. HC-SR04 Ultrasonic Range Finder Sensor[8]

it’s inaudible to the human ear and is relatively accurate within short distances.
A basic ultrasonic sensor consists of one or more ultrasonic transmitters
(basically speakers), a receiver, and a control circuit. The transmitters emit a
high frequency ultrasonic sound, which bounce o any nearby solid objects.
Some of that ultrasonic noise is reflected and detected by the receiver on the
sensor. That return signal is then processed by the control circuit to calculate
the time difference between the signal being transmitted and received. This
time can subsequently be used, along with clever math, to calculate the distance
between the sensor and the reflecting object.

The HC-SR04 ultrasonic sensor has four pins: ground (GND), Echo Pulse
Output (ECHO), Trigger Pulse Input (TRIG), and 5V Supply (Vcc). As can be
seen in Figure 3.6. We power the module using Vcc, ground it using GND, and
use our Raspberry Pi to send an input signal to TRIG, which triggers the sensor
to send an ultrasonic pulse. The pulse waves bounce on any nearby objects and
some are reflected back to the sensor. The sensor detects these return waves
and measures the time between the trigger and returned pulse, and then sends a
5V signal on the ECHO pin.

Figure 3.7. A Basic Voltage Divider Circuit[8]

19
ECHO will be low (0V) until the sensor is triggered when it receives the echo
pulse. Once a return pulse has been located ECHO is set high (5V) for the
duration of that pulse. Pulse duration is the full time between the sensor
outputting an ultrasonic pulse, and the return pulse being detected by the sensor
receiver. We used a Python script to measure the pulse duration and then
calculate distance from this. The sensor output signal (ECHO) on the HC-SR04
is rated at 5V. However, the input pin on the Raspberry Pi GPIO is rated at
3.3V. Sending a 5V signal into that unprotected 3.3V input port could damage
our GPIO pins, which is something we want to avoid. For this reason we used a
small voltage divider circuit, consisting of two resistors, to lower the sensor
output voltage to something the Raspberry Pi can handle.

A Voltage divider consists of two resistors (R1 and R2) in series connected to
an input voltage (Vin), which needs to be reduced to our output voltage (Vout).
In our circuit, Vin will be ECHO, which needs to be decreased from 5V to our
Vout of 3.3V. A basic voltage divider circuit is shown in Figure 3.7. The circuit
in Figure 3.7 and the simple equation in Figure 3.8 can be applied to many
applications where a voltage needs to be reduced. We know our input voltage
(5V), and our required output voltage (3.3V), and we could have used any
combination of resistors to achieve the reduction. I happened to have a bunch
of extra 1k resistors, so we decided to use one of these in the circuit as R1.
After some simple math we got R1 as 1k and a 2k resistor for R2.

Figure 3.8. Equation for Voltage Divider Circuit

20
Figure 3.9. Connections between Ultrasonic Sensor and Raspberry Pi[8]

In order to connect the ultrasonic sensor to the Raspberry Pi we used four pins
on the Raspberry Pi GPIO. GPIO 5V [Pin 2]: Vcc (5v Power), GPIO GND [Pin
6]: GND (0V Ground), GPIO 23 [Pin 16]: TRIG (GPIO Output) and GPIO 24
[Pin 18]: ECHO (GPIO Input). The connection to the Raspberry Pi including
the voltage divider can be seen in Figure 3.9.

As stated earlier we created a Python module on the Raspberry Pi that


calculates the measured distance to the ground. This module can be imported
into any other Python 24 script allowing it to trigger a measurement and
retrieve the measured distance.

3.6.3 Laser Range Scanner

The last piece of hardware that was incorporated into the quadcopter was a
laser range scanner. The laser range scanner is needed for SLAM. In order to
construct a map of the environment and determine the quadcopters location
within the environment, SLAM needs a way to sense the environment. While
this can be done with a number of different sensors, from ultrasonic range
finders, fixed position laser range finders, and even cameras in the case of
visual SLAM, the most commonly used sensor to implement SLAM is a laser
range scanner or LiDAR.

The principle behind LiDAR is really quite simple. Shine a small light at a
surface and measure the time it takes to return to its source. Light travels very
fast, about 300,000 kilometers per second or 0.3 meters per nanosecond, so
equipment required to measure this needs to operate extremely fast. Only with

the advancements in modern computing technology has this become possible.


The LiDAR instrument res rapid pulses of laser light at a surface, some at up to

21
150,000 pulses per second. A sensor on the instrument measures the amount of
time it takes for each pulse to bounce back. Light moves at a constant and
known speed so the LiDAR instrument can calculate distance between itself
and the target with high accuracy. By repeating this in quick succession the
instrument builds up a complex map of the surface it is measuring. As the
sensor is moving, location and orientation of the instrument must be included
to determine the position of the laser pulse at the time of sending and the time
of return. The laser range scanner we chose to use was the RPLidar A2 pictured
in Figure 3.10.

The core of RPLidar A2 runs clockwise to perform a 360 degree


omnidirectional laser range scanning for its surrounding environment and then
generate an outline map for the environment. The sample rate of LIDAR
directly decides whether the robot can map quickly and accurately. With a
rotational frequency of 10 Hertz RPLidar A2 is able to provide

Figure 3.10. RPLidar A2 Laser Range Scanner[20]

4000 samples per second and has a scan range accurate up to 6 meters. The
RPLidar A2 laser range finder connects to the Raspberry Pi via a USB
connection and SLAMTEC, the manufactures of the scanner, provide a
downloadable SDK which makes getting the scanner running quick and easy.
The SDK as well as a user manual can be downloaded from [20]

22
CHAPTER 4
SOFTWARE STACK

4.1 Flight Controller Firmware

Within the flight controller market there are two main firmwares that are used
within the controller, APM and PX4. Ardupilot Mega (APM) is a professional
quality IMU autopilot that is based on the Arduino Mega platform. This
autopilot can control fixed-wing aircraft, multi-rotor helicopters, as well as
traditional helicopters. It is a full autopilot capable of autonomous stabilization,
way-point based navigation and two way telemetry. Although APM was
originally built on the Arduino Mega platform it has moved to an open source
firmware stack that can be installed and used on a large number of different
flight controllers, including Pixhawk. PX4 is much like APM, except PX4 is
part of the Dronecode Project, a shared and collaborative open source project to
deliver a complete end-to-end platform for unmanned aerial vehicles.

While Pixhawk Flight controllers are developed to be used with PX4 we


decided to use APM because DroneKit-Python can be interfaced with APM
(more on DroneKit-Python later). This is where an issue arose. Although APM
works well with the original Pixhawk hardware, the Pixhawk Mini is a fairly
new hardware platform and the current stable version of APM, version 3.4, is
not compatible with the Pixhawk Mini. The work around we used 27 to resolve
this issue was to use the master version of APM, version 3.6, which is still in
beta as of this time. After installing APM version 3.6 onto the Pixhawk Mini
and running some basic tests it seems to work well enough for our
experimentation, although some of the functionality doesn't work very well
such as monitoring the battery level and landing the craft when the battery
becomes too low.

4.1.1 Installing and Configuring APM Firmware

In order to install and configure the APM firmware it requires a Ground


Control Station (GCS), that is to be installed onto your desktop or laptop. There
are two GCS programs that are officially supported by APM. If your machine
runs Windows it is recommended to use Mission Planner, while if your
machine is running a Linux distro or MacOS it is recommended to use APM

23
Planner 2. Mission Planner was the original GCS software to install and
configure APM but was only available on Windows. APM Planner 2 is a later
version of Mission Planner that is cross-platform. After experimenting with
both we've found there is little difference between the two applications. From
the GCS software you can install different APM firmwares. It even offers a
wizard after a new firmware installation that will walk you through the
configuration process.

After a fresh firmware installation there are generally several things that are
mandatory to configure before the drone is ready for basic flight. These
mandatory configurations include: frame type, compass calibration,
accelerometer calibration, radio calibration,flight mode setup, and failsafe setup.
Frame type, compass calibration, and accelerometer calibration are all simple
to construct and the GCS software walks you through the whole process.
However the radio calibration is a little more di cult. During this step you are
setting up the RC transmitter and letting the flight controller know which
channels will be used for which commands as well as the thresholds for each of
those channels. For our setup we can control which flight mode we are
currently in using a 3 position switch on the front right of the controller,
corresponding to channel 5. The three flight modes that are currently setup 28
are center position (STABILIZE), down position (ALT HOLD), and up
position (LAND). STABILIZEflight mode is like a manual flight mode. In this
mode you have the most control over the copter, the flight controller just tries
to keep the copter as stable as possible. From my experience this is the hardest
mode to control the copter and have had some pretty hard landings while flying
in STABILIZEflight mode. The mode I personally like ying the copter in is
ALT HOLD mode. ALT HOLD attempts to hold the copter at the current
altitude but leaves you in control of everything else. While ALT HOLD
attempts to hold the current altitude there is still some drift in altitude,
especially when there is wind, when this occurs you can still tell the flight
controller to increase or decrease the altitude using the throttle joystick, it will
just increase or decrease very slowly. The last flight mode setup to be used is
the LANDflight mode. When LANDflight mode is invoked, the throttle
joystick is ignored and the copter levels itself out and slowly descends until it
touches the ground. This was setup as a manual failsafe, if the operator loses
control of the copter then you can switch it to LAND and not worry about
damaging the copter. The last mandatory configuration to be setup is the
failsafe configuration. The failsafe configuration tells the flight controller what
to do when certain circumstances occur, such as when the battery voltage
24
becomes too low, or if the flight controller loses the signal from the RC
transmitter. In our setup all failsafes have been set to land at current position.
Once the APM firmware has been installed and configured you can take the
quadcopter out and y it using the RC transmitter. Flying the quadcopter is a lot
of fun and I personally have spent a lot of time just ying our setup around the
yard.

4.2 Raspberry Pi Operating System

While there are many different operating systems that can be run on a
Raspberry Pi including Raspbian, Debian, Ubuntu MATE, Arch Linux, and
Gentoo Linux to name a few, the most popular seems to be Raspbian. The
operating system currently running on our Rasp 29 berry Pi 3 is Raspbian
Jessie. Raspbian Jessie is the current stable version of the popular Raspbian
operating system. The Raspbian operating system is based on Debian Linux,
and all of the software we need to run on the Raspberry Pi works well with
Raspbian.

4.3 DroneKit-Python

In order to control the quadcopter autonomously we needed a way to create


applications on a companion computer, in this case the Raspberry Pi, and then
send commands to the flight controller to control the quadcopters movements.
For this we chose to use DroneKit-Python. DroneKit-Python allows developers
to create apps that run on an onboard companion computer and communicate
with the ArduPilot (APM)flight controller using a low-latency link. The API
communicates with vehicles over MAVLink, or Micro Air Vehicle Link. It
provides programmatic access to a connected vehicle's telemetry, state and
parameter information, and enables both mission management and direct
control over vehicle movement and operations. DroneKit-Pythons API
provides classes and methods to:

● Connect to a vehicle (or multiple vehicles) from a script.


● Get and set vehicle state/telemetry and parameter information.
● Receive asynchronous notification of state changes.
● Guide a UAV to specified position (GUIDED mode).
● Send arbitrary custom messages to control UAV movement and other
hardware (GUIDED mode).
● Create and manage waypoint missions (AUTO mode).
● Override RC channel settings.

25
Anyone with programming experience in Python has the ability to pick up
DroneKit Python very quickly. The API is also very well documented, with
quick start guides and examples for all of the built-in functionality. The
documentation can be found at [10].

4.4 Software to Run SLAM

While we could implement our own version of SLAM, there is no need in


reinventing the wheel as they say. Remember SLAM has been around since the
late 80s, so there are many open source SLAM algorithms out there as well as
many implementations. Most SLAM approaches require odometry input in
order to complete the problem. With wheeled robots this is not a problem, since
you can acquire odometry from how much the wheels have turned, but with a
quadcopter it is very difficult to get odometry information. With this in mind
we chose to implement Hector SLAM. Hector SLAM can build up a map and
predict location without the need for odometry. Since the lidar sensor outputs a
distance versus polar angle readings, when the sensor moves, the readings
change. Hector SLAM uses this change in sensor readings in place of odometry
input.

In order to implement Hector SLAM in our system, we decided to use ROS.


The Robot Operating System (ROS) is a flexible framework for writing robot
software. It is a collection of tools, libraries, and conventions that aim to
simplify the task of creating complex and robust robot behavior across a wide
variety of robotic platforms. One of the packages that ROS provides is an
implementation of Hector SLAM. This implementation of Hector SLAM in
ROS not only provides the core functionality of constructing the map and
predicting the robots location within it but also provides a means of saving the
map to be reloaded and updated later. ROS is known to be very complex and to
have a steep learning curve, but luckily there is a lot of documentation on how
to install the system and get it set up and working[9]. Once the ROS system as
well as the Hector SLAM package was installed onto our system we needed a
way for our LiDAR sensor to talk to ROS. Luckily a group 31 known as
robopeak has already written a ROS package that allows our RPLidar sensor to
work with the Hector SLAM package. After modifying some of the
configurations we were able to use the ROS system to build a map and predict
the quadcopters localization within the map.

26
CHAPTER 5
AUTONOMOUS OPERATIONS

As stated earlier the software we chose to use in order to programmatically


control the movements of the quadcopter is DroneKit-Python. When
researching this API it seemed to be exactly what we needed in order to
perform our autonomous controls, since the API has built-in methods for
commands like move forward one meter or rotate orientation clockwise by 30
degrees. However once we started the real world test, we realized these
functions are only available when the quadcopter was in GUIDED flight mode.
Under normal conditions this would not be a problem as the APM firmware
supports GUIDEDflight mode, the problem arose because we were testing and
developing the system to work indoors. Within the APM firmware,
GUIDEDflight mode has a failsafe that will not let the quadcopter arm its
motors unless it has a strong GPS signal, and since we were testing indoors the
GPS signal was weak or not present at all. After reading through the
documentation we found there is no way of turning this failsafe off and because
of this we were unable to use most of the built-in functionality DroneKit-
Python has to offer. In order to control the quad copters movements we had to
resort to using RC channel overrides. RC channel overrides, which is supported
by DroneKit-Python, does exactly what the name implies, it overrides the RC
channel inputs from the RC transmitter. While DroneKit-Python does offer this
functionality it is not recommended, they even give the following warning
about using RC 33 channel overrides, WARNING: Channel overrides (a.k.a.
RC overrides) are highly discouraged (they are primarily intended for
simulating user input and when implementing certain types of joystick control).
Instead use the appropriate methods to set the desired position or
direction/speed.[10] Even though using RC overrides was discouraged this was
the only option we could use to control the movements of the quadcopter
indoors.

5.1 Taking off to Target Altitude

In order to get the quadcopter to ascend a target altitude we wrote a function in


DroneKit Python that accepts the target altitude in centimeters as an argument,
it then slowly increases the output of RC channel 3, which is the throttle
channel, while continuously monitoring the quadcopters altitude, once the
target altitude is reached the function returns.

27
This function is presented in Algorithm 1.

Algorithm 1 Take O to Target Altitude

Input: A Target Altitude target


Output: NA
while 1 do

channel[3] override ←channel[3] + 3

if Altitude >=target *0.95 then return


end if
time.sleep(1)
end while

While this function seems quite simple, which it is, using RC overrides can
produce some weird results from time to time. This is because you can't be sure
what the RC channel will be when the method is called and there is no way that
I have found to preset a RC channel to a desired value, the override is
dependent on the current channel value. While this approach works it is slow as
the propellers slowly increase to be able to generate enough thrust to lift the
quadcopter.

5.2 Holding the Quadcopter at Current Altitude

Once the quadcopter has reached a desired altitude we want it to hold this
altitude while all other functionality is being performed, until we invoke a
landing function. The most straightforward approach to achieve would be to
switch the APM firmware into ALT HOLD mode and let the flight controller
do the heavy lifting for you. However because of RC overrides this is not
possible because you cannot be sure as to what the throttle channel value is,
also even if the value is within a desired range, as stated earlier ALT HOLD
mode will still allow the quadcopter to drift in altitude. This drift is usually

28
minimal but indoors it could cause problems. Because of this we wrote another
function in DroneKit-Python that continuously monitors the quadcopters
altitude and applies slight adjustments to the throttle accordingly. This function
is invoked after reaching a target altitude and is executed in a separate thread so
that it is always attempting to hold the target altitude.

This function is presented in Algorithm 2.

Algorithm 2 Holding Target Altitude

Input: A Target Altitude target


Output: NA
while 1 do
if Altitude > target *1.1 then

channel[3]. override ←channel[3]- 1

end if
if Altitude < target* 0.9 then

channel[3] .override ←channel[3] + 1

end if
time.sleep(0.5)
end while

As stated earlier this function is continuously running in its own thread, once it
is time to land the craft, the thread is killed and the land gently function is
invoked.

5.3 Moving Quadcopter Forwards, Backwards, Left, Right, and


Orientation

In order to move the quadcopter forwards, backwards, left, right, and


orientation, we wrote another function in DroneKit-Python using RC overrides
except in this case we are overriding the corresponding channel, channel 2:
29
pitch, channel 1: roll, channel 4: yaw. This function takes 3 parameters, the first
parameter is a 1 or-1 corresponding to direction. The second parameter is the
duration the movement should occur. The third parameter is the channel to
override.

The function is presented in Algorithm 3.

Algorithm 3 Moving Pitch, Roll, and Yaw

Input: Direction(1 or-1) Direction, Duration in seconds Duration, Channel to


Override Channel
Output: NA

channel[Channel].override← channel[Channel] + (Direction* 5)

for i to Duration do
time.sleep(1)
end for

channel[Channel].override← channel[Channel]-(Direction*5)

As can be seen from Algorithm 3 the function overrides the corresponding


channel by 5 units in the direction that was passed as an argument, this o-
setting by 5 was chosen from trial-and-error which moves the quadcopter at a
slow steady pace, it then waits for the duration of time that was passed as an
argument, then finally resets the corresponding channel back to its starting
value. For clarification direction 1 on channel 2 corresponds to the forward
pitch direction, while direction-1 on channel 2 corresponds to the backwards
pitch direction, direction 1 on channel 1 corresponds to the right roll direction,
while-1 on channel 1 corresponds to the left roll direction, direction 1 on
channel 4 corresponds to clockwise rotation of yaw, and direction-1 on channel
4 corresponds to counterclockwise rotation of yaw.

5.4 Landing the Quadcopter

In order to land the quadcopter, we first would just switch the flight controller
into LAND mode using the corresponding DroneKit-Python command and let
30
the flight controller land the quadcopter for us. However, for reasons I will
discuss in the next chapter, this would result in the motors of the quadcopter to
stop while it was still a good way off the ground and the quadcopter would free
fall to the ground. For this reason we wrote our own land function in DroneKit-
Python that monitors the altitude of the quadcopter and slowly decreases the
throttle till the quadcopter is safely on the ground.

The function is presented in Algorithm 4.

Algorithm 4 Landing the Quadcopter

Input: NA

Output: NA

while Altitude > 13cm do

channel[3]. override ←channel[3] -5

time.sleep(1)

end while

VehicleMode←” LAND”

31
CHAPTER 6
CONCLUSION

This thesis presents the building and development of an autonomous indoor


drone system. It provides the theory behind how quadcopter technology works
as well as the theory behind the indoor positioning system SLAM. The thesis
continues by giving an in-depth explanation of all the hardware and software
that make up our drone system as well as how it all fits together. It then
presents our proposed solution to autonomous control of a quadcopter system.

32
REFERENCE

● Valavanis, P., Voulgaris, P., Zachmann, G., & Pachter, M. (2015). Handbook of
unmanned aerial vehicles (Vol. 89). Springer.
● Boskovic, B., Munoz-Hernandez, M., & Caprari, G. (2019). A review of computer
Colomina, I., & Molina, P. (2014). Unmanned aerial systems for photogrammetry
and remote sensing: A review. ISPRS Journal of Photogrammetry and Remote
Sensing, 92, 79-97.
● Gurumurthy, S. K., & Modali, K. (2020). Cybersecurity for unmanned aerial vehicles
(UAVs): An overview. In 2020 IEEE Aerospace Conference (pp. 1-7). IEEE.

● Bansal, R., Vincent, D., & Jain, V. (2020). Towards an ethical framework for drone
use in public spaces. Nature Machine Intelligence, 2(8), 369-374.
● Van den Hoven, J., Vermaas, P., & Miller, K. (2019). A framework for ethical
decision-making in artificial intelligence and robotics. Science and Engineering
Ethics, 25(4), 1203-1228.
● International Civil Aviation Organization (ICAO). (2023). Unmanned aircraft
systems (UAS).
https://www.icao.int/safety/UA/Model%20UAS%20Regulations/Model%20UAS%2
0Regulations/Model%20UAS%20Regulations%20-
%20Parts%20101%20and%20102.pdf.
● European Union Aviation Safety Agency (EASA). (2023). Unmanned aircraft
systems (UAS). https://www.easa.europa.eu/en/domains/civil-drones.
● Zhu, H., Sun, R., Hu, H., & Li, T. (2023). A Survey on Artificial Intelligence-
Enabled Unmanned Aerial Vehicles (UAVs). IEEE Transactions on Aerospace and
Electronic Systems, 1-11.
● Sharma, V., & Yoo, S. M. (2023). A Survey on AI-Based Navigation and Obstacle
Avoidance for Autonomous UAVs. arXiv:2301.07135v2.

33
34

You might also like