Ros2 | Codesys

CODESYS + ROS 2: Bringing Industrial Control and Robotics Together

CODESYS is a widely used industrial automation engineering environment for programming PLCs with IEC 61131-3 languages. ROS 2 (Robot Operating System 2) is the modern, distributed robotics middleware standard focused on real-time-capable communication, modularity, and cross-platform support. Combining CODESYS and ROS 2 lets industrial control systems interoperate with advanced robotic capabilities — useful for factory automation, mobile robots, AGVs, collaborative robots, and lab or research deployments.

3.1 Communication Patterns

| Pattern | Direction | Real-time req. | Suggested QoS | |---------|-----------|----------------|----------------| | Sensor streaming | PLC → ROS2 | <5ms latency | BEST_EFFORT, VOLATILE | | Command/control | ROS2 → PLC | Deterministic (<1ms jitter) | RELIABLE, TRANSIENT_LOCAL | | Parameter sync | Bidirectional | >100ms | RELIABLE, PERSISTENT | | Emergency stop | ROS2 → PLC | Priority interrupt | RELIABLE, Deadline 1ms |

Bridging the Gap: Integrating CODESYS with ROS2 for Next-Generation Automation

For decades, the worlds of industrial automation and mobile robotics have run on parallel, yet distinctly separate, tracks.

On one side, we have CODESYS, the gold standard for industrial programmable logic controllers (PLCs). It is reliable, deterministic, and governed by strict IEC 61131-3 standards. It is the language of the factory floor—handling sensors, actuators, and safety logic with millisecond precision.

On the other side, we have ROS2 (Robot Operating System). This is the dominant framework for robotics research and development. It handles complex motion planning, computer vision, SLAM (Simultaneous Localization and Mapping), and high-level decision-making.

Historically, getting these two to talk required custom middleware, messy socket programming, or expensive hardware gateways. However, as Industry 4.0 advances, the demand for "Industrial ROS" has led to a convergence. Today, integrating CODESYS with ROS2 is not just possible—it is becoming a best practice for building robust, scalable robotic systems.

Bridging Real-Time Control and Robotic Middleware: An Architectural Framework for CODESYS-ROS2 Integration

Abstract The convergence of classical Programmable Logic Controller (PLC) ecosystems and modern robotic software frameworks is a critical challenge in Industry 4.0. CODESYS, a dominant IEC 61131-3 development environment, excels at hard real-time control and fieldbus management (EtherCAT, CANopen). The Robot Operating System 2 (ROS2), built on Data Distribution Service (DDS), provides a flexible, distributed middleware for perception, planning, and collaboration. This paper proposes a formal architecture for integrating CODESYS runtime with ROS2. We analyze communication patterns, data representation mapping, real-time constraints, and security implications. A reference implementation using ROS2-native client libraries for CODESYS is presented, alongside performance benchmarks comparing native DDS versus OPC UA gateway approaches.

Keywords: CODESYS, ROS2, Industrial Robotics, Real-Time Systems, DDS, EtherCAT, IEC 61131-3.

Conclusion

The integration of CODESYS and ROS2 represents the maturation of the robotics industry. We are moving away from "hobbyist" control systems and toward a hybrid model where ROS2 provides the intelligence and CODESYS provides the discipline.

For automation engineers, learning how to interface their PLCs with ROS2 is no longer a niche skill—it is becoming a requirement for building the next generation of intelligent machinery. As the tools for bridging these environments improve, the line between the "Industrial Controller" and the "Robot Brain" will continue to blur.

Unlocking the Power of Industrial Automation with CoDeSys and ROS 2

The world of industrial automation is undergoing a significant transformation. The increasing demand for flexibility, scalability, and interoperability has led to the development of innovative solutions that combine traditional industrial control systems with modern software frameworks. One such combination that has gained significant attention in recent years is CoDeSys and ROS 2.

What is CoDeSys?

CoDeSys (Controller Development System) is a popular software development environment for industrial automation. It provides a comprehensive set of tools for creating, testing, and deploying control applications on a wide range of industrial controllers. CoDeSys is widely used in various industries, including manufacturing, process control, and building automation. codesys ros2

What is ROS 2?

ROS 2 (Robot Operating System 2) is an open-source software framework for building robot applications. It provides a flexible and modular architecture for developing complex robot behaviors, allowing developers to focus on high-level tasks rather than low-level details. ROS 2 is designed to be highly scalable, secure, and reliable, making it suitable for a broad range of applications, from robotics and autonomous systems to industrial automation and IoT.

The Convergence of CoDeSys and ROS 2

