Willow Garage has a nice SolidWorks Plugin for exporting URDF. Here is a link and check out everything in there:
EDIT I have actually tried doing something like this myself. What we are trying to do is called a closed loop joint. From reading around, URDF format does not support closed loop joints because the people who update it "see no need in implementing this functionality". From the using URDF in gazebo 1.9 tutorial: "URDF can not specify the pose of the robot itself within a world. It is also not a universal description format since it cannot specify joint loops (parallel linkages), and it lacks friction and other properties. Additionally, it cannot specify things that are not robots, such as lights, heightmaps, etc."
But on the positive side of things, SDF format seems like it supports closed loop joints. gazebo parallel mechanisms. Even though this post is taking about parallel mechanisms, it is essentially the same thing with trying to connect a child joint, back to its originating parent. More specifically to your scenario, inside of that gazebo parallel mechanisms link is another link to pr2's gripper. It is in sdf format already. In case you did not want to deal with sdf and stick with urdf, it is really easy to convert the urdf to sdf since gazebo already does it every time you load the model. (go to directory of your URDF) gzsdf print (yoururdf.URDF) > (yoursdfname).sdf is all you need.
And from my understanding, I believe you would want your joints set as revolute (in sdf) and just calculate the upper and lower limits (in radians) of how far up and down the actuator angles can go.
Let me know if you make any progress because I am also trying to get the closed loop joints to work. This is all I pretty much knew about it from the research I have done. Hope this gives you a head start.
So I have actually been able to successfully define a (little bit more complicated than yours) closed loop joint linkage. The approach that I took may/may not be the most optimal way, but it definitely works since my model won't fall apart in gazebo now..
For your scenario, (assuming you are using the sw_urdf_exporter like i recommended):
- make the base of your robot mechanism the part that is in the most bottom right corner of your picture (so basically the 'non-moving' part), and call it base_link
- Next create a child off of the base_link you just created, for part A in your picture, and call it lets say "mech_top_link" and then call the joint name "mech_top_base_joint" (With joints, try to make them as specific to what two linkages they are jointing). Make sure you set the axis rotation type to revolute as well.
- Once mech_top_link is created, you can then add the ending to that arm (which is at the top right of the picture, its also cut off from the pic) as a child, set those following joints to be revolute as well.
- At this point, you have taken care of the whole arm, except for the actuator. Here you will want to create another child off of base_link, and call it "actuator_link", and call the joint "actuator_base_joint", set it as well to revolute.
- Here is pretty much where it gets tricky; Create a child off of actuator_link. Call it "actuator_prismatic_link" and name the joint "actuator_prismatic_joint". This will give you two things; 1 will specify a joint that can move "prismatically", allowing to you to perform up and down actuator movements. 2 will allow you to use a gazebo actuator plugin (I'm not that familiar with it) that i imagine would require you to specify the joint that you want the actuator plugin to apply a force to.
- Since URDF does not support closed loop joints, you will NOT create a joint between the actuator and the mech_top_link. Stop here and try to export the URDF. If it takes longer then 5 minutes for a dialog box to pop up, let me know, that means we set up something wrong. If it pops up, move to step 7.
- Once you save your URDF, convert it to sdf format like i showed you in Edit 1.
- You will have to manually create JUST a joint (no linkage, just a joint) in the sdf file. The joint's child would be the actuator, and the joints parent would be the mech_top_link.
I won't go into to much more detail as i feel this should actually become a tutorial, but let me know how this goes and i can further help you.
Originally posted by l0g1x with karma: 1526 on 2014-06-19
This answer was ACCEPTED on the original site
Post score: 4
Comment by anonymous8676 on 2014-06-22:
Thanks for the suggestion, but i was asking how i should setup the joints within the SW2URDF plugin.
One thought i had is that i may need to add rotational joints at the top and bottom of B, as well as a prismatic joint in between.
Comment by anonymous8676 on 2014-08-05:
That is a great insight, thanks for your help. I will be sure to post something as soon as i make progress! :)