As a mobile robot operates in environment, its actual position and orientation are not exactly the same as targeted. Therefore, it is important to know about the robot’s definite current position for controlling it. In this section, three methods for positioning are described; using encoders, using ultrasonic ranging sensor, and using both ultrasonic and encoder sensors.
Positioning Using Encoder
In order to position the robot using encoders, it is necessary to take two steps. First, encoders should provide the current robot position. Second, it is important to reach the target position given by the supervisor.
Receiving the Robot’s Current Position Using Encoder
It is imperative to know the current position of the robot to know if it is working correctly or whether it reached the target point without errors or not. However, it is necessary to first know that the robot’s initial point is (0,0) in cm. Let’s assume that the robot was not at the initial point due to some accident, power or system shut down for instance. Thus, it becomes extremely necessary to be aware of the robot’s current position. If the robot was not at start point (0,0), the supervisor could execute the manual mode to control the robot manually to the start point. The manual mode could be done in two different ways: by controlling the motors using two keys on the keyboard or by giving the values of both angles (θ) and distance to reach home point.
It must be mentioned here that encoders provide measurements in Ticks (encoder pulses output) for which motors turn. This could be converted to cm to obtain the turning angle (θ) and the travelled distance. Equation (1-1) converts Ticks to cm as follows:
distance cm= Number of Ticks × circumferencenumber of Ticks per revolution÷10 (1-1)
For example, the Ticks measurement of two encoders, 1 and 2, are 1500 and 1000 respectively. By converting the Ticks to cm, we get (26, 17) from (1500, 1000). For the distance travelled, both encoders should have the same output Ticks. Therefore, the travelled distance is 17 cm. The angle (θ) is given by subtracting the greater number from the lesser number which gives 9 cm to the right hand direction because encoder 1 (right motor) is greater than encoder 2 (left motor).
Travel to Target Point Using Encoders
The robot travels from point to point based on the command received from the supervisor. The method used is to calculate the target angle (θ) and the travel distance to reach the target point. When the supervisor gives a command point in cm, this command should be converted to angle (θ) and distance in Ticks.
First, it is required to get the angle (θ) and distance from current point to target point. Equation (1-2) calculates the angle (θ) in degrees of target point as follows:
Angle θ=arctanyt-y0xt-x0 (1-2)
Equation (1-3) will take the angle (θ) in degree and convert it to a distance in cm.
Angle distance (cm)=Robot Diameter × π ×Angle in degrees360 (1-3)
Later, Equation (1-4) will convert the angle in cm to Ticks which is necessary for better resolution and more accurate reading from the encoder.
Angle distance (Ticks)=Angle distance in cm×10Distance per revolution in mm (1-4)
Second, it is required to get the travelled distance to target point. Equation (1-5) calculates the distance in cm from the current point to target point as:
Distance (cm)=xt-x02+yt-y02 (1-5)
After using Equation (1-4), it is necessary to convert the distance in cm to distance in Ticks.
Figure 1-1 shows the navigation and control system using two encoders. Figure 1-1 (a) shows how the robot identifies its current position using two encoders whereas Figure 1-1 (c) demonstrates how the robot turns by the calculated target angle. Figure 1-1 (d), on the other hand, shows how the robot travels to the target after calculating the target distance from the current position.
Figure 1.1: Positioning and Control using 2 encoders
Positioning Using Ultrasonic Ranging Sensors
In order to attain positioning using a ranging sensor, four ultrasonic ranging sensors are used to know the current position of the robot and reach the target position given by the supervisor. Only one or two sensors are used out of the four ultrasonic ranging sensors.
Getting the Robot’s Current Position Using 4 Ultrasonic Sensors
There are two methods for localisation using ultrasonic ranging sensor. Both methods use 4 ultrasonic ranging sensors.
Method 1
The first method is to localise the robot in one quadrant where both x and y axis are positive. The area consist of two walls, x and y axis. Also, only two sensors are used to navigate the current position of the robot. Because there are only two walls on the area, there are 4 cases in order to navigate the current position depending on the direction the robot is facing. Thus, the first thing to know is the sensors with their order number:
Sensor 1; back sensor
Sensor 2; left sensor
Sensor 3; front sensor
Sensor 4; right sensor
The robot navigates it current position using only two sensors depending on the direction the robot is facing.
Robot facing North; current position is (x = Sensor 1, y = Sensor 2)
Robot facing East; current position is (x = Sensor 4, y = Sensor 1)
Robot facing West; current position is (x = Sensor 2, y = Sensor 3)
Robot facing South; current position is (x = Sensor 3, y = Sensor 4)
Figure 1-2 illustrates the method used for navigation using 4 ultrasonic ranging sensors and area with 2 walls.
Figure 1-2: Navigating the current position of the robot using 4 ultrasonic ranging sensors in 2 walls area
Method 2:
This method was developed to compare the navigation and control system using ultrasonic ranging sensors to the system using encoders. It means the system needs to navigate the robot at 4 quadrants and requires 4 walls in the testing area.
The middle point of the area will be the initial point (x=0, y=0). There will be only two cases for this method. They are:
Robot facing North or South; current position is
x = Sensor 2 - Sensor 4; if Sensor 2 is greater than Sensor 4, the robot is heading East which means x is increasing (positive). If Sensor 2 is less than Sensor 4, the robot is heading West which means x is decreasing (minus).
y = Sensor 1 - Sensor 3; if Sensor 1 is greater than Sensor 3, the robot is heading North which means y is increasing (positive). If Sensor 1 is less than Sensor 3, the robot is heading South which means y is decreasing (minus).
Robot facing East or West; current position will be the other way round. The x axis value will take Sensor 1 and Sensor 3 and y axis value will take Sensor 2 and Sensor 4.
Figure 1-3 illustrates the method used for navigation using 4 ultrasonic ranging sensors and area with 4 walls.
Figure 1-3: Navigating the current position of the robot using 4 ultrasonic ranging sensors in 2 walls area
Figure 1-3 (a) shows the 4 sensors used for the system and the conditions of navigation depending on the direction the robot is facing. Figure 1-3 (b) shows the robot at the initial point and the calculations of navigation system. Figure 1-3 (c) shows the robot at point (40, 20) and the navigation calculation.
Travelling to Target Point Using Ultrasonic Ranging Sensors
The robot travels to target point received from the supervisor using either 1 or 2 ultrasonic ranging sensors. The target given point is on cm so the first thing to do is to convert the cm to the Analog output reading from the ultrasonic ranging sensor (microsecond-used) by using equation (1-6).
Duration μs= Distance cm×58 (1-6)
Figure 1-4: Navigating the current position of the robot and the method used to travel to target point
The method used to reach the target point is to make the back sensor (Sensor 1) equal to the target point y and x respectively. For example, if the robot is at point (10, 20) facing north as shown in Figure 1-2 (a); the robot knows its current position in 2-walls area (as mentioned earlier). A target command received equals (60, 40) in cm. This value must be converted to duration time. The robot will go forward till the sensor value gets to 50 (y-value) as shown in Figure 1-4 (b). Afterwards, the robot will turn 90 degrees to the right as in Figure 1-4 (c) and then move forward till the sensor value reaches 40 (x-value) as in Figure 1-4 (d).
One way to improve the system is to use Sensor 3 in order to reach a specific point. Now, the system has 2 sensors used to reach the target point. This method is used only in 4 walls area. If it is assumed that the testing is 2x2 meter and the robot wants to get from 0 to 30 cm, it will move forward till Sensor 1 reads 30 cm and Sensor 2 reads 170 cm.