How to create a joint with two DOF (using URDF)

asked 2021-03-20 13:21:58 -0600

patrchri gravatar image

updated 2021-03-20 13:22:36 -0600

Hello,

I have scanned the internet for answers regarding this issue, but it is not clear to me how to resolve it. I would like to ask how it is possible to create a joint of two DOF (y - continuous and z - revolute). To be more particular, I would like to create two joints, one for wheel spin and one for steering at around the same coordinate location. I have written the following part of URDF code to implement it:

  <link name="link_FR_wheel">
    <inertial>
      <mass value="0.5"/>
      <origin rpy="0 1.5707 1.5707" xyz="0 0 0"/>
      <inertia ixx="0.000975" ixy="0" ixz="0" iyy="0.000975" iyz="0" izz="0.000225"/>
    </inertial>
    <collision name="link_FR_wheel_collision">
      <origin rpy="0 1.5707 1.5707" xyz="0 0 0"/>
      <geometry>
        <cylinder length="0.014" radius="0.03"/>
      </geometry>
    </collision>
    <visual name="link_FR_wheel_visual">
      <origin rpy="0 1.5707 1.5707" xyz="0 0 0"/>
      <geometry>
        <cylinder length="0.014" radius="0.03"/>
      </geometry>
    </visual>
  </link>

  <joint name="joint_FR_wheel" type="continuous">
    <origin rpy="0 0 0" xyz="0.045 -0.0575 0.0"/>
    <child link="link_FR_wheel"/>
    <parent link="link_chassis"/>
    <axis rpy="0 0 0" xyz="0 1 0"/>
    <limit effort="5" velocity="10"/>
    <joint_properties damping="0.0" friction="0.0"/>
  </joint>



<joint name="joint_FR_steering" type="revolute">
        <origin rpy="0 0 0" xyz="0.047 -0.0570 0.0"/>
        <child link="link_FR_wheel"/>
        <parent link="link_chassis"/>
        <axis rpy="0 0 0" xyz="0 0 1"/>
        <limit lower = "-0.2" upper = "0.2" effort="5" velocity="3"/>
        <joint_properties damping="0.0" friction="0.0"/>
      </joint>

where link_chassis is the chassis of the RC car and link_FR_wheel is the FR wheel. This URDF code does not work, showing the following error when I spawn the robot in Gazebo:

This robot has a joint named "joint_FR_steering" which is not in the gazebo model.

Moreover, when I open my URDF robot in rviz, I get the following warning:

Joint state with name: "joint_FR_steering" was received but not found in URDF

I have seen solutions about creating dummy links but it is not clear to me how it works.

edit retag flag offensive close merge delete

Comments

I am also having a lot of trouble with this! The SDF implementation is clearer, but URDF does not support a universal joint! So how can ros2 actually support car-like steering??

sameh4 gravatar image sameh4  ( 2022-01-29 13:08:23 -0600 )edit

I have done two DOF joints in the past with custom robotic manipulators in RVIZ but it is difficult to say if it is possible in your case without actually knowing the constraints of your robot model link configurations and what you are trying to achieve. Can you perhaps drop a link to the complete URDF?

I would suggest doing this. Instead of trying to allocate the parent to be the chassis link for both joints set them up as serial joints. i.e : your Joint FR Wheel is has child of Link FR Wheel and parent of Link FR Steering and the Joint FR steering would have a child of Link FR Steering and parent of Link Chassis. Again this may not work for you because I am not exactly sure how your robots links are configured in the design.

jclinton830 gravatar image jclinton830  ( 2022-06-16 22:52:39 -0600 )edit