Write a Guidance Mode in C++

Hi,

I’m trying to write a guidance mode in C++, I’ve written my code following what’s explained on Guidance - 7.7 and I’ve made changes to the ‘atom.mk’ file however I can’t figure out how to make the whole thing work. My cpp file is compiled but doesn’t seem to be taken into account. I feel like I’m missing something on how executables are dealt with. Could anyone help me ? Is there any documentation that I could refer to ?

Thank you

1 Like

Hi e267,

We are working on adding more examples to the airsdk samples repository. but they are not ready (including an example of C++ guidance mode).

Please find a template of a atom.mk to be placed in you guidance/native directory and included by the main atom.mk of autopilot-plugins by adding ‘include $(LOCAL_PATH)/guidance/native/atom.mk’ at the end of the file.

template.zip (495 Bytes)

You can find documentation on how to write an atom.mk here (it is part of Alchemy build system documentation):

Thanks,

1 Like

Also you will need to enable it in the build config.

To edit the configuration file (and enable your module), you can use the ./build.sh -p hello-pc -A xconfig (graphical) or ./build.sh -p hello-pc -A menuconfig (ncurses) tasks, which work similarly to the linux kernel configuration tools.

This will allow the -t all task to properly build your new module.

Thanks,

Hi Ronan,

Thanks a lot ! However I’ve followed your instructions and it still doesn’t work.
This is what I’ve done so far :
(1) I’ve added the template of the atom.mk file and the guidance modes written in cpp under the directory guidance/native
(2) I’ve changed how the guidance messages.proto is handled in the main atom.mk following the same syntax used for the service’s messages.proto and added the line ‘include $(LOCAL_PATH)/guidance/native/atom.mk’
(3) I’ve removed anything relative to the guidance file written in python in the main atom.mk

It builds just fine using ‘./build.sh -p hello-pc -A xconfig’ and then ‘./build.sh -p hello-pc -t all -j’ but when I launch the mission and want to use a mode it doesn’t work.

Is there something else that I should know and/or could try ? Here is how I’ve written my guidance modes :

I’ve also added the functions guidance_plugin_init(guidance::Guidance *guidance) and void guidance_plugin_shutdown(guidance::Guidance *guidance) at the end of the file.

Thanks,

Also, when the mission is launched I get the following log :
guidance (guidance-337) : Adding guidance mode ‘ModeTest’

There is no errors but I can’t see my log “DEBUG TEST”

Issue solved : the name given to the mode in the cpp file was different from the one used with the set_guidance_mode() function

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.