I have always just used my servos at the servo's full speed. 

This is a problem when setting servos if something goes wrong. No reaction time before breakages occur. 

Q1) For stand-alone Arduino - Is there a line of code I can add after "servotest.write(90);" to lower the speed of servo movement even to a quarter or a half of normal speed or is this too simple?  I have been using the delay() command but I gather that doesn't affect the speed of movement only the delay between movements. 

I am referring, of course, to servos which have not been modified for continuous rotation as we know you can't set these with Arduino then use them in MRL without re-setting or they spin like Dervishes. I'm just asking about the un-hacked servos. 

Q2) In Python in MRL, what do I add to the code to change the speed of movement to the new position? Is there a simple way to do this with one line of added code?   

 

 

hairygael

6 years 3 months ago

Hello Humanoid,

Here is an exemple of slow motion for a servo on a stand alone Arduino:

#include <Servo.h>

Servo servo1;

 void setup() {
  servo1.attach(2);
 }
void loop() {            // Loop through motion tests
  slowclose();             // Example: slowclose
  delay(3000);
 }

int pos = 0;    // variable to store the servo position

void slowclose() {
  for(pos = 45; pos < 120; pos+=1)
  {
  servo1.write(pos);
    delay(20);
  }}

######################################

In the InMoov service, we use the velocity function:

i01.rightHand.index.setVelocity(-1)## Maximum velocity

i01.rightHand.index.setVelocity(20)## Low velocity

i01.rightHand.index.setVelocity(50)## Medium velocity

That was exactly what I need to know.

Time to put the forearms back on and do some tests with the latest build, hopefully this time without breakages.

GroG

6 years 3 months ago

Hi Humanoid,

Did you look at the Servo Service page for Q2 ?

http://myrobotlab.org/service/Servo

at the bottom of each service page their is a Service Script Example ! (Yay!)

These service pages "should" show all the basic functionality of a service in Python.

the velocity stuff is here https://github.com/MyRobotLab/pyrobotlab/blob/master/service/Servo.py#L…

Each Service in the matrix "should" have a Service Page & Service example Script.