Codesys Ros2 !exclusive! →
. While CODESYS excels at deterministic, real-time control (PLC), ROS 2 provides the "brains" for complex tasks like navigation, computer vision, and AI.
Historically, PLCs handled simple I/O and motion control, while a separate PC handled "smart" tasks like SLAM (Simultaneous Localization and Mapping). Integrating them directly offers several advantages:
The ROS ecosystem includes rosbridge_suite , a package that exposes ROS topics, services, and actions over a WebSocket connection using JSON messages. This lightweight protocol is ideal for connecting non‑ROS applications (e.g., a web dashboard or a CODESYS program) to a ROS 2 system.
Both are industry standards. Using them together avoids "reinventing the wheel" with custom communication protocols. The Architecture: How It Works
Previous works include:
CODESYS bridges this gap by providing a unified and mature platform for industrial communication. With CODESYS, developers can configure and manage complex fieldbuses with just a few clicks, abstracting away low-level hardware details. The primary goal of integration is to between the two platforms, allowing, for instance, ROS 2 to send target positions to a CODESYS motion controller, and CODESYS to stream back sensor data for ROS 2 to process.
A practical deployment integrated:
We propose a layered architecture consisting of three logical planes:
Bring AI-driven vision or machine learning (via ROS2 nodes) to standard industrial hardware. codesys ros2
For applications that demand high‑speed, low‑latency communication—such as joint‑level control at 200 Hz or higher—a shared memory bridge is the most performant option. Both the CODESYS runtime and ROS 2 nodes run on the same computer (e.g., an industrial PC with a real‑time operating system). A dedicated bridge process maps a region of shared memory, which both sides can read and write without copying data or incurring network overhead.
If you are running on the same industrial PC as your ROS2 Humble or Iron distribution, shared memory is the fastest route.
We evaluated the system on a dual-core x86_64 Linux with PREEMPT_RT (5.15 kernel), CODESYS Control RTE V3.5 SP19, and ROS2 Humble.
Historically, getting these two to talk required custom middleware, messy socket programming, or expensive hardware gateways. However, as Industry 4.0 advances, the demand for "Industrial ROS" has led to a convergence. Today, integrating CODESYS with ROS2 is not just possible—it is becoming a best practice for building robust, scalable robotic systems. Integrating them directly offers several advantages: The ROS
Why not just write everything in C++ (ROS2) or everything in Structured Text (CODESYS)?
In a typical modern production line, a central PLC running a CODESYS-based program coordinates the high-speed, deterministic motion of a robotic arm, while an ROS 2-based system handles autonomous navigation and object recognition. Traditionally, these two domains operated in silos, but the integration of CODESYS and ROS 2 breaks down these barriers, creating a unified control and communication architecture.
Developers can map IEC variables to MQTT or other standard protocols, which can then be ingested by a ROS2 node. This abstracts away the complex socket programming, allowing the PLC engineer to "tag" a variable in the development environment and have it instantly available to the network.