Dragonbot/Spring/2021
Dragonbot Movement’s Adjustment Function
Author: Muath Almandhari
Table of Contents
Introduction
One of the main mission success requirements is to make the robot able to move throughout the maze in a straight path and do not deviate into the walls. Therefore, the overall goal of this blog post is to explain the functionality of Dragonbot’s movement, as well as the processes and steps, were taken to develop a robot that would recognize the path and walls around it to stay within the path.
Movement Algorithm
In order to make Dragonbot able to stay within its track and do not go over the walls, the Dragonbot is required to identify and differentiate between the wall around it and the path in front of it. Therefore, Dragonbot shall use the LDC sensors that are placed to the right and to the left of it to identify the existence of a wall around it. In addition, it will use the LDC sensor that is placed in front of it to recognize the path in front of it.
The algorithm that was adopted for this mission is to have the right LDC sensor control the movement of the left motor. On the opposite, the left LDC sensor will control the movement of the right motor. Therefore, Dragonbot’s movement will be adjusted by making the motors will turn on and off accordingly to the readings of the LDC sensors which will return a 0 if there was no walls and a 1 if there was a wall.
Software Program
In order to make Dragonbot able to have an automated drive mode, a movement function must be created to control the motors’ pins. First, three functions must be created that will get the readings from all the three sensors with the proper sensitivity ranges which are: “leftOnly()”, “rightOnly()”, and “frontOnly()”. These three functions will be called in the movement function “goForward()” which will take the readings and toggle the motors on and off according to the sensors.
One-Room Movement
After testing and verifying the ability of Dragonbot to adjust itself in the path, it was time for the next step which is to make it move one room at a time. The benefit of making the robot move one room at a time is to give the Dragonbot more time to get each room’s configurations and send it to the Game Software. Therefore, here are two solution stages that I tested to get Dragonbot to move to each room serially.
Measure Dragonbot’s Speed
My initial solution was to just make adjust either the speed of the movement time of Dragonbot in order to make it stop in the middle of each next room. Therefore, I did some iteration of testing the motor’s speed and measure the time spent to travel for one meter. Then I took the average time of these iterations and calculated the speed of the motor which turned to be = 13.6 cm/sec. Knowing that each room is about 7.5 cm and having the calculated speed of the motor, I was able to calculate the time required to get to the next room which turned to be = 0.55 sec.
However, after testing this method, I realized that this method is not a good approach because the movement of the motor varies continuously due to the adjustment delays and sensors’ readings delay. Therefore, having a constant defined time was not the best approach for the mission.
Using the Front Sensor
The second approach for this issue was to use the front sensor to detect if the robot has entered a new room or not. In order to do that, I placed a thin copper tape in each room barrier. Therefore, Dragonbot shall differentiate between the thin copper tape of the room barriers and the thick copper tape of the walls as the image shown below.
In order to control the movement of the Dragonbot between the rooms, a function was created “walk()” that would control Dragonbot’s movement between the rooms. “walk()” function will have a variable to store the time which would make it able to execute two tasks at a time. The first is to adjust Dragonbot’s movement between the walls. The second is to return the readings of the barriers and walls from the front sensor.
Conclusion
In conclusion, the purpose of this blog post is to explain the steps and the processes were taken for Dragonbot’s movement. First, it focused on the algorithm that was adopted to make Dragonbot stay within the path. Second, it focused on the algorithm adopted to make Dragonbot move one room at a time.