Compile custom code with different flight modes

I’ve successfully compiled ArduCopter for several boards, including ones with custom hwdef to use external IMUs.

I am now trying to compile ArduCopter that includes guided_nogps to a board that have this mode (and other features) disabled by default. Board is OmnibusF7V2.
How do I enable guided_nogps when not using CustomBuild?

I was able to do so using the CustomBuild web app, but then I cannot use custom hwdef or testing some changes in the code itself for me to test.

I couldn’t find instructions on where should I enable guided_nogps within the compilation environment to do so.

Thanks!

1 Like

Answering myself here.
As I suspected the answer is editing ArduCopter/APM_Config.h.

To enable GUIDED_NOGPS

Change from:
//#define MODE_GUIDED_NOGPS_ENABLED DISABLED
To:
#define MODE_GUIDED_NOGPS_ENABLED ENABLED

See here for an easy CLI command

hello Dotan, I want to compile arducopter that include ZigZag mode that remove for 1mb board from vertion 4.5 but i cant . when edit apm_config from //#define MODE_ZIGZAG_ENABLED DISABLED to
#define MODE_ZIGZAG_ENABLED ENABLED
compile produce Error,
plz more guide if you can change and compile it .

[ 928/1002] Compiling ArduCopter/mode_smart_rtl.cpp
[ 929/1002] Compiling ArduCopter/mode_acro_heli.cpp
[ 930/1002] Compiling ArduCopter/mode_throw.cpp
[ 931/1002] Compiling ArduCopter/mode_auto.cpp
[ 932/1002] Compiling ArduCopter/autoyaw.cpp
In file included from …/…/ArduCopter/config.h:29,
from …/…/ArduCopter/Copter.h:78,
from …/…/ArduCopter/mode_throw.cpp:1:
…/…/ArduCopter/APM_Config.h:29: error: “MODE_ZIGZAG_ENABLED” redefined [-Werror]
29 | #define MODE_ZIGZAG_ENABLED ENABLED // disable zigzag mode support
|
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors


Waf: Leaving directory `/home/babak/ardupilot/build/F4BY’
Build failed
→ task in ‘bin/arducopter’ failed (exit status 1):
{task 140283394800800: cxx mode_throw.cpp → mode_throw.cpp.51.o}
(run with -v to display more information)
→ task in ‘bin/arducopter’ failed (exit status 1):
{task 140283394800240: cxx mode_smart_rtl.cpp → mode_smart_rtl.cpp.51.o}
(run with -v to display more information)
→ task in ‘bin/arducopter’ failed (exit status 1):
{task 140283394798672: cxx mode_autotune.cpp → mode_autotune.cpp.51.o}
(run with -v to display more information)
→ task in ‘bin/arducopter’ failed (exit status 1):
{task 140283394798224: cxx mode_acro_heli.cpp → mode_acro_heli.cpp.51.o}
(run with -v to display more information)
→ task in ‘bin/arducopter’ failed (exit status 1):
{task 140283394799456: cxx mode_follow.cpp → mode_follow.cpp.51.o}
(run with -v to display more information)
→ task in ‘bin/arducopter’ failed (exit status 1):
{task 140283394798448: cxx mode_auto.cpp → mode_auto.cpp.51.o}
(run with -v to display more information)
→ task in ‘bin/arducopter’ failed (exit status 1):
{task 140283391050352: cxx takeoff.cpp → takeoff.cpp.51.o}
(run with -v to display more information)
→ task in ‘bin/arducopter’ failed (exit status 1):
{task 140283394794976: cxx autoyaw.cpp → autoyaw.cpp.51.o}
(run with -v to display more information)
babak@DESKTOP-5O513SQ:~/ardupilot$

Did you read the comment in the file that you started modifying? Keep it as it was.
Go to AP_HAL_CHibiOS\hwdef\include\minimize_common.inc and set
#define MODE_ZIGZAG_ENABLED 0
to
#define MODE_ZIGZAG_ENABLED 1

2 Likes

Thanks a lot,successfully compiled and now I Have ZigZag on my 1Mb flight board.
is it possible plz more explaine about how can remove any more none used flight mode,sensor or extra functions for save more flash because newer features? I see Custom Firmware Builder but need manualy choise sensor or pinout map in hwdef that it not possible in this page .