Why?
For cutter/gripper, we need to simulate the execution of end effectors inside a simulation (a physics accurate one, so not RViz, but even RViz requires URDFs).
Reference
See the files here (https://github.com/VADER-CMU/vader_sim/commit/15a8a370b06ceb4e33b0c33166184ba616e812d8)
Recipe
(As of March 2025):
- This only works on Windows because the URDF exporter only works on Windows. Additionally, you cannot install this on Virtual Andrew because of some policies. So you need a non-virtual-andrew PC with SolidWorks.
- Get SolidWorks from CMU’s student software things. Get a License Key (It appears to only work for 2024 versions of SW. Don’t spend 20 mins downloading 2025 and then finding out that the key doesn’t work and then spending 15 more minutes removing it and then doing this all over again with the 2024 version that would be very dumb and I definitely did this)
- Install Solidworks 2024
- Follow instructions on https://wiki.ros.org/sw_urdf_exporter to install the script. This has been tested and moderately works on Windows 11 + Solidworks 2024.
Clean up the model
- Delete useless parts/components of the model. Basically, you should be left with the components that you definitely want to visualize (outer shell of model, or etc., and remove the screws or unseen internals).
- Think about which components belong to either 1) the base link or 2) each of the child links you want to create.
Define Coordinate Systems and Axes
In the URDF exporter, it will ask you for axes and coordinate systems of each link. This refers to SolidWorks’ Coordinate Systems and Axis (not just sketch object!).
Take a bit of extra time to do this. I found making a sketch where I want the origins to be & adjusting the Coord System to have Z axis pointing in conventional ways (as rotational axis of joint, or perpendicular to mounting zone) works well. I defined an axis by sketching out a point + line and then creating a 90 deg tilted plane based on that, then drawing a line on that as a Z axis.
Make sure you know which Coord systems (for every link, not necessarily every component) & axes (for non-fixed joints) correspond to which components.
Export to URDF
Use Tools → Export to URDF… with your model.