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

Roscore not finding rostopic

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

pitosalas gravatar image

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

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_MASTER_URI=http://129.64.123.200:11311
export ROS_IP=129.64.123.200

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


SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.13

NODES

auto-starting new master
process[master]: started with pid [44723]
ROS_MASTER_URI=http://localhost:11311/

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=http://129.64.123.200:11311 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.

127.0.0.1   localhost
127.0.1.1   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
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/home/pitosalas/catkin_ws/src:/opt/ros/kinetic/share
LD_LIBRARY_PATH=/home/pitosalas/catkin_ws/devel/lib:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/x86_64-linux-gnu
PATH=/opt/ros/kinetic/bin:/home/pitosalas/bin:/home/pitosalas/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PYTHONPATH=/home/pitosalas/catkin_ws/devel/lib/python2.7/dist-packages:/opt/ros/kinetic/lib/python2.7/dist-packages
PKG_CONFIG_PATH=/home/pitosalas/catkin_ws/devel/lib/pkgconfig:/opt/ros/kinetic/lib/pkgconfig:/opt/ros/kinetic/lib/x86_64-linux-gnu/pkgconfig
CMAKE_PREFIX_PATH=/home/pitosalas/catkin_ws/devel:/opt/ros/kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros

printenv | grep ROS

$ printenv | grep ROS
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/home/pitosalas/catkin_ws/src:/opt/ros/kinetic/share
ROS_MASTER_URI=http://129.64.123.200:11311
ROS_VERSION=1
ROS_HOSTNAME=localhost
ROSLISP_PACKAGE_DIRECTORIES=/home/pitosalas/catkin_ws/devel/share/common-lisp
ROS_DISTRO=kinetic
ROS_IP=129.64.123.200
ROS_ETC_DIR=/opt/ros/kinetic/etc/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

Comments

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

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

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

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

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

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

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

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

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

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

updated. thanks!

pitosalas gravatar image pitosalas  ( 2018-07-12 20:50:43 -0600 )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 -0600 )edit

Weird: I did

$ export ROS_IP=129.64.123.200
$ export ROS_MASTER_URI=http://129.64.123.200:11311

On both shells, and then I did

$ roscore

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

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

3 Answers

Sort by ยป oldest newest most voted
0

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

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
0

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

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 http://129.64.123.200:11311. Can you confirm that these are the same (i.e., localhost is 129.64.123.200)? If they're not the same then modify them so that they are.

edit flag offensive delete link more

Comments

I've updated the original question...

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

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

Reamees gravatar image

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

Edit

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 129.64.123.222 and slave ip is 129.64.123.111

Then on the slave machine you would have to run $ export ROS_MASTER_URI=http://129.64.123.222:11311 && export ROS_IP=129.64.123.111

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

Comments

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 -0600 )edit

Question Tools

2 followers

Stats

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

Seen: 1,285 times

Last updated: Jul 13 '18