0
$\begingroup$

Rosanswers logo

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"?>

 <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.3"/>
</inertial>
 </link>

  <link name="back_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>

 <joint name="base_link_to_front_left_wheelholder" type="revolute">
   <origin rpy="0 0 0" xyz="0.295 0.145 0.065"/>
   <axis xyz="0 0 1"/>
   <limit effort="150" lower="-0.523" upper="0.523" velocity="0.5"/>
   <parent link="base_link"/>
   <child link="front_left_wheelholder"/>
 </joint>

 <joint name="base_to_front_right_wheelholder" type="revolute">
<origin rpy="0 0 0" xyz="0.295 -0.145 0.065"/>
   <axis xyz="0 0 1"/>
   <limit effort="150" lower="-0.523" upper="0.523" velocity="0.5"/>
   <parent link="base_link"/>
   <child link="front_right_wheelholder"/>
 </joint>

 <joint name="base_to_back_left_wheelholder" type="fixed">
   <origin rpy="0 0 0" xyz="-0.295 0.145 0.065"/>
   <parent link="base_link"/>
   <child link="back_left_wheelholder"/>
 </joint>

 <joint name="base_to_back_right_wheel" type="fixed">
   <origin rpy="0 0 0" xyz="-0.295 -0.145 0.065"/>
   <parent link="base_link"/>
   <child link="back_right_wheelholder"/>
 </joint>

 <joint name="wheel_to_front_left_wheelholder" type="continuous">
<origin rpy="1.57 0 0" xyz="0 0.055 0"/>
   <axis xyz="0 0 1"/>
   <parent link="front_left_wheelholder"/>
   <child link="front_left_wheel"/>
   <limit effort="100" velocity="100"/>
   <limit dynamicsdamping="0.0" friction="0.0"/>
 </joint>

 <joint name="wheel_to_front_right_wheelholder" type="continuous">
<origin rpy="1.57 0 0" xyz="0 -0.055 0"/>
   <axis xyz="0 0 1"/>
   <parent link="front_right_wheelholder"/>
   <child link="front_right_wheel"/>
   <limit effort="100" velocity="100"/>
   <limit dynamicsdamping="0.0" friction="0.0"/>
 </joint>

 <joint name="wheel_to_back_left_wheelholder" type="continuous">
<origin rpy="1.57 0 0" xyz="0 0.055 0"/>
   <axis xyz="0 0 1"/>
   <parent link="back_left_wheelholder"/>
   <child link="back_left_wheel"/>
   <limit effort="100" velocity="100"/>
   <limit dynamicsdamping="0.0" friction="0.0"/>
 </joint>

 <joint name="wheel_to_back_right_wheelholder" type="continuous">
<origin rpy="1.57 0 0" xyz="0 -0.055 0"/>
   <axis xyz="0 0 1"/>
   <parent link="back_right_wheelholder"/>
   <child link="back_right_wheel"/>
   <limit effort="100" velocity="100"/>
   <limit dynamicsdamping="0.0" friction="0.0"/>
 </joint>

It works fine, besides i can't see colors and any links(though they are displayed in parameter list in gazebo).

Then i wrote simple joint controller which is supposed to control front wheels. I passed through this tutorial
This controller works with PR2. Now want to add it to my robot. Also when i launch my model in Gazebo, pr2-controller_manager doesn't show the joint-list of my model as well as list of controllers.

What should i do to add controller to my robot model?


Originally posted by Peter Listov on ROS Answers with karma: 338 on 2012-08-25

Post score: 0


Original comments

Comment by Peter Listov on 2012-08-27:
The Problem solved.

Comment by arzhed on 2012-10-01:
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

Comment by Peter Listov on 2012-10-01:
Sure. I'll write the answer.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Peter Listov with karma: 338 on 2012-10-01

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by arzhed on 2012-10-01:
Ok, actually I had done that but thought it was wrong. thanks a lot!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.