No version for distro humble showing github. Known supported distros are highlighted in the buttons above.
Package symbol

rxros2_py package from rxros2 repo

rxros2_cpp rxros2_cpp_examples rxros2_py rxros2_py_examples

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.1.0
License Apache-2.0
Build type AMENT_PYTHON
Use RECOMMENDED

Repository Summary

Description Reactive programming for ROS 2
Checkout URI https://github.com/rosin-project/rxros2.git
VCS Type git
VCS Version master
Last Updated 2025-05-27
Dev Status UNKNOWN
Released UNRELEASED
Tags reactive-programming rxcpp rxpy ros2
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

Reactive programming in Python for ROS 2.

Additional Links

No additional links.

Maintainers

  • Henrik Larsen
  • G.A. vd. Hoorn
  • Andrzej Wasowski

Authors

  • Henrik Larsen

RxROS2 - Reactive Programming for ROS2

Introduction

RxROS2 is new API for ROS2 based on the paradigm of reactive programming. Reactive programming is an alternative to callback-based programming for implementing concurrent message passing systems that emphasizes explicit data flow over control flow. It makes the message flow and transformations of messages easy to capture in one place. It eliminates problems with deadlocks and understanding how callbacks interact. It helps you to make your nodes functional, concise, and testable. RxROS2 aspires to the slogan ‘concurrency made easy’.

Contents

Acknowledgements

rosin_logo

Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu

eu_flag

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.

Creating a RxROS2 Node

A RxROS2 node is fundamentally a ROS2 node. It can be created in two distinct ways: Either by means of creating a class that is a sub-class of a rxros2.Node or by using the function rxros2.create_node.

Creating a RxROS2 Node using a class

The following code shows how a RxROS2 node is created using a class:

import rclpy
import rxros2

class MyNode(rxros2.Node):
    def __init__(self):
        super().__init__("my_node")

    def run(self):
        # add your code here ...

def main(args=None):
    rclpy.init(args=args)
    my_node = MyNode()
    my_node.start()
    rclpy.spin(my_node)
    my_node.destroy_node()
    rclpy.shutdown()

Common for all RxROS2 programs is that they import the rxros2 library. It contains all the necessary code, including observables and operators, to get started using reactive programming (RxPY) with ROS2.

MyNode is further defined as a rxros2.Node. The rxros2.Node is a very simple class. It is a sub-class of rclpy.node.Node and therefore also a ROS2 node. The constructor of the rxros2.Node takes the name of the node as argument. In this case “my_node”. The rxros2.Node is an abstract class with one abstract method named run that must be implemented by the sub-class. rxros2.Node contains further a function named start. It will execute the run function in a new thread.

The main function is straight forward: It first initialize rclpy. Then it creates an instance of MyNode and executes the start function. The start function will execute the run function of MyNode in a new thread. It is possible to call run directly from the main function simply by executing my_node.run(). But be sure in this case that the run function is not blocking or else the rclpy.spin function is not called. rclpy.spin is needed in order to publish and listen to ROS2 topics. rclpy.spin is a blocking function that will continue to run until it is stopped/terminated. In this case my_node.destry_node and rclpy.shutdown are called to terminate the node.

Creating a RxROS2 Node using the create_node function

The other way to create a RxROS2 node is by using the function call rxros2.create_node. This is done as follows:

