Codesys Ros2 Now
CoDeSys is a popular software tool for programming and configuring industrial controllers, such as programmable logic controllers (PLCs). It provides a comprehensive development environment for creating and testing control applications.
[1] CODESYS GmbH. (2023). CODESYS Control RTE User Manual.
[2] Macenski, S., et al. (2022). "Robot Operating System 2: Design, architecture, and uses in the wild." Science Robotics.
[3] ROS-Industrial Consortium. (2021). ros2_canopen – ROS2 CANopen driver.
[4] OPC Foundation. (2020). OPC UA for Robotics Companion Specification.
[5] Maruyama, Y., et al. (2019). "Bridging ROS2 and DDS for real-time control." IEEE Int. Conf. on Robotics and Automation.
[6] Benveniste, A., et al. (2018). "Time in DDS and ROS2." Tech Report, INRIA.
Appendix A: CODESYS library architecture diagram
Appendix B: ROS2 message definition for PLC status
Appendix C: Benchmark raw data tables
Integrating CODESYS with ROS 2 allows you to combine the deterministic hardware control of industrial PLCs with the advanced motion planning and perception capabilities of the Robot Operating System. 🚀 Direct Integration Methods
Shared Memory Bridge (Recommended for High Speed): Use the ROBIN project (ScalABLE40/robin) for high-performance data exchange on the same hardware (e.g., Raspberry Pi, Beaglebone). codesys ros2
OPC UA Bridge: Set up an OPC UA Server in CODESYS and use a ROS 2 node as an OPC UA Client with libraries like asyncua (Python) or open62541 (C++).
MQTT Messaging: Use the CODESYS MQTT library to publish PLC variables to a broker and subscribe to them via a ros2_mqtt bridge for non-real-time tasks.
Micro-ROS Agent: For microcontrollers or lightweight PLCs, run a micro-ROS node directly on the target hardware to communicate with the ROS 2 Global Data Space. 🛠️ Strategic Setup: Why use both?
Here’s a feature concept for bridging CODESYS (a leading IEC 61131-3 development environment for industrial controllers) with ROS 2 (Robot Operating System), aimed at simplifying hybrid robotics/automation projects. CoDeSys is a popular software tool for programming
CODESYS, the market leader in SoftPLC development, has released a professional package that allows a standard Industrial PC (IPC) to run both a real-time CODESYS Control Runtime and a ROS 2 stack simultaneously.
It isn't just a bridge; it is a native integration. The ROS 2 nodes communicate directly with the CODESYS SoftMotion PLCopen parts via shared memory.
Both CODESYS runtime and ROS 2 must use the same DDS implementation (e.g., eProsima Fast DDS or CycloneDDS). Configure their XML profiles to share the same domain ID (e.g., Domain ID = 5), network interface (e.g., eth0), and discovery settings.
The CODESYS ROS 2 integration is a mature, production-ready bridge that respects the strengths of both worlds. It does not ask a PLC to think like a robot, nor a robot to cycle like a PLC. Instead, it creates a high-bandwidth, low-latency neural link between deterministic control and cognitive autonomy. Appendix A: CODESYS library architecture diagram Appendix B:
For engineers facing the greenfield challenge of Industry 4.0, mastering this bridge is no longer a "nice to have"—it is a competitive necessity.
Ready to start? Download the CODESYS ROS 2 library from the CODESYS Store, install Ubuntu 22.04 with ROS 2 Humble and CODESYS Control for Linux, and begin your first hybrid project today.
In your CODESYS project:
The lock-free bridge adds ~135μs overhead compared to native DDS, acceptable for most mechatronic systems (e.g., mobile robot base control, conveyor tracking). The OPC UA path is unsuitable for real-time control but remains viable for configuration and non-critical logging.
We implemented a CODESYS ROS2 Client Library written in C++ (compiled as a CODESYS External Library) and exposed to IEC code via Function Blocks (FBs).