| Application Area | Description | | :--- | :--- | | | Precise control of robotic arms for pick-and-place, assembly, welding, and painting. ROS 2 handles path planning and vision, while CODESYS manages the real-time joint control. | | Autonomous Mobile Robots (AMRs) | Combined navigation and manipulation systems, where ROS 2 provides SLAM and autonomy, and CODESYS handles wheel motor drives, safety interlocks, and battery management. | | Digital Twins | Creation of virtual replicas of physical systems for simulation, monitoring, and predictive maintenance, using the Gazebo-ROS 2 pipeline to simulate and visualize the behavior of the CODESYS-controlled machine. | | Smart Manufacturing | Fully integrated production cells where every component communicates seamlessly, using the combined strength of ROS 2 and CODESYS to orchestrate complex workflows. |

CODESYS (Controller Development System) is unique among PLC environments because it runs on a real-time operating system (RTOS) kernel (e.g., CODESYS Control RTE on Linux) and can execute IEC 61131-3 code (Ladder Logic, Structured Text, etc.) with sub-millisecond jitter. ROS2, by contrast, prioritizes throughput and scalability over strict determinism but offers a rich ecosystem of packages.

// 2. Handle Connection Status bConnected := MqttClient.xConnected;

While the integration of CODESYS and ROS 2 is powerful, it comes with its own set of challenges. Key implementation challenges include:

PROGRAM PRG_JointPublisher VAR ros_pub : FB_ROS2_Publisher; joint_pos : ARRAY[0..5] OF LREAL := [0.0, -0.5, 0.5, 0.0, 0.0, 0.0]; trigger : R_TRIG; cycle : UINT := 0; END_VAR

In response to the need for a dedicated, high-performance bridge, the project was created. Developed initially within the European ROSIN project, ROBIN is an open-source middleware designed specifically to provide a bidirectional, reliable, and structured real-time communication link between ROS and CODESYS. ROBIN utilizes the EtherLab Master Module API for the EtherCAT protocol to establish a high-speed real-time channel.

For the most demanding real-time applications, such as direct, high-speed motion control loops, the overhead of network-based communication might be prohibitive. A high-performance alternative is to use POSIX shared memory, where both ROS 2 nodes and the CODESYS Control runtime system share a common memory region, enabling near-zero-latency data exchange. The CODESYS SysShm library provides functions like SysShmOpen to facilitate this, and the POSIX-based shared memory libraries enable the ROS side to interact with the same memory region seamlessly.

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.