```python import rclpy import rxros2

def main(args=None): rclpy.init(args=args) my_node = rxros2.create_node(“my_node”)

# add your code here ...

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

Deps Name
rclpy

System Dependencies

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rxros2_py at Robotics Stack Exchange

No version for distro jazzy showing github. Known supported distros are highlighted in the buttons above.
Package symbol

rxros2_py package from rxros2 repo

rxros2_cpp rxros2_cpp_examples rxros2_py rxros2_py_examples

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.1.0
License Apache-2.0
Build type AMENT_PYTHON
Use RECOMMENDED

Repository Summary

Description Reactive programming for ROS 2
Checkout URI https://github.com/rosin-project/rxros2.git
VCS Type git
VCS Version master
Last Updated 2025-05-27
Dev Status UNKNOWN
Released UNRELEASED
Tags reactive-programming rxcpp rxpy ros2
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

Reactive programming in Python for ROS 2.

Additional Links

No additional links.

Maintainers

  • Henrik Larsen
  • G.A. vd. Hoorn
  • Andrzej Wasowski

Authors

  • Henrik Larsen

RxROS2 - Reactive Programming for ROS2

Introduction

RxROS2 is new API for ROS2 based on the paradigm of reactive programming. Reactive programming is an alternative to callback-based programming for implementing concurrent message passing systems that emphasizes explicit data flow over control flow. It makes the message flow and transformations of messages easy to capture in one place. It eliminates problems with deadlocks and understanding how callbacks interact. It helps you to make your nodes functional, concise, and testable. RxROS2 aspires to the slogan ‘concurrency made easy’.

Contents

Acknowledgements

rosin_logo

Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu

eu_flag

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.

Creating a RxROS2 Node

A RxROS2 node is fundamentally a ROS2 node. It can be created in two distinct ways: Either by means of creating a class that is a sub-class of a rxros2.Node or by using the function rxros2.create_node.

Creating a RxROS2 Node using a class

The following code shows how a RxROS2 node is created using a class:

import rclpy
import rxros2

class MyNode(rxros2.Node):
    def __init__(self):
        super().__init__("my_node")

    def run(self):
        # add your code here ...

def main(args=None):
    rclpy.init(args=args)
    my_node = MyNode()
    my_node.start()
    rclpy.spin(my_node)
    my_node.destroy_node()
    rclpy.shutdown()

Common for all RxROS2 programs is that they import the rxros2 library. It contains all the necessary code, including observables and operators, to get started using reactive programming (RxPY) with ROS2.

MyNode is further defined as a rxros2.Node. The rxros2.Node is a very simple class. It is a sub-class of rclpy.node.Node and therefore also a ROS2 node. The constructor of the rxros2.Node takes the name of the node as argument. In this case “my_node”. The rxros2.Node is an abstract class with one abstract method named run that must be implemented by the sub-class. rxros2.Node contains further a function named start. It will execute the run function in a new thread.

The main function is straight forward: It first initialize rclpy. Then it creates an instance of MyNode and executes the start function. The start function will execute the run function of MyNode in a new thread. It is possible to call run directly from the main function simply by executing my_node.run(). But be sure in this case that the run function is not blocking or else the rclpy.spin function is not called. rclpy.spin is needed in order to publish and listen to ROS2 topics. rclpy.spin is a blocking function that will continue to run until it is stopped/terminated. In this case my_node.destry_node and rclpy.shutdown are called to terminate the node.

Creating a RxROS2 Node using the create_node function

The other way to create a RxROS2 node is by using the function call rxros2.create_node. This is done as follows:

```python import rclpy import rxros2

def main(args=None): rclpy.init(args=args) my_node = rxros2.create_node(“my_node”)

# add your code here ...

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

Deps Name
rclpy

System Dependencies

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rxros2_py at Robotics Stack Exchange

No version for distro kilted showing github. Known supported distros are highlighted in the buttons above.
Package symbol

rxros2_py package from rxros2 repo

rxros2_cpp rxros2_cpp_examples rxros2_py rxros2_py_examples

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.1.0
License Apache-2.0
Build type AMENT_PYTHON
Use RECOMMENDED

Repository Summary

Description Reactive programming for ROS 2
Checkout URI https://github.com/rosin-project/rxros2.git
VCS Type git
VCS Version master
Last Updated 2025-05-27
Dev Status UNKNOWN
Released UNRELEASED
Tags reactive-programming rxcpp rxpy ros2
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

Reactive programming in Python for ROS 2.

Additional Links

No additional links.

Maintainers

  • Henrik Larsen
  • G.A. vd. Hoorn
  • Andrzej Wasowski

Authors

  • Henrik Larsen

