Back to Blog
Webots controller7/3/2023 ![]() ![]() menu item after you choose the C or C++ language on Windows. New Robot ControllerĪ Visual Studio option is offered in the File / New / New Robot Controller. In principle any C or C++ controller from the Webots distribution can be turned into a Visual Studio project. The C++ API is composed of ".hpp" files that contain C++ classes and methods that can be used in C++ controllers only. The C API is composed of ".h" files that contains flat C functions that can be used in C or C++ controllers. The developer must choose one of these two APIs as they cannot be used together in controller code. Visual Studio can be used to develop controllers using Webots C or C++ API. On Windows, Visual Studio is a possible alternative to using Webots built-in Makefile and gcc (MinGW) compiler. Microsoft Visual Studio is an integrated development environment (IDE) for C/C++ available on the Windows platform. Therefore Visual Studio needs custom instructions. In this case, the IDE integration may be much more complex.įor example, this is the case of the Visual Studio C++ compiler which is not compatible with the MINGW gcc compiler used to precompile the C++ Webots controller library. They may be incompatible with the precompiled Webots controller libraries. Some IDE comes with interpreters or a compiler tool chain. PYTHON_VERSION is your Python version, but concatenated ( 310, 39, 38, etc.).SL_SUFFIX is the suffix of a shared library.SL_PREFIX is the prefix of a shared library: lib on Linux or macOS, and an empty string on Windows.exe on Windows, and an empty string on other operating systems. EXE_EXTENSION is the executable file suffix.CONTROLLER_NAME is the name of your controller.WEBOTS_PROJECT is the path to your Webots project.Therefore a number of paths and/or environment variables should be set accordingly. ![]() The executable should be compiled, linked and executed with the Webots controller library.The target executable file should have the same name as the controller directory, and follow strictly this path: $WEBOTS_PROJECT/controllers/$(CONTROLLER_NAME)/$(CONTROLLER_NAME)$(EXE_EXTENSION).They could serve as a reference for others. Therefore, only some of them are documented here. It is simply a matter of setting up the IDE correctly to use the build rules of Webots controllers.ĭocumenting every IDE for each OS is difficult to maintain. Using an Integrated Development Environment (IDE) is convenient as it generally features advanced source code edition tools, a built-in debugger, etc.įortunately, you can use your favorite IDE to develop a Webots controller.Ī priori, Webots works with any IDE to create, build and debug robot controllers. ![]()
0 Comments
Read More
Leave a Reply. |