Codesys Ros2 May 2026

Integrating creates a powerful hybrid architecture where CODESYS handles low-level, real-time industrial hardware protocols (like EtherCAT or CANopen) while ROS 2 manages high-level tasks such as motion planning and AI. This combination is often achieved through high-speed communication bridges like shared memory or Modbus TCP. Key Integration Approaches Shared Memory Bridge : Projects like ScalABLE40/robin

provide a direct ROS node and CODESYS library to exchange data via shared memory. This is ideal for high-speed control (up to 1000 Hz) where both ROS 2 and the soft PLC run on the same embedded hardware, such as a Raspberry Pi ctrlX CORE Standard Industrial Protocols : You can connect them using common protocols like Modbus TCP EtherNet/IP

. ROS 2 nodes written in Python or C++ can act as clients to read/write PLC registers. Datalayer Integration

: Modern industrial platforms like Bosch Rexroth’s ctrlX use a "datalayer" that acts as a broker, allowing ROS 2 topics to be mapped directly to PLC global variables. Bosch Rexroth Performance and Capabilities codesys ros2

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.


Option B: ROS 2 + Modbus/TCP

Conclusion: Do You Need CODESYS ROS 2 Integration?

Yes, if:

No, if:

Step 2: Write CODESYS PLC Logic

In your CODESYS project:

  1. Add the ROS2 Core and ROS2 std_msgs libraries.
  2. Declare variables:
    PROGRAM Main
    VAR
        ros2_core : ROS2_CORE;
        sub_cmd_vel : ROS2_SUBSCRIBE;
        twist_msg : geometry_msgs__Twist;
        motor_speed_left : REAL;
        motor_speed_right : REAL;
    END_VAR
    
  3. In the PLC cycle:
    • Call ros2_core() to initialize the DDS node (once).
    • Call sub_cmd_vel(Execute:=TRUE, TopicName:= "/cmd_vel", Message:= twist_msg)
    • Map twist_msg.linear.x (forward speed) and twist_msg.angular.z (rotation) to your motor outputs.

Feature Name: CODESYS ROS 2 Connector

Part 2: The Technical Architecture – How It Works

You cannot "run" ROS 2 inside a standard CODESYS PLC (yet). Instead, integration relies on a bridge architecture.

Why Integrate CoDeSys with ROS 2?

The integration of CoDeSys with ROS 2 enables the use of CoDeSys controllers in ROS 2 environments, providing several benefits: Option B: ROS 2 + Modbus/TCP

2. Safety Certified Logic

ROS 2 is fantastic for perception, but it is notoriously difficult to certify for functional safety (ISO 13849, IEC 61508). PLC code is not.

This integration allows you to keep Safety-rated logic in the CODESYS Safety PLC (e-stop, light curtains, over-torque protection) while keeping Navigation and Vision in ROS 2. The safety PLC can monitor and override the ROS 2 commands without a single line of unsafe code in your Python/C++ nodes.