Adding new flight modes to multicopters

Hi all,

I would like to add new flight modes to multicopters to carry out some custom maneuvers (e.g. flip, dive, swoop etc.). Could anyone give some pointers to where I should start looking inside the source code?

I have done the tutorial in the dev guide on how to write an application, and I have some experience coding in Ardupilot. I switched to PX4 recently because PX4 is awesome :sunglasses: Help and suggestions will be much appreciated :smile:

Take a look at module mc_att_control. You could probably implement flip and roll behaviors inside it. For maneuvers which require navigation, you’ll probably need to add code in mc_pos_control.

Thank you for the suggestions. I had a look at these files and it looks like it is the correct place for me to start.

I am trying to simulate my code at the moment, so I can test any changes in the future without risking my vehicle. However, both the user and dev guide on hardware in the loop simulation is a bit out of date, do you know where I can get help for setting up a quadrotor HIL simulation?

I’m afraid I’m not up to date on that either. But there’s a gitter channel where simulation is frequently discussed: https://gitter.im/PX4/Firmware

I have added my flight task under FlightTest Lib, give reference this to mc_pos_contrl and also added added parameter in mc_pos_control
Could you please help me how to test my task.

Does anyone have any idea about how the same could be achieved for a rover?

@Shambhavi_Gupta You will have different flags being enabled for rover: PX4-Autopilot/RoverPositionControl.cpp at 86dc35022a6eadddccfa32007d5cae9bfc3d10ea · PX4/PX4-Autopilot · GitHub

You can add another case and use that as a flight mode

How about adding a new flight task instead?

@Shambhavi_Gupta Rovers don’t support flight tasks. I think this thread is becoming unrelated to the initial topic of this thread.