How do I reconfigure ROS Master to run locally?

Hi, I’m connecting between two computers with Husarnet. Then one acts as “Master” and it works correctly. The problem I have is that now on the non-master computers I can’t run roscore locally. when I run roscore I get the following


terminal$ roscore

... logging to /home/user/.ros/log/5c392ac6-80aa-11ed-b61c-21a4b16299ec/roslaunch-ubuntu-22831.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

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

A common cause is that the machine cannot connect to itself.  Please check
for errors by running:

        ping device

For more tips, please see

        http://wiki.ros.org/ROS/NetworkSetup

The traceback for the exception was written to the log file

Already deactivate husarnet and verify that husarnet is deactivated:

terminal$ husarnet stop
SUCCESS:  Stopped husarnet-daemon
terminal$ husarnet status
INFO:  Daemon does not seem to be running
Do you want to run: sudo systemctl restart husarnet? [y/N]: No

I think it’s a topic that should be documented. But I already looked in the official documentation and in several forums and couldn’t find anything.

Hi @Wilber

We have reviewed your issue and it seems that the problem is emerging strictly due to ROS configuration in this particular setup rather than Husarnet.
We would be able to help you in greater capacity if you described your setup in more detail and if possible provided us with steps to reproduce the problem.

We assume that you have used our tutorial in trying to set up the environment.
If you have previously used the steps form this tutorial:
https://husarnet.com/docs/tutorial-ros1
Please, try to unset the environmental variables the the tutorial suggest and the run the project again, as we believe this may help.
Shall the problems persist or shall you encounter new ones don’t hesitate to contact us and we will try to help you.
Best regards,
Konrad

Yes, I have already removed the environment variables from the .bashrc file:

export ROS_IPV6=on
export ROS_MASTER_URI=http://master:11311

I already reset the terminal and the computer…
However, it still won’t let me run the “roscore” command. I practically undid everything from your tutorial.

Replicating this problem is easy, just follow your ROS 1 tutorial. Connect two computers with your Husarnet system. Then you will have one computer as Master and the other as slave. Once you verify that the slave computer can use the Master’s “roscore”, try to disable it. Try to get the slave computer to be able to run the “roscore” command again without depending on the Master.

From my perspective, the configurations for this to happen should be simply with the “husarnet stop” command. But this does not work.

Hi Wibler,

Husarnet by itself doesn’t mess with your ROS configuration. You need to define

  • export ROS_IPV6=on to enable your ROS nodes talk over IPv6 (the virtual network layer exposed to your OS by Husarnet is based on IPv6)
  • export ROS_MASTER_URI=http://master:11311 oraz export ROS_MASTER_URI=http://<PASTE_HERE_HUSARNET_HOSTNAME_OF_HOST_RUNNING_ROSCORE>:11311 to tell your ROS nodes where it should look for ROS Master.

Starting or stopping Husarnet daemon or having it installed or not doesn’t have any effect on your ROS installation.

We have too little information to tell you what is going on. Please print all environment variables in your system and send the output log to us:

printenv

Also please let me know whether you have also changed the firewall rules from here: Using Husarnet & ROS | Husarnet . If yes, you should also undo the changes.

Best,
Dominik


Husarnet team

1 Like

Thanks Dominik, that comment gave me a hint of the real solution. Since “husarnet stop” doesn’t have the complete configurations, I created two aliases:

alias husarnet_on='export ROS_IPV6=on && export ROS_HOSTNAME=ubuntu && export ROS_MASTER_URI=http://master:11311 && husarnet start'
alias husarnet_off='husarnet stop && export ROS_IPV6=off && export ROS_HOSTNAME=ubuntu.local && export ROS_MASTER_URI=http://ubuntu.local:11311'

Things to consider when using those alias:

  1. alias “husarnet_on”:
    ROS_HOSTNAME=[device-name-in-husarnet]
    in my case the name is the same as the local device, which is “ubuntu”:

  2. alias “husarnet_off”:
    ROS_HOSTNAME and ROS_MASTER_URI contain [device-name].local.
    If you don’t know what the name of your device is, it appears next to your user in the terminal:

    wilber@ubuntu:~$
    

    In any case, it can also be seen in the ubuntu settings.

Now, if I want to use husarnet or use ros locally, I just have to use those aliases. That is the answer I was looking for.

(edit) I tried to make it as understandable as possible.

2 Likes