Shop OBEX P1 Docs P2 Docs Learn Events
Need help with Boe Bot Maze race program Race is tomorrow help plz — Parallax Forums

Need help with Boe Bot Maze race program Race is tomorrow help plz

SandhuamarinderSandhuamarinder Posts: 85
edited 2010-04-16 21:43 in Learn with BlocklyProp
Hi Guys
I need Boe Bot program so i can see how it works and stuff. Bcoz i dont know how many servos it have etc etc how the sensor works.

Why i need this program?
Bcoz in my class professor said that you will get bonus marks if u will make your boe bot win in the race and also in the maze.
So i need those bonus marks and we will be given limited time to figure that thing out . so PLZ some one help me

It is obvious people will come ready so i dont have anyone who help in programming except parallax people. So help me and save me.

I dont know anything about Boe Bot or What kind of sensor does Boe bot use and how many servos. Some one give me information in detail plz and give me some codes for that.
I will really appreciate that.

Post Edited (Sandhuamarinder) : 4/16/2010 1:53:14 AM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-04-13 04:55
    Read the manual on the BoeBot. It will answer your questions about servos and sensors and will show you sample code.

    You want to download "Robotics with the Boe-Bot" here: www.parallax.com/tabid/535/Default.aspx
  • SandhuamarinderSandhuamarinder Posts: 85
    edited 2010-04-13 04:56
    Thanks Sir
  • SandhuamarinderSandhuamarinder Posts: 85
    edited 2010-04-13 05:08
    Manual is of 360 pages.
    I hate reading manuals. But still going to read it.

    One quick question
    I had never played with 360 degree servo. So to make that one turn fast what i have to do.

    Can you give me
    Any small loop example for that so i can understand the commands.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-04-13 05:22
    Read Chapter 2 of the Manual, particularly the area around page 41 and starting at page 67.

    R/C servos respond to pulses in the range of 1ms to 2ms repeated about 50 times a second. Some servos respond to narrower or wider pulses, sometimes in the range of 0.5ms to 2.5ms. Continuous motion servos like those on the Boe-Bot move in one direction with pulses narrower than 1.5ms and move in the other direction with pulses wider than 1.5ms. The further the pulse width is from the center of the range (roughly 1.5ms), the faster it goes.

    Page 79 of the Manual shows one example of the code needed to move the two wheel servos of a Boe-Bot.
  • SandhuamarinderSandhuamarinder Posts: 85
    edited 2010-04-13 05:35
    To make it run fast have to pulsout 650 and 850 fastest speed which servo can give out.
    One will run in clock wise and one will run in anti clockwise.

    To position the servos check down there sir Mike Green post

    Page 76 and 78 for speed in manual.

    Sorry sir i was editing my message at that time. When u posted


    Thanks Sir for helping this Dumb student.

    Hope u are not my professor with different pic and different id hahaha just joking.

    Post Edited (Sandhuamarinder) : 4/13/2010 5:53:38 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2010-04-13 05:42
    A PULSOUT of 750 produces a 1.5ms pulse which will normally cause the servo to stop moving. If the servo pulse is narrower than 1.5ms, it will move faster in one direction. If the servo pulse is wider than 1.5ms, it will move faster in the other direction (assuming you have the servo calibrated as shown in the Manual). A PULSOUT value less than 750 produces a narrower pulse. Greater than 750 produces a wider pulse.

    Read page 76 in the Manual.
  • SandhuamarinderSandhuamarinder Posts: 85
    edited 2010-04-13 05:54
    One more question

    Sir i had seen that in manual they had used

    for i = 1 to 200
    why such a big loop can i use for i = 1 to 35 whats the difference. Above one is for 360 degree servo and bottom one is for 180 degree servo bcoz of that.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-04-13 14:44
    How long do you think it takes for the servo to actually move the distance you want? When the control pulses stop going to the servo, the servo will turn itself off. I don't know exactly how quickly, but it's probably within 50ms. The loop has to continue putting out the control pulses long enough for the servo to actually move the distance physically.

    Do remember that there are two types of servos ... one that's used for the BoeBot's wheels called a "continuous motion servo" and the other is just a standard servo. In the first case, the pulse width has the effect that I've described earlier. With a standard servo, the pulse width specifies the actual desired position for the servo. Here's a good description: www.seattlerobotics.org/guide/servos.html
  • Ken GraceyKen Gracey Posts: 7,395
    edited 2010-04-13 15:08
    Sandhuamarinder, you could think of the two parameters that drive the servo to be velocity (the PULSOUT value) and duration (the number of "i" loops in your example).

    How hard you press on the gas pedal is your PULSOUT value. Your foot off of the gas pedal is a PULSOUT pin, 750 value. The amount of difference (above or below) from 750 is your speed.

    How long you maintain this speed is the number of loops in which you PULSOUT. Try 35. Try 200. Try 1000.

    Read Mike's posts above again, carefully. You're on the right track and asking the right questions.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ken Gracey
    Parallax Inc.

    Follow me at http://twitter.com/ParallaxKen for some insider news.
  • SandhuamarinderSandhuamarinder Posts: 85
    edited 2010-04-13 16:17
    I got it i should just give it 150 or 200 in loop bcoz the race is on a table and table is not that big.

    So 150 or 200 is good enough i think rest i will see if they will change the floor for the race.



    Thanks alot Sir for the help.

    Time is coming close for the race. Hoahhhh Hoahhhh

    Post Edited (Sandhuamarinder) : 4/13/2010 4:25:13 PM GMT
  • SandhuamarinderSandhuamarinder Posts: 85
    edited 2010-04-16 01:24
    I made this program for the Boe Bot maze race. Can some one tell me is this program going to work fine.
    I dont have Boe Bot with me. So help PLZ I am just giving a shot in the air. So can some one check it for me. So i dont have to spend time figuring this thing out in school.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    dist1 VAR Byte
    dist2 VAR Byte
    dist3 VAR Byte

    t VAR Byte
    i VAR Word

    Left PIN 14
    Right PIN 15

    Sensors:
    HIGH 3
    HIGH 4
    HIGH 5
    PAUSE 3
    LOW 3
    LOW 4
    LOW 5
    FOR t=1 TO 30
    PAUSE 1
    IF IN2=1 THEN
    IF IN7=1 THEN
    IF IN8=1 THEN

    GOTO display
    ENDIF
    ENDIF
    ENDIF
    NEXT
    GOTO Sensors

    display:
    DEBUG CLS
    SHIFTIN 2,0,2,[noparse][[/noparse]dist1\8] 'Left
    SHIFTIN 7,0,2,[noparse][[/noparse]dist2\8] 'Middle
    SHIFTIN 8,0,2,[noparse][[/noparse]dist3\8] 'Right
    DEBUG"distance=",DEC dist1,CR
    DEBUG"distance=",DEC dist2,CR
    DEBUG"distance=",DEC dist3,CR
    PAUSE 50 'if pause increased will get reading slowly if decreased will get reading faster


    IF dist1 > 200 THEN 'if left sensor got distance less than 200 the turn left
    FOR i= 1 TO 35 STEP 1
    PULSOUT left,800 'anticlockwise
    PULSOUT right,650 'clockwise
    PAUSE 18
    NEXT


    IF dist3 > 200 THEN 'if right sensor got distance less than 200 then turn right
    FOR i= 1 TO 35 STEP 1
    PULSOUT left,850 'anticlockwise
    PULSOUT right,700 'clockwise
    PAUSE 18
    NEXT


    IF dist2 = 200 THEN
    PULSOUT left,750 'anticlockwise
    PULSOUT right,750 'clockwise
    PAUSE 18



    FOR i= 1 TO 35
    PULSOUT left,850
    PULSOUT right,650
    PAUSE 18
    NEXT
    ENDIF
    ENDIF
    ENDIF

    GOTO Sensors
  • FranklinFranklin Posts: 4,747
    edited 2010-04-16 01:43
    Your code will not work as you expect (if at all)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • SandhuamarinderSandhuamarinder Posts: 85
    edited 2010-04-16 01:46
    I had fixed the program so can u see if its fine now and can u tell me whats wrong. Pin 3,4,5 are the clock line and Pin 2,7,8 are the Data line DIRRS sensor

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    dist1 VAR Byte
    dist2 VAR Byte
    dist3 VAR Byte

    t VAR Byte
    i VAR Word

    Left PIN 14
    Right PIN 15

    Sensors:
    HIGH 3
    HIGH 4
    HIGH 5
    PAUSE 3
    LOW 3
    LOW 4
    LOW 5
    FOR t=1 TO 30
    PAUSE 1
    IF IN2=1 THEN
    IF IN7=1 THEN
    IF IN8=1 THEN

    GOTO display
    ENDIF
    ENDIF
    ENDIF
    NEXT
    GOTO Sensors

    display:
    DEBUG CLS
    SHIFTIN 2,0,2,[noparse][[/noparse]dist1\8] 'Left
    SHIFTIN 7,0,2,[noparse][[/noparse]dist2\8] 'Middle
    SHIFTIN 8,0,2,[noparse][[/noparse]dist3\8] 'Right
    DEBUG"distance=",DEC dist1,CR
    DEBUG"distance=",DEC dist2,CR
    DEBUG"distance=",DEC dist3,CR
    PAUSE 50 'if pause increased will get reading slowly if decreased will get reading faster

    IF dist1 > 200 THEN
    GOTO M1
    IF dist3 > 200 THEN
    GOTO M2
    IF dist2 = 200 THEN
    GOTO M3

    else
    GOTO M4

    M1:
    IF dist1 > 200 THEN 'if left sensor got distance less than 200 the turn left
    FOR i= 1 TO 35 STEP 1
    PULSOUT left,800 'anticlockwise
    PULSOUT right,650 'clockwise
    PAUSE 18
    NEXT

    M2:
    IF dist3 > 200 THEN 'if right sensor got distance less than 200 then turn right
    FOR i= 1 TO 35 STEP 1
    PULSOUT left,850 'anticlockwise
    PULSOUT right,700 'clockwise
    PAUSE 18
    NEXT

    M3:
    IF dist2 = 200 THEN
    PULSOUT left,i 'anticlockwise
    PULSOUT right,i 'clockwise
    PAUSE 18


    M4:
    FOR i= 1 TO 35
    IF dist1 > 200 THEN
    GOTO M1
    IF dist3 > 200 THEN
    GOTO M2
    IF dist2 = 200 THEN
    GOTO M3
    ELSE
    PULSOUT left,850
    PULSOUT right,650
    PAUSE 18
    ENDIF
    ENDIF
    ENDIF
    NEXT
    Goto M4

    ENDIF
    ENDIF
    ENDIF

    GOTO Sensors

    Post Edited (Sandhuamarinder) : 4/16/2010 2:07:55 AM GMT
  • SRLMSRLM Posts: 5,045
    edited 2010-04-16 21:43
    Code is a language, and like all languages there are certain format conventions that we use to make it easier to read. One of those is proper and judicious use of whitespace. Don't just paste your code! Attach it!

    I'm not sure if you're indenting in your source code, but you should be. If you're not then take a look at the sample code that Parallax provides.

    BTW, generally you tell the forum what the problem is, and the forum will try and tell you where the source is. If we don't know what is wrong then we can't provide any useful feedback.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Powered by enthusiasm
Sign In or Register to comment.