ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Costume world fail to load in Hector_quadrotor_gazeboo

asked 2018-04-01 14:14:06 -0500

Caesar84 gravatar image

updated 2018-04-01 15:08:03 -0500

jayess gravatar image

hi there. I am trying to load a costume world for Hector_quadrotor_gazebo using the same procedure i have done with turtlebot_gazebo that is: i run :

roslaunch hector_quadrotor_gazebo quadrotor_empty_world.launch

then edited the empty world and 'save the world as' 2.world. nest step i ran this command:

~/catkin_ws$ roslaunch hector_quadrotor_gazebo quadrotor_empty_world.launch world_file:=/home/mastlab/2.world

and it ignored the edited world and loaded the original empty_world. next thing i tried was to modify the (2) into the following:

~/catkin_ws$ roslaunch hector_quadrotor_gazebo quadrotor_empty_world.launch world:=/home/mastlab/2.world

and nothing change.

i think the problem is i dont know what is the default world for hector_quadrotor_gazebo because it was pretty straight forward with turtlebot_gazebo .( roslaunch turtlebot_gazebo turtlebot_world.launch) . i am running ROS Kinetic and Gazebo 7. also I am quiet new to ROS and Gazebo.

Anyone have any idea?

thanks

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-04-03 11:02:51 -0500

Caesar84 gravatar image

solved, by adding the line <arg name="world_name" value="/home/mastlab/2.world"/> to the launch file so it will be :

<include file="$(find gazebo_ros)/launch/empty_world.launch">
  <arg name="paused" value="$(arg paused)"/>
  <arg name="use_sim_time" value="$(arg use_sim_time)"/>
  <arg name="gui" value="$(arg gui)"/>
  <arg name="headless" value="$(arg headless)"/>
  <arg name="debug" value="$(arg debug)"/>
<arg name="world_name" value="/home/mastlab/2.world"/>
</include>
edit flag offensive delete link more
1

answered 2018-04-01 15:23:37 -0500

jayess gravatar image

updated 2018-04-02 17:03:13 -0500

If you look at the source for the quadrotor_empty_world.launch you'll see that it doesn't have a world argument.

<?xml version="1.0"?>

<launch>
  <arg name="paused" default="false"/>
  <arg name="use_sim_time" default="true"/>
  <arg name="gui" default="true"/>
  <arg name="headless" default="false"/>
  <arg name="debug" default="false"/>

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="paused" value="$(arg paused)"/>
    <arg name="use_sim_time" value="$(arg use_sim_time)"/>
    <arg name="gui" value="$(arg gui)"/>
    <arg name="headless" value="$(arg headless)"/>
    <arg name="debug" value="$(arg debug)"/>
  </include>

  <include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch" />
</launch>

So, what you'll want to do is create a new launch file in your package that's similar to the one that you're using and include your custom world instead. You can make it a little more flexible by add a world argument that you're trying to use (let's call it world_name to be consistent with the empty_world.launch file):

<launch>
  <arg name="paused" default="false"/>
  <arg name="use_sim_time" default="true"/>
  <arg name="gui" default="true"/>
  <arg name="headless" default="false"/>
  <arg name="debug" default="false"/>
  <arg name="world_name"/>

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(arg world_name)"/>
    <arg name="paused" value="$(arg paused)"/>
    <arg name="use_sim_time" value="$(arg use_sim_time)"/>
    <arg name="gui" value="$(arg gui)"/>
    <arg name="headless" value="$(arg headless)"/>
    <arg name="debug" value="$(arg debug)"/>
  </include>

  <include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch" />
</launch>

Now, you should be able use it similarly to how you're currently trying to use it:

roslaunch my_package my_world.launch world_name:=2.world

One caveat is indicted in the empty_world.launch file

the world_name is with respect to GAZEBO_RESOURCE_PATH environmental variable

so you might have to work that out. Hopefully, this at least gives you something to go off of.


Update:

From the Gazebo tutorials,

GAZEBO_RESOURCE_PATH: colon-separated set of directories where Gazebo will search for other resources such as world and media files.

edit flag offensive delete link more

Comments

thanks alot @jayess . i have created new launch file named it empty_world_costume.launch that has:

<arg name="world_name"/>

and run the command roslaunch hector_quadrotor_gazebo empty_world_costume.launch world_name:=/opt/ros/1.world and it didnt work.

Caesar84 gravatar image Caesar84  ( 2018-04-02 11:48:04 -0500 )edit

also edited the original quadrotor_empty_world.launch file by adding the same line :

<arg name="world_name"/> and used the command :

roslaunch hector_quadrotor_gazebo quadrotor_empty_world_.launch world_name:=/opt/ros/1.world also nothing happened.

Caesar84 gravatar image Caesar84  ( 2018-04-02 12:02:32 -0500 )edit

it didnt work

Exactly what happened? Also, the world_name argument is the caveat that I was talking about. It's relative to the GAZEBO_RESOURCE_PATH. If you echo that you can try putting your world file in that location. Although, I haven't tried this myself.

jayess gravatar image jayess  ( 2018-04-02 12:03:41 -0500 )edit

i mean that in both cases the loaded world was the original empty_world and not 1.world at all. regarding the resource path environment, i didnt get any result using 1- ~$ echo $GAZEBO_RESOURCE_PATH and 2- ~/catkin_ws$ echo $GAZEBO_RESOURCE_PATH. the output is empty line . thanks again

Caesar84 gravatar image Caesar84  ( 2018-04-02 12:10:49 -0500 )edit
jayess gravatar image jayess  ( 2018-04-02 13:19:11 -0500 )edit

hi @jayess. i managed to get the content of the gazebo_resource_path: /usr/share/gazebo-7:/usr/share/gazebo_models, however, i dont know the exact echo command for hector_quadrotor_gazebo (you can say i tried different possibilities with no success). how to use that for my case? thanks again

Caesar84 gravatar image Caesar84  ( 2018-04-02 15:18:47 -0500 )edit

i dont know the exact echo command for hector_quadrotor_gazebo

I'm not sure what you're referring to here.

you can say i tried different possibilities with no success

I don't know how to help if I don't know what you've tried and what the results were.

jayess gravatar image jayess  ( 2018-04-02 15:25:23 -0500 )edit

I am sorry if i confused you.iam trying to solveGAZEBO_RESOURCE_PATH problem as you mentioned its the reason why costume worlds isnt loading. i tried 1- echo $HECTOR_QUADROTOR_GAZEBO_WORLD_FILE 2-echo $HECTOR_QUADROTOR_WORLD_FILE 3-echo $HECTOR_GAZEBO_WORLD_FILE , and none seems correct.

Caesar84 gravatar image Caesar84  ( 2018-04-02 16:10:33 -0500 )edit

Question Tools

Stats

Asked: 2018-04-01 14:14:06 -0500

Seen: 171 times

Last updated: Apr 03 '18