These files go in a folder named lawnmow_gazebo in the src directory.
This file goes in a folder named launch in the lawnmow_gazebo directory
lawnmow_world.launch:
<?xml version="1.0" encoding="UTF-8"?><launch> <arg name="world" default="empty"/> <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="world_name" value="$(find lawnmow_gazebo)/worlds/lawnmow.world"/--> <arg name="world_name" value="$(find lawnmow_gazebo)/worlds/turtlebot_playground.world"/> <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> <param name="robot_description" command="$(find xacro)/xacro.py '$(find lawnmow_description)/urdf/lawnmow.xacro'"/> <node name="lawnmow_spawn" pkg="gazebo_ros" type="spawn_model" output="screen" args="-urdf -param robot_description -model lawnmow" /></launch>The following files go in a folder named worlds that are in the lawnmow_gazebo folder:
lawnmow.world:
<?xml version="1.0" ?><sdf version="1.4"> <!-- We use a custom world for the robot so that the camera angle is launched correctly --> <world name="default"> <include> <uri>model://ground_plane</uri> </include> <!-- Global light source --> <include> <uri>model://sun</uri> </include> <!-- Focus camera on tall pendulum --> <gui fullscreen='0'> <camera name='user_camera'> <pose>4.927360 -4.376610 3.740080 0.000000 0.275643 2.356190</pose> <view_controller>orbit</view_controller> </camera> </gui> </world></sdf>turtle_playground.world:
<sdf version='1.4'> <world name='default'> <light name='sun' type='directional'> <cast_shadows>1</cast_shadows> <pose>0 0 10 0 -0 0</pose> <diffuse>0.8 0.8 0.8 1</diffuse> <specular>0.2 0.2 0.2 1</specular> <attenuation> <range>1000</range> <constant>0.9</constant> <linear>0.01</linear> <quadratic>0.001</quadratic> </attenuation> <direction>0.5 0.1 -0.9</direction> </light> <scene> <ambient>0.4 0.4 0.4 1</ambient> <background>0.7 0.7 0.7 1</background> <shadows>1</shadows> </scene> <physics type='ode'> <max_step_size>0.01</max_step_size> <real_time_factor>1</real_time_factor> <real_time_update_rate>100</real_time_update_rate> <gravity>0 0 -9.8</gravity> </physics> <model name='bookshelf'> <static>1</static> <link name='link'> <inertial> <mass>1</mass> </inertial> <collision name='back'> <pose>0 0.005 0.6 0 -0 0</pose> <geometry> <box> <size>0.9 0.01 1.2</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <visual name='visual1'> <pose>0 0.005 0.6 0 -0 0</pose> <geometry> <box> <size>0.9 0.01 1.2</size> </box> </geometry> <material> <script> <uri>file://media/materials/scripts/gazebo.material</uri> <name>Gazebo/Wood</name> </script> </material> </visual> <collision name='left_side'> <pose>0.45 -0.195 0.6 0 -0 0</pose> <geometry> <box> <size>0.02 0.4 1.2</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <visual name='visual2'> <pose>0.45 -0.195 0.6 0 -0 0</pose> <geometry> <box> <size>0.02 0.4 1.2</size> </box> </geometry> <material> <script> <uri>file://media/materials/scripts/gazebo.material</uri> <name>Gazebo/Wood</name> </script> </material> </visual> <collision name='right_side'> <pose>-0.45 -0.195 0.6 0 -0 0</pose> <geometry> <box> <size>0.02 0.4 1.2</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <visual name='visual3'> <pose>-0.45 -0.195 0.6 0 -0 0</pose> <geometry> <box> <size>0.02 0.4 1.2</size> </box> </geometry> <material> <script> <uri>file://media/materials/scripts/gazebo.material</uri> <name>Gazebo/Wood</name> </script> </material> </visual> <collision name='bottom'> <pose>0 -0.195 0.03 0 -0 0</pose> <geometry> <box> <size>0.88 0.4 0.06</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <visual name='visual4'> <pose>0 -0.195 0.03 0 -0 0</pose> <geometry> <box> <size>0.88 0.4 0.06</size> </box> </geometry> <material> <script> <uri>file://media/materials/scripts/gazebo.material</uri> <name>Gazebo/Wood</name> </script> </material> </visual> <collision name='top'> <pose>0 -0.195 1.19 0 -0 0</pose> <geometry> <box> <size>0.88 0.4 0.02</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <visual name='visual5'> <pose>0 -0.195 1.19 0 -0 0</pose> <geometry> <box> <size>0.88 0.4 0.02</size> </box> </geometry> <material> <script> <uri>file://media/materials/scripts/gazebo.material</uri> <name>Gazebo/Wood</name> </script> </material> </visual> <collision name='low_shelf'> <pose>0 -0.195 0.43 0 -0 0</pose> <geometry> <box> <size>0.88 0.4 0.02</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <visual name='visual6'> <pose>0 -0.195 0.43 0 -0 0</pose> <geometry> <box> <size>0.88 0.4 0.02</size> </box> </geometry> <material> <script> <uri>file://media/materials/scripts/gazebo.material</uri> <name>Gazebo/Wood</name> </script> </material> </visual> <collision name='high_shelf'> <pose>0 -0.195 0.8 0 -0 0</pose> <geometry> <box> <size>0.88 0.4 0.02</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <visual name='visual7'> <pose>0 -0.195 0.8 0 -0 0</pose> <geometry> <box> <size>0.88 0.4 0.02</size> </box> </geometry> <material> <script> <uri>file://media/materials/scripts/gazebo.material</uri> <name>Gazebo/Wood</name> </script> </material> </visual> <velocity_decay> <linear>0</linear> <angular>0</angular> </velocity_decay> <self_collide>0</self_collide> <kinematic>0</kinematic> <gravity>1</gravity> </link> <pose>0 1.53026 0 0 -0 0</pose> </model> <model name='jersey_barrier'> <static>1</static> <link name='link'> <visual name='visual'> <geometry> <mesh> <uri>model://jersey_barrier/meshes/jersey_barrier.dae</uri> </mesh> </geometry> </visual> <collision name='upright'> <pose>0 0 0.5715 0 -0 0</pose> <geometry> <box> <size>4.06542 0.3063 1.143</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <collision name='base'> <pose>0 0 0.032258 0 -0 0</pose> <geometry> <box> <size>4.06542 0.8107 0.064516</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <collision name='base2'> <pose>0 0 0.1 0 -0 0</pose> <geometry> <box> <size>4.06542 0.65 0.1</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <collision name='base3'> <pose>0 0 0.2 0 -0 0</pose> <geometry> <box> <size>4.06542 0.5 0.1</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <collision name='left-angle'> <pose>0 -0.224 0.2401 0.9 -0 0</pose> <geometry> <box> <size>4.06542 0.5 0.064516</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <collision name='right-angle'> <pose>0 0.224 0.2401 -0.9 0 0</pose> <geometry> <box> <size>4.06542 0.5 0.064516</size> </box> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <velocity_decay> <linear>0</linear> <angular>0</angular> </velocity_decay> <self_collide>0</self_collide> <kinematic>0</kinematic> <gravity>1</gravity> </link> <pose>-4 -1 0 0 -0 -0.7</pose> </model> <model name='ground_plane_0'> <static>1</static> <link name='link'> <collision name='collision'> <geometry> <plane> <normal>0 0 1</normal> <size>100 100</size> </plane> </geometry> <surface> <friction> <ode> <mu>100</mu> <mu2>50</mu2> </ode> </friction> <bounce/> <contact> <ode/> </contact> </surface> <max_contacts>10</max_contacts> </collision> <visual name='visual'> <cast_shadows>0</cast_shadows> <geometry> <plane> <normal>0 0 1</normal> <size>100 100</size> </plane> </geometry> <material> <script> <uri>file://media/materials/scripts/gazebo.material</uri> <name>Gazebo/Grey</name> </script> </material> </visual> <velocity_decay> <linear>0</linear> <angular>0</angular> </velocity_decay> <self_collide>0</self_collide> <kinematic>0</kinematic> <gravity>1</gravity> </link> <pose>0.497681 0 0 0 -0 0</pose> </model> <state world_name='default'> <sim_time>0 0</sim_time> <real_time>0 44986</real_time> <wall_time>1377677575 940727583</wall_time> <model name='Dumpster'> <pose>1 -3.44458 0 0 -0 0</pose> <link name='link'> <pose>1 -3.44458 0 0 -0 0</pose> <velocity>0 0 0 0 -0 0</velocity> <acceleration>0 0 0 0 -0 0</acceleration> <wrench>0 0 0 0 -0 0</wrench> </link> </model> <model name='cube_20k'> <pose>1.41131 -1 0 0 -0 0.9</pose> <link name='link'> <pose>1.41131 -1 0.5 0 -0 0.9</pose> <velocity>0 0 0 0 -0 0</velocity> <acceleration>0 0 0 0 -0 0</acceleration> <wrench>0 0 0 0 -0 0</wrench> </link> </model> <model name='unit_cylinder_1'> <pose>-2 -3.4888 0.5 0 -0 0</pose> <link name='link'> <pose>-2 -3.4888 0.5 0 -0 0</pose> <velocity>0 0 0 0 -0 0</velocity> <acceleration>0 0 0 0 -0 0</acceleration> <wrench>0 0 0 0 -0 0</wrench> </link> </model> </state> <gui fullscreen='0'> <camera name='user_camera'> <pose>1.33336 -0.422442 27.6101 3e-06 1.5698 3.04015</pose> <view_controller>orbit</view_controller> </camera> </gui> <model name='unit_cylinder_1'> <pose>-2 -3.4888 0.5 0 -0 0</pose> <link name='link'> <inertial> <mass>1</mass> <inertia> <ixx>1</ixx> <ixy>0</ixy> <ixz>0</ixz> <iyy>1</iyy> <iyz>0</iyz> <izz>1</izz> </inertia> </inertial> <collision name='collision'> <geometry> <cylinder> <radius>0.5</radius> <length>1</length> </cylinder> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <visual name='visual'> <geometry> <cylinder> <radius>0.5</radius> <length>1</length> </cylinder> </geometry> <material> <script> <uri>file://media/materials/scripts/gazebo.material</uri> <name>Gazebo/Grey</name> </script> </material> </visual> <velocity_decay> <linear>0</linear> <angular>0</angular> </velocity_decay> <self_collide>0</self_collide> <kinematic>0</kinematic> <gravity>1</gravity> </link> <static>0</static> </model> <model name='Dumpster'> <link name='link'> <collision name='collision'> <geometry> <mesh> <uri>model://dumpster/meshes/dumpster.dae</uri> </mesh> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <visual name='visual'> <geometry> <mesh> <uri>model://dumpster/meshes/dumpster.dae</uri> </mesh> </geometry> <material> <script> <uri>model://dumpster/materials/scripts</uri> <uri>model://dumpster/materials/textures</uri> <name>Dumpster/Diffuse</name> </script> </material> </visual> <velocity_decay> <linear>0</linear> <angular>0</angular> </velocity_decay> <self_collide>0</self_collide> <inertial> <inertia> <ixx>1</ixx> <ixy>0</ixy> <ixz>0</ixz> <iyy>1</iyy> <iyz>0</iyz> <izz>1</izz> </inertia> <mass>1</mass> </inertial> <kinematic>0</kinematic> <gravity>1</gravity> </link> <pose>1 -3.44458 0 0 -0 -0.3</pose> <static>0</static> </model> <model name='cube_20k'> <link name='link'> <pose>0 0 0.5 0 -0 0</pose> <collision name='collision'> <geometry> <mesh> <uri>model://cube_20k/meshes/cube_20k.stl</uri> <scale>0.5 0.5 0.5</scale> </mesh> </geometry> <max_contacts>10</max_contacts> <surface> <bounce/> <friction> <ode/> </friction> <contact> <ode/> </contact> </surface> </collision> <visual name='visual'> <geometry> <mesh> <uri>model://cube_20k/meshes/cube_20k.stl</uri> <scale>0.5 0.5 0.5</scale> </mesh> </geometry> </visual> <velocity_decay> <linear>0</linear> <angular>0</angular> </velocity_decay> <self_collide>0</self_collide> <inertial> <inertia> <ixx>1</ixx> <ixy>0</ixy> <ixz>0</ixz> <iyy>1</iyy> <iyz>0</iyz> <izz>1</izz> </inertia> <mass>1</mass> </inertial> <kinematic>0</kinematic> <gravity>1</gravity> </link> <pose>1.41131 -1 0 0 -0 0.9</pose> <static>0</static> </model> </world></sdf>