Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

As suggested by branwer, if anyone is trying to make a conveyor belt simulation, you can use the following steps:

1) Create a simple black box object that resembles a belt (I named this file "moving_ground.URDF":

<?xml version="1.0" ?>
<robot name="simple_box">
  <link name="my_box">
    <inertial>
      <origin xyz="0 0 0" /> 
      <mass value="1.0" />
      <inertia  ixx="1.0" ixy="0.0"  ixz="0.0"  iyy="100.0"  iyz="0.0"  izz="1.0" />
    </inertial>
    <visual>
      <origin xyz="0 0 0"/>
      <geometry>
        <box size="1 1000 0.01" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 0"/>
      <geometry>
        <box size="1000 1 0.01" />
      </geometry>
    </collision>
  </link>
  <gazebo reference="my_box">
    <material>Gazebo/FlatBlack</material>
  </gazebo>
</robot>

2) Create a sample object that will go on top of the belt (so you can verify the belt is moving) (I named this file my_box.URDF)

<robot name="simple_box">
  <link name="my_box">
    <inertial>
      <origin xyz="0 0 0" /> 
      <mass value="1.0" />
      <inertia  ixx="1.0" ixy="0.0"  ixz="0.0"  iyy="100.0"  iyz="0.0"  izz="1.0" />
    </inertial>
    <visual>
      <origin xyz="0 0 1"/>
      <geometry>
        <box size="0.5 0.5 0.5" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 1"/>
      <geometry>
        <box size="0.5 0.5 0.5" />
      </geometry>
    </collision>
  </link>
  <gazebo reference="my_box">
    <material>Gazebo/Blue</material>
  </gazebo>
</robot>

3) Open an empty world in gazebo and spawn these two objects:

rosrun gazebo spawn_model -file moving_ground.URDF -urdf -model belt
rosrun gazebo spawn_model -file my_box.URDF -urdf -model my_box

4) Apply a wrench on the belt:

rosservice call /gazebo/apply_body_wrench '{body_name: "belt::my_box", reference_frame: "belt::my_box", wrench: { force: { x: 0, y: 1, z: 0 } }, start_time: 0, duration: -1 }'

And ta daaaa.... It worked for me. Hopefully it will work for you.

As suggested by branwer, if anyone is trying to make a conveyor belt simulation, you can use the following steps:

1) Create a simple black box object that resembles a belt (I named this file "moving_ground.URDF":

<?xml version="1.0" ?>
<robot name="simple_box">
  <link name="my_box">
    <inertial>
      <origin xyz="0 0 0" /> 
      <mass value="1.0" />
      <inertia  ixx="1.0" ixy="0.0"  ixz="0.0"  iyy="100.0"  iyz="0.0"  izz="1.0" />
    </inertial>
    <visual>
      <origin xyz="0 0 0"/>
      <geometry>
        <box size="1 1000 0.01" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 0"/>
      <geometry>
        <box size="1000 1 0.01" />
      </geometry>
    </collision>
  </link>
  <gazebo reference="my_box">
    <material>Gazebo/FlatBlack</material>
  </gazebo>
</robot>

2) Create a sample object that will go on top of the belt (so you can verify the belt is moving) (I named this file my_box.URDF)

<robot name="simple_box">
  <link name="my_box">
    <inertial>
      <origin xyz="0 0 0" /> 
      <mass value="1.0" />
      <inertia  ixx="1.0" ixy="0.0"  ixz="0.0"  iyy="100.0"  iyz="0.0"  izz="1.0" />
    </inertial>
    <visual>
      <origin xyz="0 0 1"/>
      <geometry>
        <box size="0.5 0.5 0.5" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 1"/>
      <geometry>
        <box size="0.5 0.5 0.5" />
      </geometry>
    </collision>
  </link>
  <gazebo reference="my_box">
    <material>Gazebo/Blue</material>
  </gazebo>
</robot>

3) Open an empty world in gazebo and spawn these two objects:

rosrun gazebo spawn_model -file moving_ground.URDF -urdf -model belt
rosrun gazebo spawn_model -file my_box.URDF -urdf -model my_box

4) Apply a wrench on the belt:

rosservice call /gazebo/apply_body_wrench '{body_name: "belt::my_box", reference_frame: "belt::my_box", wrench: { force: { x: 0, y: 1, z: 0 } }, start_time: 0, duration: -1 }'

And ta daaaa.... It worked for me. Hopefully it will work for you.

This is what it looks like:

Conveyor_Belt