This robot car goes through a maze to detect balls with avoiding obstacles. This robot uses LADAR, a camera, a gyroscope module, and a setup of motion capture cameras in the room to complete the tasks.
The tasks of the robot include going through a random maze and getting to the set points in the course and meanwhile, if a ball is detected, move towards it, open the gate in front of the ball, and gather the same colored one in its designated compartment using a tong attached to a servo motor. In the course, there are cubic wooden obstacles that the robot should avoid colliding with them. After exiting the maze for the second time, there are two chutes for each ball color for the robot to dispose of the balls. Fig 1 is a map of the course and chutes. Meanwhile, the data on the robot's location and the balls collected based on their colors are being printed on LabVIEW.
1. Vision
For ball detection, the camera on the robot detects the range of colors on the LAB chart. To set up the parameters for both colors, purple and orange, we used OpenMV to capture a snapshot (Fig 2) of the balls. We extracted the parameters by using this software. We implemented the Python code for blob detection with the LAB parameters to run on the Raspberry PI board on the robot, where the blob is detected, and based on its circular shape, the center of the ball is calculated.
During the contest, the conditions were such that if orange or purple were detected, the robot would turn and slow down and make a straight move toward the center of the ball after not seeing the ball, meaning the ball was below the frame of the camera,stops, open its gate, turn the tongue to open the compartment under the robot that is designated by the color, make a slow move forward towards the center of the ball and continue its straight movement for 0.667 seconds, ensuring the ball is under the robot and close the gate.
2. Obstacle Avoiding
In order for the robot to avoid obstacle collision, we decided to make the robot do a wall follow. There are two scenarios where the robot can select between the right and left wall follow. Using LADAR, if the robot detects an obstacle in less than 0.85 feet on a sweep of the right and front sides, it will make a sharp turn to its left and start moving forward until obstacles are passed, which is determined by LADAR. This will lead the robot to follow a block on the right side until an exit condition. The wall follows has the same procedure; the condition for the robot to do a left wall follow is for the sweep of indexes of LADAR in front and left side of the robot to detect an obstacle in 0.8 feet distance it will make a sharp turn right in place and move forward until the obstacle is passed or another exit condition is fulfilled.
Another condition for the robot to detect and avoid the obstacles is for the robot to map its surroundings with 7 LADAR indexes, two on the sides, another two on the front right and front left, and three in a slight range of right, left of the front, and front of the robot at any location. This mapping of obstacles is bound to a certain distance of obstacles and repeatedly observing the same obstacle three times. ; in the generated map, for the robot to run, its path-finding algorithm would change, and a barrier would be added to the map. These points are bound to 8 neighbors of the robot's location, which will be explained in the A* algorithm section.
3. Path-finding
Our robot car had to go to specific points inside and outside the contest's course. Therefore, there should be an algorithm for the robot to find the best possible path from its location to the next set point. For this purpose, we used A* algorithm to generate paths at each location of the robot to get to the next point. Using A*, we set 8 neighbors for the robot at any location based on tiles on the floor where a possible obstacle might appear. Four of these points are in front, right, back, and left side, and the other four are the corners if we consider the robot in a tile of gridlines. As mentioned before, the robot maps the surrounding while moving, so if any obstacles are found, meaning within a certain distance of the robot LADAR detects an obstacle for more than three times in the exact location. In this case, the map used for the A* algorithm to generate a path will receive the obstacle data as a point as impossible to travel to. The algorithm then, based on eight neighboring points, has chosen the possible points and then, based on the distance of the point and the distance of the point to the goal point, weights the points and chooses the most efficient accessible one. In our algorithm, we decided to calculate the distance of a point by the diagonal distance of its Euclidean distance on the square grids. Therefore, the robot would consider diagonal travel if the point is the most accessible one, which will help us with the period of completing the tasks.
The robot's current location was captured by the moving capture cameras surrounding the course, and data was set to a global coordinate.
4. Ball Diposit in Chutes
The chute, as shown in Fig 1, are color tagged. For less complexity, because of the relatively close distance of the points of the last two destinations and lack of any obstacles in between, the robot, after using A* to get the First chute then without going back to A* algorithm to generate a path will go to the second chute to deposit the remaining balls. First, the robot would reach the chute point, then stop and turn the tongue to open the purple color section, open the gate, and move back for two seconds. Then, the robot stops, closes the gate, moves to the next point, and follows the same procedure.
5. Robot Logic of Decision Making
Due to the case structure of our robot tasks, we structured our state machine with different cases followed by if statements to implement conditions for the main cases, such as obstacle detection on the front-right side, obstacle detection on the front-left side, orange ball detection, purple ball detection, and ball deposit points. In total, six main cases and eight subcases followed by the main cases.
6. The Contest
A demo of our first run on the contest day is attached. Finally, the last run had more improvements. The robot's moving velocity was faster; it avoided obstacles in the field completely, gathered all five balls and deposited them, and sent the location of four of the balls correctly to the LabVIEW and was placed third in the contest.
Please find the demo day video here.
Comments