ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Ok it took me some time to figure out the solution to this problem as well.

When you're designing your robot you have different kind of things to think about.

First of all you place all of you tf frames. Tf frames are independent of the actual robot appearance. The hand frame could not be "on" the hand (but it would not be very handy though).

That's what you do when you write something like

 <joint name="${prefix}_shoulder_joint" type="revolute">
    <parent link="shoulder"/>
    <child link="${prefix}_upper_arm"/>
    <axis xyz="0 1 0"/>
    <origin xyz="0 ${reflect * shoulder_length/2} ${-upper_arm_length/2}"/>
    <limit lower="${upper_arm_min_angle}" upper="${upper_arm_max_angle}" 
            effort="${arm_max_effort}" velocity="${arm_max_velocity}" />
</joint>

There this origin element define where your frame is going to be. You thus defined the position of each tf frame of the robot

Now you want to draw the robot itself. You have to use the visual element for that. For example

<link name="${prefix}_upper_arm"> <visual> <geometry> <box size="0.07 0.07 ${upper_arm_length}"/> </geometry> <material name="green"> <color rgba="0 1 0 1"/> </material> </visual> </link>

Here in your code you miss an origin element like this one :

      <origin rpy="0 0 0" xyz="0 0 ${hand_length/2}"/>

This element will define the origin of the visual shape compared to the tf frame. The rpy define the rotation while the xyz define the translations. So you can just move the visual element around the tf frame to have it wherever you want.

To summarize :

First you define the tf frame place. The visual shape is going to be centered on that shape so you use the origin element to place it in space, compared to the tf frame it depend on.

Hope I have been clear enough.

Ok it took me some time to figure out the solution to this problem as well.

When you're designing your robot you have different kind of things to think about.

First of all you your place all of you tf frames. Tf frames are independent of the actual robot appearance. The hand frame could not be "on" the hand (but it would not be very handy though).

That's what you do when you write something like

 <joint name="${prefix}_shoulder_joint" type="revolute">
    <parent link="shoulder"/>
    <child link="${prefix}_upper_arm"/>
    <axis xyz="0 1 0"/>
    <origin xyz="0 ${reflect * shoulder_length/2} ${-upper_arm_length/2}"/>
    <limit lower="${upper_arm_min_angle}" upper="${upper_arm_max_angle}" 
            effort="${arm_max_effort}" velocity="${arm_max_velocity}" />
</joint>

There this is the origin element define where your frame is going to be. You thus defined the position of each tf frame of the robot

Now you want to draw the robot itself. You have to use the visual element for that. For example

<link name="${prefix}_upper_arm"> <visual> <geometry> <box size="0.07 0.07 ${upper_arm_length}"/> </geometry> <material name="green"> <color rgba="0 1 0 1"/> </material> </visual> </link>

Here in your code you miss are missing an origin element like this one :

      <origin rpy="0 0 0" xyz="0 0 ${hand_length/2}"/>

This element will define the origin of the visual shape compared to the tf frame. The rpy define the rotation while the xyz define the translations. So you can just move the visual element around the tf frame to have it wherever you want.

To summarize :

First you define the tf frame place. The visual shape is going to be centered on that shape so you use the origin element to place it in space, compared to the tf frame it depend on.

Hope I have been clear enough.

Ok it took me some time to figure out the solution to this problem as well.

When you're designing your robot you have different kind of things to think about.

First of all your place all of you tf frames. Tf frames are independent of the actual robot appearance. The hand frame could not be "on" the hand (but it would not be very handy though).

That's what you do when you write something like

 <joint name="${prefix}_shoulder_joint" type="revolute">
    <parent link="shoulder"/>
    <child link="${prefix}_upper_arm"/>
    <axis xyz="0 1 0"/>
    <origin xyz="0 ${reflect * shoulder_length/2} ${-upper_arm_length/2}"/>
    <limit lower="${upper_arm_min_angle}" upper="${upper_arm_max_angle}" 
            effort="${arm_max_effort}" velocity="${arm_max_velocity}" />
</joint>

There is the origin element define where your frame is going to be. You thus defined the position of each tf frame of the robot

Now you want to draw the robot itself. You have to use the visual element for that. For example

 <link name="${prefix}_upper_arm">
     <visual>
         <geometry>
             <box size="0.07 0.07 ${upper_arm_length}"/>
         </geometry>
         <material name="green">
             <color rgba="0 1 0 1"/>
         </material>
     </visual>
    </link>

</link>

Here in your code you are missing an origin element like this one :

      <origin rpy="0 0 0" xyz="0 0 ${hand_length/2}"/>

This element will define the origin of the visual shape compared to the tf frame. The rpy define the rotation while the xyz define the translations. So you can just move the visual element around the tf frame to have it wherever you want.

To summarize :

First you define the tf frame place. The visual shape is going to be centered on that shape so you use the origin element to place it in space, compared to the tf frame it depend on.

Hope I have been clear enough.