Gazebo | Ignition | Community
Ask Your Question
0

URDF to SDF Frame of Reference Calculation for Base Joint Fixed vs Floating

asked 2023-02-24 18:26:05 -0500

jfrye11 gravatar image

I am trying to simulate a robot I do not want fixed to the Gazebo world I am spawning it into. However, when I make the joint between my base link and the world floating, I get unexpected behavior in the way children frames of reference are established.

To preface, here is all the relevant XACRO

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="frye_arm_1">

  <xacro:include filename="/home/jackfrye/Documents/Robotics/workspace/src/frye_arm_1/urdf/base_wide.xacro" />
  <xacro:include filename="/home/jackfrye/Documents/Robotics/workspace/src/frye_arm_1/urdf/polou_4801.xacro" />

  <link name="world"></link>

  <joint name="world_to_base" type="floating">
      <parent link="world" />
  <child link="a_base_wide" />
  <origin  rpy="0 0 0" xyz="0 0 0" />
  </joint>

  <xacro:base_wide prefix="a" x="0.0" y="0.0" z="0.374" />

  <joint name="base_to_motor_body" type="fixed">
      <parent link="a_base_wide" />
      <child link="a_robot_body" />
      <origin  rpy="0 0 0" xyz="0 0 .359" />
  </joint>

  <xacro:polou_4801 prefix="a" x="0.0" y="0.0" z="0.0" phi="0.0" theta="0.0" psi="0.0" />
</robot>

base_wide.xacro

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="frye_arm_1">
  <xacro:macro name="base_wide" params="prefix x y z">

  <link name="${prefix}_base_wide">
    <visual>
      <origin xyz="${x} ${y} ${z}" rpy="0 0 0" />
      <geometry>
          <mesh filename="file:///home/jackfrye/Documents/Robotics/FryeArm1/Mechanical/ROS2_Prep/base_widen/base_widen_x10.dae"/>
 </geometry>
  <material name="blue"/>
</visual>
<collision>
  <origin xyz="${x} ${y} ${z}" rpy="0 0 0"/>    
  <geometry>
              <mesh filename="file:///home/jackfrye/Documents/Robotics/FryeArm1/Mechanical/ROS2_Prep/base_widen/base_widen_x10.dae"/>
  </geometry>
</collision>
    <inertial>
        <origin xyz="${x} ${y} ${z}" rpy="0 0 0"/>
        <mass value="131.0971" />
        <inertia ixx="0.1811" ixy="0.0" ixz="0.0" iyy="0.1809" iyz="0.0002" izz="0.18" />      
    </inertial>     
  </link>
  </xacro:macro>
</robot>

polou_4801.xacro

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="frye_arm_1">
  <xacro:macro name="polou_4801" params="prefix x y z phi theta psi">

    <link name="${prefix}_robot_body">
    <visual>
      <origin xyz="${x} ${y} ${z}" rpy="${phi} ${theta} ${psi}" />
      <geometry>
        <mesh filename="file:///home/jackfrye/Documents/Robotics/FryeArm1/Mechanical/ROS2_Prep/polou_4801_body/polou_4801_body_x10_no_wire.dae"/>
  </geometry>
  <material name="blue"/>
</visual>
<collision>
  <origin xyz="${x} ${y} ${z}" rpy="${phi} ${theta} ${psi}" />    
  <geometry>
          <mesh filename="file://file:///home/jackfrye/Documents/Robotics/FryeArm1/Mechanical/ROS2_Prep/polou_4801_body/polou_4801_body_x10_no_wire.dae"/>
  </geometry>
</collision>
<inertial>
    <origin xyz="${x} ${y} ${z}" rpy="${phi} ${theta} ${psi}" />
       <mass value="94" />
        <inertia ixx="3.4438" ixy="0.0" ixz="0.0" iyy="3.4438" iyz="0.0" izz="0.7338" />      
    </inertial>     
  </link>
  <joint name="${prefix}_body_to_rotor" type="revolute">
      <parent link="${prefix}_robot_body" />
      <child link="${prefix}_robot_rotor" />
      <axis xyz="0 0 1" />
<!--      <origin  xyz="${x} ${y} ${z}" rpy="${phi} ${theta} ${psi}" /> -->
         <origin  xyz="0 0 0.374" rpy="0 0 0" /> 
      <limit lower="0" upper="${4*pi}" effort="10" velocity="3"/>
  </joint>
  <link name="${prefix}_robot_rotor">
    <visual>
<!--      <origin xyz="${x} ${y} ${z+0.75}" rpy="${phi} ${theta} ${psi}" /> -->
      <origin xyz="${x} ${y} ${z}" rpy="0 0 0" /> 
      <geometry ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-03-01 23:05:20 -0500

azeey gravatar image

updated 2023-03-01 23:05:46 -0500

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-02-24 18:26:05 -0500

Seen: 327 times

Last updated: Mar 01 '23