I am taking an 'Intro to Mobile Robotics' this summer and decided to sign up for the Summer of Robotics learning after I found out the online class I am in has no lectures other than a link to the RobotC tutorials.
I have viewed all the RobotC tutorials and some programming experience through college but I am very insecure about my programming abilities.
My first two class projects consisted of line following which I had no problem with, then wall following the inside and outside of a maze (half maze really) in three configurations with the same program. Two mazes were box shaped, the third was a circle. I used the ultra-sonic sensor to find my way out of the maze to a goal box, did a u-turn and followed the wall back to the finish box. The square boxes worked ok but the circular maze did not work so well with the ultrasonic sensor as I approached the wall at an angle, it continued to crash into the wall. I ran the program over and over tweaking various values, nearly getting it to complete the circular maze based on factors of changing swing arc, changing sensor distance and even just moving the robot's starting point to the right or left. In the end I stayed up until 3am and could not get the circular maze completed satisfactorily.
I am now on my third project which consists of 3 maze configurations again, two boxes and one circle. 5 balls are in the center of the maze. The robot starts in the center of the maze, seeks a ball, grabs the ball, follows the wall to the outside goal, does a u turn, follows the wall (opposite direction), enters maze to grab another ball (repeat four times), after four balls dropped in goal box, return to center of maze finish box.
My first problem was actually building a bot that I thought could accomplish this maze. All I had was the education base set and I quickly found out this was not enough. I raided my kids closets for as many pieces as I could find and the Lego Education expansion set is on its way, but I think I will have to finish this maze before it gets here. So far I have built a Castor Bot with a claw and an ultrasonic sensor to detect the ball at the base. There is a V shaped attachment on the front modeled after the Ball Hunter from NXT programs but I had to modify a bit because I am using table tennis balls, much smaller than the NXT red ball. I made a bumper for the back using the logic that I could turn around and follow the wall in reverse because I didn't want the bumper to interfere with the ultrasonic sensor and ball up front.
Right now, I am still working on pseudocode for this maze. I typically set it up in my garage with wood blocks and emulate the motions and running the maze to write down what I think I need to do.
I wrote functions for my last maze which kept my code simple and clean and for me, easier to understand. I will put that code at the end of the post.
The pseudocode for this maze is as follows:
move forward until ball detect
if ultrasonic sensor detects ball - lower claw(motorA)
180 degree turn
reverse forward until touch sensor hits wall
while goal box not detected
forward half second
reverse right until touch sensor hits wall
if goal box detected with color sensor
forward half second
reverse left until touch sensor hits wall
if finish box detected
Here is the actual code from my first program which wall followed the exact mazes I need for the ball maze, just without seeking and delivering balls to a goal:
I am sorry for such a long post, but I am a little overwhelmed working on this project alone and the forums for my class are not helpful. My main questions to help me proceed at this point are:
Will the touch sensor design work to follow the wall effectively for an inside and outside of maze? Is it going to be difficult since I mounted the bumper on the back of the brick?
I had issues before with the ultrasonic making the turns around the opening of the maze and got to the point of drawing a circle around the opening and trying to figure out a mathematical value for the arc to determine the best swing arc, is there a better way to do this?
I am having a hard time wrapping my head around seeking out the additional balls when I am back in the maze. In the beginning of my pseudocode, I simply go forward to find the ball because it is in front of me. After I follow the maze wall to the goal and back to the inside again, the balls are in random places and if I go forward I may never find a ball (just run into a wall). There is a simulator video that shows the robot entering the maze and after sensing the wall a second time on the inside, it turns around and seeks the ball. I am not sure how it knows it is back inside the maze..
Again, so sorry for the long post and I don't want code given to me, but any ideas about how to think about this, even if I need to redesign the bot and my pseudocode I am very open. Thank you so much.http://www.youtube.com/watch?v=11t3I_Ib ... e=youtu.be