Shop OBEX P1 Docs P2 Docs Learn Events
Programing to Move multiple motor moves together -- Need Help — Parallax Forums

Programing to Move multiple motor moves together -- Need Help

ColinAldineColinAldine Posts: 1
edited 2009-12-21 04:20 in Robotics
Currently Im able to moves each servo separately,

but when i replay the recorded action,

how do i moves all servo together?

i.e. Moves Servo 1 -> Moves Servo 2 -> save position ->
--> replay -> Moves Servo 1 and Servo 2 "at the same time"

Anyone got any idea to moving multiple servo together?

Comments

  • Brandon C.Brandon C. Posts: 106
    edited 2009-09-08 16:31
    Well I am assuming you are using a Basic Stamp. If you are, it is not possible to move more than 1 servo simultaneously. you would need some sort of external servo controller.

    Brandon C.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    No purchase necessary. See back panel for more details.

    Tired of the same old robot brains? not enough processing power? Get the Propeller Robot Module now!!

  • FranklinFranklin Posts: 4,747
    edited 2009-09-08 17:16
    Could you attach your code so we can have a look? A drawing of your circuit would also be helpful.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • W9GFOW9GFO Posts: 4,010
    edited 2009-09-08 17:54
    You can move multiple servos at the same time using a Basic Stamp. If you couldn't, the Boe-bot wouldn't work.

    DO
    PULSOUT Servo1 X
    PULSOUT Servo2 Y
    PULSOUT Servo3 Z
    GOSUB CheckSensors
    PAUSE 10 ' adjust to remove jerkiness from servo movement - the whole loop should take 20 milliseconds
    LOOP

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Servo Boss, a 12 channel servo tester kit from Gadget Gangster.
  • Brandon C.Brandon C. Posts: 106
    edited 2009-09-09 00:22
    Well, you sorta can move more than one servo at once. but what I meant was that it can get hard to manage if you have a big program, and it takes too long for 1 clock cycle, the servo won't move very well. it also gets worse the more servos you use.

    Brandon C.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    No purchase necessary. See back panel for more details.

    Tired of the same old robot brains? not enough processing power? Get the Propeller Robot Module now!!

  • W9GFOW9GFO Posts: 4,010
    edited 2009-09-09 03:38
    Brandon C. said...
    Well, you sorta can move more than one servo at once.

    More than "sorta".

    The BS2 takes about 250 uS + the pulse width time to execute a PULSOUT command. If the average pulse width time is 1.5 mS that gives 1.75 mS per PULSOUT command. For one servo that would leave 18.25 mS for the program to do other things before needing to send another PULSOUT.

    With four servos there will be only 13 milliseconds for the program to do other things while maintaining a 50 hz frame rate. A simple program could drive 10 servos at the same time, while a complex program may not be able to drive even one servo smoothly. It's all about how long the program loop takes, each servo added will increase the loop time by 1.75 mS + whatever support code (if any) is added for that servo. When the loop gets over 20 mS long you may start noticing less smoothness.

    One thing to look out for is PAUSE commands. Even the standard PAUSE 20 you find in the examples is really too long of a pause, it should be PAUSE 18 to keep the frame rate close to 50 hz. The more time the loop takes, the less time the PAUSE command should be.

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Servo Boss, a 12 channel servo tester kit from Gadget Gangster.
  • StickySticky Posts: 42
    edited 2009-09-17 12:25
    Like Brandon C says using an external servo controller is a good solution. I'm experimenting with a Lynxmotion SSC-32 which will move up to 32 servos at the same time and for the same amount of time making all of then stop at the same time (sorry for the redundancy there). Also you can use just one pin for input for 32 servos. Lots of advantages. If someone has had a bad experience with it or there is something I should know, please tell me.
  • sailman58sailman58 Posts: 162
    edited 2009-09-17 14:25
    If the servos will always be moving together in the same direction, then use a Y connector for the servos. You can either buy one or roll your own from a couple of servo extension cables, you can even get a Y connector that reverses one of the servos. I had to do this with a rc car that steered both axles.

    Ron
  • RogerNRogerN Posts: 19
    edited 2009-12-21 04:20
    In a Radio control system like they use to fly model planes and helicopters, the transmitter sends out a 4.5ms sync pulse then pulses from 1ms to 2ms. The receiver takes this series of pulses, syncs with the 4.5ms pulse and sends the first pulse after the sync pulse to channel 1 servo, next pulse to channel 2, next to channel 3, and so on. This isn't how the newer PCM systems work but it's how the AM and FM systems work in general. The point is that all servos move together even though the pulses are sent to each servo at different times.

    Your program could read I/O and sensors, calculate what you want the motors to do, and pulsout to the servos. You can set your loop up to run 50 times per second and use loop counting for a timer. For example if you want to go forward for 3 seconds you can pulsout for forward for 150 counts through the loop. This way you can control 8 servos and still have the frame rate the servos were designed for.

    RogerN
Sign In or Register to comment.