I need help with my boe-bot project for class
Statz
Posts: 28
So I have a boe-bot project due i think 6 or 8 weeks for class and I've decided to make the boe-bot draw out a room while roaming around it and calculate the area and the perimeter as well. I just starting learning programming this semester as well, so I know I'm going to have a lot of trouble in this class. Also! We're supposed to work in groups of two for this class, but I'm partnerless since my partner dropped out. I'm eager to try this and failing or passing isn't a main concern, because I'm taking this class for personal experience, because robots is my dream. So here's my code so far, Its just a really really rough sketch of the program.
I dont really want anyone to do my project for me, I just need a little advice on how I should go about writing my code. So here are the goals:
1.Make The Boe-bot Move around the room. When it bumps into the wall, the bump sensor will make it turn right. When The laser sees that there isn't a wall to the left, The Boe-bot Turns left.
2.After the boe-bot is done moving around the confined area, it is plugged into the computer and draws out the room with "-" and "|' on the debug screen.
3.The robot also finds a way to calculate the area and the perimeter of the room it roamed around
I know this is hard, but I just need ideas on how I should go about writing the program. Thanks a lot btw. I'm really excited about this project
' {$STAMP BS2} ' {$PBASIC 2.5} '====================Declare Variables===================== W VAR Word 'Boe-Bot Going West S VAR Word 'Boe-Bot Going South N VAR Word 'Boe-Bot Going North E VAR Word 'Boe-Bot Going East pulseCount VAR Word forwardCount VAR Byte 'Times Moved Forward turnCount VAR Byte 'Record Turning lineDirection VAR Word 'Either the "-" or "|" '===================Initialize Variables==================== W = 1 E = 1 S = 0 N = 0 '===================Main Routine====================== DO IF (IN5 = 0) AND (IN7 = 0) THEN 'Both whiskers are hit GOSUB Turn_Right ELSEIF {Laser Activated} THEN 'When Laser sees no object GOSUB Turn_Left ELSE 'Keep Driving Forward forwardCount = forwardCount + 1 'Count How Many Times Moved Forward PULSOUT 13, 850 PULSOUT 12, 650 PAUSE 20 ENDIF lineDirection = turnCount%2 'To make the following case Statement 0 or 1 SELECT (lineDirection) CASE 0 DEBUG "-" CASE ELSE DEBUG "|" ENDSELECT LOOP '===================Sub Routines=================== '----------Turn Right Routine-------- Turn_Right: '---Move Backwards--- turnCount = turnCount + 1 FOR pulseCount = 0 TO 20 PULSOUT 13, 650 PULSOUT 12, 850 PAUSE 20 NEXT '---Turn Right--- FOR pulseCount = 0 TO 20 PULSOUT 13, 850 PULSOUT 12, 850 PAUSE 20 PAUSE 20 NEXT RETURN '----------Turn Left Routine--------- Turn_Left: '---Turn Left--- turnCount = turnCount - 1 FOR pulseCount = 0 TO 20 PULSOUT 13, 850 PULSOUT 12, 850 PAUSE 20 NEXT RETURN '-----------Debugging the East "-"-------------- '**Still In Progress** debug_East: FOR E = 0 TO forwardCount DEBUG "-" NEXT RETURN '-----------Debugging the South "|"----------- '**Still in Progress** debug_South: FOR S = 0 TO forwardCount DEBUG CR, " " NEXT DEBUG "|" RETURN
I dont really want anyone to do my project for me, I just need a little advice on how I should go about writing my code. So here are the goals:
1.Make The Boe-bot Move around the room. When it bumps into the wall, the bump sensor will make it turn right. When The laser sees that there isn't a wall to the left, The Boe-bot Turns left.
2.After the boe-bot is done moving around the confined area, it is plugged into the computer and draws out the room with "-" and "|' on the debug screen.
3.The robot also finds a way to calculate the area and the perimeter of the room it roamed around
I know this is hard, but I just need ideas on how I should go about writing the program. Thanks a lot btw. I'm really excited about this project
Comments
For now, you should just have the BOE Bot measure the length of each side, and display that. You can save the drawing until later when everything else works.
Which dirrection are you going? Clockwise or anit-clockwise?
What are your sensors and where are they positioned?
How exactly do you plan to stay close to a wall?
What defines a "corner" in your program?
So here are the answers to your questions.
The Boe-bot is going to be going Clockwise, so the bump sensors will be in the front. Whenever the bump sensors are hit, the robot will 90 degree turn to the right.
The boe-bot will also have a laser pointing to the left, which will be scanning the wall the whole time. When it sees that there is no more wall, it will turn to the left and continue.
I'll have the boe-bot start off going east against the wall and to make sure it stays close to the wall, I'll have the laser make sure it isn't too far from the wall.
I actually don't know yet what is going to be a corner, but I will definately look into that. The ping sensors will help with that rite?
Thanks again.
Anyway, some IR would probably be the best tool to use (cheap mostly). The ping might work, but it's overkill. Plus you'd need to stay minimum distance away from the wall (something like 2 or 3 inches) due to the ping limitations.
Why are you turning left? I envision a box that the BOE goes around in, and since it's going clockwise it can only turn right.
So yeah, I plan to use the IR. I'm going to write the code with the IR in a couple of days, do you mind looking over it?
You may want to define what sort of room you plan to run in. It sounds like something that is, at the worst, a random shape where all the corners are 90 degrees. True? If so, then you will have a very difficult time calculating the area. My recomendation is that you create a system that tells you length of a straight piece, then the dirrection of turn, length, turn, and so on. Like this:
22, R, 3, L, 45, L, 22, R, ...
Then, output that into a PC program that will graphically display it for you.
So yeah that makes sense. Having a random room is probably too difficult for me right now. I have a big tendancy to try to do the most.
Also, yeah, I'll start off trying to find the length of 1 straight piece.
Thanks for helping me mellow down my goals for this project. I have a bad habit of trying to start off with the impossible that I forget I don't know enough yet.
Guess I just needed to know how to use the IR, now I do. So next would be being able to make it record how far its going rite?
So I'm laying down a ruler and calculating the speed itself. Seems like a good idea?
I'm excited. I'll try to make see if the resetting actually works when its supposed to.
In short: use IR encoders for distance tracking.
I'll have to learn what IR encoders are too.
-Move around a square or a rectangle
-Draw out the direction its going
-Calculate the perimeter and area of what it measured
After I test this out at school on wednesday, I'm going to have to learn how to use the transceiever, so I can send the data back to another breadboard to display on the debug terminal. I'm so excited ^_^