The integration of CoDeSys and ROS 2 represents a significant milestone in the evolution of industrial automation. By combining the strengths of CoDeSys in industrial control with the flexibility and modularity of ROS 2, developers can create powerful and scalable control applications that leverage the best of both worlds.

Benefits of CoDeSys and ROS 2 Integration

The integration of CoDeSys and ROS 2 offers several benefits, including:

  1. Improved flexibility: CoDeSys provides a comprehensive set of tools for developing industrial control applications, while ROS 2 offers a flexible and modular architecture for building complex behaviors. The integration of both allows developers to create highly customized and adaptable control applications.
  2. Increased scalability: ROS 2 is designed to be highly scalable, making it suitable for large and complex industrial automation systems. CoDeSys, with its support for a wide range of industrial controllers, can take advantage of ROS 2's scalability features to deploy control applications on a variety of platforms.
  3. Enhanced interoperability: The integration of CoDeSys and ROS 2 enables seamless communication between industrial controllers and other ROS 2 nodes, facilitating the creation of heterogeneous systems that combine different control devices and software frameworks.
  4. Faster development: CoDeSys provides a comprehensive development environment for industrial control applications, while ROS 2 offers a wide range of tools and libraries for building robot and automation applications. The integration of both allows developers to leverage the strengths of each platform, reducing development time and effort.

Use Cases for CoDeSys and ROS 2 Integration

The integration of CoDeSys and ROS 2 has numerous applications in industrial automation, including:

  1. Industrial robotics: CoDeSys and ROS 2 can be used to develop complex robot control applications that leverage the strengths of both platforms. For example, a CoDeSys-based control application can be used to control a robot's motion, while ROS 2 provides the necessary software framework for integrating sensors, actuators, and other peripherals.
  2. Process control: CoDeSys is widely used in process control applications, such as chemical processing, oil and gas, and food processing. The integration of CoDeSys and ROS 2 enables the creation of highly customized and adaptable control applications that can be easily integrated with other ROS 2 nodes.
  3. Building automation: CoDeSys and ROS 2 can be used to develop intelligent building automation systems that integrate HVAC, lighting, and security systems. The integration of both platforms enables the creation of highly scalable and flexible control applications that can be easily adapted to changing building requirements.

Technical Details of CoDeSys and ROS 2 Integration

The integration of CoDeSys and ROS 2 is achieved through a combination of software components and development tools. Some of the key technical details include:

  1. CoDeSys ROS 2 node: A custom ROS 2 node is created to interface with the CoDeSys development environment. This node provides a bridge between the CoDeSys control application and the ROS 2 software framework.
  2. ROS 2 CoDeSys bridge: A software bridge is used to connect the ROS 2 node to the CoDeSys development environment. This bridge provides a transparent communication interface between the CoDeSys control application and the ROS 2 node.
  3. Development tools: A range of development tools, including compilers, debuggers, and simulation environments, are used to create, test, and deploy CoDeSys and ROS 2 applications.

Conclusion

The integration of CoDeSys and ROS 2 represents a significant milestone in the evolution of industrial automation. By combining the strengths of CoDeSys in industrial control with the flexibility and modularity of ROS 2, developers can create powerful and scalable control applications that leverage the best of both worlds. The benefits of this integration, including improved flexibility, increased scalability, enhanced interoperability, and faster development, make it an attractive solution for a wide range of industrial automation applications. As the industrial automation landscape continues to evolve, the integration of CoDeSys and ROS 2 is likely to play a key role in shaping the future of industrial control systems.

Introduction to CoDeSys and ROS 2

CoDeSys (Controller Development System) is a popular software tool used for developing and programming industrial automation controllers. It provides a comprehensive environment for designing, testing, and deploying control applications. On the other hand, ROS 2 (Robot Operating System 2) is an open-source software framework widely used in robotics and automation for building complex robot applications. It provides a flexible and scalable architecture for developing robot software.

What is CoDeSys?

CoDeSys is a software tool developed by 3S - Smart Software Solutions GmbH, a leading provider of automation software. It allows users to design, test, and deploy control applications for various industrial automation controllers, including programmable logic controllers (PLCs), industrial PCs, and other embedded systems. CoDeSys supports multiple programming languages, including IEC 61131-3 languages (e.g., Ladder Logic, Function Block Diagram, and Structured Text).

What is ROS 2?

ROS 2 is an open-source software framework developed by the Open Source Robotics Foundation (OSRF). It is designed to simplify the development of complex robot applications by providing a flexible and scalable architecture. ROS 2 offers a wide range of features, including:

  1. Modular design: ROS 2 applications are built from modular components called "nodes," which communicate with each other using a publish-subscribe messaging system.
  2. Multi-platform support: ROS 2 supports various operating systems, including Linux, Windows, and macOS.
  3. Extensive libraries and tools: ROS 2 provides a rich set of libraries and tools for tasks such as 3D perception, motion planning, and control.

