Quick IDEA Required: Continuous servos

Dear All,

I am using continuous rotation servo for 'Yaw' control of my camera gimbal. I am using it for stabilization around a setpoint/ target angle, using PID's.

If I give a target of say 60 degrees, the servo should adjust its speed in such a way as to make it to 60 degrees (in a circle of 360 degrees).

The AHRS system gives a DCM Yaw output from [-180 to 180], i.e. 0 to +180 degrees and sudden transition to -179 and goes to 0 in the reverse direction.

The problem I am facing is this transition around the boundary from +180 to -179. If my target angle is say 170 degrees, once it nears 170 degrees the servo speed reduces and when it reaches 170, the velocity becomes zero to a standstill. Having the same 'Target angle' if the orientation of board is such that yaw output is 180 and then a slight change in orientation cause a sudden change to -179 (This is a difference of almost 180 - (-179) ~= 360). The servo speed reverses from relatively slow to fast, due to this vast difference to compensate.

Is there a workaround? or a method to compensate for this problem? This is not there in the code. Any help is appreciated.

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • anyone know about any 360degree servos out there ? - trying to avoid belts.

  • Developer

    It sounds to me like you are stuck, simply because the system is designed for a non-continuous servo, not a continuous one.   You'll need to calculate your direction and speed of rotation differently than usual, but it shouldn't be too hard, assuming you can write a little code.   :-) 

    eg:  in your solution, your servo should always take the "path of least rotation" between it's current position and it's target position, so (eg)  if current position is X, and target position is Y ( both range from -180 to +180 ), then the angle(A) of least-rotation  travel could be calculated as  the minimum of one of three values.  

    A = min(abs(Y-X), abs(X-Y), (180-abs(X))+(180-abs(Y)) )  

    and the direction of travel from X to Y could be calculated with something like:


    if ( X+A==Y) { go_clockwise(); } else
    if ( X-A==Y ) { go_anticlockwise(); } else

    if ( X+180)+(180-Y)==A ) { go_clockwise(); } else

    if( Y+180) + (180-X)==A) { go_anticlockwise(); }

    ...or something kinda like that.    I've not tested that, just made this crap up. :-)

This reply was deleted.

Activity