# Revision history [back]

### What is recommended way to get the model state

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.

### What is recommended way to get the model statestate in ROS?

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.