Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

As I found out here, if you want to use the get_model_state, you can simply add

<plugin name="gazebo_ros_state" filename="libgazebo_ros_state.so">
      <ros>
        <namespace>/gazebo</namespace>
      </ros>

      <update_rate>1.0</update_rate>
    </plugin>

to the world file of your ros2 package. To test it, you can run

ros2 service call /gazebo/get_entity_state gazebo_msgs/GetEntityState '{name: my_robot_name, reference_frame: world}'

when gazebo is running in the background, and the service appears on ros2 service list

As I found out here, if you want to use the get_model_state, you can simply add

<plugin name="gazebo_ros_state" filename="libgazebo_ros_state.so">
      <ros>
        <namespace>/gazebo</namespace>
      </ros>

      <update_rate>1.0</update_rate>
    </plugin>

to the world file of your ros2 package. To test it, you can run

ros2 service call /gazebo/get_entity_state gazebo_msgs/GetEntityState '{name: my_robot_name, reference_frame: world}'

when gazebo is running in the background, and the service appears on ros2 service list