Obstacle Avoidance Robot
Obstacle Avoidance Robot
By Dangampola D.L. De Abrew K.N.T. Kasthuriarachchi T.D. Malwatta K.A. Dahanayake J.K. 020059 020067 020203 020241 020057
EN407 : Robotics
Abstract
The objective of this project was to develop a Collision Avoidance Mobile robot with onboard sensors and a Microcontroller. The mobile robot designed is capable of moving in an environment which has obstacles avoiding collisions. The Designed mobiles robot is a three wheeled Robot with differential steering. The Robot has an onboard rotating Ultrasonic Sensor and Bumper switches for improved safety. The Main Controller of the Robot is implemented in a PIC microcontroller. The Mobile robot uses the Potential Field Method for Obstacle avoidance. The Algorithms runs on the PIC microcontroller based on the information received by the Ultrasonic Ranger.
EN407 : Robotics
Table of Contents
1.0 Introduction ........................................................................................................................................ 1 1.1 Scope and Overview....................................................................................................................... 1 1.2 Basic Operation .............................................................................................................................. 1 2.0 Overall system Design and operation................................................................................................. 2 2.1 Functional Block Diagram ............................................................................................................. 2 2.2 System Operation ........................................................................................................................... 3 2.3 Implementation of the potential field method ................................................................................ 4 3.0 Components of the Mobile Robot ...................................................................................................... 6 3.1 The PIC 877A microcontroller....................................................................................................... 6 3.2 Servo Motor.................................................................................................................................... 6 3.3 Sonar Sensor................................................................................................................................... 7 3.4 Stepper motors................................................................................................................................ 7 3.5 The PIC 873A microcontroller Sonar/ Servo controller ............................................................. 9 3.6 Mechanical Design....................................................................................................................... 11 3.7 Circuit Diagram............................................................................................................................ 12 4.0 Results .............................................................................................................................................. 12 5.0 Limitations and Further Developments............................................................................................ 13
APPENDIX A : PIC Program : Main Controller ................................................................................... 14 APPENDIX B : PIC Program : Servo and Sonar Controller ................................................................. 30
ii
EN407 : Robotics
List of Figures
Figure 1 : The Mobile Robot.................................................................................................................... 1 Figure 2: Mobile Robot Navigating through Obstacles ........................................................................... 2 Figure 3: Block Diagram of the System................................................................................................... 2 Figure 4 : Flow chart ................................................................................................................................ 3 Figure 5: Sonar Readings ......................................................................................................................... 4 Figure 6 : Repulsive Forces...................................................................................................................... 5 Figure 7 : Local Goals.............................................................................................................................. 5 Figure 8: hitec HS 300 Servo motor and the Sonar sensor ..................................................................... 6 Figure 9 : SRF 05 Sonar Sensor ............................................................................................................... 7 Figure 10 : FDK Stepper motors Unipolar mode operation.................................................................. 8 Figure 11 : PIC 873A microcontroller Pin Diagram ................................................................................ 9 Figure 12 : PIC 873A microcontroller - Used Pin layout ........................................................................ 9 Figure 13 : Robot Base........................................................................................................................... 11 Figure 14 : Circuit Diagram ................................................................................................................... 12
iii
EN407 : Robotics
1.0 Introduction
1.1 Scope and Overview
The purpose of this project was to develop a mobile robot with the collisions avoidance capability in an obstructed environment. The mobile robot has been built as a fully autonomous vehicle with onboard sensors to get information about the surrounding environment. The mobile robot is a three wheeled robot platform which employs the differential steering mechanism for motion in given angles. Two stepper motors have been used for the driving wheels. The robot has an onboard Ultrasonic sensor which is mounted on the standard servo motor. The Servo Motor and the Ultrasonic sensor are controlled by a dedicated microcontroller which sends the information collected to the main controller. To improve the reliability the bumper switches has been used as redundant sensors. The Potential Field method has been used as the obstacle avoidance algorithm and the Algorithm is implemented in the main PIC microcontroller which is on the mobile robot. The Algorithm implemented is used to avoid the obstacle and to drive the robot to a locally generated goal.
EN407 : Robotics
Thereafter the robot moves a predefined distance and the robot scans its environment again as mentioned earlier. This process continues when the mobile robot is switched on.
Figure 3: Block Diagram of the System The above diagram is the functional block diagram of the entire system. The Main Controller will trigger the Servo Controller, receive the distance values, run the collision avoidance algorithm and control the Stepper motors. The Servo Controller controls the sonar sensor and servo motor while providing the readings from the sonar sensor to the Main Controller. A description of each of these functional blocks is given in next chapter.
EN407 : Robotics
EN407 : Robotics
135
180 Robot
Figure (b)
EN407 : Robotics
When we calculate the resultant force we ignore the obstacles that are beyond a certain threshold distance DTh to avoid unnecessary calculations. For example obstacle B is taken into account because it is within the threshold while obstacle A is discarded from the process of calculating the resultant force as it is away from the threshold distance.
DTh
Figure 6 : Repulsive Forces The repulsive force (or weight) for obstacle B is calculated as F = DTh D1 If all five sonar readings come from within the threshold distance, the repulsive force is not calculated and the robot is instructed to reverse. All the repulsive forces are resolved and the total repulsive forces x and y components are calculated. Resolving for 45 and 135 degrees components is done using a table lookup. The advantage of these angles is that we dont have to use two separate tables for sin and cos. Selecting the goal is done on a priority basis. This priority scheme is shown in the following figure. 90 Priority level = 1 135 Priority level = 2 45 Priority level = 2
0 Priority level = 3
EN407 : Robotics
For example if the sonar reading indicates that the 90 direction is clear (that is theres no obstacle within the threshold distance in that direction) it is the direction that is chosen as the goal direction even if any other directions are clear. After assigning the goal, its attractive force which is a constant is resolved if necessary and is subtracted or added accordingly to the resultant repulsive forces x and y components to calculate the x and y components of the total force acting on the robot. Then the angle of the resultant force is calculated from these x and y components and it is fed to the motor controlling unit.
Figure 8: hitec HS 300 Servo motor and the Sonar sensor The servo motor consists of three wires. Yellow wire - Control 6
Black wire - Ground The position of the servo motor is determined by the width of the (3-5V) pk-pk square pulse sent to its Control wire. The pulses should be given every 20 ms. Given below are the pulse durations required for the servo motor positions are given below. Center Position 1.7 ms 90 degrees counter clockwise from center position 0.9 ms 45 degrees counter clockwise from center position 1.3 ms 90 degrees clockwise from center position 2.1 ms 45 degrees clockwise from center position - 2.5 ms
Figure 9 : SRF 05 Sonar Sensor The mode pin is not used , thus we have used separate pins for echo output and trigger input. The sonar sensor is triggered by sending a 10us pulse. The echo pulse width determines the distance to the object. The range of the echo pulse is from 100us to 25 ms. The 10 us is sent to the trigger input and the echo output is received by the PIC 873A microcontroller.
EN407 : Robotics Drive mode Unipolar mode Excitation - Two way excitation
EN407 : Robotics
Figure 11 : PIC 873A microcontroller Pin Diagram In the above PIC microcontroller the following pins are configured as inputs and outputs Inputs RA1 - Echo output from sonar RB0 Interrupt from Master PIC Outputs RA3 - Trigger input to the Sonar RC0 -PWM output to the Servo Motor RC6 -USART TX to the Master PIC
EN407 : Robotics
When an interrupt arrives from the Master PIC to perform obstacle surveillance, the PWM output will be given such that the servo motor will move the sonar sensor to Position 1. At this 10
EN407 : Robotics
position the sonar will be triggered and four echo outputs will be obtained and averaged. Then the servo motor will move the sonar to Position 2 and as before the readings from the sonar sensor will be obtained and averaged. This procedure is performed in 5 positions. Finally the averaged distance readings from these 5 positions will be sent through USART transmission to the master PIC. The software flow chart of the PIC program is given below. The program is given in Appendix B . The 5 Position that readings from the sonar sensor are taken Position 1 90 degrees counter clockwise from the center position Position 2 - 45 degrees counter clockwise from center position Position 3 Center position Position 4 - 45 degrees clockwise from center position Position 5 - 90 degrees clockwise from center position
11
EN407 : Robotics
4.0 Results
After creating the mobile robot, implementing the collision avoidance algorithm on the microcontroller, testing and with modifications we were able to achieve our project goal. That is to design a collision avoidance robot. Our final version of the mobile robot was able to avoid collisions 12
EN407 : Robotics
90% of the time (according to test results). Since it is quite difficult to develop a 100% collision avoidance system, we believe that the achieved collision avoidance rate is satisfactory.
13
EN407 : Robotics
14
EN407 : Robotics
15
EN407 : Robotics
16
EN407 : Robotics
17
EN407 : Robotics
18
EN407 : Robotics
19
EN407 : Robotics
20
EN407 : Robotics
21
EN407 : Robotics
22
EN407 : Robotics
23
EN407 : Robotics
24
EN407 : Robotics
25
EN407 : Robotics
26
EN407 : Robotics
27
EN407 : Robotics
28
EN407 : Robotics
29
EN407 : Robotics
30
EN407 : Robotics
31
EN407 : Robotics
32
EN407 : Robotics
33
EN407 : Robotics
34
EN407 : Robotics
35
EN407 : Robotics
36