Unable to communicate to some of ROS services
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
rosservice list shows all. Fixing /etc/hosts didn't help.
Maybe a stupid question but is gazebo running? What's the output of
rosservice info /gazebo/unpause_physics
?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]
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 unsettingROS_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 setAnd in my computer, I had to set the variables in the same way, but a different ROS_HOSTNAME, of course:
ROS_HOSTNAME=myComputerNameHere