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

Is it possible to remap /clock?

asked 2016-08-29 11:18:21 -0500

JaredMoore gravatar image

updated 2016-08-31 10:01:56 -0500

I'm running a launch file with grouped gazebo instances. So far I've been able to successfully separate each group into its own container, however, the \clock topic is still being shared among the groups. I've inserted a <remap from="clock" to="groupX_clock"/> following the conventions in . After launching, it appears that the clock is not being remapped correctly and the different Gazebo nodes use the same clock topic, leading to collisions in messages and errors mentioning that the simulation has moved back in time.

Is there an undocumented restriction on remapping certain topics? Or perhaps (most likely) I have just missed a critical piece of information.


Edit 1

After the comments posted in dornhege's answer, I've tried quite a few variations and investigated using rostopic list, rostopic info, and gz topic -l. It appears that the clock topic is remapped correctly in all but the Gazebo node. Something appears to be hindering the remapping there, but I'm am currently unsure how to get it to work correctly.

Edit 2

I've created a simplified set of launch and world files to try and isolate where I might be running into a problem. Here is my gazebo_only.launch file:


<!-- ********************* Begin Gazebo Defaults ******************************** -->

<arg name="args" default="--verbose -r -e ode"/>
<arg name="world" value="$(find basicbot_gazebo)/worlds/"/>

<!-- set use_sim_time flag -->
<!--<param name="/use_sim_time" value="true" />-->

<!-- ********************* End Gazebo Defaults ******************************** -->    

<!-- start gazebo server-->
<!--<env name="GAZEBO_MASTER_URI" value="http://localhost:11345"/>-->
<node name="gazebo" pkg="gazebo_ros" type="gzserver" args="$(arg world) $(arg args)" respawn="false" output="screen">
  <remap from="rosout" to="rosout_remapped" />  
  <remap from="clock" to="clock_remapped" />


Here is my world file:

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">
    <physics type="ode">


I've tried launching this on both my remote system, and my local Ubuntu VM both running Kinectic and Gazebo7. The remapping of both topics in the gazebo node still appears to fail. Does it work on your system?

Edit 3

Opened a github issue in the gazebo_ros_pkgs repository ( ) after considering Stefan's post. Verified myself that the code works in Indigo/Gazebo2 but not Kinectic/Gazebo7.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-08-31 05:52:44 -0500

Remapping /clock works fine more me: Gazebo launch:

  <node name="gazebo" pkg="gazebo_ros" type="gzserver" args="$(arg world) $(arg args)" respawn="false" output="screen">
    <remap from="odom" to="odom_trash" />
    <remap from="clock" to="clock_remapped" />

Check while gazebo is running:

kohlbrecher@kohlbrecher-XPS-15-9550:~$ rostopic info /clock_remapped
Type: rosgraph_msgs/Clock

 * /gazebo (http://kohlbrecher-XPS-15-9550:49687/)

 * /gazebo (http://kohlbrecher-XPS-15-9550:49687/)

Note that remapping applies to a topic and process/node, so it is not possible to remap tf data of one robot in a gazebo process from /tf to /tf_robot_1 and for another robot to tf_robot_2 (at least not with simple command line remapping).

edit flag offensive delete link more


Just tried using this configuration using the launch and world file in my Edit 2. Any chance you could take a look, maybe try those on your system to see if the remapping works? It has failed on my two test systems. Thanks for the help!

JaredMoore gravatar image JaredMoore  ( 2016-08-31 08:47:59 -0500 )edit

I just copied your launch file (only change was the world file, back to <arg name="world" default="worlds/"/>. Works for me, I'm using Gazebo2 on Indigo, however (but I think it's unlikely this ceased working with 7). How did you test wether the remapping works?

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2016-08-31 09:07:39 -0500 )edit

Great, thanks for the quick reply! I just tried changing the world to use empty world as well but still no success. I'm wondering if they inadvertently broke something on Gazebo7/Kinectic. I launched the file and then used rostopic list. The /clock topic was there, but no remapped one.

JaredMoore gravatar image JaredMoore  ( 2016-08-31 09:15:21 -0500 )edit

Tested the code on my local VM with Indigo/Gazebo2. Works here as well. Appears that possibly they've broken something between versions. I went ahead and added a github issue to the repository. Thanks for the help here, looks like I might have to go there to get the issue resolved.

JaredMoore gravatar image JaredMoore  ( 2016-08-31 10:02:50 -0500 )edit

Wow, that's really surprising, will be interesting to (hopefully) get this resolved.

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2016-08-31 10:12:27 -0500 )edit

answered 2016-08-29 12:23:22 -0500

dornhege gravatar image

My guess is that you need to remap '/clock' and not 'clock', if gazebo publishes on /clock explicitly. For Gazebo that would make sense, after all, why should there be more than one time...

edit flag offensive delete link more


Tried to remap /clock instead of clock as suggested and variants of groupX_clock as well as /groupX_clock. For the first configuration (/clock,groupX_clock) no updates occurred at all. Adding / to groupX published back on the clock topic, remap seems to fail.

JaredMoore gravatar image JaredMoore  ( 2016-08-29 12:48:13 -0500 )edit

The clock topic can be remapped as of Hydro and ros_comm version 1.11.0: . Since it uses the absolute name, I think you'll need to remap the absolute name. Use rostopic list and rostopic info to verify.

ahendrix gravatar image ahendrix  ( 2016-08-29 14:21:26 -0500 )edit

I think I'm being a bit dense but I looked around and ran rostopic info. All I see for a name is /clock. Im my setup file I currently do not have anything inside group tags to avoid any possible problems there. Any more info on absolute names? Sorry and thanks for the help!

JaredMoore gravatar image JaredMoore  ( 2016-08-29 14:57:01 -0500 )edit

The best I can do is refer you to:

ahendrix gravatar image ahendrix  ( 2016-08-29 15:12:08 -0500 )edit

Thanks for the help, I've edited my question as I think there might be an issue with remapping clock in gazebo nodes.

JaredMoore gravatar image JaredMoore  ( 2016-08-30 13:20:11 -0500 )edit

Question Tools



Asked: 2016-08-29 11:18:21 -0500

Seen: 1,000 times

Last updated: Aug 31 '16