Spherical Joint in URDF
I have the following URDF. I striped out the meshes for this post. Does anyone know how to make the shapes that are on the x y and z axis move like a spherical/ball joint? If you use this URDF and launch in rviz you will see shapes representing x,y, and z axis. If you move them their anchor point is at the base.
<material name="blue">
<color rgba="0 0 0.8 1"/>
</material>
<material name="red">
<color rgba="0.8 0 0 1"/>
</material>
<material name="green">
<color rgba="0 0.8 0 1"/>
</material>
<material name="gray">
<color rgba="0.9 0.9 0.9 1"/>
</material>
<!-- * * * Link Definitions * * * -->
<link name="base_link">
<visual>
<origin rpy="1.54 0 0" xyz="0 0 0.13"/>
<geometry>
</geometry>
<material name="gray"/>
</visual>
</link>
<link name="roll_M1_link">
<visual>
<origin rpy="0 0 0" xyz="0 0 0.125"/>
<geometry>
<cylinder length="0.005" radius="0.01"/>
</geometry>
<material name="red"/>
</visual>
</link>
<!-- This is for color and physical properties in Gazebo, color won't work with the material tag in gazebo
only for URDF coloring -->
<gazebo reference="roll_M1_link">
<kp>1000.0</kp>
<kd>10.0</kd>
<mu1>10.0</mu1>
<mu2>10.0</mu2>
<material>Gazebo/Red</material>
</gazebo>
<joint name="roll_joint" type="revolute">
<parent link="base_link"/>
<child link="roll_M1_link"/>
<origin xyz="0.0 0 0.0" rpy="0 0 0"/>
<limit lower="-0.4" upper="0.3" effort="0.1" velocity="0.005"/>
<axis xyz="1 0 0"/>
</joint>
<link name="pitch_M2_link">
<visual>
<origin rpy="0 0 0" xyz="0.125 0 0"/>
<geometry>
<cylinder length="0.005" radius="0.01"/>
</geometry>
<material name="green"/>
</visual>
</link>
<!-- This is for color and physical properties in Gazebo, color won't work with the material tag in gazebo
only for URDF coloring -->
<gazebo reference="pitch_M2_link">
<kp>1000.0</kp>
<kd>10.0</kd>
<mu1>10.0</mu1>
<mu2>10.0</mu2>
<material>Gazebo/Green</material>
</gazebo>
<joint name="pitch_joint" type="revolute">
<parent link="roll_M1_link"/>
<child link="pitch_M2_link"/>
<origin xyz="0 0 0" rpy="0 -1.5708 0"/>
<limit lower="-0.22" upper="0.22" effort="0.1" velocity="0.005"/>
<axis xyz="0 1 0"/>
</joint>
<link name="yaw_M3_link">
<visual>
<origin rpy="0 0 0" xyz="0 0 0.125"/>
<geometry>
<cylinder length="0.005" radius="0.01"/>
</geometry>
<material name="blue"/>
</visual>
</link>
<!-- This is for color and physical properties in Gazebo, color won't work with the material tag in gazebo
only for URDF coloring -->
<gazebo reference="yaw_M3_link">
<kp>1000.0</kp>
<kd>10.0</kd>
<mu1>10.0</mu1>
<mu2>10.0</mu2>
<material>Gazebo/Blue</material>
</gazebo>
<joint name="yaw_joint" type="continuous">
<parent link="pitch_M2_link"/>
<child link="yaw_M3_link"/>
<origin xyz="0.01 0 0" rpy="0 1.5708 0"/>
<limit effort="0.1" velocity="0.01"/>
<axis xyz="0 0 1"/>
</joint>
<link name="head_link">
<visual>
<origin rpy="1.54 0 0" xyz="0 0 0.122"/>
<geometry>
</geometry>
<material name="gray"/>
</visual>
</link>
<joint name="base_head_joint" type="fixed">
<parent link="yaw_M3_link"/>
<child link="head_link"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
</joint>
<link name="camera_link">
<visual>
<origin rpy="0.0 0 0" xyz="0 0 0"/>
<geometry>
<box size="0.0005 0.0005 0.0005"/>
</geometry>
<material name="green"/>
</visual>
</link>
<gazebo reference="camera_link">
<material>Gazebo/Green</material>
</gazebo>
<joint name="head_camera_joint" type="fixed">
<parent link="head_link"/>
<child link="camera_link"/>
<origin xyz="0 0.057 0.0255" rpy="0 0 0"/>
</joint>
Asked by CodeMade on 2018-10-02 09:45:32 UTC
Answers
The unsatisfying answer is that there is no native way to represent a ball joint other than similar to what you have, by breaking it into multiple joints.
Asked by David Lu on 2018-10-02 16:00:13 UTC
Comments
Those joints don’t move like a ball joint though. They move from a point below. How do I set the center of rotation in the center of the joints I have created?
Asked by CodeMade on 2018-10-02 16:07:12 UTC
Let say you want Link1 to have a ball joint with Link2. In this case you have to add 3 additional links lets call them (temp1, temp2, and temp3). These links should not have transmission (unless you want to control ball joint), also you should consider very small mass for them, then it won't impact your model.
You have to connect them in this way: Link1--> temp1 --> temp2 --> temp3 --> Link2
All joints are revolute except the last one is fixed. Revolute joints connected to other and can rotate over 1 axis only.
Asked by Navid007 on 2020-07-31 08:17:14 UTC
Comments
clearly explained, thanks
Asked by Kaveh_ROS on 2022-08-16 09:45:33 UTC
Comments