APIs, concepts, guides, and more
🚀 Get started

Learn RapidCode Python with these sample applications.

RapidCode Python Samples

These Python 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.

⚠️ Important Note

These sample applications are provided to help you integrate the RMP motion controller into your own projects. They are not production-ready and may lack critical logic or safety mechanisms required for your specific application.

If you are working with real hardware, we strongly recommend wiring an external hardware emergency stop (e-stop) button. This safeguard is essential to protect both people and equipment, reducing the risk of injury or damage when using these sample applications.

✅ Prerequisites

  • RapidCode / RMP SDK installed (Windows: C:\RSI\X.X.X, Linux: /rsi)
  • INtime Runtime (Windows) when targeting hardware (C:\Program Files (x86)\INtime\bin)
  • Supported Python + NumPy version (see below)

⬇️ Install Python

Python (Windows) Python (Linux)
3.10 3.9 / 3.10 / 3.11
  1. Install a compatible python version from python.org
  2. Verify the version by running:

    py --version
    # Sample: Python 3.10.10

Note: You may consider uninstalling unnecessary python versions to avoid conflicts. If you need support for another Python version, contact tech@roboticsys.com.

⬇️ Install NumPy

NumPy (Windows) NumPy (Linux)
1.22 1.23 / 1.24 / 1.25 / 1.26
  1. Install by running:

    py -m pip install numpy==<VERSION_NUMBER>

📂 Files

  1. Navigate to the sample apps folder
Windows path Linux path
C:\RSI\X.X.X\examples\python /rsi/examples/python
  1. Verify that you have the following helper files:
General
_constants.py Common constants for all sample apps (RMP path, node name, etc)
_helpers.py Helper functions and utilities used across sample applications
_config.py Central configuration helpers (e.g., setup_controller, configure_hardware_axes)
_imports.py Finds our RapidCode library and imports it for our sample apps. Do not edit this file

⚙️ Configuration

Edit _constants.py before running the samples:

Constant Windows Linux Value
RMP_PATH ✔️ ✔️ RMP installation path. Usually /rsi (Linux) or C:\RSI\X.X.X (Windows)
RMP_NODE_NAME ✔️ INtime node name (usually NodeA)
RMP_NIC_PRIMARY ✔️ The name of the primary network card (only required for physical axes)
RMP_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

🚀 Get started with Python

  1. Verify you have correctly installed all prerequisites (see above)
  2. Navigate to the installed samples:
Windows path Linux path
C:\RSI\X.X.X\examples\python /rsi/examples/python
  1. Configure _constants.py (see above).
  2. Launch a terminal in that directory (PowerShell, cmd, or bash).
  3. Run a sample:

    py controller-create.py

    On Linux you can run python3 controller-create.py.

⚙️ Set up Autocomplete for the Sample Apps (VSCode)

If you'd like to have autocomplete available in VSCode for the RapidCode API, make sure that you:

  1. Open VSCode to the general RMP folder (i.e., C:\RSI\X.X.X on Windows, /rsi on Linux), not the python sample apps folder
  2. Install the Python extension
  3. Use type hints on your RapidCode objects (see below)
# No auto-complete for Axis
axis = controller.AxisGet(0)
# Auto-complete for Axis
axis: RapidCode.Axis = controller.AxisGet(0)

⚙️ Run with hardware

Some sample apps (e.g., axis-motion.py) can be run with hardware. Use the following steps to do so.

  1. Choose a sample and run it with phantom axes to understand its behavior.
  2. Adjust any motion constants (position, velocity, acceleration, jerk) to safe values.
  3. Update _config.py (user units, limits, network settings) and implement configure_hardware_axes if you are not using rsiconfig.

Note: For more info on configuring hardware axes, see our Concepts > Configuration documentation

  1. Enable hardware by setting USE_HARDWARE = True in _constants.py.
  2. Double-check constants again (especially those expressed in user units).
  3. Build and run the sample while monitoring hardware and e-stop readiness.
  4. When finished, set USE_HARDWARE = False so future runs revert to phantom axes.

⚠️ Include critical directories in your own projects

import os
import sys
import platform
if platform.system() == "Windows":
# import the ntx.dll from INtime
os.add_dll_directory("C:\\Program Files (x86)\\INtime\\bin")
# add RapidCode install directory to Python path
sys.path.append("C:\\RSI\\10.X.X\\")
else:
# linux RapidCode install directory
sys.path.append("/rsi/")

🔧 Troubleshooting

  • RapidCode not found: Set RMP_PATH in _constants.py or update sys.path.
  • Network fails: Check EtherCAT wiring or switch to phantom axes by leaving RMP_NIC_PRIMARY empty.
  • INtime DLL error: Confirm the INtime runtime is installed and os.add_dll_directory points to its bin folder.