CODESYS executes tasks in strict real-time, often with cycle times down to 1 millisecond.
Converting PLC data types (like REAL or INT ) into ROS2 messages ( sensor_msgs/LaserScan , etc.) requires careful serialization.
Integrating CODESYS with ROS 2 allows companies to build robust, industrial-grade mobile robots and flexible manufacturing cells. By delegating high-level perception to ROS 2 and low-level deterministic control to CODESYS, engineers no longer have to compromise between cutting-edge software capabilities and rock-solid industrial reliability.
Based on community experience and existing projects, here's a practical guide to implementing a CODESYS and ROS 2 integration. codesys ros2
What is the primary (e.g., AMR navigation, robotic arm manipulation)?
What (such as UDP, OPC UA, or MQTT) do you prefer for the bridge? Share public link
CODESYS, the market leader in SoftPLC development, has released a professional package that allows a standard Industrial PC (IPC) to run a real-time CODESYS Control Runtime and a ROS 2 stack simultaneously. CODESYS executes tasks in strict real-time, often with
A Python or C++ ROS 2 node acts as a Modbus TCP client or raw TCP server. CODESYS runs a matching server or client. Data is passed via raw byte arrays or registers.
If you build mobile robots, autonomous guided vehicles (AGVs), or industrial manipulators, you’ve likely faced this painful choice. Do you use a standard PLC for safety and I/O but struggle with complex navigation? Or do you use ROS 2 for perception and planning but struggle with real-time fieldbus control?
project is a dedicated bridge designed specifically for ROS and CODESYS. How it works By delegating high-level perception to ROS 2 and
+------------------------------------------+ | High-Level Intelligence | | ROS 2: Navigation, Vision, AI, SLAM | +------------------------------------------+ │ ▼ (OPC UA / DDS / MQTT) +------------------------------------------+ | Deterministic Control | | CODESYS: Safety, Actuation, Real-time | +------------------------------------------+ CODESYS: The Industrial Anchor
Many CODESYS-compatible controllers support OPC UA , which can be bridged to ROS 2 using standard nodes like ros2_opcua_gateway .
There is no single "native" ROS 2 driver for CODESYS, but several established methods exist: micro-ROS - Putting ROS 2 onto Microcontrollers - FIWARE
This integration allows you to keep (e-stop, light curtains, over-torque protection) while keeping Navigation and Vision in ROS 2 . The safety PLC can monitor and override the ROS 2 commands without a single line of unsafe code in your Python/C++ nodes.
: It provides a CODESYS library that allows you to use a "Robin" function block within your PLC logic to exchange data.