ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Roscore not finding rostopic

asked 2018-07-12 15:05:07 -0500

pitosalas gravatar image

updated 2018-07-13 03:31:14 -0500

jayess gravatar image

I am configuring a whole new setup, with a new Turtleot3, a new computer, and a new wifi network. And I can't get what should simple to work...

On a Mac, Running VMware, with Ubuntu 16.04, and ROS Kinetic installed (correctly, I hope), I have the following confusing behavior. Do you see the problem?

Here are the key environment variables defined in bashrc in the VMWare Linux instance:

export ROS_IP=

In a fresh shell on VMWare:

$ Roscore
... logging to /home/pitosalas/.ros/log/fdf2db06-860d-11e8-b1a7-000c29b28fa8/roslaunch-ubuntu-44713.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://localhost:45411/
ros_comm version 1.12.13


 * /rosdistro: kinetic
 * /rosversion: 1.12.13


auto-starting new master
process[master]: started with pid [44723]

setting /run_id to fdf2db06-860d-11e8-b1a7-000c29b28fa8
process[rosout-1]: started with pid [44736]
started core service [/rosout]

Note regarding localhost

The report of ROS_MASTER_URI=http://localhost:11311 is what Roscore displays. In both shells we are running on the same .bashrc with export ROS_MASTER_URI= so I have to assume that Roscore noticing that the master uri env matches localhost, decides to display it as localhost.

Here's the /etc/hosts file which is all defaults as far as I can tell.   localhost   ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

printenv | grep ros

$ printenv | grep ros

printenv | grep ROS

$ printenv | grep ROS

Unable to communicate

Continuing, the same VMWare Linux instance, a different shell:

$ rostopic list
ERROR: Unable to communicate with master!
edit retag flag offensive close merge delete


Can you check your hosts file to see what the localhost entry maps to?

jayess gravatar image jayess  ( 2018-07-12 16:06:47 -0500 )edit

I've updated the original question with the hosts file.

pitosalas gravatar image pitosalas  ( 2018-07-12 17:07:20 -0500 )edit

Can you update your question with the output of printenv | grep ROS?

jayess gravatar image jayess  ( 2018-07-12 17:17:12 -0500 )edit

Thanks for taking the time to look at this, question is updated.

pitosalas gravatar image pitosalas  ( 2018-07-12 20:19:35 -0500 )edit

Np. Can you try it again with ROS capitalized? grep is case sensitive.

jayess gravatar image jayess  ( 2018-07-12 20:34:03 -0500 )edit

updated. thanks!

pitosalas gravatar image pitosalas  ( 2018-07-12 20:50:43 -0500 )edit

What happens if you manually set ROS_MASTER_URI and ROS_IP in each terminal?

jayess gravatar image jayess  ( 2018-07-12 21:26:16 -0500 )edit

Weird: I did

$ export ROS_IP=
$ export ROS_MASTER_URI=

On both shells, and then I did

$ roscore

and nothing happened. I tried to ^c and this happened:

WARNING: ROS_MASTER_URI [] host is not set to this machine
pitosalas gravatar image pitosalas  ( 2018-07-12 21:35:34 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2018-07-13 06:18:38 -0500

pitosalas gravatar image

I found the problem! If we look closely at my printenv, you see that there's a ROS_HOSTNAME=localhost that is being set somewhere. By the doc, that overrides the ROS_IP I have below!! Thanks for all your time and help troubleshooting this.

edit flag offensive delete link more

answered 2018-07-13 03:11:04 -0500

Reamees gravatar image

updated 2018-07-13 04:14:40 -0500


As @jayess pointed out you don't actually say that you are setting the environment variables in order to use ros as a master/slave setup. If you are not doing it for that can you please explain why are you changing the default values.

Does pinging the IPs you are trying to use work? If ping doesn't work then ROS is also not going to work with those settings.

From your question and comments it's not clear what you set each computers ROS_MASTER_URI and ROS_IP to.

Before trying the ROS slave/master connection try to ping the computers from each other.

In any case, to communicate with the master you shouldn't have to change anything from the default setup on the computer used as master. So on the master ROS_MASTER_URI=http://localhost:11311 and don't specify any ROS_IP.

Lets say the master's ip is and slave ip is

Then on the slave machine you would have to run $ export ROS_MASTER_URI= && export ROS_IP=

Easiest way to check if everything works is to run roscore on the master and try run $ rostopic list or something similar on the slave pc in the terminal with the correct exports. With just roscore running on the master you should see the /rosout and /rosout_agg topics.

edit flag offensive delete link more


He's doing everything from the same machine in different shells and setting ROS_MASTER_URI and ROS_IP in two different ways and getting different behavior for each way.

jayess gravatar image jayess  ( 2018-07-13 03:30:49 -0500 )edit

answered 2018-07-12 15:35:26 -0500

jayess gravatar image

Your first listing says that the ROS_MASTER_URI is http://localhost:11311/, yet your listing of environment variables for your other shell says that it's Can you confirm that these are the same (i.e., localhost is If they're not the same then modify them so that they are.

edit flag offensive delete link more


I've updated the original question...

pitosalas gravatar image pitosalas  ( 2018-07-12 15:55:52 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-07-12 15:05:07 -0500

Seen: 1,023 times

Last updated: Jul 13 '18