How to spawn one robot onto another in gazebo?
Hello,
I have two different and independent robots. (TWO different URDF
files)
In gazebo i want to spawn+attach the second robot to the top of the first robot (the top is defined by the eef_link
of robot1).
Of course, in this way, i want these robots to be connected, i.e., if robot1 actuates/moves its eef then since robot2 is attached to it, therefore robot2 needs to move with robot1's eef.
Can you please provide a launch file that performs this spawning mechanism in gazebo?
Thank you in advance.
The only way to accomplish what you're talking about that I can think if is to create a third URDF, and import the top URDF and bottom URDF files into it, then add a joint to connect the two. If you're fancy, you can parameterize this third urdf to accept two paths, and two links to join together. That way you can specify a top and bottom URDF, and the link in the top to joint to a link on the bottom...
I dont think that is correct if two
independent
robots are considered. if im not mistaken that way you described only one robot (robot1+robot2) will be spawned to gazebo. However i want to control robot1 and robot2 separately since those are independent robots.I think your usage of "independent" is ambiguous. It sounds like you want to have the robots physically connected to each other, but you want to control each one separately. Am I correct in that interpretation? If so, my proposed solution will still work. Both robots will still be controllable independent from the other, but will be physically attached.
Perhaps more detail in your question would be helpful. What's the function of the top and bottom robots? Example URDFs?
Gazebo Answers post: How to spawn one robot onto another in gazebo?.
@ChuiV Yes, you are right, your answer is actually correct... Originally, i wanted to totally separate these robots.I did not want to make them connected in the TF tree, because in that way if i check the coordinates of the base_link of the second robot, i am going to get the real xyz coordinates because of the TF tree. If these robots are independent, then robot2 doesn't know that its connected to robot1, and its xyz coordinates will be 0,0,0. But i assume everything is relative. Idk if my description was clear. But your answer can be accepted if an admin allows it.
@akosodry, glad I could I help. I'll just copy and paste my first comment into an actual answer then.