Using PING)), IR, Sound Impact and Whiskers on Boe-Bot
Matthews_19
Posts: 5
in BASIC Stamp
Hello,
I am working on a project that is due in a couple of weeks. I have not been able to program my robot using any other sensors other than the PING)).
I am trying to make a robot that follows sound and color, spins when it is touched by whiskers and looks for where it goes as well as escape corners.
I have got it to function with PING)) by rotating when encountering obstacles. However, I tried programming whiskers in by using a while loop but, an error occurred. I have not attempted t program with Sound Impact and IR sensors.
Any advice? ASAP would help me.
I am working on a project that is due in a couple of weeks. I have not been able to program my robot using any other sensors other than the PING)).
I am trying to make a robot that follows sound and color, spins when it is touched by whiskers and looks for where it goes as well as escape corners.
I have got it to function with PING)) by rotating when encountering obstacles. However, I tried programming whiskers in by using a while loop but, an error occurred. I have not attempted t program with Sound Impact and IR sensors.
Any advice? ASAP would help me.
Comments
First get different programs working ... one using PING))), one using IR, one using whiskers, one using sound impact. You may not be able to combine all of these and still get any kind of effective speed of reaction. PING))) takes a lot of time. IR is pretty fast. Whisker sensing is instantaneous. Sound impact timing depends on what you're doing with it. Think about (specifically) you want your robot to do with IR sensing or sound impact sensing. Try adding whisker sensing to a PING))) program first ... not using a while, but IF-THEN statements.
http://forums.parallax.com/profile/41756/Mike Green
Here's some useful information on Stamp Programming. Look particularly at the tables of statement execution time. Add comments to each statement with the execution time for the statement. Then you can trace through the program in your head and mark down the range of times for subroutines and major sections of your code.
The best you may be able to do is to stop, scan the environment with the PING and note distance sensed straight ahead and a little to the right and to the left. Your program can decide which way to turn, do so, then move straight ahead while checking the whiskers. If one of the whiskers is on, have your robot back up, then start again with the PING sensing.
Notice that only one of the following is done at a time: the wheels turn right or left, the wheels back up, the wheels go forward with whisker sensing, the PING moves, the PING senses.
I was able to get my robot to function using the whiskers and ping at the same time. However, its movement is odd. It rotates in circles instead of moving forward and the pingservo does not work. I have attached the file of my program. Please review. Any feedback is highly appreciated.
I do not know if this is a problem with hardware or simply a debugging issue with determining certain rotational values of each wheel for forward, backward and turning movements.
I'm sure there's other stuff as well, but this is something that catches beginners.
http://forums.parallax.com/profile/41756/Mike Green
I think you would want to scan with the PING and make a note in a variable of where the longest clear path is found, maybe straight ahead (1), a little to the left (2) a little to the right(3), or no path is seen within some distance (4). You'd then do something like your "taskN" where 1 = forward, 2 = turn left, move a little forward, then turn right, 3 = turn right, move a little forward, then turn left, 4 = back up. If a whisker is triggered in one of these tasks, the routine would GOTO some other routine that would look again at the whiskers, act appropriately (back up or back up and turn a little), then RETURN to start again with the PING scan.