Openhab and ROS

Hi,
Can we connect ROS codes to iot_bridge(openhab) via a .items file and ROS Messages? How can we send ROS codes information such as image and video to iot_bridge?

Thanks.

Hi,
Have a look at using node-red


You could then pass your ROS messages to openhab items with the openhab nodes
or via http calls to the api

Regards

1 Like

How can I send my ROS messages to openhab items? I do not know. I mean, How should I define openhab items contents based on ROS messages? Please, give a simple example. For instance: I want to send an image from ROS to Openhab based on iot_bridge.
Please, guide me.
Thanks.

There’s no way to store an Image BLOB in oh2. you could store the URL/path to an image in a oh2-item.
What’s your use case, perhaps this is the better approach?
second question, as I don’t know ROS at all: is ROS capable of either adressing a REST API or connecting to a MQTT broker?

  1. I want to send images or videos from my PC to a mobile robot (Raspberry pi is on my robot). I want to control my robot based on images or videos which my robot receives from my PC. For instance, I want to use the SLAM algorithm.

  2. Yes, MQTT is supported ROS.

you could use an openHAB item to transport the path or the URL to the ROS - but then again: why do you need openHAB for that, you could send the Image directly from your PC to your robot?

nevertheless, you could either use MQTT:

or you could use the REST API of openHAB:

both are capable of updating openHAB items (https://docs.openhab.org/concepts/items.html)

I just read, that you can indeed store an image in oh2 (sorry about my information earlier):

Image Holds the binary data of an Image

I never used it, so I don’t know how to transport a image item to your ROS

1 Like

Thank you very much.

I have earned a map of the environment via a camera and my algorithm. Then, I have turned my map to numbers, because Openhab can not receive a video or an image from ROS, easily. These numbers are stored in a text file. I want to send my text file to Openhab. How can I define a file item based on text file with contents of the numbers?

Thanks

1 Like

You can just declare an “String”-item and update it via REST API.
or - if you need the discrete numbers on various items, you could parse the text file (with an external script?) and just update the different items you defined via REST within that script. (or you can have a rule or a script within openHAB, which parses the contents of that String-Item.

To my knowledge, there’s no way to import a file via hotfolder or something. You have to either use REST/MQTT or a binding, both ways can update items.

1 Like

Thanks.