Robotics StackExchange | Archived questions

help on revolute joint placement in gazebo

Hi,

I'm trying to build two robot system where the robot has a revolute joint which needs to rotate around it's axis.

my urdf file looks like this

<!-- robot 2 -->
<robot name="pointrobot">
 <link name="base_link_x_2">
    <inertial>
      <mass value="1.0"/>
      <origin rpy="0 0 0" xyz="1.5 0 0"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
  </link>
  <link name="base_link_y_2">
    <inertial>
      <mass value="1.0"/>
      <origin rpy="0 0 0" xyz="1.5 0 0"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
  </link>
  <link name="base_link_2">
    <inertial>
      <mass value="100.0"/>
      <origin rpy="0 0 0" xyz="1.5 0 0"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
    <collision>
      <origin rpy="0.0 0 0" xyz="1.5 0 0"/>
      <geometry>
          <cylinder length="0.1" radius="0.2"/>
      </geometry>
    </collision>
    <visual>
      <origin rpy="0.0 0 0" xyz="1.5 0 0"/>
      <geometry>
          <cylinder length="0.1" radius="0.2"/>
      </geometry>
    </visual>
  </link>
  <link name="lidar_link_2">
    <inertial>
      <mass value="100.0"/>
      <origin rpy="0 0 0" xyz="1.5 0 0"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
    <collision>
      <origin rpy="0.0 0 0" xyz="1.5 0 0"/>
      <geometry>
          <cylinder length="0.1" radius="0.02"/>
      </geometry>
    </collision>
    <visual>
      <origin rpy="0.0 0 0" xyz="1.5 0 0"/>
      <geometry>
          <cylinder length="0.1" radius="0.02"/>
      </geometry>
      <material name="blue"/>
    </visual>
  </link>
  <link name="feature_link_2">
    <inertial>
      <mass value="1.0"/>
      <origin rpy="0 0 0" xyz="1.5 0 0"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
    <collision>
      <origin rpy="0.0 0 0" xyz="1.5 0 0"/>
      <geometry>
          <cylinder length="0.001" radius="0.02"/>
      </geometry>
    </collision>
    <visual>
      <origin rpy="0.0 0 0" xyz="1.5 0 0"/>
      <geometry>
          <cylinder length="0.001" radius="0.02"/>
      </geometry>
      <material name="red"/>
    </visual>
  </link>
  <link name="lidar_sensor_link_2"/>
  <joint name="mobile_joint_x_2" type="prismatic">
    <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/>
    <parent link="world"/>
    <child link="base_link_x_2"/>
    <origin rpy="0 0 0" xyz="1.5 0 0.05"/>
    <axis xyz="1 0 0"/>
    <limit effort="87" lower="-5" upper="5" velocity="2.1750"/>
  </joint>
  <joint name="mobile_joint_y_2" type="prismatic">
    <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/>
    <parent link="base_link_x_2"/>
    <child link="base_link_y_2"/>
    <origin rpy="0 0 0" xyz="1.5 0 0"/>
    <axis xyz="0 1 0"/>
    <limit effort="87" lower="-5" upper="5" velocity="2.1750"/>
  </joint>
  <joint name="mobile_joint_theta_2" type="revolute">
    <parent link="base_link_y_2"/>
    <child link="base_link_2"/>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <axis xyz="0 0 1"/>
    <limit effort="87" lower="-5" upper="5" velocity="2.1750"/>
  </joint>
  <joint name="robot_lidar_2" type="fixed">
    <parent link="base_link_2"/>
    <child link="lidar_link_2"/>
    <origin rpy="0 0 0" xyz="0 0 0.1"/>
  </joint>
  <joint name="lidar_sensor_joint_2" type="fixed">
    <parent link="lidar_link_2"/>
    <child link="lidar_sensor_link_2"/>
    <origin rpy="0 0 0" xyz="0 0 0.1"/>
  </joint>
  <joint name="feature_link_joint_2" type='fixed'>
    <parent link="base_link_2"/>
    <child link="feature_link_2"/>
    <origin rpy="0 0 0" xyz="0 0.1 0.0505"/>
  </joint>


