Robotics StackExchange | Archived questions

How to add gazebo models like oak tree(which has meshes) through the launch file?

Hello,

I am using ROS melodic and I have to create some environments. I need to parameterize adding obstacles like box and trees. For box, I have already added a xacro file and I call this xacro file in my launch file like this:

group if="$(arg obst)">
        <param name="box_description" command="$(find xacro)/xacro.py aerialist/resources/simulation/box.xacro name:=box l:=$(arg obst_l) w:=$(arg obst_w) h:=$(arg obst_h) pattern:=$(arg pattern_design)" />

        <node name="spawn_obstacle" pkg="gazebo_ros" type="spawn_model" output="screen"
            args="-param box_description -urdf -x $(arg obst_x) -y $(arg obst_y) -z $(arg obst_z) -Y $(arg obst_yaw) -model box/">
        </node>
    </group>

Currently, I add complex gazebo models with meshes like oak and pine tree directly in the world file using include tag like this:

<include>
      <name>pine_tree_1</name>
      <uri>model://pine_tree</uri>
      <pose>10 0 0  0 0 0</pose>
 </include>

But I have to now add this oak and pine tree through a launch file dynamically instead of directly changing the world file all the time. The tree models are in the sdf format inside .gazebo folder in the root and this sdf file uses .dae file in turn. I am unable to convert them to Xacro format. Any other way by which I can include these oak and pine tree in my world file by using the launch file?

Asked by Prasun on 2023-07-25 07:13:49 UTC

Comments

Answers