Participants: Helene, Lukas, Daniela
Duation: 6 hours
Goals
Implement detecting of new nodes and determine the robots position on the map. Start building the internal graph representation of the map.
Plan:
- Refine mechanisms for determining road directions and for finding black lines while rotating.
Results:
General problems with changing light conditions
During this session, we encountered a problem with the color sensor. The color detection that we used in the previous sessions, started to not recognize the yellow markers anymore. We argue that the problem was due to the changing levels of light between the sessions due to weather conditions. The first thing we did, was then to move away our track from the window, thus providing a more stable light level. This did improve the situation a bit, but we still had a lot of problems. We then decided to look into the color detection code going from the use of build-in colors IDs to analyzing raw sensor data, but saw how the values still were too unstable and therefore it was difficult to detect the yellow color from these values. In the end, we decided to move our track away from the windows, to a place where the light was mostly artificial and did not change all the time.
Detecting crossroad's outgoing edges and driving along a random direction
Last session, we decided to limit the the number of directions to four. This means, all angles have to be changed to 0, 90, 180, 270, and there can not be any skew edges. All edges on the graph have to be orthogonal to each other. To normalize all angles the robot encounters, we wrote a simple function:
![]() |
| Method to normalize all angles to four cardinal directions. |
We changed all angles in the program to be normalized. Now, after detecting edges at a crossroad, the robot tried to turn to an edge, but would not turn enough or too much, and simply drove off the map. This happens, because the angles in the real world are not necessarily normalized direction. To remedy this, we chose to let the robot rotate less than the angle it wanted to turn, and then keep turning, while using the left sensor to detect a black line. When the black line is detected, the robot stops turning, and only turn a small amount, which we estimated, to place the light sensors above the black line. Now we can safely give control to the P(ID) controller again, without the robot just driving off the map.
![]() |
| Code for searching a black line, while rotation to a chosen angle. When rotating, test if the robot sees a dark value, if so, turn 7 degrees. |
Finding crossroads and building nodes
We have implemented a Location class that maintains the coordinates (x,y) of a crossroads and which other nodes (crossroads) it is connected to. The implementation can be found here:
Location class
When the robot meets a crossroads, we search through all the Location-objects we have stored, and search for the node, that hast the shortest distance to the robots current position.
We now have three scenarios:
- There are no Location objects yet: We simply create a new Location, and store the position the robot is at right now.
- The distance is below some threshold (5-10 cm): We assume that the node we currently visit is the same as the closest node. We then reset the robots current position to the position of the closest node. We do this to keep the error in the robots position to be the same, as the first time the robot visited this node. This helps keeping the error from accumulation over time
- The distance is bigger than the threshold: We assume that we are visiting a new crossroad that we have not seen before. We create a new Location object and save the new crossroad position and let the robot rotate around its axis in order to detect the outgoing roads. We connect the current crossroad/Location to the Location we saw last.
We ran the robot a few times and noticed some problems in the node detection mechanism, since the robot wasn't always able to detect new nodes. What happened was, that the robot could not correctly compute, which Location-object was the one that was closest by, and the Location-objects coordinates would change, even though these coordinates are never supposed to change. We assumed that there must be some error in the code and decided to address the problem in the next session.
Conclusion:
We experienced some problems with the light conditions, and found that the best way to handle this, was to move our track away from the windows, and hope that the light conditions would not be to much of a problem.
We found that our resriction to 90 degree angles was very successful, since the car almost never drove of the track. However, we experienced some strage error in the information about the location of the robot and the crossroads. We did not have time to investiagete this further at this lab session, but will start by adressing this concern at the next session.
Plan for next time:
- Debug our program to find the error with the location.
- Start building the internal and send it to the computer.
- Write a graphical interface for the computer to show the map the robot is building.



No comments:
Post a Comment