|
Explore TEAMS!
|
Student /
Lfitzlab5Lab5 In this lab, we had a choice of either mimicking a Breitenberg vehicle that drove towards and away from the light or following a wall. I chose to follow the wall. My coding strategy was very similar to the one I used in line following. I did not use any sort of algorithm as I was alble to follow the wall without one. Instead I used a series of if loops, with each condition leading to an action- turning left, turning right, or driving straight. For example- if there's a wall to the right but none in front, drive straight; if there's a wall ahead and a wall to the right, turn left. This lab differed from line following only in the sensors used- long range distance sensors mounded on the sides and on top of the robot instead of two cliff sensors in front of the robot. In wall following, I mounded my sensors in the front and on the right side of the robot. Because the distance sensors are innaccurate at distances less than 4 cm, I had to mount the sensors recessed towards the center of the robot instead of on the outside. This contributed to the robot getting stuck in tight corners. I added some features my wall following code. To start the program, one has to press play. There is also a safety function that knocks the robot out of the code if it senses unsafe conditions like wheeldrops. Because the robot was at this time permanently outfitted for the egg hunt, complete with hand-made bump sensors, I used the dontcrash function that I used in my egg hunt code. It works like a simplified version of wimpmode- when a bumper is pressed it turns 90 degrees from the source of the bump, and then continues on with its regular programming. I added this function mainly to protect the various egg hund add ons, but it came in handy in some of the corners. Problems I faced in this lab were getting stuck in tight corners. If I had to write the code over again, I would have the robot turn 90 degrees when it saw a wall in front of it instead of trying to manouever the turn based on the distances to each wall of the corner. Because of the egg hunt, I had to program the robot to move backwards instead of forwards (the part of the robot with the cargo bay became the front). This was somewhat tedious, but not a major problem. Overall, my code worked well except for very tight corners. This lab provided a good introduction to analogue and digital sensors as well as switches. ![]() |