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

robot axes in wrong position

asked 2019-09-17 09:03:28 -0500

kallivalli gravatar image

updated 2019-09-21 00:41:01 -0500

imported robot model from solidworks and now axes is wrong position ,how to correct it ?

here is my urdf file

```<robot
  name="urdfkarbrs">
  <link
    name="base_link">
    <inertial>
      <origin
        xyz="0.0024688 0.33762 -0.098216"
        rpy="0 0 0" />
      <mass
        value="293.45" />
      <inertia
        ixx="."
        ixy="."
        ixz="."
        iyy="."
        iyz="."
        izz="." />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdfkarbrs/meshes/base_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.1098 0.1098 0.1098 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdfkarbrs/meshes/base_link.STL" />
      </geometry>
    </collision>
  </link>
  <link
    name="wheel_left">
    <inertial>
      <origin
        xyz="0 6.9389E-18 0"
        rpy="0 0 0" />
      <mass
        value="1.232" />
      <inertia
        ixx="0.0033433"
        ixy="-1.1064E-19"
        ixz="2.0298E-20"
        iyy="0.0033433"
        iyz="3.9954E-21"
        izz="0.0062939" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdfkarbrs/meshes/wheel_left.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.1098 0.1098 0.1098 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdfkarbrs/meshes/wheel_left.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="base_to_wheel_left"
    type="fixed">
    <origin
      xyz="0.200006504170248 -0.117214105335033 0.0322348664686984"
      rpy="1.5707963267949 6.12303176911189E-17 1.5707963267949" />
    <parent
      link="base_link" />
    <child
      link="wheel_left" />
    <axis
      xyz="0 0 0" />
  </joint>
  <link
    name="wheel_right">
    <inertial>
      <origin
        xyz="-1.38777878078145E-17 0 0"
        rpy="0 0 0" />
      <mass
        value="1.23201604934254" />
      <inertia
        ixx="0.00334328321751409"
        ixy="-8.08731176170645E-19"
        ixz="-6.85412539663736E-19"
        iyy="0.00334328321751409"
        iyz="6.76489684109897E-19"
        izz="0.00629386357236665" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdfkarbrs/meshes/wheel_right.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.109803921568627 0.109803921568627 0.109803921568627 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdfkarbrs/meshes/wheel_right.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="base_to_wheel_right"
    type="fixed">
    <origin
      xyz="-0.2 -0.117214105335033 0.0322348664686984"
      rpy="1.5707963267949 -5.3987124996798E-05 -1.5707963267949" />
    <parent
      link="base_link" />
    <child
      link="wheel_right" />
    <axis
      xyz="0 0 0" />
  </joint>
  <link
    name="imu_link">
    <inertial>
      <origin
        xyz="4.03180014199E-05 -0.0156879017748662 -0.00151010441324315"
        rpy="0 0 0" />
      <mass
        value="0.0322916953109473" />
      <inertia
        ixx="1.00363686277193E-05"
        ixy="-1.00690641922697E-08"
        ixz="2.46871412698827E-10"
        iyy="1.70223765399293E-05"
        iyz="5.97014858901897E-07"
        izz="9.87585772922106E-06" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdfkarbrs/meshes/imu_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.792156862745098 0.819607843137255 0.933333333333333 1" />
      </material>
    </visual>
    <collision>
      <origin ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-09-17 09:15:04 -0500

Choco93 gravatar image

updated 2019-09-20 07:37:52 -0500

You can either modify your URDF, add 90 degrees or 1.57 rad yaw to your base_link rpy="0 0 1.57"

Or you can change name of base_link to mock_base_link or whatever, and publish a static transform called base_link that is offset by 1.57 rad in yaw to your mock_base_link, adding this to your launch file

<node pkg="tf" type="static_transform_publisher" name="mock2base" args="0 0 0 1.57 0 0 mock_base_link base_link 20" />

You can read about args here

EDIT: Current node will have mock_base_link as parent and base_link as it's child, you need to switch them like,

<node pkg="tf" type="static_transform_publisher" name="mock2base" args="0 0 0 1.57 0 0 base_link mock_base_link 20" />
edit flag offensive delete link more

Comments

TF tree doesn't show a base_link frame at all, which tells me that while publishing mock_base_link -> base_link, there's nothing publishing the base_link frame or a completed tree of base_link -> odom. ! how to solve this ?

kallivalli gravatar image kallivalli  ( 2019-09-19 00:51:35 -0500 )edit

Do you see rest of the links for your robot? What are you using to publish odom?

Choco93 gravatar image Choco93  ( 2019-09-20 01:21:34 -0500 )edit

yes i have edited my question and pasted the transforms map >odom

kallivalli gravatar image kallivalli  ( 2019-09-20 01:34:55 -0500 )edit

I am a little confused now, your tf-tree and URDF don't match. you have changed base_link to mock_base_link in urdf, right?

Choco93 gravatar image Choco93  ( 2019-09-20 04:56:43 -0500 )edit

yescheck is there anything wrong with wrong [launch] (https://hastebin.com/imeqerigep.xml) file ?

kallivalli gravatar image kallivalli  ( 2019-09-20 07:26:35 -0500 )edit

So one thing I just checked, args should be 0 0 0 1.57 0 0 base_link mock_base_link 20". But this is actually a nicer solution when you are adding a child link and not a parent link. Alternatively you can take your original URDF, and add 1.57 to yaw for base_link, and add a child (mock_base_link) to it with -1.57 yaw, and all other links will then be connected to mock_base_link.

Choco93 gravatar image Choco93  ( 2019-09-20 07:36:34 -0500 )edit

root Link: base_link has 1 child(ren) child(1): mock_base_link child(1): imu child(2): laser_frame child(3): wheel_left child(4): wheel_right

it became like this axes are all working now ~ thank you

kallivalli gravatar image kallivalli  ( 2019-09-20 23:50:47 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-09-17 09:03:28 -0500

Seen: 423 times

Last updated: Sep 21 '19