</robot>

which can be seen at http://www.mymodelrobot.appspot.com/5629499534213120 when i change the revolute joint the robot is rotating around the world but not the base_link_2 which is the origin of the robot. i.e the joint needs to rotate about the lidar_link

as seen on this robot.

<robot name="pointRobot">
  <material name="blue">
      <color rgba="0 0 0.8 1"/>
  </material>
  <material name="red">
      <color rgba="0.8 0 0.0 1"/>
  </material>
  <link name="world"/>
  <link name="base_link_x_1">
    <inertial>
      <mass value="1.0"/>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
  </link>
  <link name="base_link_y_1">
    <inertial>
      <mass value="1.0"/>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
  </link>

  <link name="base_link_1">
    <inertial>
      <mass value="100.0"/>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
    <collision>
      <origin rpy="0.0 0 0" xyz="0 0 0"/>
      <geometry>
          <cylinder length="0.1" radius="0.2"/>
      </geometry>
    </collision>
    <visual>
      <origin rpy="0.0 0 0" xyz="0 0 0"/>
      <geometry>
          <cylinder length="0.1" radius="0.2"/>
      </geometry>
    </visual>
  </link>
  <link name="lidar_link_1">
    <inertial>
      <mass value="100.0"/>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
    <collision>
      <origin rpy="0.0 0 0" xyz="0 0 0"/>
      <geometry>
          <cylinder length="0.1" radius="0.02"/>
      </geometry>
    </collision>
    <visual>
      <origin rpy="0.0 0 0" xyz="0 0 0"/>
      <geometry>
          <cylinder length="0.1" radius="0.02"/>
      </geometry>
      <material name="blue"/>
    </visual>
  </link>
  <link name="feature_link_1">
    <inertial>
      <mass value="1.0"/>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
    <collision>
      <origin rpy="0.0 0 0" xyz="0 0 0"/>
      <geometry>
          <cylinder length="0.001" radius="0.02"/>
      </geometry>
    </collision>
    <visual>
      <origin rpy="0.0 0 0" xyz="0 0 0"/>
      <geometry>
          <cylinder length="0.001" radius="0.02"/>
      </geometry>
      <material name="red"/>
    </visual>
  </link>
  <link name="lidar_sensor_link_1"/>
  <joint name="mobile_joint_x_1" type="prismatic">
    <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/>
    <parent link="world"/>
    <child link="base_link_x_1"/>
    <origin rpy="0 0 0" xyz="0 0 0.05"/>
    <axis xyz="1 0 0"/>
    <limit effort="87" lower="-5" upper="5" velocity="2.1750"/>
  </joint>
  <joint name="mobile_joint_y_1" type="prismatic">
    <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/>
    <parent link="base_link_x_1"/>
    <child link="base_link_y_1"/>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <axis xyz="0 1 0"/>
    <limit effort="87" lower="-5" upper="5" velocity="2.1750"/>
  </joint>
  <joint name="mobile_joint_theta_1" type="revolute">
    <parent link="base_link_y_1"/>
    <child link="base_link_1"/>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <axis xyz="0 0 1"/>
    <limit effort="87" lower="-5" upper="5" velocity="2.1750"/>
  </joint>
  <joint name="robot_lidar_1" type="fixed">
    <parent link="base_link_1"/>
    <child link="lidar_link_1"/>
    <origin rpy="0 0 0" xyz="0 0 0.1"/>
  </joint>
  <joint name="lidar_sensor_joint_1" type="fixed">
    <parent link="lidar_link_1"/>
    <child link="lidar_sensor_link_1"/>
    <origin rpy="0 0 0" xyz="0 0 0.1"/>
  </joint>
  <joint name="feature_link_joint_1" type='fixed'>
    <parent link="base_link_1"/>
    <child link="feature_link_1"/>
    <origin rpy="0 0 0" xyz="0 0.1 0.0505"/>
  </joint>

any help is appreciated thank you!

Asked by atom on 2022-10-12 19:35:46 UTC

Comments

Answers