Boe-Bot Troubles and Questions
Evan_Petersen
Posts: 3
I currently have a project for my class that requires me to build the boe-bot, it has navigate through a course using a predetermined path. I insereted the exact code below which is straight out of the handbook (Chapter 4 EEPROM Navigation). When I try to run the code onto my bot it sends an error message stating that the constant exceeds 16 bits, while highlighting the 01234567 in the EEPROM data. Does anyone know how to fix this? Im using the BS2 model and version 2.5.
' Robotics with the Boe-Bot - EepromNavigation.bs2q ' Navigate using charachters stored in EEPROM. ' {$STAMP BS2} ' {$PBASIC 2.5} ' {$PORT COM3} DEBUG "Program Running!" pulseCount VAR Word address VAR Byte instruction VAR Byte Address: 0123456789 |||||||||| DATA "FLFFRBLBBQ" FREQOUT 4, 2000, 3000 DO UNTIL (instruction = "Q") READ address, instruction address = address + 1 SELECT instruction CASE "F": GOSUB Forward CASE "B": GOSUB Backward CASE "L": GOSUB Left_Turn CASE "R": GOSUB Right_Turn ENDSELECT LOOP END Forward: FOR pulseCount = 1 TO 64 PULSOUT 13, 850 PULSOUT 12, 650 PAUSE 20 NEXT RETURN Backward: FOR pulseCount = 1 TO 64 PULSOUT 13, 650 PULSOUT 12, 850 PAUSE 20 NEXT RETURN Left_Turn: FOR pulseCount = 1 TO 24 PULSOUT 13, 650 PULSOUT 12, 650 PAUSE 20 NEXT RETURN Right_Turn: FOR pulseCount = 1 TO 24 PULSOUT 13, 850 PULSOUT 12, 850 PAUSE 20 NEXT RETURN
Comments
Evan_Petersen,
You code is Chapter 4, Activity #6 except for the comments.
The line with Address and the Vertical Pipes (|) are comments so there should be an apostrophe (') in front of them, just like the first few lines of the program.
Comments are ignored but since the apostrophes are missing, the editor thinks that it should be using that huge number so you get an error.
You can copy and paste the programs from the PDF.
https://www.parallax.com/package/robotics-with-the-boe-bot-kit-downloads/
Thank you very much, I had no clue there were pdf files for them.
I have another problem if anyone could help...
So I have finsihed the eeprom navigation code to the specifications needed for my maze (listed below). My next objective is to add the whiskers to it. When the whiskers make contact i want the bot to pause and then turn slowly the opposite way until the whisker istn making contact anymore. So in otherwords if the Right whisker is triggered then the right wheel will go forward and the left wheel will go backwards and the opposite if the left whisker is triggered. When no whiskers are triggered i want it to continue on with program ive created. Ive been trying to use the roaming with whiskers file but i cant figure out how to have it return to the eeprom code. Roaming with whiskers is also provided below under the maze code.
That's somewhat challenging with a BS2, which has neither hardware or software interrupts. Otherwise you would "simply" run your maze program until a whisker triggered an interrupt, when you would jump to the whiskers subroutine, which could return to your maze code when its done.
One possible method is to send enough servo pulses to move an inch or so at a time, then check the whiskers and repeat. No need to stop really, the whisker check is likely so fast that you won't even see the bot slow down, it will coast for a fraction of a second during the check then keep going.
One problem I foresee with your plan is that the whiskers subroutine will move your robot in random ways to get away from a wall, so when you return to your maze map you are likely headed in a different direction than before you hit the wall. After just one whisker trigger & routine, your robot is off course and it gets worse with each subsequent whisker trigger.
Have you considered modifying your whiskers to let you follow a wall?
HI, this is the same person i just got locked out of my account and I took what you said I have changed the idea. Thank you very much for the advice!!
I'm now working on a code that a professor has given me, using this code 5 IR sensors are used to detect the front, Front left and right, and sides left and right. I have the design down but I do have some questions on the code that my professor was unable to clear up with me. There are a few lines like this ( IF irDetectCenter = 0 THEN cent ) i get the that ir is detecting something causing a 0 but what on earth does cent mean? it says its not defined when i try to run the code but i dont know how to define it. Again, thank you for any help that you could provide:)
ModEdit: code tags added
BTW what causes the cent to be a problem is when I take the apostrophe away from the endif statement in the middle of the Main code. As seen in the code above it has an apostrophe, i meant to take that out. This ENDIF statement is needed for the LOOP
If you can post yor complte code using the code tag...
CR
Here is my file on the basic stamp editor, im having problems copying the code with code tag.
BS2 file even better.
Peter167,
These are useful references.
https://www.parallax.com/go/PBASICHelp/Content/LanguageTopics/Reference/ElementsStyle.htm
https://www.parallax.com/package/basic-stamp-manual/
Your code is cluttered and hard to read.
Chapter 7 of Robotics with the BOE-Bot is on Infrared Object Detection.
A LOW or 0 means that an object IS detected, and a HIGH or 1 means that NO object was detected.
Your mystery line means that when the Center IR detector sees something it should... we don't know.
Is this all you were given?
Yes, this was all that I was given to me. Im trying to get it so it can guide its way through a maze using the infrared detectors for a little show for incoming students.
for reference here is the circuit design,
Peter167,
The program and the diagram have some differences.
The diagram has P4 as the Front Right transmitter, and P2 as the Far Right Side transmitter.
Front Right should be P4 and P3, but the program uses P3 and P2.
Far Right side uses P2 but is P4 in the program.
The 1st IF...THEN...ELSEIF looks for irDetectRSide, but uses the Front Right for detection.
Which IR directions are TurnLeft, TurnRight, and TurnReverse supposed to use?
I once again have changed to project a bit to combine some of an old code that I had using specific distances with the addition of using two IR sensors on the left and right side to slow down the wheels when it comes to close to a wall to keep it from running into any sidewalls. I'm currently just trying to figure out how I can have the frequency scanning while the Boebot is traveling on its specific. As shown in the BS2 file I'm trying to make X = 1 to that it can run while looping so when X = 1 the frequency sweep is active so it would be running the entire time, although I'm trying this currently it's not working how I want it to.
I Think I figured out my previous problem but i am now stuck with it saying that my Data occupies the same location as my program..... any help here?
does this basically mean that I have too much for it to hold? I can try to shorten/combine some of the subroutines if so.
I guess I could buy the bs2p microcontroller but I want to ask if I'm correct before I spend $200 on it for next-day shipping
Peter167,
The BS2 has only 2K of EEPROM and you repeat the same code segments over and over again.
https://www.parallax.com/package/basic-stamp-manual/
Notice how the wheel pulse rates are treated as variables in the IR roaming programs starting on page 250 of Robotics with the BOE-Bot.
In AvoidTableEdge on page 245, the number of servo pulses is also a variable.
Look at the code segment at the bottom of page 133 to see as a perfect example.
The more often that you can use the same segment of code and the same variables, the more compact your program will be.
I see that you are using some of the code from Chapter 8, Activity 1 but your starting frequency values don't match.
What's a Microcontroller is a good reference for basic BS2 programming.
https://www.parallax.com/package/whats-a-microcontroller-and-linked-downloads/
StampWorks deals with more advanced BS2 programming.
https://www.parallax.com/package/stampworks-experiment-kit-manual-and-code/
Very helpful, thank you!