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

use_sim_time only for some of the running nodes

asked 2017-10-05 06:18:56 -0500

Felix Widmaier gravatar image

Is there some way to enable use_sim_time only for dedicated nodes?

I have a scenario in which a node should use the simulated time published on /clock while at the same time other nodes are running which should use the wall time.

Since /use_sim_time is a global parameter, simply setting it to true would lead to all nodes using the simulated time. I think it would work to first start the wall-time nodes, then set the parameter and after that start the sim-time node, but I would prefer a more robust method, if there is any.

edit retag flag offensive close merge delete

Comments

1

Can you explain why you feel you need this, just to avoid an xy-problem? Perhaps board members can then assess whether it makes sense to do this.

There is a reason use_sim_time is 'a global parameter'.

gvdhoorn gravatar image gvdhoorn  ( 2017-10-05 07:03:53 -0500 )edit

I need a node to process a bagfile (using the clock from the bagfile) while other nodes are running normally (i.e. using the wall-time) on the same machine.

Felix Widmaier gravatar image Felix Widmaier  ( 2017-10-05 07:23:08 -0500 )edit
1

Ok, so why do the other nodes need to use wall-time?

gvdhoorn gravatar image gvdhoorn  ( 2017-10-05 07:26:34 -0500 )edit

The other nodes do not subscribe to anything published by the bagfile. I have a running system and just a single node (which is completely decoupled from the remaining system) needs to do some processing of a bagfile. Unfortunately it has to run together on the same machine.

Felix Widmaier gravatar image Felix Widmaier  ( 2017-10-05 07:37:14 -0500 )edit

An idea just came to my mind, maybe I can solve it by running two parallel roscores.

Felix Widmaier gravatar image Felix Widmaier  ( 2017-10-05 07:39:00 -0500 )edit

Are the other nodes not using data from the bag file?

jayess gravatar image jayess  ( 2017-10-05 12:30:20 -0500 )edit
1

It may be better to use the C++ bag API to process the bag file instead of publishing those messages and having a node that subscribes to them.

ahendrix gravatar image ahendrix  ( 2017-10-05 18:19:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-10-09 02:07:54 -0500

Felix Widmaier gravatar image

I solved it now by running two separate roscores (see e.g. this question). So the nodes using the wall time run with one core and the node using the simulated time runs with the other core.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-10-05 06:18:56 -0500

Seen: 1,155 times

Last updated: Oct 09 '17