Controlling 360 servo with linux shell/python

Hi!

I am using maestro micro 6 port usb controller trying to make servo HSR-1425CR (continuous 360 servo) to move around in different speeds and angles.

I use python and shell script and i only can move servo back and forth at same speed and it just spins continuously. i only can use command line shell.

I’ve used same scripts etc to control “normal” servos and they work just fine. What i am missing is it even possible to make like low speed 45 degree turn with that servo?

Sorry i am new to this kind of things :slight_smile:

Edit:
Ok managed to get this partly working with python3 code is below
Still dont know why i cant control that speed?

import maestro
import time
x=1
looptime=2
servo = maestro.Controller()

while True:

    print ('x =',x)
    servo.setAccel(0,1)  #not working?
    servo.setSpeed(0,1)  #not working?

    servo.setTarget(0,-1) #move right
    time.sleep(0.1)
    servo.setTarget(0,0)  #stop movement
    time.sleep(1)

    servo.setTarget(0,1) #move left (back where to start)
    time.sleep(0.1)
    servo.setTarget(0,0) #stop movement
    time.sleep(1)

    servo.setTarget(0,1) #move left
    time.sleep(0.1)
    servo.setTarget(0,0)  #stop movement
    time.sleep(1)

    servo.setTarget(0,-1) #move right
    time.sleep(0.1)
    servo.setTarget(0,0)  #stop movement
    time.sleep(1)

    x=x+1
    if x>looptime: #loop until done
        servo.close()
        break

It sounds like you are trying to do position control with a continuous rotation servo, but they do not typically support that. Continuous rotation servos sacrifice position control for speed control, so the normal Maestro speed commands do not work the same way for them. Typically, the speed of a continuous rotation servo is proportional to how far the signal is to the neutral point (usually ~1500us); the greater the distance from the neutral point, the faster the servo will go. If you only need 45 degrees of motion in total, you should be able to use a standard servo for that.

-Derrill

Thanks for FAST reply! That 45 degrees was just for example. I need to rotate 360 with steps of 45 degrees. But if thats not possible with servos i could use stepper motor with another controller.

If you do not need it to be able to turn indefinitely, you might look for a sail-winch servo; some of which can do multiple turns and still offer positions control. Unfortunately, we do not carry those.

-Derrill