coppeliasim-cpp provides a C++ library for interfacing with CoppeliaSim through its legacy remote API.
The library lives in coppeliasim-cpp-client/ — see its README for the API overview and usage examples.
- CMake (3.15 or newer) and a C++20 compiler to build the project.
- CoppeliaSim to run against a live simulator. The library vendors the legacy
remote API sources (under
coppeliasim-cpp-client/lib/), so CoppeliaSim is not required to build — only to run. You can download it from the Coppelia Robotics website.
cd coppeliasim-cpp-client
cmake -B build
cmake --build build
ctest --test-dir buildCMake presets are also available (see coppeliasim-cpp-client/CMakePresets.json).
-
Enable the legacy remote API on the server side. Add the following command to be executed once, at simulation start, in a child script of your CoppeliaSim scene:
simRemoteApi.start(19999)
Replace
19999with a different port if needed (the client's default is 19999). A ready-made scene is included atcoppeliasim-cpp-client/scene.ttt. -
Start the simulation in CoppeliaSim.
-
Build and run your C++ program. It should establish a connection with CoppeliaSim using the legacy remote API.
If you want to use the raw C API in your own project instead of the C++ client, the required files are already vendored in this repository:
coppeliasim-cpp-client/lib/extApi.h/extApi.ccoppeliasim-cpp-client/lib/extApiPlatform.h/extApiPlatform.c(platform-specific code)
Define the following preprocessor definitions in your project configuration (this repository's CMakeLists.txt does this already):
NON_MATLAB_PARSINGMAX_EXT_API_CONNECTIONS=255(the value is adjustable)DO_NOT_USE_SHARED_MEMORY(optional, if not using shared memory)
- CoppeliaSim Documentation: Check out the official CoppeliaSim documentation for more information on using the legacy remote API and working with the simulation environment.
Feel free to modify and extend the project according to your needs. If you encounter any issues or have questions, please open an issue in this repository.
This project is licensed under the MIT License. The vendored
CoppeliaSim legacy remote API sources under coppeliasim-cpp-client/lib/ are
third-party code distributed under their own license — see
coppeliasim-cpp-client/lib/license.txt.
