Robotics StackExchange | Archived questions

How to pass 'world_name' argument to roslaunch via command line ?

I have a package named 'huskyhighlevelcontroller' at '~/catkinws/src/' . Inside my package, I have the a 'world' folder which contains 'singlePillar.world' file.

I have already installed the 'huskygazebo' package. This package contains a launch file named 'huskyemptyworld.launch'. This is how the 'huskyempty_world.launch' file looks -

<launch>
 26 
 27   <arg name="world_name" default="worlds/empty.world"/>
 28 
 29   <arg name="laser_enabled" default="true"/>
 30   <arg name="realsense_enabled" default="false"/>
 31 
 32   <include file="$(find gazebo_ros)/launch/empty_world.launch">
 33     <arg name="world_name" value="$(arg world_name)"/> <!-- world_name is wr    t GAZEBO_RESOURCE_PATH environment variable -->
 34     <arg name="paused" value="false"/>
 35     <arg name="use_sim_time" value="true"/>
 36     <arg name="gui" value="true"/>
 37     <arg name="headless" value="false"/>
 38     <arg name="debug" value="false"/>
 39   </include>
 40 
 41   <include file="$(find husky_gazebo)/launch/spawn_husky.launch">
 42     <arg name="laser_enabled" value="$(arg laser_enabled)"/>
 43     <arg name="realsense_enabled" value="$(arg realsense_enabled)"/>
 44   </include>
 45 
 46 </launch>

I want to pass 'singlePillar.world' file (as mentioned above) to the huskyemptyworld.launch file.

To do this, in my terminal, I first navigated to the 'launch' folder inside my 'huskyhighlvel_controller' package-

cd ~/catkin_ws/src/husky_high_level_controller/world/

Then, at this location, I ran the following command -

roslaunch husky_gazebo husky_empty_world.launch world_name:=singlePillar.world

This lauches the Gazebo environment with a Husky robot, but with an empty world. The singlePIllar.world file is not loaded. What am I missing?

Asked by skpro19 on 2020-10-20 04:07:35 UTC

Comments

What am I missing?

this bit most likely:

<!-- world_name is wrt GAZEBO_RESOURCE_PATH environment variable -->

Is your singlePillar.world on the GAZEBO_RESOURCE_PATH?

Asked by gvdhoorn on 2020-10-20 05:23:57 UTC

Answers