SITL new flight mode


I’d like to develop my own flight mode (something like a circle) and test it in SITL. I found an interesting blog providing some indications on how to add a flight mode and a flip controller in px4 firwmare. This tutorial is based on px4 v1.4.4 and it’s a bit old.

Does anyone have suggestions on where I can start? What do you suggest to start develop code?


@MaEtUgR I think you could help here! :smile:

any suggestions? I hope someone could help…

Hi Matteo,

We are developing own flight modes too. When you want to make the mode like a circle you can create new mode flag and incorporate it into fw_pos_control_l1. Other requirements for running the new mode are similar to the blog.

Have you tried to do something? If you do not have a more specific problem.

I’m not now able to change mode through QGC because I cant compile QGC. But this is other problem.

Thnakyou for the suggestions @roman-dvorak.
I’m trying to implement flip_control in the last firmware. I’m able to change the flight mode from manual to flip but I still have problem with mc_att_control as when I set the reference rates the vehicle seems not responding…
When I’ll finished with flip, I’ll move to circle and expoit fw_pos_control_l1

I had no idea that you are developing this mode for multicopter. Than you need to edit mc_pos_control_l1 instead of fw_pos_control_l1.

You are setting these reference rates through uORB messages? Are you sure that you are placing correct time to message headers? I would recommend that you check that the message is being sent well. You can do it with listener app in PX4.

Witch autopilot are you using?

Yes I’m using uORB messages. I’ll try to use listener app in px4 to check messages are sent correctly.
I’m working with SITL.
Have you already implemented your own circle mode? Which autopilot did you use?


no, we haven’t implemented circle, flip mode or something like this. We are impementing own mode for prerotation of the gyrocopter rotor. And in near future for autogyro takeoff.

We are using PX4 fmu_v3, SITL with Gazebo and we are planning to use PX4 fmu v5 autopilot.

Do you know which source files allow to set flight mode from QGC? I’d like to change flight mode from QGC instead of terminal…

Sorry for replying so late.
Actually I implemented a horizontal circle for multicopter, it’s called orbit mode.
I’ll send you the references and you can ask further questions that arise when you look at them ok?

The most important spots are:

Generally I’m aware the process is a bit involved especially if you didn’t scan how the whole system works before. My goal is to simplify it and the FlightTask part is a first step into this direction. I hope I was able to help.

1 Like

Hey @MaEtUgR . A lot has changed in the PX4 firmware since this post was made. state_machine_helper no longer exists and I couldn’t find a definitive guide on the internet that teaches you to make your own flight mode.
I think it will be very helpful if you can update the guide that you’ve posted here.