Ask Your Question
0

easily move relative base position in urdf (for 2 seperate robots)?

asked 2016-09-16 14:06:50 -0500

rosnutsbolts gravatar image

updated 2016-09-21 14:23:30 -0500

gvdhoorn gravatar image

I want to display two robots in Rviz using URDF that do not share a base link (to be controlled in simulation using joint_state_publisher) by only changing 1 base offset origin in the world coordinate system for each robot.

I experimented with a lot of combinations using urdf displayed in rviz, but no luck. I'm sure someone has done this, only I cant find the answer.

I thought the axis and origin were offsets from the previous link (but since everything is defined on top of 0,0,0 this may be an erroneous assumption.)

TIA


Edit: This URDF only moves the base link offset - all connected links and joints above are aligned along (0,0,0) axiss:

<link name="base_link">
  <visual>
    <origin rpy="0 0 0" xyz="0 -0.5 0"/>
    <geometry>
      <mesh filename="package://fanuc_lrmate200id_support/meshes/lrmate200id/visual/base_link.stl" scale="1.0 1.0 1.0"/>
    </geometry>
    ....

Want to move (offset) robot -.5 in y axis so I can add another robot in the +.5 in the y axis.

Sample would work best - tried suggestions found on internet but didnt work. And could not find anything on the www.

Appears as if I have to offset all links/joints by base amount along lines of pr2.

edit retag flag offensive close merge delete

Comments

Normally the robot is moved around in rviz by the frame transformations published by your odometry components. That is, the odometry publishes the transform from the odom frame to base_link (or whatever the name of your robot's main frame is). joint_state_publisher is not used for this.

Mark Rose gravatar image Mark Rose  ( 2016-09-16 17:23:20 -0500 )edit

Maybe give a little more detail what you're trying to do? You want to visualize two robots? That's doable. How are you publishing odometry for each? Do you have a separate URDF for each? (Or two instances of the state publishers and the same URDF.)

Mark Rose gravatar image Mark Rose  ( 2016-09-16 17:24:27 -0500 )edit

You can create a dummy link for each robot that will connect from world link to the base link of each robot, assuming you are having two robots defined in the same URDF. Not sure if this is what you are looking for.

JoshMarino gravatar image JoshMarino  ( 2016-09-17 23:15:55 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-09-21 12:36:55 -0500

JoshMarino gravatar image

Below is an example of what I commented earlier, if this is what you are looking for. You will have to modify it for your specific robot of course.

<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="robot" >

  <!-- World Link -->
  <link name="world" />


  <!-- Dummy Link -->
  <link name="link0" />
  <joint name="world_joint" type="fixed">
    <parent link="world" />
    <child link="link0" />
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <axis xyz="0 0 1"/>
  </joint>


  <!-- First Robot -->
  <joint name="link0_joint" type="fixed">
    <parent link="link0" />
    <child link="robot1_link1" />
    <origin xyz="0 -0.5 0" rpy="0 0 0"/>
  </joint>
  <link name="robot1_link1" />
  <joint name="robot1_joint1" type="revolute">
  <link name="robot1_link2" />
  <joint name="robot1_joint2" type="revolute">
  <link name="robot1_link3" />


  <!-- Second Robot -->
  <joint name="link0_joint" type="fixed">
    <parent link="link0" />
    <child link="robot2_link1" />
    <origin xyz="0 0.5 0" rpy="0 0 0"/>
  </joint>
  <link name="robot2_link1" />
  <joint name="robot2_joint1" type="revolute">
  <link name="robot2_link2" />
  <joint name="robot2_joint2" type="revolute">
  <link name="robot2_link3" />



</robot>
edit flag offensive delete link more

Comments

Thanks - explanation helpful. One caveat. The robot URDF I was testing against had a fixed base joint connected to joint_1, when I changed base joint to 0,-0.5,0 as above it only moved the base. When I changed the first revolute joint in the robot to 0,-0.5,0, the entire robot shifted.

rosnutsbolts gravatar image rosnutsbolts  ( 2016-09-22 12:45:21 -0500 )edit

@rosnutsbolts: you don't want to move joints. To properly do what @JoshMarino is suggesting, create a fixed joint between your shared world link and the root link of the fanuc_lrmate200id model you're instantiating twice. The root would be base_link. That will automatically move the rest too.

gvdhoorn gravatar image gvdhoorn  ( 2016-09-22 13:36:55 -0500 )edit
0

answered 2016-09-26 15:49:31 -0500

rosnutsbolts gravatar image

For reference (or at least it worked for me), here's the xacro code I used for 2 robots with grippers in urdf that are controllable by joint_state_publisher: (still a few extra reference frames, but first things first). Make sure rviz says "world" is your base reference frame.

 <?xml version="1.0"?>
<robot name="fanuc_lrmate200id" xmlns:xacro="http://ros.org/wiki/xacro">
  <xacro:include filename="$(find fanuc_lrmate200id_support)/urdf/lrmate200id_macro.xacro"/>
   <xacro:include filename="$(find fanuc_lrmate200id_support)/urdf/robotiq_c2_model_macro.xacro"/>
   <xacro:include filename="$(find motoman_sia20d_support)/urdf/sia20d_macro.xacro"/>
    <xacro:fanuc_lrmate200id prefix="fanuc_"/>
   <xacro:robotiq_c2_model prefix="fanuc_"/>
    <xacro:motoman_sia20d prefix="motoman_"/>
   <xacro:robotiq_c2_model prefix="motoman_"/>

  <link name="world" />

  <!-- Dummy Link -->
  <link name="link0" />
  <joint name="world_joint" type="fixed">
    <parent link="world" />
    <child link="link0" />
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <axis xyz="0 0 1"/>
  </joint>

  <!-- First Robot -->
  <joint name="fanuc_joint_0" type="fixed">
    <parent link="link0" />
    <child link="fanuc_base_link" />
    <origin xyz="0 -0.5 0" rpy="0 0 0"/>
  </joint>

  <joint name="fanuc_joint_6-tool0" type="fixed">
    <!--      <origin xyz="0 0 0" rpy="${m_pi} ${-m_pi_2} 0" /> -->
    <origin xyz="0 0 0" rpy="0 0 0" />
    <parent link="fanuc_link_6" />
    <child link="fanuc_robotiq_85_adapter_link" />
    <axis xyz="0 0 0"/>
  </joint> 

  <!-- Second Robot -->
  <joint name="motoman_joint_0" type="fixed">
    <parent link="link0" />
    <child link="motoman_base_link" />
    <origin xyz="0 0.5 0" rpy="0 0 0"/>
  </joint>
   <joint name="motoman_link_t-tool0" type="fixed" >
     <!--  <origin xyz="0 0 0.0" rpy="0 0 -3.1416"/> -->
     <origin xyz="0 0 0.0" rpy="0  -1.57  0"/>
      <parent link="motoman_link_t" />
      <child link="motoman_robotiq_85_adapter_link" />
     </joint>

</robot>
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2016-09-16 14:06:50 -0500

Seen: 1,908 times

Last updated: Sep 26 '16