Remote PC cannot connect to ROS Master
I cannot carry out gmapping from a remote PC. I can ssh thr turtlebot. I can ping it. and I can ping the remote PC from the turtlebot. But when I roslaunch turtlebot_rviz_launchers view_navigation.launch
, I get:
ERROR:unable to contact ROS master at [http://10.130.240.48:11311]
I made sure the ROS_MASTER_URI
in the bashrc script of the remote PC is the IP of the turtlebot. I have no clue what's going on. I made sure to source my workspace in the terminal I tried to launch the file from. When I try to rostopic list
it says ERROR: Unable to communicate with master !
Asked by distro on 2022-09-09 23:45:01 UTC
Answers
Make sure to do export all ROS network variables (ROS_MASTER_URI, ROS_IP, ROS_HOSTNAME)
You can put something similar in the .bashrc of your ROS MASTER (exchange wlp2s0
with your device name)
ip_addr="$(ip addr show wlp2s0 | grep "inet " | awk '{print $2}')"
ip_addr="${ip_addr::-3}"
export ROS_MASTER_URI="http://$ip_addr:11311"
export ROS_IP="$ip_addr"
export ROS_HOSTNAME="$ip_addr"
On the other computer do the same but set the ROS_MASTER_URI by hand
If this does not work you can also add the IP of the master in your /etc/hosts
file.
See here for more: http://wiki.ros.org/ROS/NetworkSetup
Asked by GeorgNo on 2022-09-21 05:16:15 UTC
Comments
@GeorgNo I fogured out the problem, I set my HOSTNAME and Master on my turtlebot to localhost, and did the same thing with HOSTNAME on remote PC so it kept looping. I localhost to the actual IPs. I didn't know setting to localhost did that.
Asked by distro on 2022-09-22 01:18:01 UTC
Comments
Are you sure,
roscore
is running at 10.130.240.48?Asked by ravijoshi on 2022-09-10 01:16:25 UTC
@ravijoshi the roscore on remote PC also cannot communicate with that IP.
Asked by distro on 2022-09-10 14:18:58 UTC
Sorry, this isn't very clear. Let me make sure that we are on the same page. As per the reported error, we need to confirm that the
roscore
is running at 10.130.240.48. If there is noroscore
at 10.130.240.48, the error totally makes sense.Asked by ravijoshi on 2022-09-10 21:36:44 UTC
There is no roscore at 10.130.240.48
Asked by distro on 2022-09-10 22:55:12 UTC
That explains the error you are receiving. I assume 10.130.240.48 is the IP address of TurtleBot. Can you please restart the bot and check if
roscore
is invoked? For example, you may use the following commands:OR
Asked by ravijoshi on 2022-09-10 23:09:43 UTC
@ravijoshi Do I
roscore
in turtlebot or remote PC?Asked by distro on 2022-09-13 18:06:48 UTC
The networking and
roscore
related information is mentioned in turtlebot's documentation. I strongly suggest going through the documentation. May I request you to read and understand from [1] and [2]?Asked by ravijoshi on 2022-09-14 05:25:21 UTC
@ravijoshi none of these links gives me information about the roscore information you are talking about. I can't roscore from remote PC because it can't communicate woth ros master. I can roscore from turtlebot2 but I dont see how that helps me in anyway. I can ping the turtelbot2 IP address from remote PC and I can ping the remote PC IP from turtlebot2. I can also ssh. I don't know what the problem possibly could be.
Asked by distro on 2022-09-20 22:36:18 UTC