I have recently make many change on the Servo speed control to have a method that don't change the speed with modification to MRLComm or load on it and that are backyard compatibable with scripts users currently had. Sorry if it cause some confusion on the way. I writing this post to clear out how to use it

there is 3 methods relate to the speed control

servo.setMaxVelocity(int)

  • Optional for now, it told MRL how much degree/second a servo will make a part move. The setting is dependant of the servo used, the voltage, the gearing of that part and the weight of it. By example, some part like the shoulder are slow and can only rotate at about 15 degrees/second, while some like the rothead are faster and can rotate in the range of 200 degree/second.
  • You can use this setting to limits how fast a part of a robot will move. 

 

servo.setVelocity(int)

  • This is a new speed control where you can define the absolute speed of rotation of a part. By example, shoulder.setVelocity(4) will have to shoulder rotate at 4 degree/second
  • using setVelocity(-1) will have the speed control bypass and servo moved at it's full speed

 

servo.setSpeed(double)

  • This is the method traditionnaly used in the script and it still work the same. Speed will be close to what was set in the version 107. 

 

I hope this help and that you can enjoy the new fonctionnality

 

kwatters

7 years 6 months ago

Just to confirm, using setSpeed(1.0) should also bypass the set Velocity logic.  yes?

hairygael

7 years 6 months ago

In reply to by kwatters

Thanks Calamity for these information,

@kwatters, I don't think setSpeed(1.0) is bypassing the Velocity logic.

I had to set the jaw and the eyes at setVelocity(0) although it was defined in my def.py as setSpeed(1.0)

setSpeed(1.0) set velocity to MaxVelocity (default value = 500)

the  reason is the setMaxVelocity should limits the speed when the servo moving at full speed can be hard for a body part. By example, I think rothead with no speed limitation is hard for the neck. 

so setSpeed(1.0) do not override MaxVelocity, but setVelocity(0) do override it.

If you saw a speed difference between setSpeed(1.0) and setVelocity(0) using default setMaxVelocity, it's probably that the default is not high enough so I can increase it

 

Hi All, Just playing with MRL 1851, where Calamity has included a Acceleration option in the Servo Service.

It looks cool and I think this is a nice future, to include something like this in all InMoov services :)

Here a basic servo test script:


# Starting the Servo Service

arduino = Runtime.createAndStart("arduino","Arduino")
arduino.setBoardMega()
arduino.connect("/dev/tty.usbmodem411")

servo = Runtime.createAndStart("servo","Servo")
servo.attach(arduino,3)
sleep(1) #attaching procedure take a bit more time to do, wait a little before using it

# Setting the Velocity and the first Acceleration
servo.setVelocity(300)

servo.setAcceleration(6)
servo.moveTo(0)

sleep(4)
servo.setAcceleration(10)
servo.moveTo(180)

sleep(4)
servo.setAcceleration(15)
servo.moveTo(0)

sleep(4)
servo.setAcceleration(20)
servo.moveTo(180)


Regards,

Marten