PROGRAM Publish_Twist VAR pub : REFERENCE TO Publisher; twist : REFERENCE TO Twist; END_VAR pub := ROS.NewPublisher('cmd_vel', 'geometry_msgs/Twist'); twist := ROS.NewObject('geometry_msgs/Twist'); twist.linear_x := 0.1; twist.angular_z := 0.2; pub.Publish(twist);
The shared memory approach used by ROBIN is the most real‑time‑friendly. Because both processes are on the same machine and the data exchange does not involve the kernel’s network stack, latencies can be kept under 100 µs. In contrast, WebSocket or OPC UA over TCP/IP may add unpredictable delays due to network scheduling and protocol overhead.
ROBIN supports a wide range of IEC 61131‑3 data types—BOOL, integers of various widths, REAL, LREAL, STRING, as well as arrays and custom structures—and has predefined message definitions for common ROS types. The bridge can be largely automated: the developer defines variables in the CODESYS project, then runs an updater tool that generates the necessary ROS mapping. codesys ros2
Building a CODESYS-ROS2 application typically follows this deployment pipeline: Step 1: Environment Setup
By effectively distributing the workload—having CODESYS manage the deterministic, low-level hardware and ROS 2 handle the complex, high-level intelligence—you can build a more reliable, powerful, and efficient robotic system. PROGRAM Publish_Twist VAR pub : REFERENCE TO Publisher;
The integration of CODESYS and ROS 2 enables sophisticated automation systems across various industries. The table below outlines some key application areas.
This paper presented a practical, real-time capable bridge between CODESYS PLCs and ROS2. By embedding a ROS2 client library into the CODESYS runtime and using a lock-free FIFO between the real-time task and a lower-priority spin thread, we achieve mean latencies of 220μs—suitable for high-speed robotic control. The architecture preserves the determinism of IEC 61131-3 code while leveraging the full ROS2 ecosystem. Source code for the CODESYS ROS2 client library is available under Apache 2.0 license (anonymized for review). ROBIN supports a wide range of IEC 61131‑3
: It adheres to rigorous functional safety standards (IEC 61508) required for heavy machinery and factory environments. The Strengths of ROS 2
CODESYS and ROS2: Bridging Industrial Automation and Advanced Robotics
ROS 2 is an open-source middleware framework built explicitly for complex, non-deterministic robotics applications.
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.