Servo Synchronization: Servospeed Delay Values

 
#1

I need to synchronize the servo movements between a EZ-Script and an external device.

ServoSpeed (Dx, speed)

The speed is 0 = (fastest) and 10 (slowest)

Q1: it's possible to know the delays in milliseconds for each speed ?


Servo( Dx, Position)

Q2: When the servo sweeps between current position and a new position is the incremental value 1/-1 or varies per speed ?


Thanks

#2

1) The millisecond is arbitrary, as with all physical motors without feedback because there is no idea to know the position.

2) The servo sweep size is unknown because the servo will decode the pwm. The software does not control the ramping, that's done through pwm - and the pwm simulates an analog signal which has no "positioning" reference.

You can find out more how a servo works with videos explaining what PWM is here: http://www.ez-robot.com/Tutorials/Lesson/48?courseId=6

Because all servos respond to an analog pulse with (even digital servos), to have degree positioning requires software calibration. The EZ-Robot servos are calibrated to the pulse width that the EZ-Builder softare provides. The ramping and sweeping of pwm is not performed in the EZ-Builder software, so there is no reference for positioning.

If you wish to control positioning by degrees and speed, use the Auto Position Control - which is designed for exactly that.

#3

Also - since servos will move to a position at different speeds based on unknown variables such as voltage, amperage, gearing, current loss in connectors, multiple motors running at once sharing current, weight of object being lifted, etc... and if you wish to use ServoSpeed() instead of an auto positioner, or set the speeds manually... build the robot first and calculate the speeds once built.

The trouble as a programmer is assuming hardware works the same way Smile Moving a motor by software is a flick of a bit... in hardware, there's a bunch of variables which encompasses an entire field of study called Physics.

#4

Auto Position Control: good tip, It seems very easy to do more with less (script), to be honest i never explored the control, probably i'll use it to simply the process.

Right know i'm tackling the crazy stuff:

1) Query if the servo is moving, and if is sweeping to estimate where he is, to trigger other external motions.

2) After every EZ-Builder connect i want to know the servos position & speed (if not the first time/ezb power on) to avoid losing their position, and restarting the servo sequences.

3) Frequent wifi disconnections, but that is another issue Winky

coming to the servos, regarding the delays i'm ignoring the power, load/weight conditions and other physics (like you said is too much), in equal conditions i measured 3 types of analog servos, using the same EZB4 and the values seem to me constants.

I believe these values must be hard coded at least per EZB firmware (3/4):

The numbers if useful for any other project:

Code:


Speed : Delay
===========
10 = 100 ms
9 = alternating between 80, 100 ms
8 = 80 ms
7 = alternating between 60, 80 ms
6 = 60 ms
5 = alternating between 40, 60 ms
4 = 40 ms
3 = alternating between 20, 40 ms
2 = 20 ms
1 = 20 ms, but the angle step is 2 or -2



The logic/implementation seems well done, delays on multiples of 20 ms, alternating when needed and in last option changing the step.

I have a solution for points 1 & 2, i'm still working to make it more bullet proof.

#5

1 and 2 can never be possible because there is no way to "read" a servo position. Servos are positioned by a repeated pwm signal, as per the how servos work tutorial.

What you could do is modify the servo. Open the servo up and connect a fourth wire to each servo. Connect it to the center pin of the potentiometer. And connect the other end of the wire to an ADC port on the ezb. This will let you query the position.

Also, you could switch the pcb out with open servo: http://www.openservo.com

Although, it works as i2c... Which is a pain to wire for. Not sure why they choose that *shrug*

#6

This should help you out with #2... It's very easy to open the servo, solder a wire to the centre pot contact and run it back to the ezb's analog port...

#7

Thanks guys, for the tips, last time i open a servo i end up buying two... ;-)

i'm very clumsy with tight spaces. I didn't give up, i'll try a cheap one, to practice.

@DJ:
I agree, no doubts, there are at least 2 options:

1) connect the servo signal to micro controller and the micro can read the modulations, i did that last night to measure the speed delays and to identify angle increments when EZB is sweeping. Although can work probably with a few more servos/ports, can't escalate to monitor all the EZB ports with a single micro.
It works if the ports are attached, but can't be used to read a detached/cold servo.

2) the other option like Richard mention, is read pot feedback, i never tried successfully hack an existent servo, but is doable if you have enough analog ports.

my solution for point 1 & 2 does not use any of the above options, point 2 is done, i'm still working on point 1 (synchronization) i'll keep you guys posted hopefully in the next few hours.

#8

I just published (public access) my test project, to show the scripts:
1) recovering the servo positions after a explicit/implicit disconnect (initialization)
2) tracking the real position of a servo while the servo is moving (sweeping)

First the output window of the initialization script (recovering servo positions after a previous disconnect)

#9

User-inserted image

#10

User-inserted image