Robotics StackExchange | Archived questions

How to spawn 2 ur16e arms in gazebo and rviz?

Hello everyone,

I have 2 UR16e arms in simulation. I have created moveit config and ikfast plugin pkgs for myself. The issue is when I spawn 2 UR16e arms it appears correctly in gazebo but I am not sure why it does not appear in rviz at the same place as gazebo when I add model in rviz.

To give you brief about the project detail,

I am using Ubuntu 1804 and ROS melodic. I have two different urdf files for 2 robots as we have several deferences between arms. I have created moveit config and ikfast plugin package for one arm. I am following this question as well.

Main Issue, I am able to see 2 robot models from different namespaces in rviz but both are shown at the same zero rviz position instead of their respective spawning coordinates.

One more thing in which I need input is, do we really I will need 2 different moveit and ikfast configuration for similar robot spawning 2 times?

edit1:

tf_frames after spawning 2 robots in the gazebo:

tf_frames after spawning 2 robots in the gazebo

edit2:

tf_frames after adding the prefix as robot name

image description

edit3:

2 robot model in rviz

image description

2 MotionPlanning (moveit) loaded in rviz. You can not see the 2 robots but it is there both are at same place.

image description

Thank you.

Asked by aarsh_t on 2022-01-13 07:41:21 UTC

Comments

do you have something that publishes the global position (e.g. the map -> baselink) transformation for each arm? else RViz won't know where the robots are actually supposed to be.

Asked by shonigmann on 2022-01-13 13:59:17 UTC

yes I do have world frame but problem is I can only see the frames of one robot (the last robot spawned). When I spawn robot1, I can see the tf_frames of that robot but when I spawn robot1 and robot2 I can only see the frames of robot2. I will edit the question with image of tf frames for your reference. I have world link in both the urdf files. that can be an issue?

Asked by aarsh_t on 2022-01-14 01:03:20 UTC

It sounds like your frame names are identical between robot1 and robot2 - that would cause the tf frames to clash between the two publishers, resulting in you only seeing one of the two robots in the tf graph. The UR arms xacro files should have an option to specify a prefix that should help remove the name clashing.

Asked by shonigmann on 2022-01-14 12:18:30 UTC

Hello Shounigmann, Sorry for little delay. After adding prefix to tf frames I am getting 2 world frames each associated with the robot. Have a look in the question that I have edited. I am not getting robot rendered correctly in rviz as well, it is just white parts gathered at one place.

Unfortunately I am not directly using the UR package from ros_industrial but I am just using their robot description but that as well I have tweaked a lot from what is available now over there for ur16e.

Asked by aarsh_t on 2022-01-16 11:32:47 UTC

I would suggest adding a static transformer in your launch files for each robot like so:

<node pkg="tf2_ros" type="static_transform_publisher" name="robot_world_broadcaster" args="0 0 0 0 0 0 world $(arg robot1)/base_link"/>

<node pkg="tf2_ros" type="static_transform_publisher" name="robot2_world_broadcaster" args="0 0 0 0 0 0 world $(arg robot2)/base_link" />

otherwise the tf_tree's are not connected, so they both start at the same point. For this I would also suggest setting the position args for one of the static_transform_publisher as different, so they wouldn't overlap. For more info check out the tf2 static_transform_publisher page.

Asked by sniegs on 2022-01-18 04:23:44 UTC

This is indeed a good idea. Let me try that out. Being not so experience I forgot that static transform also exist in tf. Thanks.

Asked by aarsh_t on 2022-01-18 07:55:55 UTC

However after adding the static_transform_publisher it does reflected the robot into correct position in rviz... But only while adding the Robotmodel in rviz, while adding the MotionPlanning for the moveit, both robots are shown at same places. Refer the edit I have made in question.

Asked by aarsh_t on 2022-01-18 12:01:38 UTC

I'm not sure if I've ever successfully been able to run two Motion Planning tabs in Rviz simultaneously (there are a ton of parameters that aren't inherently namespaced that might be clashing). As a sanity check, consider removing one of the motion planners, and changing the target within the remaining motion planner to see if the arms are correctly selected (the orange version which indicates the target pose)

Asked by shonigmann on 2022-01-18 12:14:47 UTC

Actually I am able to use both the planners but only issue is the visualization in rviz. Whenever I put some goal pose for both the robots, it will be shown as 2 different robots (in orange) in rviz but at the rviz zero position and not at the respective robot positions. I can see 2 different robots with 2 MotionPlanning (moveit) tabs while I use different origin for the world to base_link joint in urdf file for both the robots.

For robot-1 in urdf file

<link name="world" />
<joint name="world-base_link" type="fixed">
    <parent link="world" />
    <child link="base_link" />
<origin rpy="0 0 0" xyz="0 0 0" />
</joint>

For robot2 in urdf file

<link name="world" />
<joint name="world-base_link" type="fixed">
    <parent link="world" />
    <child link="base_link" />
<origin rpy="0 0 0" xyz="2 0 0" />
</joint>

Asked by aarsh_t on 2022-01-18 12:43:58 UTC

i seem to remember Moveit struggling with namespaces, but I can't find the issue/thread that backs that up right now... My dual arm sim uses prefixes in the URDF (e.g. robot1_base_link and robot2_base_link). You could consider quickly adding prefixes to your link names to see if it helps

Asked by shonigmann on 2022-01-18 13:37:28 UTC

Let me quickly try that out as well.

Asked by aarsh_t on 2022-01-19 01:45:34 UTC

At the end I had left the rviz issue but after few trials, I was able to see two robots at separate places in the rviz after properly adding the namespaces to the MotionControl tab in the rviz. Sorry for confirming it late. I will write it down detailed answer whenever I will get some time.

Asked by aarsh_t on 2022-03-05 15:38:42 UTC

Hi everyone,

would it be possible to implement this on a real robot ur16e using moveIt Rviz? I found on a page that the support for ur16e is not yet complete and I am currently working on this physical robot e series. Thanks in advance for any helpful reply!

Asked by Lara_1 on 2022-03-19 18:24:46 UTC

Yes it is. You have to create your own pkg if you do not want to wait for the pkg from someone else. I cant share mine because it is not common and a company specified use case.

Asked by aarsh_t on 2022-03-22 09:15:28 UTC

To answer this specific question asked by me, May be I will make some tutorial with the other robot (may be ur5) and share it to the community on how to use more than one moveit pkgs in simulation using namespaces.

Asked by aarsh_t on 2022-03-22 09:24:23 UTC

Answers