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

Unable to communicate to some of ROS services

asked 2012-11-15 15:23:04 -0600

jys gravatar image

updated 2014-11-22 17:05:30 -0600

ngrennan gravatar image

I am trying to call ros services but I am unable to call some rosservices...

It works for /rosout/get_loggers but doesn't work with gazebo related services.. rosservice list shows all services.

(I intentionally added spaces between rosrpc and localhost because the system thinks I am posting some URL links and I don't have enough karma)

$ rosservice uri /rosout/get_loggers 
rosrpc: // localhost:59423
$ rosservice type /rosout/get_loggers 
roscpp/GetLoggers
$ rosservice uri /gazebo/unpause_physics
rosrpc : // localhost:41557
$ rosservice type /gazebo/unpause_physics
ERROR: Unable to communicate with service [/gazebo/unpause_physics], address [rosrpc : // localhost:41557]
$ rosservice call /gazebo/unpause_physics
ERROR: Unable to communicate with service [/gazebo/unpause_physics], address [rosrpc : // localhost:41557]

I read about network setup but still not able to figure out what is going on.. Please help.

$ echo $ROS_MASTER_URI 
http : // localhost:11311
$ echo $ROS_HOSTNAME 
localhost
edit retag flag offensive close merge delete

Comments

rosservice list shows all. Fixing /etc/hosts didn't help.

jys gravatar image jys  ( 2012-11-16 03:19:47 -0600 )edit

Maybe a stupid question but is gazebo running? What's the output of rosservice info /gazebo/unpause_physics?

Lorenz gravatar image Lorenz  ( 2012-11-18 21:49:06 -0600 )edit

I get same error.. Gazebo is running.. It is in "paused" state and GUI botton for "resume" doesn't respond.. Node: /gazebo URI: rosrpc://localhost:36586 ERROR: Unable to communicate with service [/gazebo/unpause_physics], address [rosrpc://localhost:36586]

jys gravatar image jys  ( 2012-11-19 05:20:49 -0600 )edit

I was using Husarnet to connect to a remote robot (ROSBot) and could list the services but not call them. In the end, the problem is that I had ROS_IP=127.0.0.1 on my computer and on the robot. After unsetting ROS_IP in my pc and in the robot, it connected fine. Of course, in order for it to work with Husarnet, I also had to set

ROS_IPV6=on
ROS_MASTER_URI=http://master:11311
ROS_HOSTNAME=master # in therobot

And in my computer, I had to set the variables in the same way, but a different ROS_HOSTNAME, of course: ROS_HOSTNAME=myComputerNameHere

Ruben Alves gravatar image Ruben Alves  ( 2022-02-03 08:32:52 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-11-15 21:23:45 -0600

michikarg gravatar image

updated 2012-11-15 21:24:24 -0600

Does rosservice list show the services?

Also I had some trouble with some entries in the /etc/hosts file since the entries there usually overwrite the information from the DNS/DHCP Server. If you have some entries there, you can make a backup of your /etc/hosts file and delete every entry except the following:

127.0.0.1   localhost

At least this was the cause for a similar problem in a network with non-static IP addresses....

edit flag offensive delete link more

Comments

rosservice list shows all. Fixing /etc/hosts didn't help.

jys gravatar image jys  ( 2012-11-19 14:46:26 -0600 )edit

so, it turns out that ROS register the names of hosts with the variables of the terminal in which the roslaunch/rosrun command was ran. I managed to solve it by executing export ROS_HOSTNAME=xxx.Home, where xxx is the name of the pc that was providing the service. this name (with the home suffix) was provided by the router, so no need to add it to /etc/hosts. That said, changing etc/hosts is a more permanent and possibly better solution.

fbelmonteklein gravatar image fbelmonteklein  ( 2021-02-18 10:49:15 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-11-15 15:23:04 -0600

Seen: 6,837 times

Last updated: Nov 16 '12