RxROS2 - Reactive Programming for ROS2

Introduction

RxROS2 is new API for ROS2 based on the paradigm of reactive programming. Reactive programming is an alternative to callback-based programming for implementing concurrent message passing systems that emphasizes explicit data flow over control flow. It makes the message flow and transformations of messages easy to capture in one place. It eliminates problems with deadlocks and understanding how callbacks interact. It helps you to make your nodes functional, concise, and testable. RxROS2 aspires to the slogan ‘concurrency made easy’.

Contents

Acknowledgements

rosin_logo

Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu

eu_flag

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.

Creating a RxROS2 Node

A RxROS2 node is fundamentally a ROS2 node. It can be created in two distinct ways: Either by means of creating a class that is a sub-class of a rxros2.Node or by using the function rxros2.create_node.

Creating a RxROS2 Node using a class

The following code shows how a RxROS2 node is created using a class:

import rclpy
import rxros2

class MyNode(rxros2.Node):
    def __init__(self):
        super().__init__("my_node")

    def run(self):
        # add your code here ...

def main(args=None):
    rclpy.init(args=args)
    my_node = MyNode()
    my_node.start()
    rclpy.spin(my_node)
    my_node.destroy_node()
    rclpy.shutdown()

Common for all RxROS2 programs is that they import the rxros2 library. It contains all the necessary code, including observables and operators, to get started using reactive programming (RxPY) with ROS2.

MyNode is further defined as a rxros2.Node. The rxros2.Node is a very simple class. It is a sub-class of rclpy.node.Node and therefore also a ROS2 node. The constructor of the rxros2.Node takes the name of the node as argument. In this case “my_node”. The rxros2.Node is an abstract class with one abstract method named run that must be implemented by the sub-class. rxros2.Node contains further a function named start. It will execute the run function in a new thread.

The main function is straight forward: It first initialize rclpy. Then it creates an instance of MyNode and executes the start function. The start function will execute the run function of MyNode in a new thread. It is possible to call run directly from the main function simply by executing my_node.run(). But be sure in this case that the run function is not blocking or else the rclpy.spin function is not called. rclpy.spin is needed in order to publish and listen to ROS2 topics. rclpy.spin is a blocking function that will continue to run until it is stopped/terminated. In this case my_node.destry_node and rclpy.shutdown are called to terminate the node.

Creating a RxROS2 Node using the create_node function

The other way to create a RxROS2 node is by using the function call rxros2.create_node. This is done as follows:

