Gazebo | Ignition | Community
Ask Your Question
1

How to use for loop in launch file in gazebo?

asked 2015-12-25 03:13:05 -0500

rahul gravatar image

updated 2021-01-07 00:30:40 -0500

yah130s gravatar image

How can implement for loop concept in gazebo to spawn multiple robot model? For example:

<include file="$(find manycar)/launch/azcar.launch">
<arg name="robot_num" value="1"/>
<arg name="init_pose" value="-x 1 -y 1 -z 0 -Y 1.57 "/>
</include>

I want to iterate above code n times, variable being robot_num's value. How should I do that?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-12-25 10:52:42 -0500

chapulina gravatar image

Maybe you could use embedded ruby the same way it can be used for SDF.

See this SDF example where wheels are generated in a for loop for a cart.

edit flag offensive delete link more

Comments

Years passed, the link https://bitbucket.org/osrf/gazebo_mod... looks broken to me.

yah130s gravatar imageyah130s ( 2021-01-07 00:33:00 -0500 )edit
0

answered 2020-01-08 11:46:48 -0500

eaucone gravatar image

There's no a direct way to loop, but you can think about writing a luanch file where you spawn N instances of the same robot.

Pay attention to add <group> tag for each one and to use different name (ns argument).

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-12-25 03:13:05 -0500

Seen: 1,925 times

Last updated: Jan 07