Shop OBEX P1 Docs P2 Docs Learn Events
project boebot ---> I need some help!!!! — Parallax Forums

project boebot ---> I need some help!!!!

robotjerobotje Posts: 10
edited 2006-01-06 19:00 in Learn with BlocklyProp
Hello,

We have a project and now we have a problem programming the boebot the proper way! We use the BS2 bord. and we navigate with ir and line·detection. the line detection is needed because we need the turn left some times.·The boebot makes the wrong dicisions when it comes to brandbeslissingen.·It does terugweg0 or terugweg1 or terugweg2 but not every time the same way. We think it hapens because we use more gosub´s and it make a error!

Can some one help use with our program?

If you need more information please let me now that

greeting Ernstjan Grosman

Comments

  • SN96SN96 Posts: 318
    edited 2005-12-13 14:18
    The code looks to be in German, its very hard to follow.

    Anyone else?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike

    ·
  • edited 2005-12-13 17:59
    Hi,

    It's best to design each subroutine so that it does a specific job.· When it's done with its job, it should return to the main routine.· It might help to move most of the decision making to·the main routine.· Then, the main routine can call subroutines as needed.· There are a·two examples of ways to organize·a large program for a robot with lots of sensors in Applied·Robotics with the SumoBot, Chapter 4, Activity #6.· Take a look at them and examine how the decision making process never allows a GOSUB without a RETURN.· You can download a .pdf of that book from this page: http://www.parallax.com/detail.asp?product_id=27402.

    Below·is an example of the kind of problems your programming is having.· I stopped at the first problem I found, but I·suspect that there will be more.··If time2 > 50, the Licht subroutine does not RETURN.· If certain conditions are true, the Beslissing subroutine sends the program to Links, which is a routine, not a subroutine.· The Links routine has the command GOSUB licht.· At this point, the Licht subroutine has been called twice, but the program never returned from the previous call.· This breaks the subroutine call stack.· Anything else in Links also breaks the call stack (if the program does not return from·Licht the first time).·


    GOSUB licht
    · .
    · .
    · .
    'Brand detecteren
    licht:
    HIGH 3
    RCTIME 3, 1, time2
    IF (time2>00070 )·················· THEN LOW 5
    IF (time2>00001) AND (time2<00050 ) THEN GOTO Brandbeslissingen ELSE RETURN

    '
    '
    beslissing:
    IF time < 1300 THEN aantal1 = 1
    IF time > 2500 AND aantal1=1 THEN aantal2=1
    IF time < 1300 AND aantal2=1 THEN aantal3=1
    IF aantal1=1 AND aantal2=1 AND aantal3=1· THEN aantal = aantal+1 : aantal1=0 : aantal2=0 : aantal3=0

    'sturen
    IF aantal = 1 OR aantal = 5 OR aantal = 7 OR aantal = 10 OR aantal = 12 OR aantal = 16 OR aantal = 18 OR aantal = 21··· THEN links
    · .
    · .
    · .
    '
    links:
    FOR counter2 = 0 TO 4
    GOSUB vooruit
    GOSUB licht······················· '***************** Breaks call stack if time2 > 50
    NEXT
    FOR counter2 = 0 TO 4
    GOSUB linksbocht
    GOSUB licht
    NEXT
    aantal = aantal +1
    GOTO main



    Post Edited (Andy Lindsay (Parallax)) : 12/14/2005 2:41:12 AM GMT
  • robotjerobotje Posts: 10
    edited 2005-12-15 11:10
    We have change soms things but the program did still not run good...·blush.gif· And the program is now not more Dutch, and it's more easy to read tongue.gif
    We have moved the most dicisions to the main, we have changed the subroutine licht (thats now called light)

    But still we have a big problem with programming the way back.

    I think the B2 can't make a good dicisions, some times the boebot makes at differend point the same way back but the program say some thing else... So i have used:
    ........
    ReturnHome1:
    IF N_O_L = 2 THEN N_O_L =· N_O_L + 50
    ........


    We have moved the dicisions to the main but we need differend way's back to ower starting point.

    Will someone look at it again....? And·tell me what is ower problem confused.gif
  • edited 2005-12-15 19:34
    I apologize because I cannot see the problem in the limited time I have. I can only try to make helpful comments with each revision of the program. Hopefully one of the comments will help you solve the problem, or perhaps somebody else on this forum will feel inclined to delve more deeply into the program or maybe see what I am missing.

    Does the Boe-Bot have to make left turns after it has crossed a certain number of stripes?

    You can rewrite the Steering routine like this:

    '
    [noparse][[/noparse] light detection ]
    GOSUB light_detection

    SELECT N_O_L
    · CASE 1, 5, 7, 10, 12, 16, 18, 21, 23
    ··· GOTO Left
    · CASE 27, 29, 32, 34, 38, 40, 43
    ····· GOTO Left
    · CASE 3, 14, 25, 36
    ··· GOTO Uturn
    · CASE 45
    ··· N_O_L = 0
    ENDSELECT

    I'm wondering about the Line detection and Led Line routines. The Led Line routine is not really displaying the same conditions Line Detection routine is looking for. Perhaps the LED should not be set LOW until Line < 1300. Maybe there can be a second LED for when Line < 1300 AND Number2 = 1.

    Another potential problem is that you have a photoresistor that's looking for a light from above. That light from above might be interfering with your Line photoresistor. The Line photoresistor should probably have a light that overpowers any light interference from above. A better option would be the QTI line sensor <http://www.parallax.com/detail.asp?product_id=555-27401>, or the QTI Line Follower AppKit<http://www.parallax.com/detail.asp?product_id=28108>.

    I would also recommend making a copy of the program and inserting DEBUG commands at key places. Then, run the program with the servos disconnected. If you have a Board of Education Rev C, that means set the power switch to position-1. While you pass stripes under it, and move the lamp around it, the Debug commands will show you what the robot sees. I have examples of this in Applied Robotics with the SumoBot, Chapter #5, Activity #3. Another thing you can do is datalog the navigation, and replay it in the Debug Terminal. See Chapter #5, Activity #4.
  • robotjerobotje Posts: 10
    edited 2005-12-16 23:26
    hello,

    I understand you don't have time for this.

    Monday I will try·the "case" sernario... But i think that only makes the·first route beter, not the way back.·The boebot have to turn left or make a U-turn on his route. If the route is completed, the boebot·resets and start agian.·But if it get a low signal from the LDR-light than it must·make the shortest way back to his starting point.

    Monday·I wil·make a picture of ower of ower boebot and the route he must make maybe than someone understands what the function of this program is.

    We have Debuged·al the values and they are correct! If i placed a debug ?N_O_L in the returnhome0 or other and the program gets ther de PC shows the value on screen so i think thats work·good too.·The line counter works good because we have made some thing so the light that the LDR-light need to make it value low does not interfeer the line detection LDR.

    Some colleges of mine think the boebot can't make its way back but·I think there must be a way...

    So if there is someone locking at this topic and now's what i missing please tell me...

    Greeting;

    H2IA04,

    Ernstjan Grosman· (Dutch student Industrial automatisation)

    ·
  • edited 2005-12-17 20:35
    I agree with you. If the Boe-Bot can get to the end of the course, it should definitely be able to make its way back to the beginning.

    The SELECT...CASE code block is just a way of making your code easier to read and maintain.

    Is the problem getting back by the shortest path if the light LDR receives a low signal?

    A couple of commands you may find useful are WRITE and READ. You can use the WRITE command to store features of the course in the portion of the BASIC Stamp's EEPROM program memory that is·not used to store the program. You can then use the READ command to retrieve these features that were recorded earlier. You can also use the DATA directive to pre-record features of the course into the BASIC Stamp's program memory, and the READ command to retrieve these prerecorded features as your Boe-Bot navigates the course. I do not know if they will help for your Boe-Bot's particular problem, because I'm still not sure what it is. I decided to mention them because they have proven useful in other maze challenges.

    The picture will probably help. Please also try to explain exactly where the Boe-Bot makes the wrong decision and what it is supposed to do. Your writing in English is much better than mine would be if I tried to write in Dutch!
  • robotjerobotje Posts: 10
    edited 2005-12-19 09:01
    Hello,

    Haha if you·have had dutch on school you would speek and write it too!

    The boebot makes the wrong decisions when it muts decide if it must take ReturnHome0 or ReturnHome1 or Returnhome2 .....

    The code of that part of the program is:
    '
    [noparse][[/noparse] Alarm ]
    IF Alarm = 1 AND N_O_L = 0 THEN GOTO ReturnHome0
    IF Alarm = 1 AND N_O_L = 2 THEN GOTO ReturnHome1
    IF Alarm = 1 AND N_O_L = 4 THEN GOTO ReturnHome2
    IF Alarm = 1 AND N_O_L = 6 THEN GOTO ReturnHome3
    '
    [noparse][[/noparse] navigation ]

    Alarm is setted only as the boebot sees a light

    N_O_L is used in the main program and in the wayback if we debug it, it keeps it value so that won't be te problem! But i still will try the read and write commands...

    If you look ar the attachments you maybe better understand the route and the way the boebot muts retrun to his Home!


    Greeting;

    H2IA04,

    Ernstjan Grosman· (Dutch student Industrial automatisation)
    1024 x 768 - 178K
    1024 x 768 - 178K
    1024 x 768 - 119K
  • edited 2005-12-19 20:48
    Is your serial cable long enough to use DEBUG commands to tell you the values of variables? If not, you can use a piezospeaker to tell you. For example, you can connect a piezospeaker circuit to P4. Then, in your program, add this to the Initialization routine:

    FREQOUT 4, 2000, 3000

    This will tell you if the Boe-Bot's program re-started. There are two reasons it could restart: (1) Executing more RETURNs than GOSUBs, and (2) power supply brown-out due to low batteries or abrupt maneuvers.

    Add a nibble variable named counter3 to your variables. Then, modify the ALARM routine as shown below. This will tell you what the N_O_L value is before your branch.

    '
    [noparse][[/noparse] Alarm ]

    IF Alarm = 1 THEN

    · FOR counter3 = 0 to N_O_L
    ··· FREQOUT 4, 3500, 200
    ··· PAUSE 200
    · NEXT

    · PAUSE 500

    · IF NOL // 2 = 0 THEN
    ··· ON (N_O_L / 2) GOTO ReturnHOme0, ReturnHome1, ReturnHome2, ReturnHome3
    · ENDIF

    · BranchError: FREQOUT 14, 10000, 3500

    ENDIF

    '
    [noparse][[/noparse] navigation ]
    ...


    Next, modify ReturnHome0 by adding a FREQOUT and PAUSE command, like this


    ReturnHome0:

    FREQOUT 14, 200, 4200
    PAUSE 200
    ...


    Modify ReturnHome1 by adding two FEQOUT and PAUSE commands, like this:


    ReturnHome1:

    · FREQOUT 14, 200, 4200
    · PAUSE 200
    · FREQOUT 14, 200, 4200
    · PAUSE 200
    · ...


    Modify ReturnHome2 by adding three FEQOUT and PAUSE commands, like this:


    ReturnHome2:

    · FREQOUT 14, 200, 4200
    · PAUSE 200
    · FREQOUT 14, 200, 4200
    · PAUSE 200
    · FREQOUT 14, 200, 4200
    · PAUSE 200
    · ...


    Modify ReturnHome3 by adding four FEQOUT and PAUSE commands, like this:


    ReturnHome3:

    · FREQOUT 14, 200, 4200
    · PAUSE 200
    · FREQOUT 14, 200, 4200
    · PAUSE 200
    · FREQOUT 14, 200, 4200
    · PAUSE 200
    · FREQOUT 14, 200, 4200
    · PAUSE 200
    · ...


    The number of 3.5 kHz beeps will tell you the value of N_O_L. Keep in mind that the number of beeps will be 1 if N_O_L is 0, 2 if N_O_L is 1, 3 if N_O_L is 2, etc... If the piezospeaker beeps continuously for 10 seconds, it indicates NOL was not a correct value. If it does jump to a ReturnHome routine, the number of 4.2 kHz beeps will tell you which ReturnHome routine the program jumped to. Again, for ReturnHomeN, the number of beeps will be N+1.

    One thing I'm interested in is the Line Detection state machine. I am curious to find out if the Alarm routine always makes the right decisions, but the value of N_O_L is not always right.· The number of beeps·should tell you this information.

    I do not recommend experimenting with READ and WRITE commands at this point.

    I do recommend using SELECT...CASE in your steering routine.

    Post Edited (Andy Lindsay (Parallax)) : 12/19/2005 8:51:10 PM GMT
  • robotjerobotje Posts: 10
    edited 2005-12-20 14:59
    ...thanks...

    That worked good

    The boebot reset's itself if it gets to bussy, so we have connected a extra power supply pack. So thats problem is solved And the short high bleeps work very well too!roll.gif


    The value the boebot gives:

    Before line 1: One time high 7 and high 9 and one time FREQOUT 4, 200, 4200
    after line 1: three times high 7 and high 9 and two times FREQOUT 4, 200, 4200
    after line 2:five times high 7 and high 9 and·three times FREQOUT 4, 200, 4200
    after line 3:seven times high 7 and high 9 and·four times FREQOUT 4, 200, 4200
    after line 4:nine times high 7 and high 9 and·six times FREQOUT 4, 200, 4200

    So that will be ok!


    But now I have another question for you:

    You asked us to use this code:

    IF Alarm = 1 THEN

    · FOR counter3 = 0 to N_O_L
    ··· FREQOUT 4, 3500, 200
    ··· PAUSE 200
    · NEXT

    · PAUSE 500

    · IF NOL // 2 = 0 THEN
    ··· ON (N_O_L / 2) GOTO ReturnHOme0, ReturnHome1, ReturnHome2, ReturnHome3
    · ENDIF

    · BranchError: FREQOUT 14, 10000, 3500

    ENDIF


    And·I must say it works good, the boebot always makes the good decisions. The question is how can we change or make a new piece of code what can make decisions of odd numbers? So we can make the whole route complete with ReturnHome's
  • edited 2005-12-20 19:46
    Well, one way to do it would be to add a condition for odd values. I don't think it's the best approach, but here is an example:

    · IF NOL // 2 = 0 THEN
    ··· ON (N_O_L / 2) GOTO ReturnHOme0, ReturnHome1, ReturnHome2, ReturnHome3
    · ELSE ' Same as ELSEIF N_O_L // 2 = 1
    ··· ON ((N_O_L - 1)/2) GOTO OddRoutine0, OddRoutine1, OddRoutine2, ...
    · ENDIF

    You might actually be able to use ON...GOSUB like this.

    · ON N_O_L GOSUB [noparse][[/noparse]ReturnHome0, OddRoutine0, ReturnHome1,
    ················· OddRoutine1, ReturnHome2, OddRoutine2,
    ··················ReturnHome3, OddRoutine3,...]

    For more flexability, use a LOOKDOWN command before the ON...GOTO. This is important if N_O_L does not necessarily follow a sequence.

    · offset VAR Byte
    ··· .
    ··· .
    ··· .
    · LOOKDOWN N_O_L, [noparse][[/noparse]0, 1, 2, 3, 4, 5, 7, 13, 22 ...], offset
    · ON offset·GOTO [noparse][[/noparse]ReturnHome0, OddRoutine0, ReturnHome1,
    ·················· OddRoutine1, ReturnHome2, OddRoutine2,
    ···················ReturnHome3, OddRoutine3, OddRoutineA,
    ·················· evenRoutineB...]

    For maximum flexibility, use SELECT...CASE. It helps if you need to insert extra commands before executing the GOTO commands. Another useful feature of SELECT...CASE is that you can make a list of arguments, like CASE "A", "B", "Y", "Z", or even CASE "A" to "Z".

    · SELECT N_O_L

    ··· CASE 0
    ····· FREQOUT 4, 100, 4000
    ····· GOTO ReturnHome0
    ····CASE 2
    ····· HIGH 5
    ····· PAUSE 100
    ····· LOW 5
    ····· GOTO ReturnHome1
    ··· CASE 4
    ····· GOTO ReturnHome2
    ··· CASE 6
    ····· GOTO ReturnHOme3
    ··· CASE 1
    ····· Goto OddRoutine!
    ··· CASE 2
    ····· GOTO OddRoutine2
    ··· CASE 3
    ····· GOTO OddRoutine3
    ··· CASE "A", "B", "Y", "z"
    ····· GOTO CharacterRoutine
    ··· CASE 100 to 200
    ······GOTO HighN_O_L_Processor
    ··· CASE ELSE
    ····· FEQOUT 4, 10000, 3500
    ·
    · ENDSELECT

    One last note.· Consider using WRITE comamnds to record what the Boe-Bot does on the way out.· Then, use READ commands to repeat the maneuvers on the way back.

    Post Edited (Andy Lindsay (Parallax)) : 12/21/2005 1:43:20 AM GMT
  • robotjerobotje Posts: 10
    edited 2005-12-22 08:42
    Hello...

    I have tryed the first piece of code and that worked. The other pieces i will try next week because I now haven't time...

    We have get a·problem... that we have earlier. The boebot resets itself if it gets busy even with a good power supply! Is there a way to find out what the reason for this probelm is?

    Can you explain how the lookdown commands works and the On command! I have looked at the Pbasic Syntax Guide but I don't understand it...

    Finaly you write the case selection code and you mention that we can make CASE "A", "B", "Y", "Z", or even CASE "A" to "Z". This may one works if you have to run every letter one time! Is there a way to program Returnhome 1 with this manner of programming?

    this is the code:
    ...
    '
    [noparse][[/noparse] Return Home 1 ]

    ReturnHome1:

    IF N_O_L = 2 THEN FREQOUT 4, 200, 4200:PAUSE 500:FREQOUT 4, 200, 4200:PAUSE 500:N_O_L = N_O_L + 1
    IF N_O_L = 3 THEN GOSUB leftfire

    GOSUB navigationfire
    GOSUB linefire

    IF N_O_L = 5 THEN GOTO Done

    GOTO ReturnHome1
    ...

    Thank you and Merry christmas in advance

    Best regards;

    H2IA04,

    Ernstjan Grosman· (Dutch student Industrial automatisation)
  • edited 2005-12-23 22:38
    Ernstjan,

    The most common cause of Boe-Bot reset is 1.2 V rechargeable batteries.· If you use 1.5 V alkaline batteries, it should solve the power supply problem.·

    Another thing you can do is change the jumper between X4 and X5.· If it is set to Vdd, try setting it to Vin instead.· CAUTION: If you set the jumper between X4 and X5 to Vin, only use the battery pack.· Do not use DC supplies that you can plug into the wall.· If you want to use a DC supply that you can plug into the wall, you must set the jumper back to Vdd.

    Another thing you can try is ramping, making the servo change speed gradually.· See EepromNavigationWithRamping.bs2 in this article:·Boe-Bot® Robot Navigation with Accelerometer Incline Sensing.

    LOOKDOWN tells you which entry in the list it found.· Consider this:

    LOOKDOWN value, [noparse][[/noparse]1, 2, 3, 5, 7, 11, 17], offset

    If value is 1, the LOOKDOWN command sets offset to 0.· If value is 2, the LOOKDOWN command sets offset to 1.· If value is 3, offset will be 2.· If value is 5, offset will be 3. If value is 7, offset will be 4. and so on...

    Well, I suppose you could replace some of the IF...THEN with SELECT...CASE like this.

    ReturnHome1:

    SELECT N_O_L
    · CASE 2
    ··· FREQOUT 4, 200, 4200
    ··· PAUSE 500
    ··· FREQOUT 4, 200, 4200
    ··· PAUSE 500
    ··· N_O_L = N_O_L + 1
    · CASE 3
    ··· GOSUB leftfire
    ENDSELECT
    GOSUB navigationfire
    GOSUB linefire
    SELECT N_O_L
    · CASE 5
    ··· GOTO Done
    ENDSELECT
    GOTO ReturnHome1

    However, I think this would be better.

    IF N_O_L = 2 THEN
    ··· FREQOUT 4, 200, 4200
    ··· PAUSE 500
    ··· FREQOUT 4, 200, 4200
    ··· PAUSE 500
    ··· N_O_L = N_O_L + 1
    ELSEIF N_O_L = 3 THEN
    · GOSUB leftfire
    ENDIF
    GOSUB navigationfire
    GOSUB linefire
    IF N_O_L = 5 THEN
    · GOTO Done
    ENDIF
    GOTO ReturnHome1

    Best regards, and merry Christmas to you too.

    Andy Lindsay
  • robotjerobotje Posts: 10
    edited 2006-01-04 13:57
    Dear Andy Lindsay

    Happy new year!

    I have a few new questions maybe you can and will explain what·I need to know?

    In your laters reply you say somethine about changing the jumper between X4 and X5 maybe it is a stupid question... I have looked at ower basic stamp board and·I see X4 and X5 and the Vin. But how can·I see to what·it is set. Because it muts be set at Vdd or Vin I think.

    My next question is: Why resets the boebot if I use a DC supplies at 6V? That muts be enough! If i increase it to 7.5V it resets les times but still resets itself!

    The resets problem is our biggest problem, Because with the program we have made it can return to his starting point. We now that because sometimes the boebot have done that. If this problem is gone it is simple a matter of time before the program is completed.

    I have discovert that the boebot only resets if it gets in a Subroutine, if you let the boebot go it wil navigate endless without resets itself but if it gets a line or a light the problem starts! maybe it is a software problem! For example if the bopebot haven't seen a line but sees a light it wil make one navigation decition and one high 8 and one bleep and the proces starts again until the light is gone! Maybe you have a idea what's ower problem?

    Owh one thing do you know where I can find information about the BS2e? And especially the information about RUN and how can we download more then one program? Every time I tryed it our first program is gone!

    The program changed because i have made a board for the hardware

    Best regards;

    H2IA04,

    Ernstjan Grosman· (Dutch student Industrial automatisation)


    Post Edited (robotje) : 1/4/2006 5:40:33 PM GMT
    1024 x 768 - 201K
    1024 x 768 - 195K
    1024 x 768 - 211K
  • edited 2006-01-05 00:37
    robotje said...
    if you let the boebot go it wil navigate endless without resets itself but if it gets a line or a light the problem starts! maybe it is a software problem! For example if the bopebot haven't seen a line but sees a light it wil make one navigation decition and one high 8 and one bleep and the proces starts again until the light is gone!
    Okay, so the program goes indefinitely until the light comes on, then it starts resetting.· The problem you describe occurs when alarm = 1 and N_O_L = 0.· The program gets to ReturnHome0, but as soon as·ReturnHome0 calls Uturnfire, the BASIC Stamp resets.· Is that correct?· Does it beep for 2 seconds at 3 kHz?

    I do not see a problem with PBASIC code that could cause this reset, but I do see a problem with the way the servos are operated.· All of your PULSOUT commands should have 10 to 20 ms delays.· In some cases the delay is caused by the time it takes to read sensors.· In other cases, you need to add PAUSE commands, and then change the FOR...NEXT loop index.· Modify Uturnfire so that it looks like this:

    '
    [noparse][[/noparse] Uturn fire ]

    Uturnfire:

    · FOR counter = 0 TO·38··············· ' <--- Modify this line.
    ··· PULSOUT 12,500
    ··· PULSOUT 13,500
    ··· PAUSE 20···························' <--- Add this line.
    · NEXT

    · N_O_L = N_O_L + 1

    · RETURN

    The previous code snippet might still cause resets.· Here is another thing to try:
    ·
    rampCounter·VAR·Word
    ·· .
    ·· .
    ·· .
    '
    [noparse][[/noparse] Uturn fire ]

    Uturnfire:

    · PAUSE 100

    ··FOR·rampCounter = 0 to 250 step 10
    ··· PULSOUT 12, 750 - rampCounter
    ··· PULSOUT 13, 750 - rampCounter
    ··· PAUSE 20
    · NEXT

    '· FOR counter = 0 TO·20
    '·· PULSOUT 12,500
    '··· PULSOUT 13,500
    '··· PAUSE 20
    '· NEXT

    ··FOR·rampCounter =·250 to·0 step 10
    ··· PULSOUT 12, 750 - rampCounter
    ··· PULSOUT 13, 750 - rampCounter
    ··· PAUSE 20
    · NEXT

    · N_O_L = N_O_L + 1

    · RETURN

    Does the program successfully execute Uturnfire?· It will have the problem in a later subroutine (probably Forwardfire), but if it makes it through Uturnfire, chances are the reset is because the servos drew more current than the batteries could supply and still hold above 4.4 V.··(See About Resets Due to Brownout below.)·

    If the ramping code (with the rampCounter variable) did not fix the problem, use the FREQOUT commands to find the last command that gets executed before the reset, and let us know what it is.
    robotje said...
    In your laters reply you say somethine about changing the jumper between X4 and X5 maybe it is a stupid question... I have looked at ower basic stamp board and·I see X4 and X5 and the Vin. But how can·I see to what·it is set. Because it muts be set at Vdd or Vin I think.
    Sorry, I did not notice that you are using a Board of Education Rev B.· This board does not have a jumper setting for Vdd/Vin.· The Board of Education Rev B supplies the servos with Vin, so you are already okay.· There is no need to make any changes.
    robotje said said...
    My next question is: Why resets the boebot if I use a DC supplies at 6V? That muts be enough! If i increase it to 7.5V it resets les times but still resets itself!
    If the batteries are running low on charge, a 6 V supply will still drop below about 4.4 V when the Boe-Bot makes a sudden change in direction.· That's because the DC motors inside the servos demand more current than tired batteries can supply.· When the supply voltage goes below 4.4 V, the BASIC Stamp will shut down to protect its program memory.· This stops the servo motors, which gives the battery supply a chance to recover.· When the supply voltage goes up again, the BASIC Stamp's program restarts from the beginning.

    If a 7.5 V battery helps, but does not fix the problem, the code with the rampCounter variable should fix the problem.

    Here is some general information about BASIC Stamp resets on the Boe-Bot.

    Resets due to brown-out can happen if the 1.5 V Alkaline batteries are running low on charge.· It can also happen if you use 1.2 V rechargeable batteries, such as NiCD or NiMH batteries.· With 1.5 V alkaline batteries, the supply is 1.5 V X 4 = 6 V.· With 1.2 V rechargeable batteries, 1.2 V X 4 = 4.8 V.··With rechargeable batteries, there is very little headroom before a current draw will cause a reset to·occur.·

    Note: If you have been following along with the BASIC Stamp manual, it says 4.2 V, but that's the voltage to Vdd.· The voltage to Vin gets regulated to Vdd, and the regulator needs some headroom.· Apparently about 0.2 V.
    robotje said...
    Owh one thing do you know where I can find information about the BS2e? And especially the information about RUN and how can we download more then one program? Every time I tryed it our first program is gone!
    Note: I deleted·my last post for today, and moved the reply here.

    The RUN command is used to run different program banks.· The best place for information about it is in the BASIC Stamp Manual.· I think it will be important to·simplify your program before taking it to multiple banks.· The next post gets started on simplifying your program.

    Post Edited (Andy Lindsay (Parallax)) : 1/5/2006 4:08:43 AM GMT
  • edited 2006-01-05 01:09
    It is also time to clean up your code.· I started by formatting it so that it is easier to read (attached).· While I was doing it, I noticed a lot of code that repeats itself.· I know that some of it was code that I suggested, and other parts I noticed the first time I looked at your code.· I have not talked about it until now because you had enough memory and we needed to focus on the reset problem.

    Even though you still have·more banks of memory, I do not think·they will be practical to use until your program is cleaned up.· You can do the same jobs you are doing now in half the program memory, probably less.· Here is one thing you can do to save program memory and make the program more organized:

    beepCount· VAR Nib

    ReturnHome0:
    ··· .
    ··· .
    ··· .
    · GOUSUB Beeps
    ··· .
    ··· .
    ··· .
    ReturnHome1:

    · GOSUB Beeps
    ··· .
    ··· .
    ··· .
    ReturnHome2:

    ·· GOSUB Beeps
    ···· .
    ···· .
    ···· .
    Beeps:

    · FOR beepCount = 0 to (N_O_L / 2)
    ··· FREQOUT 0, 200, 4200
    ··· PAUSE 500
    · NEXT

    · RETURN

    Here is another example.· Your program only needs one PULSOUT 12 and one PULSOUT 13.··Below is an example from Applied Robotics with the SumoBot (SumoWrestler.bs2), which you can download from www.parallax.com.· Notice how two completely different maneuvers are executed by one subroutine.· The maneuver depends on the variables that are set in the main routine before the subroutine is called.

    '
    [noparse][[/noparse] I/O Definitions ]


    ServoLeft····· PIN···· 13··················· ' Left servo connected to P13
    ServoRight···· PIN···· 12··················· ' Right servo connected to P12
    ·· .
    ·· .
    ·· .
    '
    [noparse][[/noparse] Constants ]


    ' Maneuvers
    Forward······· CON···· 0···················· ' Forward
    Backward······ CON···· 1···················· ' Backward
    RotateLeft···· CON···· 2···················· ' RotateLeft
    RotateRight··· CON···· 3···················· ' RotateRight
    PivotLeft····· CON···· 4···················· ' Pivot to the left
    PivotRight···· CON···· 5···················· ' Pivot to the right
    CurveLeft····· CON···· 6···················· ' Curve to the left
    CurveRight···· CON···· 7···················· ' Curve to the right

    ' Servo pulse width rotations
    FS_CCW········ CON···· 850·················· ' Full speed counterclockwise
    FS_CW········· CON···· 650·················· ' Full speed clockwise
    NO_ROT········ CON···· 750·················· ' No rotation
    LS_CCW········ CON···· 770·················· ' Low speed counterclockwise
    LS_CW········· CON···· 730·················· ' Low speed clockwise
    ·· .
    ·· .
    ·· .
    '
    [noparse][[/noparse] Variables ]

    temp·········· VAR···· Word················· ' Temporary variable
    pulseCount···· VAR···· Byte················· ' Loop counting variable.
    maneuver······ VAR···· Nib·················· ' SumoBot travel maneuver
    ·· .
    ·· .
    ·· .
    '
    [noparse][[/noparse] Main Routine ]

    ·· .
    ·· .
    ·· .
    maneuver =·Forward····· ' Forward 20 pulses
    pulseCount = 20
    GOSUB Pulse_Servos
    ·· .
    ·· .
    ·· .
    maneuver =·RotateLeft·· ' Rotate left 10 pulses
    pulseCount = 10
    GOSUB Pulse_Servos
    ·· .
    ·· .
    ·· .
    '
    [noparse][[/noparse] Subroutine - Pulse_Servos ]


    Pulse_Servos:

    · FOR counter = 0 to pulseCount

    · · ' Pulse to left servo
    ··· LOOKUP maneuver, [noparse][[/noparse] FS_CCW, FS_CW, FS_CW, FS_CCW,
    ···················· NO_ROT, FS_CCW, LS_CCW, FS_CCW ], temp
    ··· PULSOUT ServoLeft, temp

    · · ' Pulse to right servo
    ··· LOOKUP maneuver, [noparse][[/noparse] FS_CW, FS_CCW, FS_CW, FS_CCW,
    ···················· FS_CW, NO_ROT, FS_CW, LS_CW ], temp
    ··· PULSOUT ServoRight, temp
    ·
    ··· ' Pause between pulses (remove when using sensors between pulses).
    ····PAUSE 20
    ·
    · NEXT

    · RETURN

    Post Edited (Andy Lindsay (Parallax)) : 1/5/2006 4:24:08 AM GMT
  • robotjerobotje Posts: 10
    edited 2006-01-05 15:14
    Hello,

    So you have been busy! Thanks!

    ---The first question you ask me in your first mail---
    Thats correct the boebot resets itself when it must carry out a subroutine like: left, utrun, uturnfire, leftfire and so on... The 2 seconds at 3 kHz beep to i here when·the program·muts carry out a Subroutine.·There is a high opportunity that the 4 x 1.2 = 4.8 volt is not enough tot power the boebot! Because I have test the program with a 6V battery from a flashlight and the program worked good! Only the battery is to heavy for the boebot. Maybe we can use five 1.2 V batteries then we have 6V. Only we have to make a new batterie pack but that won't be te problem!

    Maybe a good idea for parallax? idea.gif

    The reason why we have made a program with lot of the same code is make sure the boebot's program have only one option! Because we din't now the boebor makes always the right decision. But now I now the boebot resets itself and do make the right decisions on the gosub en return commands.

    I now have removed the most of the dubble code I think...rolleyes.gif· But I will wait with the RUN command until I realy need more storage room!

    I have tested the first solution that you give me, it worked but I have used fully charged batteries so I have to test until the begin to lose energy.

    I have tested the second solution now but how can I make the boebot make a forward move? If I do it like this it makes a strange forward whit·at the end a turn left!

    forward???

    FOR rampCounter = 0 TO 500 STEP 10
    ··· PULSOUT 12, 1000 - rampCounter
    ··· PULSOUT 13, 500 - rampCounter
    ··· PAUSE 20
    · NEXT

    Finaly you say something about a better way to build up ower navigation routine. I think that I now how it works but I haven't realy a idea how I must do that! expecialy incombination with the IR sensors and te differnt pulscount's!

    Best regards;

    H2IA04,

    Ernstjan Grosman· (Dutch student Industrial automatisation)

  • edited 2006-01-05 19:40
    Ernstjan,
    robotje said...
    There is a high opportunity that the 4 x 1.2 = 4.8 volt is not enough tot power the boebot! Because I have test the program with a 6V battery from a flashlight and the program worked good! Only the battery is to heavy for the boebot. Maybe we can use five 1.2 V batteries then we have 6V. Only we have to make a new batterie pack but that won't be te problem!
    Excellent!· I am very relieved that this problem has been solved.· Five 1.2 V rechargeable batteries in series is usually a good solution.· Rechargeable batteries are typically lighter than alkaline, and will help with the weight problem.·
    robotje said...

    I have tested the second solution now but how can I make the boebot make a forward move? If I do it like this it makes a strange forward whit·at the end a turn left!

    Attached is EepromNavigationWithRamping2.bs2.· It has a subroutine with all the maneuvers with ramping.· This program has another important feature that you may find useful - the maneuvers are recorded in the EEPROM Data section.· "F" 70 stands for forward 70 pulses, "L" 53 stands for left 53 pulses, "R" 77 stands for right 77 pulses.· There's also a "B", which stands for backward, and a "Q" for quit (end of navigation instructions).· The Main Routine uses READ commands to access the values stored by the Directions and Distances DATA directives.· For a more complete explanation of this program, see Boe-Bot Robot Navigation with Accelerometer Incline Sensing.

    You will probably have to modify the Navigate subroutine.· Replace 850 with 1000, and replace 650 with 500.· Also replace +/- 2 with +/- 5.
    robotje said...

    Finaly you say something about a better way to build up ower navigation routine. I think that I now how it works but I haven't realy a idea how I must do that! expecialy incombination with the IR sensors and te differnt pulscount's!

    Also attached is SumoWrestler.bs2, which provides an example of reading sensors, making decisions, and making a variety of complex maneuvers.· The complex maneuvers can even be interrupted by certain sensor conditions.· Top level sensor decisions and navigation subroutine calls are made in the Main Routine.· Navigation subroutines like Avoid_Tawara_Left, Go_Forward, and Track_Front_Right_Object set the maneuver variable for specific maneuvers.· Each navigation routine also has some kind of loop that repeats pulses for a given maneuver a certain number of times, or until a certain sensor condition is observed.· Inside each of the navigation routines' loops, it calls the Servos_And_Sensors subroutine.· The Servos_And_Sensors subroutine checks all the sensors and records their values in a variable named sensors.· Each of the navigation routines has reasons it should stop what it's doing, and each reason is a part of the sensors variable.· If you look in the Variables section, you'll see that qtiLF is sensors.BIT5, qtiRF is sensors.BIT4, irLS is sensors.BIT3, and so on.· If you take a look at Track_Front_Left_Object navigation subroutine, it sets counter to 0, then it curves left until either irLF = 1·or irRF = 1 or counter > 15.· These are all reasons to stop the maneuver and return to the main routine.· When the program gets back to the main routine, it takes a look at all the important sensor conditions again, and calls the appropriate navigation routine.

    Regards, Andy

    Post Edited (Andy Lindsay (Parallax)) : 1/5/2006 8:17:19 PM GMT
  • robotjerobotje Posts: 10
    edited 2006-01-06 14:00
    Thanks I will look at it next week because I first have to write al the way's back and then I maybe must use the BS2e! So I have a lot of work to compleet before next week! Then I have to test the boebot. 17-01-06 the project have to be completed. So I have to hurry!!!

    If I had more time there where lot of things that can be programmed beter then that I did now! But I think(hoop) we did it good enough for the first time programming a basic stamp.

    You have helped me a lot with your explanations and examples! So I thank you....

    Ps maybe I will ask a question next week.


    Best regards;

    H2IA04,

    Ernstjan Grosman (Dutch student Industrial automatisation)
  • robotjerobotje Posts: 10
    edited 2006-01-06 15:57
    Hello,

    Damn my slot of 2Kbytes is full. I have the Basic stamp programming manual 2.0b and it say's:

    'download the following two lines into program slot 0
    DEBUG "Hello"
    RUN 1

    'download the following three lines into program slot 1
    DEBUG "World!",CR
    PAUSE 0
    RUN 0

    I have tryed to send this programs to the BS2e module but I can get the second program in slot 1. It keeps on overwriting the first program! What did I do wrong? In the help version doesn't say how I download the two program's!

    Finaly I will write the program in two parts the first part is the route and desicions! The second part is the way back. So the program only·one time·switch between the two parts. This will increase the necessary space but I think we have enough of it if we use two slots.

    ·
    Best regards;

    H2IA04,

    Ernstjan Grosman· (Dutch student Industrial automatisation)
  • edited 2006-01-06 19:00
    In the BASIC Stamp Manual, the RUN command refers you to a section entitled Advanced Compilation Techniques (Page 68 in BASIC Stamp Manual 2.2). There, it explains how to modify your $STAMP directive in the 0 program slot to include multiple files.

    Make sure to study the GET and PUT commands so that you can use the scratchpad RAM.

    Also, make sure to declare your variable names in the same order in all the programs. This will allow you to keep your RAM memory values when you change from one program to another.

    I can understand that you will probably want to make a larger program because you have a repeatable pattern that works. Especially with the deadline so near, this is probably your best bet. Redesigning the way your program works is probably not practical at this point.

    Good luck with your deadline.
Sign In or Register to comment.