Shop OBEX P1 Docs P2 Docs Learn Events
Turn the robot for 180 degree — Parallax Forums

Turn the robot for 180 degree

heavy-freelancerheavy-freelancer Posts: 23
edited 2010-12-20 02:13 in Robotics
Hey,

I want to turn my Boe-Bot for 180 degree so if he was going ahead he will turn left and continue moving.

My problem here is I can't control the angle of rotation of my robot.

This is my code :

myVar VAR Word

Begin:

DEBUG "Ahead",CR

FOR myVar = 0 TO 500
PULSOUT 13,850
PULSOUT 12,650
PAUSE 1
NEXT

DEBUG "Return",CR

FOR myVar = 0 TO 500 ' The problem is here my friends (500)
PULSOUT 13,650
PULSOUT 12,650
PAUSE 1
NEXT

GOTO Begin

In this case the robot rotate for anonymous degree.
What do you suggest for this problem.

Thanks

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-12-19 13:34
    As to the turn you will need to figure out the loop count (myVar) that turns the robot 180 degrees.
    The boe-bot's servos are not precision devices and each one is a bit different so there is no "right" value to put in.
    Also the pause in your loop should be 20. There should be 20ms between pulses.
  • hover1hover1 Posts: 1,929
    edited 2010-12-19 13:40
    Your "Pause 1" should be "Pause 20". That is the minimum to keep the servo in place. They have to be refreshed at 50khz. 50hz. (Thanks Rich)

    Jim
  • ercoerco Posts: 20,256
    edited 2010-12-19 14:17
    Additionally, you need a "pause 20" after your servo pulsouts, instead of your "pause 1". Servos need to be updated 50 times per second.

    Anybody else care to chime in here? :)

    Captain Obvious
  • ajwardajward Posts: 1,130
    edited 2010-12-19 22:49
    Hey,

    I want to turn my Boe-Bot for 180 degree so if he was going ahead he will turn left and continue moving.

    My problem here is I can't control the angle of rotation of my robot.

    This is my code :

    myVar VAR Word

    Begin:

    DEBUG "Ahead",CR

    FOR myVar = 0 TO 500
    PULSOUT 13,850
    PULSOUT 12,650
    PAUSE 1
    NEXT

    DEBUG "Return",CR

    FOR myVar = 0 TO 500 ' The problem is here my friends (500)
    PULSOUT 13,650
    PULSOUT 12,650
    PAUSE 1
    NEXT

    GOTO Begin

    In this case the robot rotate for anonymous degree.
    What do you suggest for this problem.

    Thanks

    A couple of things, if I may...

    Your "PAUSE 1" needs to be "PAUSE 20 for the servos to operate correctly.

    Then... to execute a turn, the value of 500 seems =awfully= high. While no two 'bots work exactly the same, I've found a value of ~22 works for a two wheel 90 degree turn and ~43 works for a 180 degree turn. To pivot with one wheel stationary, ie PULSOUT x, 750, just double those numbers.

    HTH,

    Amanda
  • W9GFOW9GFO Posts: 4,010
    edited 2010-12-20 02:13
    hover1 wrote: »
    Your "Pause 1" should be "Pause 20". That is the minimum to keep the servo in place. They have to be refreshed at 50khz.

    Wow! That there's some fancy servos that need to be refreshed fifty thousand times a second! :)

    Rich H
Sign In or Register to comment.