```python import rclpy import rxros2

def main(args=None): rclpy.init(args=args) my_node = rxros2.create_node(“my_node”)

# add your code here ...

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

Deps Name
rclpy

System Dependencies

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rxros2_py at Robotics Stack Exchange

No version for distro rolling showing github. Known supported distros are highlighted in the buttons above.
Package symbol

rxros2_py package from rxros2 repo

rxros2_cpp rxros2_cpp_examples rxros2_py rxros2_py_examples

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.1.0
License Apache-2.0
Build type AMENT_PYTHON
Use RECOMMENDED

Repository Summary

Description Reactive programming for ROS 2
Checkout URI https://github.com/rosin-project/rxros2.git
VCS Type git
VCS Version master
Last Updated 2025-05-27
Dev Status UNKNOWN
Released UNRELEASED
Tags reactive-programming rxcpp rxpy ros2
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

Reactive programming in Python for ROS 2.

Additional Links

No additional links.

Maintainers

  • Henrik Larsen
  • G.A. vd. Hoorn
  • Andrzej Wasowski

Authors

  • Henrik Larsen

RxROS2 - Reactive Programming for ROS2

Introduction

RxROS2 is new API for ROS2 based on the paradigm of reactive programming. Reactive programming is an alternative to callback-based programming for implementing concurrent message passing systems that emphasizes explicit data flow over control flow. It makes the message flow and transformations of messages easy to capture in one place. It eliminates problems with deadlocks and understanding how callbacks interact. It helps you to make your nodes functional, concise, and testable. RxROS2 aspires to the slogan ‘concurrency made easy’.

Contents

Acknowledgements

rosin_logo

Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu

eu_flag

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.

Creating a RxROS2 Node

A RxROS2 node is fundamentally a ROS2 node. It can be created in two distinct ways: Either by means of creating a class that is a sub-class of a rxros2.Node or by using the function rxros2.create_node.

Creating a RxROS2 Node using a class

The following code shows how a RxROS2 node is created using a class:

import rclpy
import rxros2

class MyNode(rxros2.Node):
    def __init__(self):
        super().__init__("my_node")

    def run(self):
        # add your code here ...

def main(args=None):
    rclpy.init(args=args)
    my_node = MyNode()
    my_node.start()
    rclpy.spin(my_node)
    my_node.destroy_node()
    rclpy.shutdown()

Common for all RxROS2 programs is that they import the rxros2 library. It contains all the necessary code, including observables and operators, to get started using reactive programming (RxPY) with ROS2.

MyNode is further defined as a rxros2.Node. The rxros2.Node is a very simple class. It is a sub-class of rclpy.node.Node and therefore also a ROS2 node. The constructor of the rxros2.Node takes the name of the node as argument. In this case “my_node”. The rxros2.Node is an abstract class with one abstract method named run that must be implemented by the sub-class. rxros2.Node contains further a function named start. It will execute the run function in a new thread.

The main function is straight forward: It first initialize rclpy. Then it creates an instance of MyNode and executes the start function. The start function will execute the run function of MyNode in a new thread. It is possible to call run directly from the main function simply by executing my_node.run(). But be sure in this case that the run function is not blocking or else the rclpy.spin function is not called. rclpy.spin is needed in order to publish and listen to ROS2 topics. rclpy.spin is a blocking function that will continue to run until it is stopped/terminated. In this case my_node.destry_node and rclpy.shutdown are called to terminate the node.

Creating a RxROS2 Node using the create_node function

The other way to create a RxROS2 node is by using the function call rxros2.create_node. This is done as follows:

```python import rclpy import rxros2

def main(args=None): rclpy.init(args=args) my_node = rxros2.create_node(“my_node”)

# add your code here ...

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

Deps Name
rclpy

System Dependencies

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rxros2_py at Robotics Stack Exchange

Package symbol

rxros2_py package from rxros2 repo

rxros2_cpp rxros2_cpp_examples rxros2_py rxros2_py_examples

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.1.0
License Apache-2.0
Build type AMENT_PYTHON
Use RECOMMENDED

Repository Summary

Description Reactive programming for ROS 2
Checkout URI https://github.com/rosin-project/rxros2.git
VCS Type git
VCS Version master
Last Updated 2025-05-27
Dev Status UNKNOWN
Released UNRELEASED
Tags reactive-programming rxcpp rxpy ros2
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

Reactive programming in Python for ROS 2.

Additional Links

No additional links.

Maintainers

  • Henrik Larsen
  • G.A. vd. Hoorn
  • Andrzej Wasowski

Authors

  • Henrik Larsen

RxROS2 - Reactive Programming for ROS2

Introduction

RxROS2 is new API for ROS2 based on the paradigm of reactive programming. Reactive programming is an alternative to callback-based programming for implementing concurrent message passing systems that emphasizes explicit data flow over control flow. It makes the message flow and transformations of messages easy to capture in one place. It eliminates problems with deadlocks and understanding how callbacks interact. It helps you to make your nodes functional, concise, and testable. RxROS2 aspires to the slogan ‘concurrency made easy’.

Contents

Acknowledgements

rosin_logo

Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu

eu_flag

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.

Creating a RxROS2 Node

A RxROS2 node is fundamentally a ROS2 node. It can be created in two distinct ways: Either by means of creating a class that is a sub-class of a rxros2.Node or by using the function rxros2.create_node.

Creating a RxROS2 Node using a class

The following code shows how a RxROS2 node is created using a class:

import rclpy
import rxros2

