Shop OBEX P1 Docs P2 Docs Learn Events
Robot Arm — Parallax Forums

Robot Arm

SandhuamarinderSandhuamarinder Posts: 85
edited 2010-02-06 03:30 in Learn with BlocklyProp
Hi
I am student and i am trying to write program for my project.
The biggest problem is if i move the shoulder u can say up and then i try to move other servo u can say move the elbow·my robot falls. Meaning it fall like i have to also give a command to shoulder to stay there at that angle always but i also wants to give comands to other servo how i can do that.
And also can some one please tell me that how to increase and decrease the speed of servo bcoz i need smooth movements.

one more question like how to move it clock wise or anti clock wise if i am at approximately at 90 degrees you can say at 550
here is what i am doing

' {$STAMP BS2}
' {$PBASIC 2.5}
ccw VAR Byte
cw VAR Byte
iter VAR Byte
main:
FOR cw = 1 TO 35
PULSOUT 15, 110
PAUSE 20
NEXT
FOR cw = 1 TO 35
PULSOUT 15, 800
PAUSE 20
NEXT
FOR cw = 1 TO 35
PULSOUT 13, 110
PAUSE 20
NEXT
PAUSE 1000
FOR ccw = 1 TO 35
PULSOUT 13, 765
PAUSE 20
NEXT
PAUSE 1000
GOTO main

Comments

  • kf4ixmkf4ixm Posts: 529
    edited 2010-02-04 17:03
    hi there and welcome to the forums, i tried your code and could not replicate the issue of servo motion not being smooth. but the line you have...

    PULSOUT 15, 110
    may be your problem depending on your servo. most can only go down to 200. try changing this to...

    PULSOUT 15, 200

    and see if this helps. the servos i tried seemed to not have a problem with these values, they came to a stop without jerking, but most will move to the farthest position limit and sit there and jerk, (i have some of those too) trying to move past the internal mechanical limit. usually a pulsout of 250 to 750 will give you roughly a 90 degrees of travel.


    as far as holding the servo positions while the bs2 is processing other tasks, you can use the servopal that parallax sells...

    http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/servopal/List/0/SortField/4/ProductID/481/Default.aspx

    this nifty lil unit will hold the position pulses sent to it till a new position pulse is sent to it, effectively holding the servo in its position till you send it a different position.

    Post Edited (kf4ixm) : 2/4/2010 5:08:09 PM GMT
  • SandhuamarinderSandhuamarinder Posts: 85
    edited 2010-02-05 03:12
    Thanks for trying to help me

    But i kind of get the (expletive)ion for keeping the arm at the same position because i have to keep giving the arm same comand. By putting same comand again and again when i give other pulsout like pulsout 1,500 and when u again give other comand like pulsout 1,500 pulsout 2,200. This way arm will stay at the same position where it suppose to be and i can give other comands to.
  • FranklinFranklin Posts: 4,747
    edited 2010-02-05 04:00
    You need to send a position command to the servo every 20ms. To every servo you want to move or hold position. You can combine pulsout commands into a group and send a set every 20ms
    Pulsout 13, 700
    pulsout 15, 650
    pause 18 (since you used up part of the 20ms)
    goto main.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • SandhuamarinderSandhuamarinder Posts: 85
    edited 2010-02-05 21:00
    Thanks for the help but i had already mentioned the thing which you are telling me. I got that how to hold it but now my problem is fast and slow movement i wants to move my·servo slowly. For smooth movement.
  • FranklinFranklin Posts: 4,747
    edited 2010-02-06 03:30
    You need to change the value of the pulse from where it is to where you want it in increments.
    for i = 1 to 25
    pulseout 15, previousvalue + i
    next i

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.