teleop model in gazebo

asked 2015-01-04 20:35:27 -0500

forinkzan gravatar image

updated 2015-01-05 23:53:46 -0500

hello every one , i write a robot model in gazebo it have two wheels and one hokuyo ,the sdf file is below and i have a model.config , then i can see it in gazebo , use gui to see hokuyo data . now i want to use my keyboard to control it , i already write teleop node in ros which can send vml_cmd messages , so how can i do and what should i do then i can use my teleop node to control this model in gazebo ? thx ~

  <?xml version="1.0"?>
<sdf version="1.4">
  <model name="my_robot">
  <static>false</static>
    <link name="link">

      <pose>0 0 .1 0 0 0</pose>

      <collision name="collsion">
        <geometry>
          <box>
            <size>.4 .2 .1</size>
          </box>
        </geometry>
      </collision>

      <visual name="visual">
        <geometry>
          <box>
            <size>.4 .2 .1</size>
          </box>
        </geometry>
      </visual>
      <collision name='caster_collision'>

        <pose>-0.15 0 -0.05 0 0 0</pose>
        <geometry>
          <sphere>
            <radius>.05</radius>
          </sphere>
        </geometry>
      </collision>

      <visual name='caster_visual'>
        <pose>-0.15 0 -0.05 0 0 0</pose>
        <geometry>
          <sphere>
             <radius>.05</radius>
          </sphere>
        </geometry>
      </visual>

    </link>

    <link name="left_wheel">

      <pose>0.1 0.13 0.1 0 1.5707 1.5707</pose>

      <collision name="collision">
        <geometry>
          <cylinder>
            <radius>.1</radius>
            <length>.05</length>
          </cylinder>
        </geometry>
      </collision>

      <visual name="visual">
        <geometry>
          <cylinder>
            <radius>.1</radius>
            <length>.05</length>
          </cylinder>
        </geometry>
      </visual>
    </link>

    <link name="right_wheel">

      <pose>0.1 -0.13 0.1 0 1.5707 1.5707</pose>
      <collision name="collision">
        <geometry>
          <cylinder>
            <radius>.1</radius>
            <length>.05</length>
          </cylinder>
        </geometry>
      </collision>

      <visual name="visual">
        <geometry>
          <cylinder>
            <radius>.1</radius>
            <length>.05</length>
          </cylinder>
        </geometry>
      </visual>
    </link>

    <joint type="revolute" name="left_wheel_hinge">

     <pose>0 0 -0.03 0 0 0</pose>

     <child>left_wheel</child>
     <parent>link</parent>
     <axis>
       <xyz>0 1 0</xyz>
     </axis>
    </joint>

    <joint type="revolute" name="right_wheel_hinge">

     <pose>0 0 0.03 0 0 0</pose>

     <child>right_wheel</child>
     <parent>link</parent>
     <axis>
       <xyz>0 1 0</xyz>
     </axis>
    </joint>

    <include>
      <uri>model://hokuyo</uri>
      <pose>0.2 0 0.2 0 0 0</pose>
    </include>
    <joint name="hokuyo_joint" type="revolute">
      <child>hokuyo::link</child>
      <parent>link</parent>
      <axis>
        <xyz>0 0 1</xyz>
        <limit>
          <upper>0</upper>
          <lower>0</lower>
        </limit>
      </axis>
    </joint>

  </model>
</sdf>
edit retag flag offensive close merge delete

Comments

look into the turtlebot_teleop node and get hints from there to configure for keyboard or joystick control.

AlexR gravatar image AlexR  ( 2015-01-10 06:23:20 -0500 )edit

I see , but the question is how can i let gazebo---model sub the cmd_vel , and i find a tutorial http://guitarpenguin.is-programmer.co... to attach diff_drive_plugin to my robot model . but it doesn't work , do you have some idea?

forinkzan gravatar image forinkzan  ( 2015-01-11 19:52:43 -0500 )edit