
ptp
USA
Asked
— Edited
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) 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 ARC softare provides. The ramping and sweeping of pwm is not performed in the ARC 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.
The trouble as a programmer is assuming hardware works the same way
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 ARC 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
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:
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.
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*
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.
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)
I'm not sure ... i think someone near by me must have some crazy wifi routers i
i'll need to find a solution (i have some ideas is the next step)
If you pull too many amps from a under rated power supply (moving too many servos at once) the ezb will "brown out".. This is a condition where the voltage drops below 4.5V temporarily staving the ezb of power... It will disconnect and reboot when this happens... This is what may be causing your disconnects...
***edit*** I see you have two servos... You have a poer problem my friend... More specifically lack of... You need a better power supply of switch to using Lipo batteries
The hardware solution, it can track all the ports (0..23)
The kids use a EZ/Kit lipo battery.
But i had the idea 5A was enough how much EZB drains ?