class MyNode(rxros2.Node):
    def __init__(self):
        super().__init__("my_node")

    def run(self):
        # add your code here ...

def main(args=None):
    rclpy.init(args=args)
    my_node = MyNode()
    my_node.start()
    rclpy.spin(my_node)
    my_node.destroy_node()
    rclpy.shutdown()

Common for all RxROS2 programs is that they import the rxros2 library. It contains all the necessary code, including observables and operators, to get started using reactive programming (RxPY) with ROS2.

MyNode is further defined as a rxros2.Node. The rxros2.Node is a very simple class. It is a sub-class of rclpy.node.Node and therefore also a ROS2 node. The constructor of the rxros2.Node takes the name of the node as argument. In this case “my_node”. The rxros2.Node is an abstract class with one abstract method named run that must be implemented by the sub-class. rxros2.Node contains further a function named start. It will execute the run function in a new thread.

The main function is straight forward: It first initialize rclpy. Then it creates an instance of MyNode and executes the start function. The start function will execute the run function of MyNode in a new thread. It is possible to call run directly from the main function simply by executing my_node.run(). But be sure in this case that the run function is not blocking or else the rclpy.spin function is not called. rclpy.spin is needed in order to publish and listen to ROS2 topics. rclpy.spin is a blocking function that will continue to run until it is stopped/terminated. In this case my_node.destry_node and rclpy.shutdown are called to terminate the node.

Creating a RxROS2 Node using the create_node function

The other way to create a RxROS2 node is by using the function call rxros2.create_node. This is done as follows:

```python import rclpy import rxros2

def main(args=None): rclpy.init(args=args) my_node = rxros2.create_node(“my_node”)

# add your code here ...

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

Deps Name
rclpy

System Dependencies

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rxros2_py at Robotics Stack Exchange

No version for distro galactic showing github. Known supported distros are highlighted in the buttons above.
Package symbol

rxros2_py package from rxros2 repo

rxros2_cpp rxros2_cpp_examples rxros2_py rxros2_py_examples

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.1.0
License Apache-2.0
Build type AMENT_PYTHON
Use RECOMMENDED

Repository Summary

Description Reactive programming for ROS 2
Checkout URI https://github.com/rosin-project/rxros2.git
VCS Type git
VCS Version master
Last Updated 2025-05-27
Dev Status UNKNOWN
Released UNRELEASED
Tags reactive-programming rxcpp rxpy ros2
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

Reactive programming in Python for ROS 2.

Additional Links

No additional links.

Maintainers

  • Henrik Larsen
  • G.A. vd. Hoorn
  • Andrzej Wasowski

Authors

  • Henrik Larsen

RxROS2 - Reactive Programming for ROS2

Introduction

RxROS2 is new API for ROS2 based on the paradigm of reactive programming. Reactive programming is an alternative to callback-based programming for implementing concurrent message passing systems that emphasizes explicit data flow over control flow. It makes the message flow and transformations of messages easy to capture in one place. It eliminates problems with deadlocks and understanding how callbacks interact. It helps you to make your nodes functional, concise, and testable. RxROS2 aspires to the slogan ‘concurrency made easy’.

Contents

Acknowledgements

rosin_logo

Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu

eu_flag

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.

Creating a RxROS2 Node

A RxROS2 node is fundamentally a ROS2 node. It can be created in two distinct ways: Either by means of creating a class that is a sub-class of a rxros2.Node or by using the function rxros2.create_node.

Creating a RxROS2 Node using a class

The following code shows how a RxROS2 node is created using a class:

import rclpy
import rxros2

class MyNode(rxros2.Node):
    def __init__(self):
        super().__init__("my_node")

    def run(self):
        # add your code here ...

def main(args=None):
    rclpy.init(args=args)
    my_node = MyNode()
    my_node.start()
    rclpy.spin(my_node)
    my_node.destroy_node()
    rclpy.shutdown()

Common for all RxROS2 programs is that they import the rxros2 library. It contains all the necessary code, including observables and operators, to get started using reactive programming (RxPY) with ROS2.

MyNode is further defined as a rxros2.Node. The rxros2.Node is a very simple class. It is a sub-class of rclpy.node.Node and therefore also a ROS2 node. The constructor of the rxros2.Node takes the name of the node as argument. In this case “my_node”. The rxros2.Node is an abstract class with one abstract method named run that must be implemented by the sub-class. rxros2.Node contains further a function named start. It will execute the run function in a new thread.

The main function is straight forward: It first initialize rclpy. Then it creates an instance of MyNode and executes the start function. The start function will execute the run function of MyNode in a new thread. It is possible to call run directly from the main function simply by executing my_node.run(). But be sure in this case that the run function is not blocking or else the rclpy.spin function is not called. rclpy.spin is needed in order to publish and listen to ROS2 topics. rclpy.spin is a blocking function that will continue to run until it is stopped/terminated. In this case my_node.destry_node and rclpy.shutdown are called to terminate the node.

Creating a RxROS2 Node using the create_node function

The other way to create a RxROS2 node is by using the function call rxros2.create_node. This is done as follows:

```python import rclpy import rxros2