CoDeSys and ROS 2 Integration

The integration of CoDeSys and ROS 2 enables developers to leverage the strengths of both technologies. By combining CoDeSys's industrial automation expertise with ROS 2's flexibility and scalability, developers can create sophisticated automation applications that benefit from:

  1. Industrial-grade control: CoDeSys provides a robust and reliable control environment, ensuring high-performance control of industrial equipment.
  2. ROS 2 ecosystem: The integration with ROS 2 opens up access to a vast ecosystem of open-source libraries and tools, facilitating the development of complex automation applications.

Benefits of CoDeSys ROS 2 Integration

The integration of CoDeSys and ROS 2 offers several benefits, including:

  1. Increased flexibility: Developers can leverage the strengths of both CoDeSys and ROS 2 to create customized automation applications.
  2. Improved scalability: The integration enables the development of complex automation applications that can scale to meet the needs of various industries.
  3. Enhanced collaboration: The use of ROS 2's open-source framework and CoDeSys's industrial automation expertise fosters collaboration between automation and robotics developers.

Use Cases for CoDeSys ROS 2 Integration

The integration of CoDeSys and ROS 2 can be applied to various industries and applications, including:

  1. Industrial robotics: Combine CoDeSys's industrial-grade control with ROS 2's robotics libraries to develop sophisticated robotic applications.
  2. Automation and control: Use CoDeSys for industrial automation and ROS 2 for developing complex control applications, such as those required in smart manufacturing.
  3. Research and development: Leverage the integration of CoDeSys and ROS 2 to develop innovative automation and robotics applications.

Getting Started with CoDeSys ROS 2 Integration

Developers interested in integrating CoDeSys and ROS 2 can follow these steps: CODESYS + ROS 2: Bringing Industrial Control and

  1. Install CoDeSys: Download and install CoDeSys from the official website.
  2. Install ROS 2: Download and install ROS 2 from the official website.
  3. Configure the integration: Configure the CoDeSys ROS 2 integration using the CoDeSys documentation and ROS 2 tutorials.

Conclusion

The integration of CoDeSys and ROS 2 offers a powerful combination of industrial automation expertise and robotics flexibility. By leveraging the strengths of both technologies, developers can create sophisticated automation applications that benefit from high-performance control, scalability, and flexibility. As the industrial automation and robotics industries continue to evolve, the integration of CoDeSys and ROS 2 is poised to play a key role in shaping the future of automation and robotics development.

Integrating CODESYS with ROS2 bridges the gap between high-level robotic decision-making and robust industrial real-time control. While ROS2 excels at perception and complex path planning, CODESYS provides the deterministic communication needed for industrial hardware. Bridging the Industrial Gap

Combining these two systems creates a powerful architecture where:

CODESYS handles low-level hardware communication (like EtherCAT or CANopen) to ensure reliable, real-time machine safety and motion.

ROS2 manages high-level logic, SLAM, and visualization through its distributed node system. Popular Integration Methods

Because CODESYS and ROS2 don't naturally "speak" the same language, developers typically use one of these bridges:

ROS-Bridge & WebSockets: A common approach involves using a ROS-Bridge client within CODESYS that connects via WebSockets to the ROS network.

Intermediate Protocols: Using Modbus or OPC UA as an intermediary layer. For example, a Python script in the ROS2 workspace can act as a bridge, reading data from CODESYS via Modbus and publishing it to a ROS2 topic.

Direct Driver Development: Writing custom C++ drivers that handle the hardware mapping in a way that remains compatible with ROS2's communication. Getting Started with ROS2 Topics

If you are new to the ROS2 side of the equation, the core communication revolves around topics—anonymous channels where nodes publish or subscribe to data:

Define your data: Use standard messages like geometry_msgs/msg/Twist for motion or create custom messages for specific industrial signals.

Launch a Bridge Node: This node will take your PLC data and use ros2 topic pub to push it into the ROS network. Improved flexibility : CoDeSys provides a comprehensive set

Visualize: Use tools like rqt_graph or the MATLAB Message Viewer to confirm your CODESYS data is successfully streaming across topics.

Are you planning to use a Raspberry Pi as your industrial gateway, or are you working with a specific PLC hardware like Beckhoff or Wago? What is a ROS2 Topic? - ROS2 Tutorial 6

5. Live ROS 2 Graph Visualization inside CODESYS IDE

Example architecture (typical)

The Classic Dilemma