The conventions for writing Basilisk modules — naming, SWIG interface files, CMakeLists layout — apply equally to external modules. See the module authoring documentation for details.
Directory structure
Your external folder must follow a specific layout. The top-level folder can have any name; the sub-folder names are fixed.Folder descriptions
| Folder | Required | Description |
|---|---|---|
ExternalModules/ | Yes | Contains one sub-folder per custom module. |
ExternalModules/_GeneralModuleFiles/ | No | Shared source files used by multiple modules. All files must be placed directly in this folder — sub-folders are not supported. |
msgPayloadDefC/ | No | Custom C message header files. Follow the naming convention <MessageType>MsgPayload.h. |
msgPayloadDefCpp/ | No | Custom C++ message header files. Same naming convention as C headers. |
Build with external modules
Pass the path to your external folder with--pathToExternalModules. Both absolute and relative paths are accepted.
Assuming your External folder is located next to the Basilisk source directory:
ExternalModules group. Custom message types are merged with the core BSK messages under architecture/msgPayloadDefC and architecture/msgPayloadDefCpp.
Import custom modules in Python
Custom modules are built into theBasilisk.ExternalModules Python package. To use a module named customCppModule in a simulation script:
Full build example
The following is a complete workflow for building Basilisk with an external module folder:Write your module files
Add your
.cpp, .h, .i, and CMakeLists.txt files inside ../External/ExternalModules/myModule/.Frequently asked questions
Can I store the external folder on a different drive?
Can I store the external folder on a different drive?
On Linux and macOS, yes. On Windows, the external folder must be on the same drive as the Basilisk source directory.
Can I rename the ExternalModules sub-folder?
Can I rename the ExternalModules sub-folder?
No. The key sub-folder names (
ExternalModules, _GeneralModuleFiles, msgPayloadDefC, msgPayloadDefCpp) are fixed and cannot be changed. If you rename them, you must write your own CMake file.Do I need to re-run conanfile.py after every code change?
Do I need to re-run conanfile.py after every code change?
Only if you add new message definitions or new source files that affect the auto-generated messaging layer. For iterative changes to existing module code, use an incremental build from the
dist3/ folder after the initial configure step.