def main(args=None): rclpy.init(args=args) my_node = rxros2.create_node(“my_node”)

# add your code here ...

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

Deps Name
rclpy

System Dependencies

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rxros2_py at Robotics Stack Exchange

No version for distro iron showing github. Known supported distros are highlighted in the buttons above.
Package symbol

rxros2_py package from rxros2 repo

rxros2_cpp rxros2_cpp_examples rxros2_py rxros2_py_examples

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.1.0
License Apache-2.0
Build type AMENT_PYTHON
Use RECOMMENDED

Repository Summary

Description Reactive programming for ROS 2
Checkout URI https://github.com/rosin-project/rxros2.git
VCS Type git
VCS Version master
Last Updated 2025-05-27
Dev Status UNKNOWN
Released UNRELEASED
Tags reactive-programming rxcpp rxpy ros2
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

Reactive programming in Python for ROS 2.

Additional Links

No additional links.

Maintainers

  • Henrik Larsen
  • G.A. vd. Hoorn
  • Andrzej Wasowski

Authors

  • Henrik Larsen

RxROS2 - Reactive Programming for ROS2

Introduction

RxROS2 is new API for ROS2 based on the paradigm of reactive programming. Reactive programming is an alternative to callback-based programming for implementing concurrent message passing systems that emphasizes explicit data flow over control flow. It makes the message flow and transformations of messages easy to capture in one place. It eliminates problems with deadlocks and understanding how callbacks interact. It helps you to make your nodes functional, concise, and testable. RxROS2 aspires to the slogan ‘concurrency made easy’.

Contents

Acknowledgements

rosin_logo

Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu

eu_flag

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.

Creating a RxROS2 Node

A RxROS2 node is fundamentally a ROS2 node. It can be created in two distinct ways: Either by means of creating a class that is a sub-class of a rxros2.Node or by using the function rxros2.create_node.

Creating a RxROS2 Node using a class

The following code shows how a RxROS2 node is created using a class:

import rclpy
import rxros2

class MyNode(rxros2.Node):
    def __init__(self):
        super().__init__("my_node")

    def run(self):
        # add your code here ...

def main(args=None):
    rclpy.init(args=args)
    my_node = MyNode()
    my_node.start()
    rclpy.spin(my_node)
    my_node.destroy_node()
    rclpy.shutdown()

Common for all RxROS2 programs is that they import the rxros2 library. It contains all the necessary code, including observables and operators, to get started using reactive programming (RxPY) with ROS2.

MyNode is further defined as a rxros2.Node. The rxros2.Node is a very simple class. It is a sub-class of rclpy.node.Node and therefore also a ROS2 node. The constructor of the rxros2.Node takes the name of the node as argument. In this case “my_node”. The rxros2.Node is an abstract class with one abstract method named run that must be implemented by the sub-class. rxros2.Node contains further a function named start. It will execute the run function in a new thread.

