Is the AP_STICK MIXING Reversed in ArduPilot 2.6?

Hi,

 

I've been working with ArduPilot 2.6 load currently in the repository.

 

In my particular airframe, I need to reverse both the ailerons and the elevator, so in my header file, I have REVERSE_ROLL and REVERSE_PITCH both set to -1.

 

The FBW modes seem to work normally, however, STABILIZE and any AUTO mode (mode>FBW_B) the nudging function seems to be reversed to me.

 

Looking at the code, I notice that in the main loop we have the code for the FBW modes:

// fake Navigation output using sticks
  nav_roll = ((ch1_in - ch1_trim) * (long)HEAD_MAX * REVERSE_ROLL) / (ch1_max - ch1_trim);
  nav_roll = constrain(nav_roll, -HEAD_MAX, HEAD_MAX);

  // nav_pitch is the amount to adjust pitch due to altitude
  nav_pitch = ((ch2_in - ch2_trim) * -1 * (long)PITCH_MIN *  REVERSE_PITCH) / (ch2_max - ch2_trim);   // We use PITCH_MIN because its magnitude is normally greater than PITCH_MAX
  nav_pitch = constrain(nav_pitch, PITCH_MIN, PITCH_MAX);

 

While in the attitude tab we have the AP_STICK_Mixing code:

 

 if ((AP_STICK_MIXING == 1 && control_mode > FLY_BY_WIRE_B) || control_mode < FLY_BY_WIRE_A) { // if Controll mode is Auto/RTL/Loiter with Stick Mixing OR we're in STABILIZE
  ch1_inf = (float)ch1_in - (float)ch1_trim; //I wonder if the fact that there is no REVERSE controls here is why my STABILIZE mode appears to work backwards.
  ch1_inf = abs(ch1_inf);         
  ch1_inf = min(ch1_inf, 400.0);       
  ch1_inf = ((400.0 - ch1_inf) /400.0);
  ch2_inf = (float)ch2_in - (float)ch2_trim;
  ch2_inf = abs(ch2_inf);         
  ch2_inf = min(ch2_inf, 400.0);       
  ch2_inf = ((400.0 - ch2_inf) /400.0);
 }

 

Which does not use the REVERSE_PITCH/ROLL constants. On my aircraft the ailerons and elevator are correctly sensed when in either FLY_BY_WIRE mode, but are reversed in STABILIZE mode.

 

Is this a problem in the 2.6 code? I can see that this issue would not be caught unless one had to use the reversing function in the header file. On the otherhand, I'm still learning my way around this autopilot so there might be reversing logic deeper in the code that I haven't gotten to yet in my studies.

 

Cheers,

 

Tom

 

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

Join diydrones

Email me when people reply –

Replies

  • hi
    is it normal I've got no manual control over throttle while in stabilize mode (throttle is fixed at about 20%) ?

    regards
  • Developer
    Hey Tom and John,

    I have never tested the stick mixing, and now that I think of it I may never have tested FBW-B either, so it is quite possible that there is a bug there. I will check it out as soon as time permits.
  • I'm going to add a +1 to this. Same servo setup for me with a normal -1.

    I've had 2 flights with 2.6 now.

    First flight: Fairly good stabilization and navigation out of the box with -1. Nudging in AUTO mode was REVERSED.

    Second flight: Switched to 1 on REVERSE_PITCH/ROLL. Plane flies inverted.

    I finally sat down and bench tested this a bit more, and -1 is still the right setting for me but here are the issues.

    1) in AUTO mode nudging is reversed in its control input
    2) in FBW_B stabilization works well, but I have ZERO control input

    Manual mode works just fine. Let me know if there are any permutations that would help.

    Thanks!

    John C.
This reply was deleted.

Activity

DIY Robocars via Twitter
Oct 23
DIY Robocars via Twitter
RT @_JonMyer: 🏎 We need your help in naming my #AWS DeepRacer Underground Track 🏎 @davidfsmith's track is going to be referred to as 𝗔𝗪𝗦 𝗗…
Oct 22
DIY Robocars via Twitter
RT @gclue_akira: 仕事もおわったし、電脳化にとらい #マリオカートハック https://t.co/4IU90hCLgm
Oct 22
DIY Robocars via Twitter
This is the hashtag to follow all the people in Japan who are hacking the new Nintendo Mario Kart with the real AR… https://twitter.com/i/web/status/1319281354664677376
Oct 22
DIY Robocars via Twitter
RT @gclue_akira: @chr1sa @diyrobocars jupyter mario https://t.co/P0oHdjlCRq
Oct 22
DIY Robocars via Twitter
RT @_JonMyer: 🚨Our 1st AWS DeepRacer Community Race is Underway on http://twitch.tv/aws 🚨 Join us to find out which member of your commu…
Oct 20
DIY Robocars via Twitter
Oct 19
DIY Robocars via Twitter
RT @BackyardRobotcs: After an admittedly long wait, the new Tinymovr R3.3 motor controller is now available https://tinymovr.com 🥳
Oct 19
DIY Robocars via Twitter
RT @_JonMyer: 🏎 1 hr left before the #AWS #DeepRacer Community 🏎 Top 5 Race tomorrow LIVE on Twitch 1st Place = $50 Amazon GC or AWS Credit…
Oct 19
DIY Robocars via Twitter
Oct 16
DIY Robocars via Twitter
Oct 15
DIY Robocars via Twitter
Oct 14
DIY Robocars via Twitter
RT @davidfsmith: Race virtually with The AWS DeepRacer Community Race and then join us on the track to see how your times compare on the ph…
Oct 14
DIY Robocars via Twitter
Oct 14
Hiroki Tanaka liked Hiroki Tanaka's profile
Oct 13
DIY Robocars via Twitter
RT @breadcentric: It's now!
Oct 13
More…