Generating Code

As a code gen extension tailor-made for robotics, the workflow for generating code with Fid is quite different to what you may be used to with other copilots or coding agents. Fid is currently optimized specifically for generating sensor integrations and only supports C++.

Basic Code Gen

To start generating code with Fid, right click on a header file name in the VS Code explorer, or inside the contents of a header file, and select “Fid: Generate File Implementation” from the context menu. This will generate the implementation for your entire header file, informed by your knowledge base, and can be an effective workflow for quickly bringing up an entirely new integration.

Alternatively, if you already have some of your integration implemented, or you would like to iterate on a specific function, you can right click inside a function definition in your header file and select “Fid: Generate Single Function Implementation” from the context menu.

Configuring Build Feedback

Fid is most powerful when it can autonomously iterate with feedback from your build system, in order to validate the code that it generates. Fid should understand build errors from most common C++ compilers.

To enable this, open the settings view in Fid and expand the “Build” section. Click on “Command” to set your build command (e.g. make -j4), and click on “Build Path” to set the path to your build directory. Finally, enable automatic builds by clicking on “Toggle auto-build”.

Now, whenever you generate code with Fid, it will automatically build your project and iterate to resolve any build errors that it encounters.