Ros2 | Codesys
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++).
Inserting the CODESYS→ROS2 publisher at 1kHz increased the maximum PLC cycle time from 1.02ms to 1.19ms (17% increase). The worst-case occurred during DDS discovery heartbeats (every 3s). Using rclcpp::Publisher::publish() with pre-allocated messages eliminated dynamic memory inside the RT task.
While highly effective, bridging these two systems presents unique challenges: codesys ros2
ROS 2 relies natively on DDS for its middleware layer. Some modern industrial controllers running CODESYS allow developers to implement DDS communication directly within the PLC runtime using C++ extensions or specialized libraries. This provides the lowest latency and direct topic subscription/publication between the PLC and ROS 2 nodes. 2. Modbus TCP or OPC UA Bridge
: High-speed communication is often achieved via shared memory. A ROS 2 node reads and writes data to a specific memory location that the CODESYS runtime can also access, enabling extremely low-latency data exchange. ROBIN Project Set up an OPC UA Server in CODESYS
This example shows the core action of populating a message object and publishing it, regardless of the underlying communication method.
The open‑source project exemplifies this approach. ROBIN (ROS‑CODESYS Bridge) uses a shared memory segment to map CODESYS variables directly to ROS topics. It consists of two components: This provides the lowest latency and direct topic
The worlds of industrial automation and advanced robotics are rapidly converging. Historically, industrial automation relied on Programmable Logic Controllers (PLCs) running deterministic, robust, and safe control loops. Meanwhile, advanced robotics—especially Autonomous Mobile Robots (AMRs) and Automated Guided Vehicles (AGVs)—developed within the open-source, highly flexible ecosystem of the Robot Operating System (ROS and now ROS 2).
Use the CODESYS DDS configuration to map global variables to the corresponding ROS2 topicName and typeName .
This public link is valid for 7 days and shares a thread, including any personal information you added. This link or copies made by others cannot be deleted. If you share with third parties, their policies apply. Can’t copy the link right now. Try again later. ScalABLE40/robin: The ROS-CODESYS Bridge - GitHub
