How to spawn a robot with a joint to another robot(which is already spawned)?

I am simulating a KUKA LWR with an Allegro hand and want to know how to spawn the two URDF models as two seperate robots( so that its easier for ros_control). The idea is to spawn KUKA first and then spawn the allegro hand with a joint which fixes the base of the hand to the last link of the KUKA. I was not able to do it as a robot's link is not visible in another robot. I tried publishing a static tf and now I can see the robots in Rviz but not in Gazebo. Is there a good method to implement this?

edit retag close merge delete

Have you tried writing a model/world plugin to do that? When you get the ModelPtr of the arm, you should be able to add a joint to it... There is also support for nested models, which should also be doable programatically.