Developing a new mode

How do I tell Mission Planner about running a certain binary in SITL?

Because even in SITL on my end it appears as this.

I appreciate the information though. By running well I mean, that my new mode is recognized correctly by your set up including SITL it appears. :slight_smile:

Let me try that gcs().send_text. Under which file is it under? Or do I include it in my mode_bird.cpp file?

You can put in somewhere that gets executed. Let’s say in mode.cpp right at the begining of

bool Copter::set_mode(Mode::Number mode, ModeReason reason)
{
gcs().send_text(MAV_SEVERITY_INFO, “Mode change initiated…”);


So here is the added code,
image
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.

OK.

  1. You are definitely not running your compiled code.
  2. I’m not familiar with navio, but I think you should check the “Launching a Custom Ardupilot binary” part here https://docs.emlid.com/navio/common/ardupilot/installation-and-running/ perhaps there is a step that you skipped

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. :smile:

1 Like

Curios, which one is your favorite? :slightly_smiling_face:

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.