setVelocity

Hi,

On the arduino nano, i have strange behavior with setVelocity.

I have a big difference between setVelocity(50) and setVelocity(-1)

setVelocity(50) is very slowly.

Is it normal ? 

Is this correct with old speed function ?

# 0.1, 3, 6
# 0.2, 5, 7
# 0.3, 7, 9
# 0.4, 9, 9
# 0.5, 13, 11
# 0.6, 19, 13
# 0.7, 26, 18
# 0.8, 36, 27
# 0.9, 50, 54 

If i put setVelocity(150), the speed is correct.

Dom.
Mats's picture

setVelocity

setVelocity(-1) = full speed. The actual speed will be determined by the servo you have and is "undefined" in the way that there is no way for MRL to know how fast the servo moves, since servos don't have any feedback.

setVelocity(50) will move the servo at 50 degrees/s measured at the potentiometer. So turning from 0-180 degrees should ( per definition ) take 3.6 seconds. This is acheived by the microcontroller to send several in between positions to the servo at a rate that should make the servo move at the desired speed. Well as long as the servo can keep up with the speed. 

At least that's how it's supposed to work. Do you get other results ? Please measure. 

Do you have an 8MHz or 16 MHz Nano ? 

The old setSpeed metod was relying on how fast the main loop in the Arduino was running, so it was also undefined / experience based and different from servo to servo.

The only way tell if the table you have is correct of not, is to test/measure with an old version of MRL/MRLComm and a specific servo. 

calamity's picture

Hi Dom One thing that may

Hi Dom

One thing that may influence the velocity computation on the microcontroller is if you change the setting of the timer. I don't remember by heart wich one regulate the method millis() and micros(), but if you change that timer, millis() and micros() will report wrong timing and change how the microcontroller 'see' the time.

 

dom14's picture

Thank you for your reply, now

Thank you for your reply, now i understand. It is OK.

Dom.