from org.myrobotlab.service import Arduino
from org.myrobotlab.service import Servo
from org.myrobotlab.service import Runtime
 
from time import sleep
 
# create the services
 
arduino = Runtime.createAndStart("arduino","Arduino")
servo01 = Runtime.createAndStart("servo01","Servo")
 
# initialize arduino
arduino.connect("/dev/ttyUSB0")
 
# TODO - set limits
 
# attach servo
arduino.servoAttach(servo01.getName(), 9)
 
# fast sweep
servo01.moveTo(179)
sleep(0.5)
 
servo01.moveTo(10)
sleep(0.5)
 
servo01.moveTo(179)
sleep(0.5)
 
servo01.moveTo(10)
sleep(0.5)
 
servo01.moveTo(179)
sleep(0.5)
 
servo01.moveTo(10)
sleep(0.5)
 
# speed changes  
servo01.setSpeed(0.99) # set speed to 99% of full speed
servo01.moveTo(90) 
sleep(0.5)
servo01.setSpeed(0.25) # set speed to 25% of full speed
servo01.moveTo(180)
 

When using this service I only get 90 degrees of rotation. The servo I am using is capable of 180 degrees. TowerPro 996r. The Finger functions as it should I was just wondering why the is only half the motion used when the program calls for 179 degrees of rotation.

Thanks Dwayne

Starting to print the head parts tonight. On my way to InMoov goodness. 

GroG

10 years 2 months ago

Hi Dwayne !

Is the mechanical system preventing the move? - If so it would be a question for Gael (or someone more knowledgeable with the mechanical details)

Frome the script I can see you move from 179 to 10 - is it not giving the expected range of motion for these values?  

From a software point of view - you should not be limited to 90 degrees.

Thanks Grog, I am a mechanical engineer by trade so that arena is no problem for me. I am however a little weak in the programming arena. I am continually absorbing all the knowledge I can in this area. 

The servos that I have are capable of the 180 degrees of motion. I can get them to the limits manually.

When I start the servo service the slider goes to 0 as it should. When I move the slider though it only utilizes 90 degrees of the servo. 

I am wondering if I have to program the servo to get the 180 degrees of motion or if it is even necessary.

Thanks for the speedy reply.

Dwayne

I google'd for information - and found others having the same problem.

In fact you might want to read this thread - it's on InMoov specificially (they even mention 996r) :)

https://groups.google.com/forum/#!topic/inmoov/ay91Yxh5AUg

Currently the Arduino Service + Servo Service - uses the standard Arduino Servo library.  If you use the Arduino software -> servo example sketch do you get the same result ..  I'm betting you will.

So possibly the details of the probem have to do with your specific servo - and the pulse width it expects.

My overall experience has been all the Servos I have purchased have done ~180 degrees and all worked with the Arduino's standard servo library.  

I would be open to the possiblity of enhancing this part of MRL so that you could put min max PWM values in for each servo, but would probably want some guidance with appropriate hardware.

Thanks for the input. I also came across the thread you mentioned. It is kind of foggy in the solution though.

I think tonight I will attempt to actuate the servos through Arduino outside of MRL and see the outcome.

I am kind of leaning towards the pulse width though as I have had this same issue with stepper drivers for printers. Leadshine drives simply will not accept the pulse for Marlin. Install Moons drivers the problem goes away.

 I will report back on my findings. I am starting to print the head parts tonight so this will be a good segway.

Thanks

Dwayne