roslaunch erros out when trying to launch master when master is already running via roscore
Guys,
I am having this issue where I can't use roslaunch command because every time I run something like:
roslaunch ros_robotics ddrobot_rviz.launch model:=dd_robot.urdf
it will error out with following message:
started roslaunch server http://localhost:34665/
SUMMARY
PARAMETERS
* /joint_state_publisher/use_gui: True
* /robot_description: <?xml version="1....
* /rosdistro: kinetic
* /rosversion: 1.12.7
NODES
/
joint_state_publisher (joint_state_publisher/joint_state_publisher)
robot_state_publisher (robot_state_publisher/state_publisher)
rviz (rviz/rviz)
auto-starting new master
process[master]: started with pid [2401]
ERROR: Unable to start XML-RPC server, port 11311 is already in use
Unhandled exception in thread started by <bound method XmlRpcNode.run of <rosgraph.xmlrpc.XmlRpcNode object at 0x7f38a45133d0>>
Traceback (most recent call last):
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/xmlrpc.py", line 215, in run
self._run()
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/xmlrpc.py", line 284, in _run
self._run_init()
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/xmlrpc.py", line 234, in _run_init
self.server = ThreadingXMLRPCServer((bind_address, port), log_requests)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/xmlrpc.py", line 115, in __init__
SimpleXMLRPCServer.__init__(self, addr, SilenceableXMLRPCRequestHandler, log_requests)
File "/usr/lib/python2.7/SimpleXMLRPCServer.py", line 593, in __init__
SocketServer.TCPServer.__init__(self, addr, requestHandler, bind_and_activate)
File "/usr/lib/python2.7/SocketServer.py", line 417, in __init__
self.server_bind()
File "/usr/lib/python2.7/SocketServer.py", line 431, in server_bind
self.socket.bind(self.server_address)
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
ERROR: could not contact master [http://localhost:11311//]
The traceback for the exception was written to the log file
[master] killing on exit
It seems that roslaunch tries to launch a master server while there is already one running in another terminal window.
Any idea how to resolve this?
Thanks!
As requested, this launch file might be helpful. That said, this issue is not specific to this particular launch file. Every launch file on my system errors out like this.
<launch>
<!-- set parameter on Parameter Server -->
<arg name="model" />
<param name="robot_description"
command="$(find xacro)/xacro.py '$(find ros_robotics)/urdf/$(arg model)'" />
<!-- send joint values from gui -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
<param name="use_gui" value="TRUE"/>
</node>
<!-- use joint positions to update tf -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"/>
<!-- visualize robot model in 3D -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find ros_robotics)/urdf.rviz" required="true" />
</launch>
Roy
Edit: @gvdhoorn
roy@RoysMacUbuntu:~/catkin_ws/src/ros_robotics/urdf$ printenv | grep ROS
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311//
ROS_HOSTNAME=localhostsource
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=kinetic
I might not be able to help much, but if you can post the roslaunch files in question (or links to them) that will definitely help others debug the issue.
@roy: could you also add the values of
ROS_MASTER_URI
,ROS_IP
andROS_HOSTNAME
?It probably shouldn't matter, but can you remove the two forward-slashes (
/
) at the end ofROS_MASTER_URI
and try again?ROS_IP is empty for some reason. Do I need to set this somewhere?
ROS_IP
is only needed if you don't have a working DNS for all involved hosts. If you're not running a multi-host ROS setup -- andlocalhost
resolves to the proper IP -- then it's not needed.Where does the
source
suffix onROS_HOSTNAME
come from?Are you setting any of these variables yourself -- in your
.bashrc
fi?Here are ROS related lines in my.bashrc: source /opt/ros/kinetic/setup.bash source ~/catkin_ws/devel/setup.bash
export ROS_MASTER_URI=http://localhost:11311// export ROS_HOSTNAME=localhostsource /opt/ros/kinetic/setup.bash