|
APIs, concepts, guides, and more
|
Learn RapidCode C++ with these sample applications.
These C++ examples, located in the examples/ folder under your RMP install directory (e.g., C:/RSI/X.X.X/examples/ or /rsi/examples/), show how to control the RMP EtherCAT motion controller with the RapidCode API. Use these projects to explore API features, validate configurations, and jumpβstart your own apps.
These samples focus on demonstrating API usage. They may not include the complete safety logic required for your machine. When working with real hardware always wire an external emergency stop, verify limits, and start with conservative motion constants.
Install the build-essential meta-package
Verify that GCC has been installed
Install Clang directly
Verify the installation
Samples such as HelloRTTasks and FollowSensor load the RTTaskFunctions library at runtime. The host sample (C++, C#, or Python) connects to the RTTaskManager, while deterministic motion/processing is executed inside the real-time tasks defined in examples/RTTaskFunctions/src/. See the rttasks documentation for the full architecture.
| Path / File | Description |
|---|---|
| src/ | Modern CMake samples organized by topic (AxisConfiguration, Motion, etc.) |
| src/config.h | User-editable configuration (RMP path, NIC, CPU affinity, hardware flag, β¦) |
| src/helpers.h | Shared helper utilities (network start/stop, error handling, console output) |
Allow license dongle access
Note: Adding a user to the rsi-dongle group grants access to all USB smart-card readers and security tokens on the system, not only RSI license dongles.
Restricting access (advanced)
The default udev rules, defined in /usr/lib/udev/rules.d/70-rsi-dongle.rules, are intentionally broad to support a wide range of license dongles. Administrators who need tighter control may replace them with rules that match specific devices (for example by USB vendor ID, product ID, or serial number).
Copy the examples
Isolate a CPU core (recommended)
Add or update the GRUB entry (replace <cpu> with the chosen core):
Reboot, then set Config::CPU_AFFINITY to that core.
Edit src/config.h before running the samples:
| Constant | Windows | Linux | Value |
|---|---|---|---|
| RMP_PATH | βοΈ | βοΈ | RMP installation path. Usually /rsi (Linux) or C:\RSI\X.X.X (Windows) |
| NIC_PRIMARY | βοΈ | The name of the primary network card (only required for physical axes) | |
| NODE_NAME | βοΈ | INtime node name (usually NodeA) | |
| CPU_AFFINITY | βοΈ | Isolated CPU core you want to use. Find it with cat /sys/devices/system/cpu/isolated | |
| USE_HARDWARE | βοΈ | βοΈ | Start with false to test your sample app with phantom axes. When you're ready to use physical motors, see the "Run with Hardware" section below |
Tip: Use rsiconfig to back up your axis settings before running samples that may overwrite firmware values. Visit Software Tools > rsiconfig in our documentation to learn more.
There are 3 supported options for building and running the sample apps
Each of these options is explained more in-depth in the sections below
Remember: Rebuild the sample app(s) after any changes to the source code
Use C/C++ Extension Pack + CMake Tools for configure/build/debug. Remote/headless targets can be driven via Remote - SSH.
Note: You can also right-click in the Project Outline dropdown to set the build and debug/launch target
Note: Re-running the Visual Studio generator script will overwrite any files in examples/C++/VisualStudio and examples/RTTaskFunctions/VisualStudio
Use the CMake CLI workflow:
Unless you call MotionController::Shutdown(), the RMP firmware will continue your run after your sample app finishes. This can also happen if you started it through RapidSetup or RapidSetupX. If you believe this is causing issues with your execution, end the RMP firmware process before running your sample app again.
Note: For more info on configuring hardware axes, see the axis-configuration.cpp sample app and our Concepts > Configuration documentation