The main function is straight forward: It first initialize rclpy. Then it creates an instance of MyNode and executes the start function. The start function will execute the run function of MyNode in a new thread. It is possible to call run directly from the main function simply by executing my_node.run(). But be sure in this case that the run function is not blocking or else the rclpy.spin function is not called. rclpy.spin is needed in order to publish and listen to ROS2 topics. rclpy.spin is a blocking function that will continue to run until it is stopped/terminated. In this case my_node.destry_node and rclpy.shutdown are called to terminate the node.

Creating a RxROS2 Node using the create_node function

The other way to create a RxROS2 node is by using the function call rxros2.create_node. This is done as follows:

```python import rclpy import rxros2

def main(args=None): rclpy.init(args=args) my_node = rxros2.create_node(“my_node”)

# add your code here ...

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

Deps Name
rclpy

System Dependencies

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rxros2_py at Robotics Stack Exchange

No version for distro melodic showing github. Known supported distros are highlighted in the buttons above.
Package symbol

rxros2_py package from rxros2 repo

rxros2_cpp rxros2_cpp_examples rxros2_py rxros2_py_examples

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.1.0
License Apache-2.0
Build type AMENT_PYTHON
Use RECOMMENDED

Repository Summary

Description Reactive programming for ROS 2
Checkout URI https://github.com/rosin-project/rxros2.git
VCS Type git
VCS Version master
Last Updated 2025-05-27
Dev Status UNKNOWN
Released UNRELEASED
Tags reactive-programming rxcpp rxpy ros2
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

Reactive programming in Python for ROS 2.

Additional Links

No additional links.

Maintainers

  • Henrik Larsen
  • G.A. vd. Hoorn
  • Andrzej Wasowski

Authors

  • Henrik Larsen

RxROS2 - Reactive Programming for ROS2

Introduction

RxROS2 is new API for ROS2 based on the paradigm of reactive programming. Reactive programming is an alternative to callback-based programming for implementing concurrent message passing systems that emphasizes explicit data flow over control flow. It makes the message flow and transformations of messages easy to capture in one place. It eliminates problems with deadlocks and understanding how callbacks interact. It helps you to make your nodes functional, concise, and testable. RxROS2 aspires to the slogan ‘concurrency made easy’.

Contents

Acknowledgements

rosin_logo

Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu

eu_flag

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.

Creating a RxROS2 Node

A RxROS2 node is fundamentally a ROS2 node. It can be created in two distinct ways: Either by means of creating a class that is a sub-class of a rxros2.Node or by using the function rxros2.create_node.

Creating a RxROS2 Node using a class

The following code shows how a RxROS2 node is created using a class:

import rclpy
import rxros2

class MyNode(rxros2.Node):
    def __init__(self):
        super().__init__("my_node")

    def run(self):
        # add your code here ...

def main(args=None):
    rclpy.init(args=args)
    my_node = MyNode()
    my_node.start()
    rclpy.spin(my_node)
    my_node.destroy_node()
    rclpy.shutdown()

Common for all RxROS2 programs is that they import the rxros2 library. It contains all the necessary code, including observables and operators, to get started using reactive programming (RxPY) with ROS2.

MyNode is further defined as a rxros2.Node. The rxros2.Node is a very simple class. It is a sub-class of rclpy.node.Node and therefore also a ROS2 node. The constructor of the rxros2.Node takes the name of the node as argument. In this case “my_node”. The rxros2.Node is an abstract class with one abstract method named run that must be implemented by the sub-class. rxros2.Node contains further a function named start. It will execute the run function in a new thread.

The main function is straight forward: It first initialize rclpy. Then it creates an instance of MyNode and executes the start function. The start function will execute the run function of MyNode in a new thread. It is possible to call run directly from the main function simply by executing my_node.run(). But be sure in this case that the run function is not blocking or else the rclpy.spin function is not called. rclpy.spin is needed in order to publish and listen to ROS2 topics. rclpy.spin is a blocking function that will continue to run until it is stopped/terminated. In this case my_node.destry_node and rclpy.shutdown are called to terminate the node.

Creating a RxROS2 Node using the create_node function

The other way to create a RxROS2 node is by using the function call rxros2.create_node. This is done as follows:

```python import rclpy import rxros2

