What is recommended way to get the model state in ROS?

asked 2015-07-05 01:32:18 -0600

bazzisniper gravatar image

updated 2015-07-05 01:32:53 -0600

When gazebo is running with ros, asik, there are two ways to get state of specific models.

  • Calling /gazebo/get_model_state service
  • Subscribing to /gazebo/model_states topic

I checked both and I found that

  • using service call is better than subscribing because user can select a model.
  • Conversely, /gazebo/model_states contains information of whole models which are spawned in the gazebo world.

So I think subscribing to /gazebo/model_states topic has huge overhead, if we're interested in only few models.

My conclusion is that good way to get model state is calling /gazebo/get_model_state service.

Am I right? I would appreciate if you know better way for it.

Thank you.

edit retag flag offensive close merge delete


I just wonder if you did not subscribe to this topic, it is still being published all the time. Therefore, I think the overhead still exists even if you did not subscribe to it though I am not sure.

winston gravatar imagewinston ( 2015-08-02 05:50:20 -0600 )edit