osrf / mbzirc

Simulator for the MBZIRC Maritime Grand Challenge
Apache License 2.0
72 stars 47 forks source link

Setting the pose of the models through code #174

Open kevindokaist opened 2 years ago

kevindokaist commented 2 years ago

Hi, we want to test out our method for various problem configurations such as different initial locations of the vessels.

In Gazebo, there is a topic or service /gazebo/set_model_state that is subscribed by Gazebo and change the states of the models.

Is there any way to do this in the provided simulator?

Thank you!

iche033 commented 2 years ago

yeah we have a service for teleporting entities. Assuming your USV is named usv, you can move it like so:

ign service -s /world/coast/set_pose --reqtype ignition.msgs.Pose --reptype ignition.msgs.Boolean --timeout 300 --req 'name: "usv", position: {x: -1400, y: 1, z: 0.3}'