def main(args=None): rclpy.init(args=args) my_node = rxros2.create_node(“my_node”)

# add your code here ...

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

Deps Name
rclpy

System Dependencies

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rxros2_py at Robotics Stack Exchange

No version for distro noetic showing github. Known supported distros are highlighted in the buttons above.
Package symbol

rxros2_py package from rxros2 repo

rxros2_cpp rxros2_cpp_examples rxros2_py rxros2_py_examples

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.1.0
License Apache-2.0
Build type AMENT_PYTHON
Use RECOMMENDED

Repository Summary

Description Reactive programming for ROS 2
Checkout URI https://github.com/rosin-project/rxros2.git
VCS Type git
VCS Version master
Last Updated 2025-05-27
Dev Status UNKNOWN
Released UNRELEASED
Tags reactive-programming rxcpp rxpy ros2
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

Reactive programming in Python for ROS 2.

Additional Links

No additional links.

Maintainers

  • Henrik Larsen
  • G.A. vd. Hoorn
  • Andrzej Wasowski

Authors

  • Henrik Larsen

RxROS2 - Reactive Programming for ROS2

Introduction

RxROS2 is new API for ROS2 based on the paradigm of reactive programming. Reactive programming is an alternative to callback-based programming for implementing concurrent message passing systems that emphasizes explicit data flow over control flow. It makes the message flow and transformations of messages easy to capture in one place. It eliminates problems with deadlocks and understanding how callbacks interact. It helps you to make your nodes functional, concise, and testable. RxROS2 aspires to the slogan ‘concurrency made easy’.

Contents

Acknowledgements

rosin_logo

Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu

eu_flag

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.

Creating a RxROS2 Node

A RxROS2 node is fundamentally a ROS2 node. It can be created in two distinct ways: Either by means of creating a class that is a sub-class of a rxros2.Node or by using the function rxros2.create_node.

Creating a RxROS2 Node using a class

The following code shows how a RxROS2 node is created using a class:

import rclpy
import rxros2

class MyNode(rxros2.Node):
    def __init__(self):
        super().__init__("my_node")

    def run(self):
        # add your code here ...

def main(args=None):
    rclpy.init(args=args)
    my_node = MyNode()
    my_node.start()
    rclpy.spin(my_node)
    my_node.destroy_node()
    rclpy.shutdown()

Common for all RxROS2 programs is that they import the rxros2 library. It contains all the necessary code, including observables and operators, to get started using reactive programming (RxPY) with ROS2.

MyNode is further defined as a rxros2.Node. The rxros2.Node is a very simple class. It is a sub-class of rclpy.node.Node and therefore also a ROS2 node. The constructor of the rxros2.Node takes the name of the node as argument. In this case “my_node”. The rxros2.Node is an abstract class with one abstract method named run that must be implemented by the sub-class. rxros2.Node contains further a function named start. It will execute the run function in a new thread.

The main function is straight forward: It first initialize rclpy. Then it creates an instance of MyNode and executes the start function. The start function will execute the run function of MyNode in a new thread. It is possible to call run directly from the main function simply by executing my_node.run(). But be sure in this case that the run function is not blocking or else the rclpy.spin function is not called. rclpy.spin is needed in order to publish and listen to ROS2 topics. rclpy.spin is a blocking function that will continue to run until it is stopped/terminated. In this case my_node.destry_node and rclpy.shutdown are called to terminate the node.

Creating a RxROS2 Node using the create_node function

The other way to create a RxROS2 node is by using the function call rxros2.create_node. This is done as follows:

```python import rclpy import rxros2

def main(args=None): rclpy.init(args=args) my_node = rxros2.create_node(“my_node”)

# add your code here ...

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

Deps Name
rclpy

System Dependencies

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rxros2_py at Robotics Stack Exchange