0
$\begingroup$

Rosanswers logo

Distro info: I am using Melodic on Ubuntu 18.04

Network info - on the same subnet: 2 hosts (1 client, 1 server), 8 port switch, and a laptop to remote into each one, OS1-64 lidar sensor, and an ip camera.

I have a client node using a roscore server to act as the central point for the sensors. I can get topics and see messages to the client just fine and even render images and video from the client node however... here is my problem i hope i can get advice from.

I would like to be able to use rosbridge on the client node which is acting like an edge device however when i run it with the server/client configuration it is unable to receive certain messages and is not able to render the lidar point clouds but when I run this on server it has no issues.

Now i have two issues I observed so far that I need advice on, the first is ROS_HOSTNAME, rosbridge expects a hostname for the localhost(client) or it will throw an error like so:

RLException: Unable to contact my own server at [http://172.18.21.80:45109/]. This usually means that the network is not configured properly.

Second is when ROS_HOSTNAME is configured as localhost i get a warning message in /rosout. The non-local host is the server node.

[WARN][1596242809.777802944][/rosbridge_websocket]: attempted to connect to non-local host [172.18.21.80] from a node launched with ROS_HOSTNAME=localhost

and the following message in the webviz viewer im using:

This can happen e.g. when playing a bag from a different codebase. Message types could not be found for these topics: /os1_node/imu_packets /os1_node/lidar_packets

when running this on the server node these issues are no longer a problem and the topics render as expected. How can I run rosbridge on a client node? Is there a config or wiki page can reference? I have not found anything on this yet. Hoping someone can help shed some light.


Originally posted by AdamS on ROS Answers with karma: 7 on 2020-07-31

Post score: 0


Original comments

Comment by gvdhoorn on 2020-08-01:
You mention the words slave and master, but ROS interactions are primarily peer-to-peer and client-server.

Could you please clarify what you mean by "slave node" and "master node"? Are these just two different machines? Please don't use the word "node" then, as in ROS, a "node" is something very specific: wiki/Nodes.

rosbridge expects a hostname for the localhost(slave) or it will throw an error

No, not as far as I know.

And that error message is not generated by rosbridge, but roslaunch.

Comment by AdamS on 2020-08-01:
the terminology i used is more illustrative to the configuration i setup. that question will help me clarify things. there is one server running roscore and the edge device is setup to listen on the topics from the roscore server. the ROS_IP, ROS_HOST and ROS_MASTER_URI is set to the server running roscore on both the server(master/server) and edge device(slave/client). i have edited the original to replace master slave with server client to keep it clear for future readers.

the command run on the client is: roslaunch rosbridge_server rosbridge_websocket.launch wich is what is producing that error.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

the terminology i used is more illustrative to the configuration i setup. that question will help me clarify things.

That's great, but seeing as you're posting on a (the?) forum about ROS and problems using it, it'd be good to use the terminology from that domain in the way it is meant to be used. That will make things easier to understand for people reading your question.

there is one server running roscore and the edge device is setup to listen on the topics from the roscore server.

So two PCs/hosts (in this example): one running the ROS Master and perhaps other things) and the other running a nr of ROS nodes.

the ROS_IP, ROS_HOST and ROS_MASTER_URI is set to the server running roscore on both the server(master/server) and edge device(slave/client).

To get it out of the way: have you seen wiki/ROS/Tutorials/MultipleMachines?

ROS_IP should be set to the (publicly) reachable IP of the host itself. Not to any IP of another host.

ROS_HOSTNAME (that is probably the variable you refer to) should be set to a (publicly) resolvable (forward and reverse) FQDN of the host itself. Not to any name of another host.

But only if you actually have DNS set up for that host (and all other hosts in your ROS application).

ROS_MASTER_URI should be set to the IP or FQDN of the host running a (publicly) reachable ROS Master instance (at whichever port you configure it to run, default: 11311).

Setting this last one to localhost does not make sense when trying to reach a Master on a remote host.

In your case:

  • on the host running your ROS Master:
    • if you have DNS working for all hosts involved:
      • set ROS_HOSTNAME to the FQDN at which your Master can be reached
      • set ROS_MASTER_URI to http://$ROS_HOSTNAME:11311 (or localhost, as it's running the Master locally)
      • do not set ROS_IP
    • if DNS does not work:
      • set ROS_IP to the IP at which your Master can be reached
      • set ROS_MASTER_URI to http://$ROS_IP:11311 (or localhost, as it's running the Master locally)
      • do not set ROS_HOSTNAME
  • on your other host(s):
    • if you have DNS working for all hosts involved:
      • set ROS_HOSTNAME to the FQDN at which your other host can be reached
      • set ROS_MASTER_URI to http://<FQDN_of_your_ROS_master>:11311
      • do not set ROS_IP
    • if DNS does not work (or is not available):
      • set ROS_IP to the IP at which your other host can be reached
      • set ROS_MASTER_URI to http://<IP_of_your_ROS_master>:11311
      • do not set ROS_HOSTNAME

You'll want to add this to your .bashrc or some other file which will set this for all shells / sets up your environment, as otherwise it will not work.

the command run on the client is: roslaunch rosbridge_server rosbridge_websocket.launch wich is what is producing that error.

As I wrote: it's roslaunch which produces that error message.


Originally posted by gvdhoorn with karma: 86574 on 2020-08-02

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by gvdhoorn on 2020-08-02:
Note: this setup is no different from any other multi-machine ROS configurations. I'd advise you to search for similar questions about networked ROS setups here on ROS Answers.

use Google and append site:answers.ros.org to your query.

Comment by AdamS on 2020-08-02:
I have already browsed the multimachine tutorial. however the second part here:

if DNS does not work (or is not available):
set ROS_IP to the IP at which your other host can be reached
set ROS_MASTER_URI to http://<IP_of_your_ROS_master>:11311
do not set ROS_HOSTNAME

is what cleared this up for me. This was unclear and has resolved my issue.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.