Robotics StackExchange | Archived questions

Roslaunch : include same .launch several times with different parameters

Hi all,

I have a .launch file who include 6 times the same launch but with different parameters. But they all take the last "model" arg, does someone know why ?

Example with only 2 includes :

<include file="$(find simulation)/launch/spawn_car.launch">
  <arg name="model" value="golf"/>
  <arg name="E1" value="1"/>
  <arg name="immat" value="golf-AAA"/>
</include>

<include file="$(find simulation)/launch/spawn_car.launch">
  <arg name="model" value="miniCooper"/>
  <arg name="F3" value="1"/>
  <arg name="immat" value="miniCooper-AAB"/>
</include>

In spawn_car.launch, I'm using "model" arg like this :

<param name="car_description" command="$(find xacro)/xacro --inorder $(find simulation)/urdf/cars/$(arg model).urdf.xacro custom_car:=true"/>

And cars are spawned with same car_description (here with miniCooper urdf.xacro file).

Help anyone ? :)

Asked by blevesque on 2017-02-27 05:44:00 UTC

Comments

Answers

I found the answer.

I had to add groups, like this :

<group ns="car1">
  <include file="$(find simulation)/launch/spawn_car.launch">
    <arg name="model" value="golf"/>
    <arg name="E1" value="1"/>
    <arg name="immat" value="golf-AAA"/>
  </include>
</group>

<group ns="car6">
<include file="$(find simulation)/launch/spawn_car.launch">
  <arg name="model" value="delorean"/>
  <arg name="F3" value="1"/>
  <arg name="immat" value="delorean-AAB"/>
</include>
</group>

Asked by blevesque on 2017-02-27 11:15:13 UTC

Comments