Project Report Introduction To Autonomous Mobile Robots MCG 5138H
Project Report Introduction To Autonomous Mobile Robots MCG 5138H
1 Introduction
An autonomous mobile robot has the ability to nav-
igate without any external human intervention. The
robot can reach the desired target while avoiding static (a) Actual (b) Simulation
or dynamic obstacles along the way. For this, it has to
Figure 1: Quickbot
determine its own position with respect to both a world
and local frame. In autonomous navigation of mobile The QuickBot is equipped with five infrared (IR)
robot, different control strategies are followed such as range sensors, of which, three are located in the front
PID, Fuzzy Logic, Genetic Algorithm, Neural Network and two are located on its sides (as shown in figure 1).
etc. In this project, PID controller is used to define 3 These sensors are effective in the range 0.04 m to 0.3 m,
1
the same as an actual IR sensor used in Quickbot [1]. 2.2 Odometry
In the simulator, there is a function that converts the In order to determine robots position in the environ-
IR sensor responses to a distance in meters. Each wheel ment, Odometry is used in mobile robotics. In odome-
is actuated by a separate motor with a wheel encoder try position is determined by measuring the change from
attached. The radius of the wheel is 32.5mm, the dis- a known initial position of the Quickbot. The general
tance between the wheels is 99.25mm. The design of the idea is to use wheel encoders to measure the distance
Quickbot comes with the simulator. Figure 1 shows the the wheels have turned over a small period of time, and
simulated and actual QuickBot mobile robot. use this information to approximate the change in pose
of the robot [3]. The pose of the robot is composed of its
2.1 Differential Drive Kinematics
position (x, y) and its orientation θ on a 2 dimensional
As a differential drive robot, the Quickbot has 3 de- plane. The Quickbot has moved by dleft and dright from
grees of freedom (x, y, θ). The navigation of the Quick- a starting point (x, y, θ ) to a new position, (x0 , y 0 , θ0 )
bot has to be controlled by specifying the rotational ve- which has to be computed.
locities of the right and left wheel (vr , v` ) . These ve-
locities are computed by a transformation from the lin-
ear and angular velocity of the robot unicycle (v, w) to
(vr , v` ). (vr , v` ) . Here R is the radius of a wheel, and L
is the distance separating the two wheels.
2
cos(θ) − sin(θ) x eI = EK + eK ∗ dt (12)
R(x, y, θ) = sin(θ) cos(θ) y (7)
Derivative Response: The Derivative response in a
0 0 1
PID controller is calculated by determining the slope of
The transformation of the IR distance measured by the error over time and multiplying this rate of change
each sensor to a point in the reference frame of the Quick- by the derivative gain (KD ).[5] The derivative response
bot is found by: is given by:
0 vi d(e(t))
vi = R (xsi , ysi , θsi ) (8) Dout = KD ∗ = KD ∗ eD (13)
1 dt
where, vi = [di , 0]T is the vector coordinate of a point In matlab simulator, the derivative error term is de-
pi from the sensor i which is at di distance. (xsi , ysi , θsi ) fined as the following, where eK1 is the error in previous
is the pose (location and orientation) of the sensor in the time step.
reference frame of the Quickbot. eK − eK1
The second transformation is to determine where the eD = (14)
dt
point, pi is located in the world. (x, y, θ) is the pose of
the robot. The transformation of the Quickbot from its
reference frame to the world frame is given by: PID controller Output The controller output which
is the angular speed (w) of the Quickbot for this project,
vi00 = R(x, y, θ)vi0 (9) can be computed by combining equations 10, 11 and 13
as following:
2.4 PID Controller
w = KP ∗ eK + KI ∗ eI + KD ∗ eD (15)
A proportional-integral-derivative (PID) controller
is a generic control loop feedback mechanism consists
of three basic coefficients; Proportional, Integral and 3 Design of Control Algorithms and
Derivative which are varied to get optimal response. Simulation
The basic idea behind a PID controller is to read
a sensor, then compute the desired actuator output For navigation, 3 basic behaviors are modularly
by calculating Proportional, Integral, and Derivative designed and simulated in Matlab based simulator
responses and summing those three components to Sim.I.Am. They are as following: go to goal (GoT oGoal
compute the output. [2] or gtg), avoid obstacles (AvoidObstacles or ao), avoid
obstacles and go to goal (AOandGT G). As the design
Proportional Response: The Proportional term is modular, all three controller algorithms are designed
produces an output value that is proportional to the cur- in three separate modules. Some necessary codes such
rent error value eK . This is done by multiplying the error as world environment, Quickbot dynamics,IR sensors,
by a constant called the proportional gain (Kp ).[5] wheel encoders and the platform for implementing the
control algorithms are provided in the simulator. Basic
Pout = KP ∗ e(t) = KP ∗ eK (10) algorithms were implemented according to the guidelines
Integral Response: The Integral component sums [1] provided with the simulator.
the error term over time. The result is that even a small The output variables of any of the designed controllers
error term will cause the integral component to increase are the angular velocity, w and linear velocity, v.
slowly. The integral term in a PID controller is the sum QBSupervisor file acts as the supervisor of the Quickbot
of the instantaneous error over time and gives the ac- and decides which controller to use for different circum-
cumulated offset that should have been corrected previ- stances. The output angular velocity, w is controlled
ously. The accumulated error is then multiplied by the with PID controller where the PID try to mitigate the
integral gain (KI ) and added to the controller output.[5] difference between the desired angle (θd ) for the goal and
Z t current heading angle (θ) of the Quickbot.
Iout = KI e(τ )dτ = KI ∗ eI (11) Before designing the main 3 behaviors, a simple
0 GoT oAngle controller was designed to test if the dif-
Where, τ is the variable of integration, takes on values ferential drive and odometry are working properly with
from time 0 to present time, t. In simulator, the integral the simulator.
error term is defined as the sum of total accumulated Some events are specified for quickbot’s supervisor
error EK and error for current time step. (QBSupervisor) for the implementation of Finite State
3
Machine (FSM) that chooses controller states in different
circumstances.
4
(−1.3, 0.5), the Quickbot first rotate (counter-clockwise) 3.3 Avoid Obstacles
to adjust its heading angle towards the goal with a pos- The objective of this controller is to steer the robot
itive angular velocity (w) controlled by PID. Then, it successfully away from obstacle to avoid a collision. In
moves with a constant linear velocity (v) until the dis- the simulator, the provided IR sensors allow us to mea-
tance of the goal is less than dstop (shown in figure 5). sure the distance from Quickbot to obstacles in the en-
vironment. For this, IR distances measured by five sen-
sors have to be transferred to five points in the reference
frame of the robot and then compute a vector ui for each
sensor to its corresponding point from the robot. The
transformation of a point in robot reference frame and
world frame is followed according to section 2.3. Each
vector has to be weighted with αi according to their im-
portance for obstacle avoidance task. The weights are
Figure 5: Simulation 2 result: Qickbot going to a fixed symmetric with respect to the left and right sides of the
goal Quickbot [1]. Finally, a single vector ua0 was derived
by summing up these five vectors. The vectors that cor-
respond to directions with large IR distances will con-
tribute the most to uao ). So, this steers the Quickbot
away from obstacles in a direction with free space.[1].
A PID controller is implemented to keep heading angle
(θ) as close as possible to the desired angle (θg ). θg is
calculated from the vector ua0 . Section 2.4 is followed
to calculate all the error term (eP , eI , eD )and the PID
output, w.
(a) Undershoot and slow settle time(before tuning)
(b) No undershoot, better settle time with some Simulation 3: Obstacle Avoidance Important pa-
steady oscillation (after tuning) rameters including the suitable PID gains for this sim-
ulation is shown in the table. As no goal is specified in
Figure 6: Simulation 2 result: Output angle θ controlled
this controller, quickbot starts moving forward with the
with PID Controller
input linear velocity v.
PID tuning: PID gains has to be tuned to get a fast Quickbot’s supervisor file: QBSupervisor.m
settle time (θ matches θg within 10% in three seconds or Input linear velocity, v 0.2ms−1
less), no undershoot and maximum overshoot should not
increase beyond 10% of the θg [1]. Initially, all the gains AvoidObstacles Controller: AvoidObstacles.m
were set to zero except KP was 1. Then the simulation Linear velocity (reduced) 1/2 ∗ v = 0.1ms−1
was launched. As shown in the figure 6(a), there was a PID Gain (KP , KI , KD ) 5, 0.01, 0.01
little undershoot and the settling time was slow. This
can be fixed by increasing KP . By trial and error, the When it reaches any obstacle, the vector uao shown in
undershoot was fixed for a KP of 4.5. But there was figure 7 by red dotted line changes the direction to steer
still some unsteady oscillation. Adding some KI and the robot away from the obstacle. In figure 7 , starting
KD (0.01), gives a better tracking and steady oscillation at (0, 0), the 2 front sensors (left and middle) detect the
(figure 6). box and the Quickbot reacts turning to the right. Once
5
Algorithm 2 Hard Switch Logic
if Event: at goal then
Switch to controller: Stop
else if Event: at obstacle then
Switch to controller: AvoidObstacles
else
Switch to controller: GoT oGoal
end if
Figure 8: Simulation 3 result: Output angle θ controlled Simulation 4: Hard Switch Logic: Different val-
with PID controller ues were tested in simulation. Following values ensure a
stable navigation for avoid obstacles and go to goal.
Quickbot’s supervisor file: QBSupervisor.m
it is away from the box, it moves forward until the front
Input linear velocity, v 0.2ms−1
left sensor detects a new obstacle, causing the robot to
Goal Location, (xg , yg ) (−1m, 1m)
turn left to drive away from the wall. Due to a small
dstop 0.05m
asymmetry in IR sensors position, the Quickbot steer
dobstacle 0.22m
slightly right when its away from obstacles.
GoT oGoal Controller: GoToGoal.m
3.4 Avoid Obstacle and Go to Goal PID Gain (KP , KI , KD ) 4, 0.01, 0.01
With the controller developed so far, the Quickbot can
either go to a goal with GoT oGoal controller or avoid AvoidObstacles Controller: AvoidObstacles.m
collision with obstacles on its path with AvoidObstacles Linear velocity (reduced) 1/3 ∗ v = 0.067ms−1
Controller. So, these two controllers need to be imple- PID Gain (KP , KI , KD ) 5, 0.01, 0.01
mented together in a way that it will allow the Quickbot
to drive to a goal, while not colliding with any obstacles 3.4.2 Blending Controller
on the way. Two arbitration mechanisms are explored
Instead of switching between 2 controller, GoT oGoal and
in this project: blending and hard switch. Each of them
AvoidObstacle controller is combined into a single con-
has advantages and disadvantages which were discussed
troller that blends the two behaviors. In avoid obstacles
with simulation results.
controller, vector uao is used for pointing from the robot
to a point in space away from obstacles. Now, a new vec-
3.4.1 Hard Switching tor, ugtg is developed which is pointing to the goal from
the quickbot. These two vectors are combined (blended)
In Hard switching logic, the robot continuously switches linearly into a single component vector uao,gtg by weigh-
between its two objectives: go to goal and avoid obsta- ing each vector according to their importance. Vector
cle, such that the robot avoids any nearby obstacles and uao,gtg points the quickbot both away from obstacle and
drives to the goal when clear of any obstacles. So, in- towards the goal [1].
stead of executing both GoT oGoal and AvoidObstacles
controller simultaneously, Quickbot only executes uao,gtg = α ∗ ugtg + (1 − α)uao (16)
one controller at a time, but switch between the two where 0 < α < 1. α needs to be carefully tuned to get
controllers whenever a certain condition is satisfied. the best balance between go-to-goal and avoid-obstacles
This is done by implementing a simple if-else algorithm behavior. This is difficult to choose as a lower value is
for the finite state machine (FSM) implemented in good for avoiding obstacles, but it may not be efficient
QBSupervisor. The pseudocode is given here. for go to goal behavior.
Though the GoT oGoal controller uses the full in- So, instead of using a single value for α, two values, a
put linear velocity, v; AvoidObstacle controller is mod- lower and a higher, is used for two conditions. A lower
ified to reduce v to ensure a smooth navigation around value gives more priority to AvoidObstacles controller
obstacles. Quickbot supervisor switches to controller when the obstacle is near. When obstacles are cleared, a
AvoidObstacle when obstacles are nearby, then v is re- higher value ensures the dominance of go to goal behav-
duced to 1/3 of the input v. When the obstacle is cleared, ior. The pseudocode for the blended vector component
supervisor switches to GoT oGoal and v is restored. is given below:
6
Algorithm 3 Blended vector uao,gtg its IR sensor is detecting the obstacle and move away
1. dobstacle < 0.3 meter (Distance of obstacle, within from it simultaneously.
IR sensor range)
2. αao = Lower value
3. αao,gtg = Higher Value
Blending Controller: AOandGTG.m Figure 11: Simulation 5 results: Output angle θ con-
dobstacle 0.20m trolled with PID controller
αao and αao,gtg 0.07 and 0.35 In hard switch, Quickbot’s heading angle always
PID Gain (KP , KI , KD ) 4, 0.01, 0.01 changes from the goal when its busy avoiding obstacles.
It forgets about the goal. So everytime, when obstacles
3.4.3 Observation of Simulation 4 and 5: Hard are clear, Quickbot has to adjust its heading angle. But
Switch and Blending in bending, Quickbot try to keep the heading towards
the goal even if its avoiding an obstacle. It smoothly
As shown in figure 9, initial position of the Quickbot blends go to goal and avoid obstacles behavior together.
is (0, 0) and the goal is fixed to (−1, 1). In hard switch, This is also observed from the output angle curves shown
Quickbot’s supervisor activates AvoidObstacle controller in figure 10 and 11. Output curve for blending is more
to move away from the obstacle detected by the right smooth and has fewer oscillations. An interesting obser-
sensor. When this obstacle is cleared, Quickbot switches vation is that Quickbot takes less time to reach goal for
to GoT oGoal and adjusted robots heading to goal and blending method. The reason is that additional time is
start moving towards it and so on. On the other hand, in needed for the quickbot to adjust its heading towards the
blending robots adjust the heading angle to goal while goal in hard switch method.
7
Which technique is more effective? The Hard Algorithm 6 Implmentation of Blending and Hard
switching technique has greater efficiency in performing Switch
the objective (avoid obstacle and go to goal) at higher if Blending then
linear velocities. But as the output curve has depicted, if (Event: at goal) then
the switching technique causes heavy vibrations in the Switch to controller: Stop
robot, which can cause damage to the internal hardware else
of an actual robot. This makes blending technique more Switch to controller: Blending AvoidObstacle and
acceptable as it uses a priority based technique. When GoT oGoal
the priority is more to avoid obstacle the robot will per- end if
form only avoid obstacle objective, otherwise it will per- else
form go to goal. This process causes a much smoother if (Event: at goal) then
transition between GotoGoal and AvoidObstacle. Switch to controller: Stop
Based on this observation, a hybrid of blending and else if (Event: at obstacle) then
hard switch algorithm is designed which utilizes the ben- Switch to controller: AvoidObstacles
efit of each technique in their favorable conditions. else
Switch to controller: GoT oGoal
end if
end if
3.4.4 Hybrid of Blending and Hard switch
Blending method’s smoothly blends go to goal and avoid Quickbot’s supervisor file: QBSupervisor.m
obstacle together which gives it the advantage of navigat- Input linear velocity, v 0.2ms−1
ing smoothly around obstacles. However, the quickbot Goal Location, (xg , yg ) (−1m, 1m)
sometimes comes too close to obstacles for its go to goal dstop 0.05m
behavior which results in collision. Another limitation of dobstacle 0.22m
blending is that its goal tracking is not that efficient as
a GoT oGoal controller. For these reason, it is better to Blending Controller: AOandGTG.m
purely use GoT oGoal when there is no obstacle around PID Gain (KP , KI , KD ) 4, 0.01, 0.01
and when obstacles are dangerously close, it is better to Linear velocity (reduced) 2/3 ∗ v = 1.33ms−1
only use AvoidObstacles. The switching logic gives a α 0.20
better performance in these conditions.
AvoidObstacles Controller: AvoidObstacles.m
Algorithm 5 Condition for Blending PID Gain (KP , KI , KD ) 5, 0.01, 0.01
if (Event: unsaf e) then Linear velocity (reduced) 1/3 ∗ v = 0.067ms−1
Blending = false
else if (Event: obstacle cleared) then GoT OGoal Controller: GoToGoal.m
Blending = false PID Gain (KP , KI , KD ) 4, 0.01, 0.01
else if (Event: at obstacle) then
Similar to simulation 4 and 5, Quickbots initial position
Blending = true
and goal is set to (0, 0) and (-1,1). Quickbot uses all 3
end if
controllers for navigation. At the start, where there is
an obstacle at a distance defined as unsaf e, controller
A hybrid algorithm is designed exploiting these advan- uses AvoidObstacles and moves to a safe distance. Then
tages in suitable conditions for blending and hard switch it uses blending AOandGT G around obstacles keeping
technique. heading angle as close to goal as possible. When the ob-
stacles are cleared it switches to GoT OGoal which purely
follow go to goal behavior to ensure the shortest path
Simulation 6: Hybrid of Blending and Hard towards goal. Different color in the output curve shown
Switch: Important parameters associated with this in figure 12 also depicts the usage of different controller
simulation are presented in the table. Suitable values used at that time. The time to reach goal is higher then
of these parameters are found from simulation, which simulation 4 and 5. The reason is the reduction of linear
will ensure a stable navigation of quickbot for moving velocity v in blending AOandGT G and AvoidObstacles
towards goal avoiding collision. controller which ensures the safest path to goal. The
8
output angle curve (figure 12) indicates a more stable IEEE Transactions on Control Systems Technol-
heading angle. ogy, vol. 13 (4), pp. 559-576, July 2005.
[3] E. Olson,“A Primer on Odometry and Motor
Control”, MIT, 2009.
References
[1] J. P. de la Croix, “Sim.I.am: A Robot Simula-
tor”, GRITS Lab, Georgia Institute of Technol-
ogy, 2014.
[2] K. H. Ang, G. Chong and Y. Li, ““PID con-
trol system analysis, design, and technology,” in