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:
edit2:
tf_frames after adding the prefix as robot name
edit3:
2 robot model in rviz
2 MotionPlanning (moveit) loaded in rviz. You can not see the 2 robots but it is there both are at same place.
Thank you.
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.
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?
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.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.
I would suggest adding a static transformer in your launch files for each robot like so:
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.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.
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.
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)