Ask Your Question
0

How to add simple controller to my robot

asked 2012-08-25 04:13:54 -0500

Peter Listov gravatar image

Hi! I'm newbie with ROS. I'm trying to simulate my robot in Gazebo. It's a 4-wheel car-based platform.

First I created urdf-file, describing my model:

<?xml version="1.0"?>

<robot name="robocv" xmlns:controller="&lt;a href=" http:="" playerstage.sourceforge.net="" gazebo="" xmlschema="" #controller"="">http://playerstage.sourceforge.net/gazebo/xmlschema/#controller" xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface">

 <link name="base_link">
   <visual>
     <origin rpy="0 0 0" xyz="0 0 0.17"/>
     <geometry>
       <box size="0.6 0.3 0.2"/>
     </geometry>
      <material name="blue">
       <color rgba="0 0 0.8 1"/>
       </material>
   </visual>
   <collision>
     <origin rpy="0 0 0" xyz="0 0 0.17"/>
     <geometry>
       <box size="0.6 0.3 0.2"/>
     </geometry>
</collision>
<inertial>
 <mass value="10"/>
 <inertia ixx="1.0" ixy="0.4" ixz="0.4" iyy="4" iyz="0.4" izz="4"/>
</inertial>
 </link>
<gazebo reference="base_link">
</gazebo>

 <link name="front_left_wheel">
   <visual>
     <geometry>
       <cylinder length="0.1" radius="0.07"/>
     </geometry>
      <material name="random">
       <color rgba="0.6 0.7 0.8 1"/>
       </material>
  </visual>
   <collision>
     <geometry>
       <cylinder length="0.1" radius="0.07"/>
     </geometry>
</collision>
<inertial>
 <mass value="0.5"/>
 <inertia ixx="0.2" ixy="0.2" ixz="0.2" iyy="0.2" iyz="0.2" izz="0.3"/>
</inertial>
 </link>

      <link name="front_right_wheel">
   <visual>
     <geometry>
       <cylinder length="0.1" radius="0.07"/>
     </geometry>
 <material name="random"/>
  </visual>
   <collision>
     <geometry>
       <cylinder length="0.1" radius="0.07"/>
     </geometry>
</collision>
<inertial>
 <mass value="0.5"/>
 <inertia ixx="0.2" ixy="0.2" ixz="0.2" iyy="0.2" iyz="0.2" izz="0.3"/>
</inertial>
 </link>

  <link name="back_left_wheel">
   <visual>
     <geometry>
       <cylinder length="0.1" radius="0.07"/>
     </geometry>
 <material name="random"/>
  </visual>
   <collision>
     <geometry>
       <cylinder length="0.1" radius="0.07"/>
     </geometry>
</collision>
<inertial>
 <mass value="0.5"/>
 <inertia ixx="0.2" ixy="0.2" ixz="0.2" iyy="0.2" iyz="0.2" izz="0.3"/>
</inertial>
 </link>

  <link name="back_right_wheel">
   <visual>
     <geometry>
       <cylinder length="0.1" radius="0.07"/>
     </geometry>
 <material name="random"/>
  </visual>
   <collision>
     <geometry>
       <cylinder length="0.1" radius="0.07"/>
     </geometry>
</collision>
<inertial>
 <mass value="0.5"/>
 <inertia ixx="0.2" ixy="0.2" ixz="0.2" iyy="0.2" iyz="0.2" izz="0.3"/>
</inertial>
 </link>

  <link name="front_left_wheelholder">
   <visual>
     <geometry>
       <cylinder length="0.01" radius="0.01"/>
     </geometry>
 <material name="random"/>
  </visual>
<inertial>
 <mass value="0.5"/>
 <inertia ixx="0.2" ixy="0.2" ixz="0.2" iyy="0.2" iyz="0.2" izz="0.3"/>
</inertial>
 </link>

  <link name="front_right_wheelholder">
   <visual>
     <geometry>
       <cylinder length="0.01" radius="0.01"/>
     </geometry>
 <material name="random"/>
  </visual>
<inertial>
 <mass value="0.5"/>
 <inertia ixx="0.2" ixy="0.2" ixz="0.2" iyy="0.2" iyz="0.2" izz="0.3"/>
</inertial>
 </link>

  <link name="back_left_wheelholder">
   <visual>
     <geometry>
       <cylinder length="0.01" radius="0.01"/>
     </geometry>
 <material name="random"/>
  </visual>
<inertial>
 <mass value="0.5"/>
 <inertia ixx="0.2" ixy="0.2" ixz="0.2" iyy="0.2" iyz="0.2" izz="0 ...
(more)
edit retag flag offensive close merge delete

Comments

1

The Problem solved.

Peter Listov gravatar imagePeter Listov ( 2012-08-27 05:15:52 -0500 )edit

Hi Peter! Could you explain how you solved it? I tried running a controller for my own robot following the tutorial you posted above and the "simple urdf controller example", but the plugin I made isnt found although I inserted it in my urdf file. I don't really understand. Any help very appreciated

arzhed gravatar imagearzhed ( 2012-10-01 04:58:03 -0500 )edit

Sure. I'll write the answer.

Peter Listov gravatar imagePeter Listov ( 2012-10-01 05:15:53 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-10-01 05:27:27 -0500

Peter Listov gravatar image

At first it's necessary to connect the joint with actuator:

<transmission name="joint_back_right_wheel_trans" type="SimpleTransmission">
     <actuator name="back_right_wheel_motor"/>
     <joint name="wheel_to_back_right_wheelholder"/>
         <mechanicalReduction>1</mechanicalReduction>
         <motorTorqueConstant>1</motorTorqueConstant>
        </transmission>

Then add these lines to your robot description file:

<gazebo>
   <controller:gazebo_ros_controller_manager name="gazebo_ros_controller_manager" plugin="libgazebo_ros_controller_manager.so">
      <alwaysOn>true</alwaysOn>
      <updateRate>1000.0</updateRate>
      <interface:audio name="gazebo_ros_controller_manager_dummy_iface" />
    </controller:gazebo_ros_controller_manager>
  </gazebo>

It should work then.

edit flag offensive delete link more

Comments

Ok, actually I had done that but thought it was wrong. thanks a lot!

arzhed gravatar imagearzhed ( 2012-10-01 23:10:36 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2012-08-25 04:13:54 -0500

Seen: 440 times

Last updated: Oct 01 '12