How to transfer asynchronous data from hardware layer to ROS2 layer

asked 2021-12-07 04:32:51 -0500

bojankoce gravatar image

updated 2021-12-07 07:26:06 -0500

Hello, guys.

I am interested to know what are currently the best ROS2 practices to handle some piece of hardware within ROS2 application.

The approach we currently apply is to have a ROS2 wrapper node around our hardware driver written in C/C++. Once we have ROS2 wrapper node around our driver, we can easily transfer data/commands from our ROS2 layer to our hardware C/C++ driver (by using parameters, topics, services, actions, as described here).

However, I am not sure what would be the best practice to transfer some asynchronous info (e.g. some data packet arrived from Ethernet or some interrupt happened and I took sensor readings that now need to be transferred to another node) from our C/C++ driver to ROS2 wrapper?

One possibility would be to continuously poll C/C++ drivers and ask for any asynchronous data but I see this approach as extremely invasive. Is there anything better we can do to move the data from our driver to ROS2 layer?

Thanks in advance for your time and efforts.

Sincerely, Bojan.

edit retag flag offensive close merge delete