Gazebo | Ignition | Community
Ask Your Question

equivalent of for loop in .world file

asked 2019-10-18 02:33:33 -0500

elemecro gravatar image

Hi..I am trying to simulate different boxes in gazebo. For that, I am copy pasting the code for one box in order to simulate the other boxes as well. Is there any option to use for loop in .world file? I tried to use xacros but the code throws error. I would be glad if someone can provide me with an example to generate several boxes using for loop in world file

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-10-18 02:47:27 -0500

kumpakri gravatar image

you can use population if you don't care for a concrete position of the boxes. You can chose the distance and formation of the generated boxes with this population tag.

edit flag offensive delete link more


Thanks..I will have a look at it...Does it allow me to place boxes at exact locations like if I say x,y, box should be placed over there and the next box at another x,y?

elemecro gravatar imageelemecro ( 2019-10-18 03:27:30 -0500 )edit

Update..I have looked into this..This does the population on fixed values whereas i want to place the objects on different x,y values by looping

elemecro gravatar imageelemecro ( 2019-10-18 04:06:12 -0500 )edit

In that case I suggest you take your time to study the XACRO, because that is what you need and will be very beneficial for you in the future. I cannot imagine building a ROS project without using XACRO.

kumpakri gravatar imagekumpakri ( 2019-10-18 08:21:46 -0500 )edit

can you please provide an example with xacro loop to generate the boxes say after every 1 m. I will be thankful

elemecro gravatar imageelemecro ( 2019-10-19 05:19:05 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-10-18 02:33:33 -0500

Seen: 509 times

Last updated: Oct 18 '19