i have a problem with my gazebo world and hope you could help me out. I Created a custom world in gazebo. However, after i add the world in my world robot setup launch, the objects shifted.
I think this have to do something with the state tag: https://answers.gazebosim.org//question/16144/world-shifts-after-reset/
I can fix it manually:
- Go to the .world file
- Go to the state tag and get a position tag of an object
- change the position of the object outside the state tag
Example:
<sdf version='1.7'>
<world name='default'>
<model name='NurseDesk'>
<static>1</static>
<link name='body'>
<pose>0 0 0 0 -0 0</pose>
<visual name='visual'>
<geometry>
<mesh>
<uri>model://NurseDesk/meshes/NurseDesk.obj</uri>
<scale>0.001 0.001 0.001</scale>
</mesh>
</geometry>
</visual>
<collision name='collision'>
<geometry>
<mesh>
<uri>model://NurseDesk/meshes/NurseDesk.obj</uri>
</mesh>
</geometry>
<max_contacts>10</max_contacts>
<surface>
<contact>
<ode/>
</contact>
<bounce/>
<friction>
<torsional>
<ode/>
</torsional>
<ode/>
</friction>
</surface>
</collision>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
<pose>-0.209073 5.49471 0 0 -0 0</pose>
</model>
<state world_name='default'>
<model name='NurseDesk'>
<pose>-0.108871 7.62391 0 0 -0 0</pose>
<scale>1 1 1</scale>
<link name='body'>
<pose>-0.108871 7.62391 0 0 -0 0</pose>
<velocity>0 0 0 0 -0 0</velocity>
<acceleration>0 0 0 0 -0 0</acceleration>
<wrench>0 0 0 0 -0 0</wrench>
</link>
</model>
</state>
</world>
</sdf>
If i change the position of the nurse desk outside the state tag from "-0.209073 5.49471 0 0 -0 0" to "-0.108871 7.62391 0 0 -0 0" (this position tag is inside the state tag), it fixed the problem.
If i start gazebo in the terminal with "gazebo my_world.world" --> World not shifted.: https://ibb.co/F5x1v2k
If i start gazebo in my launch file (inside include tag "include file="$(find gazebo_ros)/launch/empty_world.launch"") --> World shifted: https://ibb.co/840Y1VW
--> I don't want to fix every object. How can i launch my world without the shift?
Thank you so much !
<world>tag has the objects in the incorrect position, and the<state>tag pose specifications put those in the correct position. So the OP cannot just delete the<state>tag without changing the<pose>of each of the models/links in the<world>. – JRTG Oct 16 '23 at 07:56