ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Remote PC cannot connect to ROS Master

asked 2022-09-09 23:45:01 -0500

distro gravatar image

updated 2022-09-20 22:36:33 -0500

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 !

edit retag flag offensive close merge delete

Comments

Are you sure, roscore is running at 10.130.240.48?

ravijoshi gravatar image ravijoshi  ( 2022-09-10 01:16:25 -0500 )edit

@ravijoshi the roscore on remote PC also cannot communicate with that IP.

distro gravatar image distro  ( 2022-09-10 14:18:58 -0500 )edit

the roscore on remote PC also cannot communicate with that IP

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 no roscore at 10.130.240.48, the error totally makes sense.

ravijoshi gravatar image ravijoshi  ( 2022-09-10 21:36:44 -0500 )edit

There is no roscore at 10.130.240.48

distro gravatar image distro  ( 2022-09-10 22:55:12 -0500 )edit

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:

$ pgrep ros
26065
26088
26113

OR

$ ps -ef | grep ros
ravi       26065   25859 61 13:01 pts/1    00:00:01 /usr/bin/python3 /opt/ros/noetic/bin/roscore
ravi       26088   26065 64 13:01 ?        00:00:01 /usr/bin/python3 /opt/ros/noetic/bin/rosmaster --core -p 11311 -w 3 __log:=/home/ravi/.ros/log/6ddf1d30-3186-11ed-b895-15d8be443cc3/master.log
ravi       26113   26065  0 13:01 ?        00:00:00 /opt/ros/noetic/lib/rosout/rosout __name:=rosout __log:=/home/ravi/.ros/log/6ddf1d30-3186-11ed-b895-15d8be443cc3/rosout-1.log
ravi       26133   25835  0 13:01 pts/0    00:00:00 grep --color=auto ros
ravijoshi gravatar image ravijoshi  ( 2022-09-10 23:09:43 -0500 )edit

@ravijoshi Do I roscore in turtlebot or remote PC?

distro gravatar image distro  ( 2022-09-13 18:06:48 -0500 )edit

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]?

ravijoshi gravatar image ravijoshi  ( 2022-09-14 05:25:21 -0500 )edit

@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.

distro gravatar image distro  ( 2022-09-20 22:36:18 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-09-21 05:16:15 -0500

GeorgNo gravatar image

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

edit flag offensive delete link more

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.

distro gravatar image distro  ( 2022-09-22 01:18:01 -0500 )edit

Question Tools

Stats

Asked: 2022-09-09 23:45:01 -0500

Seen: 449 times

Last updated: Sep 21 '22