Codesys Ros2 [exclusive] [ LIMITED ]
CODESYS GmbH (now part of Schneider Electric) provides a dedicated for CODESYS. This library introduces special function blocks that act as DDS (Data Distribution Service) publishers and subscribers—directly from IEC 61131-3 code.
: ROS2 messages use Unix epoch timestamps, while PLCs often use internal hardware ticks or local system time. For accurate data alignment, use Network Time Protocol (NTP) or Precision Time Protocol (PTP/IEEE 1588) to synchronize the system clocks of your PLC and ROS2 computer.
Integrating CODESYS with ROS 2 is not without pitfalls. Here are common issues and how to avoid them:
+-------------------------------------------------------+ | Industrial PC (IPC) | | | | +---------------------+ +---------------------+ | | | CODESYS RTL | | ROS2 Node | | | | (Deterministic) | | (Asynchronous) | | | +----------+----------+ +----------+----------+ | | | | | | +------------+--------------+ | | | | | [Bridge Layer: Shared Memory / DDS / MQTT] | +-------------------------------------------------------+ 1. The Native DDS Approach (Data Distribution Service) codesys ros2
Traditional industrial robot arms programmed in CODESYS can handle fast, repeatable pick-and-place trajectories. By integrating ROS2, engineers can attach a 3D camera to the system, use ROS2 OpenCV or point-cloud processing nodes to identify randomly oriented items, and send the exact coordinates down to the CODESYS PLC for execution. 3. Digital Twins and Simulation
Non-time-critical data, such as sending telemetry to a dashboard or receiving high-level mission commands (e.g., "Go to Station A"). 2. The CODESYS "ROS 2 Driver" (Micro-ROS) For deeper integration, some developers use
: This open-source bridge (originally for ROS but adaptable for ROS 2) maps CODESYS variables directly to ROS topics using a dedicated library and a ROS node. Industrial Protocols : Alternatives include using Modbus TCP CODESYS GmbH (now part of Schneider Electric) provides
By linking CODESYS and ROS2, engineers build systems where the PLC handles predictable hardware control while ROS2 provides the "brains" for advanced autonomy. Architectural Patterns for Integration
PLC-centric (CODESYS master)
Highly secure, object-oriented, natively supported by CODESYS, excellent for cross-vendor industrial networking. For accurate data alignment, use Network Time Protocol
This is the most efficient approach, ideal for high-speed motion control.
The core challenge of a CODESYS-ROS2 integration is bridge communication. Because the platforms utilize different data structures and network protocols, engineers typically choose one of three architectural approaches:
ROS2 relies heavily on coordinate transformations via the tf2 package, adhering to standard Cartesian coordinates (X-forward, Y-left, Z-up). Industrial articulated arms or gantry systems programmed in CODESYS may use alternative kinematic definitions.
Lightweight, incredibly fast, easy to implement for basic data exchange.
community has several open-source projects dedicated to communication libraries. Additionally, checking out the ROS 2 Hardware Interface

