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

How to change the pivot point of a link in URDF joint?

asked 2018-08-19 05:20:53 -0500

Kishore Kumar gravatar image

updated 2021-11-14 09:47:59 -0500

lucasw gravatar image

I have built simple robotic arm, where the Link1 is joined to the base_link through a revolute joint. When i try to move the link1 it is revolving on its own center instead pivoting the bottom to base_link. Here, how to change the pivot point from the center of link1 to its bottom and fix it to the base_link.

My urdf:

<?xml version="1.0"?>
<robot name="myfirst" xmlns:xacro="http://www.ros.org/wiki/xacro">
  <link name="base_link">
    <visual>
      <geometry>
        <box size="0.5 0.5 0.5"/>
      </geometry>
    </visual>
  </link>

<joint name="joint1" type="revolute">
 <axis xyz="0 1 0"/>
<limit effort="1000.0" lower="-0.548" upper="0.548" velocity="0.5"/>
    <parent link="base_link"/>
    <child link="arm2"/>
    <origin xyz="0 0 0.5" rpy="0 0 0" />
  </joint>

<link name="arm2">
<origin xyz="0 0 -0.3" rpy="0 0 0" />
    <visual>
      <geometry>
        <cylinder length="0.6" radius="0.04"/>
      </geometry>
    </visual>
  </link>

</robot>

Result initial pose:

image description

Result end pose:

image description

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2018-08-19 06:41:30 -0500

gvdhoorn gravatar image

updated 2018-08-19 06:41:47 -0500

A cylinder has its origin in the centre of the shape (all primitive geometry actually). That is why you're seeing the rotation as it is.

If you want the cylinder to rotate at one of its ends, you'll have to translate it half its own length up.

Something like:

<origin xyz="0 0 0.3" rpy="0 0 0" />
edit flag offensive delete link more

Comments

Thank you so much that helped!

Kishore Kumar gravatar image Kishore Kumar  ( 2018-08-19 07:26:45 -0500 )edit
0

answered 2018-08-19 07:30:49 -0500

Kishore Kumar gravatar image

The origin must be inside the Visual tag, but i had it outside the tag and iterated the origin which didn't help. I added the origin tag inside visual tag as below and changed the origin to fix the issue.

    <?xml version="1.0"?>
    <robot name="myfirst" xmlns:xacro="http://www.ros.org/wiki/xacro">
      <link name="base_link">
        <visual>
          <geometry>
            <box size="0.5 0.5 0.5"/>
          </geometry>
        </visual>
      </link>

    <joint name="joint1" type="revolute">
     <axis xyz="0 1 0"/>
    <limit effort="1000.0" lower="-0.548" upper="0.548" velocity="0.5"/>
        <parent link="base_link"/>
        <child link="arm2"/>
        <origin xyz="0 0 0.5" rpy="0 0 0" />
      </joint>

    <link name="arm2">

        <visual>
<origin xyz="0 0 0.3" rpy="0 0 0" />
          <geometry>
            <cylinder length="0.6" radius="0.04"/>
          </geometry>
        </visual>
      </link>    
    </robot>
edit flag offensive delete link more

Comments

It would be nice to have the figures of the result to see the final origin. Somehow I cannot replicate your results.

hbaqueiro gravatar image hbaqueiro  ( 2018-11-26 06:56:25 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-08-19 05:20:53 -0500

Seen: 2,346 times

Last updated: Aug 19 '18