CODESYS Control Runtime follows a cyclic executive pattern:
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.
Imagine an Autonomous Mobile Robot (AMR) designed for a warehouse. Here is how the responsibilities are split: codesys ros2
The CODESYS Layer:
The ROS2 Layer:
The Interface:
The ROS2 Nav2 stack calculates a velocity command (Twist message). It publishes this to a topic /cmd_vel. Through a DDS bridge or Gateway, this data arrives in the CODESYS controller as a structure containing linear and angular velocities. The CODESYS logic then checks if the velocity is within safe limits, applies ramping (smooth acceleration), and sends the command to the motor drives.
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). CODESYS Control Runtime follows a cyclic executive pattern:
Acknowledgments – The authors thank the CODESYS community and ROS-Industrial consortium for feedback.