I have serious problem how to configure my tricopter (2.0.39). Roll and pitch are correct. Yaw(rudder aka tail servo) was incorect thus i reversed RC channel via MAVlnk (btw i don't understand why dip switches are not enabled anymore in ACM...)

Now the servo moves correct according to radio stick movement but when i do yaw movement of frame by hand servo moves incorrectly - by this 'correction' frame would start spin infinitely.

How can i reverse this?

Views: 9011

Reply to This

Replies to This Discussion

I have the exact same issue. I just got Jakub's tri frame and almost done setting it up with AC 2.0.39 and noticed the same thing. Both the servo and gyro commands are reversed.

 

Changing the direction via manlink via the planner IMO is not correct way to fix as this only reverses channel 4 (which btw, doing so also means you must arm holding down and left VS right), it does not reverse the gyro commands as you described.

 

What is the fix? I would rather not tear my tail apart and rebuild it in reverse to fix this (which would).

If I reverse RC_4 and RC_7 via MegaPlanner on commands it doesn't help. When i looked bit in the code there is such thing in ArduCopterMega.pde around line 831:

#if FRAME_CONFIG == TRI_FRAME
        // servo Yaw
        g.rc_4.calc_pwm();
        APM_RC.OutputCh(CH_7, g.rc_4.radio_out);
#endif

 

This method OutputCh doesn't do any reversing because APM_RC_Class doesn't bear any info about reversing which in opposite class AP_RC_Channel has. IMHO reversing via command in Planner is applied only for pwm inputs from receiver not for pwm outputs to servos.

This is but only my guess.

In my opinion there is missing in ACM reversing of logical functions (elev, ail, rudd) like it was with DIP switches.

Or best would be possibility reversing of output signals, not only inputs from RC receiver.

Now i can reverse movement of rudder servo by reversing of RC_4. This but doesn't affects control of this servo from ACM software ;o(.

Does hear anybody responsible on this thread?

All we really need is to reverse the output to the servo on channel 7. Im going to fuss with code a bit later tonight as searching hasnt turned up any answers.

After tons of googling, searching the forums and on and on I really found no answer to this. It seems it would be really simple, the best i could find was respondents suggesting to reverse channel 4 within the planner. As explained above this reverses the servo but the yaw correction from the APM remains incorrect.

 

Maybe reversing a channel in the APM works for planes and such, but it does not seem to work for tri-copters.

 

I went over the code for a bit and unfortunately I just don't have the time (im the lead developer for my company so am fairly busy)  to learn all there is to know about AC2.

 

Anyway, my temporary solution until someone with more AC2 knowledges comes up with an official fix (or shows us the light to the proper solution) this is what I done...

 

In ArduCopterMega.pde find this code starting around line 841 and change it to match this:

 

#if FRAME_CONFIG == TRI_FRAME
        // servo Yaw
        g.rc_4.calc_pwm();
        //APM_RC.OutputCh(CH_7, g.rc_4.radio_out);
        APM_RC.OutputCh(CH_7, (   (-1 * (g.rc_4.radio_out - g.rc_4.radio_trim) ) + g.rc_4.radio_trim  ) );
#endif

 

Basically commenting out the APM_RC.OutputCh line and adding the modified APM_RC.OutputCh. This will accomplish the same thing as adding a servo reverser (thus reversing both the yaw command from the radio and from the APM).

 

Be sure to remove any channel reversing you have set in the APM or on your radio.

 

This seems to work well. Unfortunately i cant test until tomorrow when the sun comes out. 

 

The only potential issue i see is the yaw movement of the servo seems very small. This is my first tri so maybe its just enough. We will see.

I'm going to test this modification in evening after work.

How did you get to this formula? If I go through formula

(-1 * (g.rc_4.radio_out - g.rc_4.radio_trim) ) + g.rc_4.radio_trim

I get this:

-g.rc_4.radio_out + g.rc_4.radio_trim + g.rc_4.radio_trim

in other words

-g.rc_4.radio_out + 2*g.rc_4.radio_trim

 

I'm bit confused.

For reversing I would suggest something like this:

    if(g.rc_4.radio_out < g.rc_4.radio_trim)

        APM_RC.OutputCh(CH_7, g.rc_4.radio_trim + g.rc_4.radio_out);
    else
        APM_RC.OutputCh(CH_7, g.rc_4.radio_trim - g.rc_4.radio_out);

 

radio_trim is your center point, radio_out is your yaw pwm (or ail, ele, etc) it is your center point +/- amount of change.

 

Lets say your radio trim (center point) is 1500, and you introduce some right yaw, radio out may be 1750... Using the above:

 

radio_out - radio trim = change, in this case change would be 250

 

-1 * change = reversed_change. in this case this is -250

 

reverse_change + radio_trim = 1250

 

1250 is sent to the servo vs 1750, thus reversing the servo direction traveled (also the gyro).

 

If yawing the reverse, your radio_out may be 1250, your final pwm would be 1750.

 

c_4.radio_trim +/- g.rc_4.radio_out would not work as radio_out is the radio_trim + change combined. 

 

 

 

 

 

Thanks for explanation, now i see it.

Just to report back and confirm, this fix works very well for me. Yaw works correctly and there are no apparent problems with the tri. Glad to finally get it flying on APM. Previously i was trying to get it to fly good on a kkmulticopter board which was a disaster compared to APM. Very smooth, im pleased.

Well, RC4_REV (or whatever it is) does do something, it reverses the servo travel only...it does not reverse the yaw command from the gyro which is what we needed. So the conditional statement above would result in the yaw command from the APM to be corrected but then the yaw from the radio would still be invalid (since RC4_REV reverses the radio only and my mod would reverse it back). You would have to dig through code to find where the actual RC4_REV code is and change it.

 

Its probably not worth doing this since any change you make you will have to re-apply on any update...

So i tested it now and it works well.

I used condition for channel 7 reversing:

 

#if FRAME_CONFIG == TRI_FRAME
        // servo Yaw
        g.rc_4.calc_pwm();

        if(g.rc_7.get_reverse() == true)
        {
            APM_RC.OutputCh(CH_7, (   (-1 * (g.rc_4.radio_out - g.rc_4.radio_trim) ) + g.rc_4.radio_trim  ) );

         }
        else
        {
            APM_RC.OutputCh(CH_7, g.rc_4.radio_out);
         }
#endif

 

Thanks Don. I guess it should be implemented in public version - nobody would like to bother with servo reversing  unless he does have digital one.

Yeah that works fine if the condition is on channel 7 and not 4 :)

 

Hopefully sometime soon a fix is implemented in the public version. I update allot and would love to see it in there VS having to mod every version.

How do you reverse the yaw on the APM 2.5 using the mission planner?

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service