In the evolving world of automation, industrial machinery and robotic systems are no longer operating in silos. —traditionally masters of determinism, safety, and I/O handling—are increasingly collaborating with Robot Operating Systems (ROS) , which excel in complex motion planning, AI, and vision.
Integrating the two enables a division of labor: ROS 2 acts as the "brain," analyzing the environment and making high-level decisions, while CODESYS acts as the "nervous system," executing those decisions safely, precisely, and in real time. Key Architecture Patterns for CODESYS-ROS 2 Integration
: PLCs like CODESYS are designed for 24/7 industrial reliability and handle low-level hardware communication (e.g., motor drives, sensors) more robustly than standard ROS 2 drivers. High-Level Intelligence codesys ros2
Ensure the OPC UA server is enabled in the PLC communication settings. Step 2: Create the ROS2 Bridge Node
Gateway-based
For simple applications or constrained hardware, standard network sockets remain an option.
Never let the asynchronous nature of ROS2 stall a real-time CODESYS task. Design the PLC code to use fallback logic. If the ROS2 bridge fails to update a target coordinate within a designated watchdog time frame (e.g., In the evolving world of automation, industrial machinery
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.
OPC UA is the gold standard for industrial interoperability. Most modern CODESYS runtimes include a built-in OPC UA server. On the robotics side, developers can use Python or C++ libraries ( opcua-asyncio or open62541 ) inside a ROS2 node to act as an OPC UA client. Key Architecture Patterns for CODESYS-ROS 2 Integration :
Here's an example code snippet in C++ that demonstrates how to integrate a CoDeSys controller with ROS 2: