The “No Such Mode” message is coming from the flight controller , not from Mission Planner. (mode.cpp / Copter::set_mode) it got a null pointer instead of the mode handling function pointer…
Which could mean that it got a wrong mode number from mission planner. You should check mavlink communication between FC and Misison Planner (CTRL-F and Mavlink inspector)…
Ok, I downloaded your code and run in SITL. Modified ParameterMetaData.xml FLTMODE1 as this :
<FLTMODE1>
<DisplayName>Flight Mode 1</DisplayName>
<Description>Flight mode when Channel 5 pwm is <= 1230</Description>
<Values>0:Stabilize,1:Acro,2:AltHold,3:Auto,4:Guided,5:Loiter,6:RTL,7:Circle,9:Land,11:Drift,13:Sport,14:Flip,15:AutoTune,16:PosHold,17:Brake,18:Throw,19:Avoid_ADSB,20:Guided_NoGPS,21:Smart_RTL,22:FlowHold,23:Follow,24:ZigZag,25:SystemID,26:Heli_Autorotate,27:TestMode1,28:TestMode2</Values>
<User>Standard</User>
</FLTMODE1>
I am working with one mode now and will not implement the second one until I get at least one mode implemented.
The following two pictures are what mavlink inspector gives me when I am in stabilize mode and autorotate mode.
Quick test; change the Stabilize mode name in the xml to something else, like Xabilize and check if it reflected in Mission Planner as well. Just to rule out issues with the xml file.
Oh, sorry… I had forgotten that we’d been here before; New Flight Mode not shown in Mission Planner
How do you get MP to use a local XML file? Do you need to build your own exe?
The mode exists, and its run() method is being called when I activate it via mavproxy. I can’t say whether it “works well” though
Are you sure MP is running the right binary for you (if using SITL) or that the FC has the right binary flashed?
I’m baffled.
I compiled your code and ran it as SITL.
Added mode 27 to Mission Planner
And as you saw above it worked fine.
Are you absolutely sure that you running your code in SITL or Flight Controller ? Perhaps you can add some gcs().send_text to the Flight controller code to make it sure…
and build the code once more using the waf system.
alias waf=“$PWD/modules/waf/waf-light”
waf configure --board=navio2
waf --targets bin/arducopter
I am assuming the message should appear under the messages tab in mission planner, and here is the result after changing through different modes under simulation.
I switched through the first three flight modes, it looks like I am not running my built code?
Are you also using the waf system to compile your code?
Not sure how useful this may be but here is how I go about editing code:
with ardupilot cloned to my pi,
I use WinSCP to get the files I will be making edits to such as mode.cpp from the pi to my PC
Then on my PC, I make the edits using sublime text editor, save the file, then copy my edited file back to the pi via WinSCP
I set up the waf build system on my pi and compile the code.
I use putty as my terminal for the pi.
Sounds good to me! I will begin here and see how far I get. This is all new to me but I really appreciate all the help you all have given me and for being patient with me!
Update on the status of my issue. It was the fact that I was not running the compiled code and the link you shared with me helped me realize what I was missing, once I followed and experimented with the steps i was able to successfully implement my custom modes. So thank you again! I am really grateful.
Can you please tell how did you ran your ardupiliot in mission planner. I am trying in SITL but even after adding the new mode it shows unknown mode in the terminal.