How to let a new flight mode appear on MAVproxy?

I’m playing with Skywaker X8 plane, and want to create a new flight mode to do some stunts XD,and I want to test the code first by SITL with MAVproxy, but even the first step: let the mode appear on the MAVproxy’s available modes list failed.Here are the things I have done:

Define for the new flight mode in defines.h [ ... /defines.h](
QHOVER = 18, QLOITER = 19, JULAND = 20, //in enum flight FlightMode ,my new flight mode called JULAND,and give value 20

Add mode name in ArduPlane/APM_Config.h.reference 6edb9fa  (these numebers are an github..)

// MANUAL | Full manual control via the hardware multiplexer. // | +// JULAND | very original ju style.

Add new flight mode's option in ArduPlane.cpp , now I just add simple codes to verify it works in the MAVproxy. and also try my flightmode with MANUAL's option, but not work in MAVproxy either

`+case JULAND:
channel_roll->servo_out = 2000;
channel_pitch->servo_out = 1100;
steering_control.steering = steering_control.rudder = channel_rudder->pwm_to_angle();

channel_throttle->servo_out = 100;

break; `

Add mode case in ArduPlane/GCS_Mavlink.cpp 6edb9fa
case JULAND: //do nothing as other modes

5.Add mode in ArduPlane/Parameters.cpp ,make it as a choice in RC switch 1~6 672d090
// @Param: FLTMODE2 // @DisplayName: FlightMode2 // @Description: Flight mode for switch position 2 (1231 to 1360) // @Values: 0:Manual,1:CIRCLE,2:STABILIZE,3:TRAINING,4:ACRO,5:FBWA,6:FBWB,7:CRUISE,8:AUTOTUNE,10:Auto,11:RTL,12:Loiter,15:Guided,20:JULAND

Add mode case in ArduPlane/system.cpp d092561

After done these, when do SITL in MAVProxy, to input “mode” on console ,get this:
‘Available modes:’,[‘RTL’,‘TRAINING’,‘LAND’…but my new flight mode not appear.
So I think maybe Mavproxy’s code also need some change,so I download mavproxy’s source code ,
and find seems that I need also add code in ardupilot/modules.mavlink/pymavlink/
mode_mapping_apm = { 0 : ‘MANUAL’, 1 : ‘CIRCLE’, 2 : ‘STABILIZE’, 3 : ‘TRAINING’, … 18 : ‘QHOVER’, 19 : ‘QLOITER’, 20 : ‘JULAND’ }
but MAVPROXY still not has my new mode JULAND

so I decided to ignore this and set flightmode 5 as 20 (20 presents my mode ),as a myparameter.parm. After take off successful with AUTO, I input “switch 5” in console.
and a error comes out :
"Verify nav. Invalid or no current nav cmd"
this error is part of code in ArduPlane/commands_logic.cpp
Plane::verify_command(const AP_Mission::Mission_Command& cmd)'s part of code…

I’m confused what further steps needs to be done= =
the main question are these three:
1.Am I add a new flight mode right in plane’s code ?For there is only copter’s example
2.How to make a new flight mode available in Mavproxy?
3.Why “Verify nav. Invalid or no current nav cmd” happens?

Is this caused by the pythenpath crashed bug?SITL: Windows build fails #3586

I use window’s cygwen do these

I have the same issue! This you solved this?
Instead of creating the same post I hope someone can reply to this :slight_smile: