microsoft / ros_azure_iothub

This repository contains a ROS node for bidirectional communication with IoT Hub
38 stars 30 forks source link

Support to use the node under ROS Melodic #38

Open robodyne-robotics opened 3 years ago

robodyne-robotics commented 3 years ago

I was able to install the package, but I really can't understand how to use this node!

When I launch the sample.launch, I get: setting /run_id to 5147197a-ad11-11eb-b370-001ee5df51a0 process[rosout-1]: started with pid [25615] started core service [/rosout] process[roscpp_azure_iothub_node-2]: started with pid [25618] [ INFO] [1620157546.523456436]: Creating IoTHub Device handle [ INFO] [1620157546.524714272]: connection_string: HostName=xxxxxxxx

[ INFO] [1620157546.525165938]: Using Shared Access Signatures authentication. [ INFO] [1620157546.756376459]: The device client is connected to iothub

and nothing else happens. How can I specify the topic that I want to send to my HUB? There is nothing in the README file about that so I cannot understand how to proceed.

Can you please provide some instructions on how to use this node?

Thank you! P.S. I use Ubuntu 18.04 and ROS Melodic

ooeygui commented 3 years ago

Hi there, Thanks for your interest in the IoT Hub ROS Node.

The idea for the ROS node is that you apply configuration on the device twin, which is reflected down to the robot at a later date. This can include Dynamic Reconfigure components and topics to relay through the iothub message bus.

You can add this information to the device twin manually by accessing the twin on http://portal.azure.com, or you can use the IoT SDK from another device or service.

Inside the desired properties block, add a ros_relays object, which maps the topic to a relay method. The relay method supports both telemetry - which is sent over the message bus, or reported which applies a serialized message it as a reported item.

           "ros_relays": {
                "1": {
                    "topic": "/rosout",
                    "relay_method": "telemetry"
                },
                "2": {
                    "topic": "/initialpose",
                    "relay_method": "reported"
                }

You can also set properties down to the robot if the target ROS node implements dynamic reconfigure.

ooeygui commented 3 years ago

Is there a place in the readme where we can clarify the use?

robodyne-robotics commented 3 years ago

I think this would help users to better understand how to use the node by reading the documentation. However, at the end, I used the iot libraries in C to write another ROS Node to publish messages to my iot azure HUB since I wasn't able to use your ros_azure_iothub node.