Codesys Ros2 Online
Integrating creates a powerful hybrid architecture where CODESYS handles low-level, real-time industrial hardware protocols (like EtherCAT or CANopen) while ROS 2 manages high-level tasks such as motion planning and AI. This combination is often achieved through high-speed communication bridges like shared memory or Modbus TCP. Key Integration Approaches Shared Memory Bridge : Projects like ScalABLE40/robin
provide a direct ROS node and CODESYS library to exchange data via shared memory. This is ideal for high-speed control (up to 1000 Hz) where both ROS 2 and the soft PLC run on the same embedded hardware, such as a Raspberry Pi ctrlX CORE Standard Industrial Protocols : You can connect them using common protocols like Modbus TCP EtherNet/IP
. ROS 2 nodes written in Python or C++ can act as clients to read/write PLC registers. Datalayer Integration
: Modern industrial platforms like Bosch Rexroth’s ctrlX use a "datalayer" that acts as a broker, allowing ROS 2 topics to be mapped directly to PLC global variables. Bosch Rexroth Performance and Capabilities codesys ros2
The Synergy
By integrating the two, you build a hybrid system:
| Feature | Handled by CODESYS (PLC side) | Handled by ROS 2 (Edge/PC side) | | :--- | :--- | :--- | | Real-time control | Servo drives, hydraulic valves, temperature loops (<1ms) | High-level trajectory following (>10ms) | | Safety | Safety-rated PLC (ISO 13849) | Monitoring, but not SIL-rated logic | | I/O Handling | 24V digital, 4-20mA analog, EtherCAT slaves | Cameras, LiDARs, 3D sensors, microphones | | Algorithms | PID, motion control (CNC/Robotics) | SLAM, A*, MoveIt motion planning, YOLO vision | | Communication | Modbus TCP, Profinet, OPC UA | DDS (Fast-DDS, CycloneDDS), MQTT, WebSockets | | Deployment | Flash to non-volatile PLC memory | Docker containers, Kubernetes, snap packages |
2.2 ROS2 Communication Model
ROS2 uses DDS as its middleware, providing: The Synergy By integrating the two, you build
- QoS profiles: Reliability, durability, history, deadline.
- Discovery: Dynamic node discovery via participant discovery protocol.
- Node model: Publisher, Subscriber, Service, Action.
Introduction: The Clash of Two Worlds
In the landscape of modern automation and robotics, two software environments reign supreme, yet they speak fundamentally different languages.
On one side, we have CODESYS (Controller Development System). It is the invisible giant of industrial automation. Powering PLCs from hundreds of OEMs (including Wago, Beckhoff, Schneider Electric, and many more), CODESYS is the home of IEC 61131-3 languages (Ladder Logic, Structured Text, FBD, SFC, IL). It is deterministic, real-time, and reliable—the beating heart of factory floors, process control, and hydraulic presses.
On the other side, we have ROS 2 (Robot Operating System 2). The rebellious, open-source star of research and logistics. ROS 2 thrives on distributed computing, peer-to-peer discovery (DDS), modular nodes, and a vast ecosystem for navigation, manipulation, perception, and simulation (Gazebo, Rviz). It is the brain of autonomous mobile robots (AMRs), robotic arms, and drone swarms. QoS profiles: Reliability, durability, history, deadline
For a decade, engineers dreamed of merging these worlds: let the PLC handle the hard real-time I/O and safety, while ROS 2 handles the complex perception, path planning, and high-level decision-making.
The good news? The dream is now a mature reality. The "CODESYS ROS 2" integration allows these two giants to communicate seamlessly. This article explores why, how, and where you should implement it.
Part 3: Step-by-Step Integration Guide (Conceptual)
Let's simulate a simple project: ROS 2 sends a target speed to a CODESYS motor controller.
Tools and resources
- CODESYS Control for target runtime platforms (Windows/Linux/real-time)
- ROS 2 distributions (Humble, Iron, or latest stable compatible with your OS)
- OPC UA servers/clients and OPC UA–ROS bridges
- DDS/RTPS config and QoS tuning for ROS 2
- Container tooling (Docker) for isolating ROS 2 nodes near CODESYS runtime