How to add a new flight mode

I have coded my custom flight mode in cpp but now I don’t what steps should I follow to register my new flight mode in ardupilot? Help

How to add a new flight mode in ArduPilot?

To add a new flight mode in ArduPilot, follow these steps:

  1. Name the Mode: Add the new mode to the control_mode_t enum in mode.h.

  2. Define the Class: Create a new class in mode.h, inheriting from the Mode class. Implement run(), name(), and name4() methods.

  3. Create a .cpp File: Develop a new mode_<new flight mode>.cpp file, implementing the init() method.

  4. Instantiate the Mode: Add the new mode in Copter.h.

  5. Map the Mode: Update mode_from_mode_num() in mode.cpp.

  6. Update Parameters: Add the mode to FLTMODE1 ~ FLTMODE6 in Parameters.cpp.

For detailed guidance, refer to the Adding a New Flight Mode to Copter documentation.

2 Likes

Thankyou @amilcarlucas