ROS -- Create Wall Gazebo Environment


Examples

Refer to turtlebot gazebo package turtlebot3_gazebo, in order to spawn the environment, we usually run


roscore # T1 
roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch # T2
    

From the launch file, you can see it calls and spawns the target objects, one world and one robot.

Create Gazebo World

  1. Open gazebo window, by gazebo.
  2. Click Box to place a box. Scale it with scale mode.
  3. Save World As (Shift+Ctrl+S) as wall.world.
  4. Place the world file into your package's worlds folder. my_package/worlds/wall.world
  5. You can view the world again by,
  6. 
    gazebo wall.world
        

Change Launch file

  1. Copy turtlebot3_gazebo/launch/turtlebot3_empty_world.launch to your launch folder as turtlebot3_wall.launch.
  2. Change the following line,
  3. 
    <arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/empty.world"/>
    to 
    <arg name="world_name" value="$(find my_package)/worlds/wall.world"/>
        
  4. This will change the world where the robot is placed.

Run simulation

  1. Start your simulation by the followings,
  2. 
    roscore  # T1
    roslaunch my_package turtlebot3_wall.launch # T2
    rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 1.0, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}' # T3
    rosservice call /gazebo/reset_simulation "{}" # T3 to reset
        
  3. You may see if the robot collides with the box, the box bounces back. We may fix the box to the ground by editing the world file, wall.world
  4. 
    <model name="unit_box_0">
      <static>1</static>
        
  5. Just include it in the first occurence of model name of unit box 0.

References


  1. Gazebo Quick Start