Creo Mechanism to URDF
Exporting a model
Main steps and tools
The main work flow to obtain an URDF file starting from a CAD model is as follow: CAD (Creo) → SimMechanics (MathWorks) → URDF
Assumptions regarding the base CAD model
The workflow described in this page, is based on several assumptions regarding the source CAD model that is used to generate the simulation model. The main one is that the robot subassembly tree reflects the assembly structure. This, in turn, often results in sub-assemblies that comprise parts of different links.
Detailed work flow
The first part of the process consists of generating link geometries. This is done by grouping together parts that move together into single geometries. These links for the standard iCub are the ones in ICub_Model_naming_conventions . To do this the Creo Parametric feature of simplified representations is employed.
- Use Simple Representation (Simp Rep) to group parts, pay attention to include ALL parts that are needed (possibly including screws).
- When doing this include and exclude components at the highest possible level.
- In Simp Rep mode first show all the parts (active and inactive), include (option Geometry) the interested parts.
- It is possible that if you activate a part within an assembly you will need to exclude some of the subparts of this assembly.
- Name the obtained simple representation as the interested link (refer to the iCubTree wiki page above).
- Possibly add the "SIM_" prefix to the Simp Rep to keep things tidy.
- Save the grouped parts as shrinkwrap.
- This operation allows to shrink the grouped parts to one part.
- The dialog is shown in the attached image
- When exporting the shrinkwrapped model use the option "Facetet solid".
- Select a quality level around 6. Increase the quality gradually until computation time remains below 1 minute.
- Select additional datums reference joint axes (and eventually planes) with the "Include Datum References" > "Select Datum" option to assemble the robot mechanism afterwards.
- Check the "Assign mass properties" check box
- Unckeck the "Use default template" check box
- If prompted for a start part select "sim_start_part.prt" from the "standard_files" directory.
- Create a new simulation mechanism and assemble the robot using the shrunk parts
- Pay attention to assemble it as the original one.
After having obtained the CAD assembly file, we need to follow these steps:
- Convert from CAD files to SimMechanics using the tool SimMechanics Link, licensed by MathWorks. SimMechanics is link is available on MathWorks website.
- Input: CAD assembly files (Creo or SolidWorks files, in the specific case of iCub Creo)
- Output: XML model description file and .stl mesh files, you can visualize the meshes with MeshLab or Blender
- To convert from SimMechanics Link XML to URDF the tool to be used is the one available on GitHub https://github.com/robotology-playground/simmechanics-to-urdf, authored by Silvio Traversaro.
- Input: XML model description file from SimMechanics Link.
- Optional inputs: .csv file with joint and actuator specifications, yaml configuration file
- Output: XML model description (URDF)
Quick simulation model updates
Several strategies can be used to speed up the model update process. Some are listed below.
- Keep the kinematic structure of the robot constant. Replace updated links with the "Replace" command. When in "Replace" mode select "Unrelated component" and then "Edit Ref table" to quickly define corresponding features and datums.
- Use the mirror command to mirror assemblies (File > Save a copy > Save a mirror assembly). Use this feature with care since it might cause issues and bad centers of gravity when exporting to SimMechanics.
- Leverage the power of Simplified representations. If the links are generated with the "save as shrinkwrap" option, from simplified representation, updating link parts can be very fast. This requires generating simplified representations by including and excluding components at the highest possible level.
Adding 6 axis force torque sensors
Six axis force torque sensors can be easily modeled with welded joints. In this case the forces passing through the joint are map directly to the forces measured by the sensor. To implement this feature in the simulation model split links at sensor interfaces and assemble rigidly the two parts.
Add additional reference frames
Additional refernce frames can be exported for convenience. To export additional coordinate frames, create them or rename them with a same prefix. Then select the appropriate prefix in the "Settings" dialogue of the SimMechanics CAD link in Creo Parametric. Selection of multiple coordinate systems can be sped up with layer based selection (select by layer in sub-components). The standard prefix for iCub additional reference frames is "SCSYS_" (which stand for Simulation Coordinate SYStem). The standard layer for simulation references and datums is "SIM_REFS".
Interesting frames to export in iCub Facility robots
Several reference frames are good candidates from extraction in iCub Facility produced robots, such as:
- The measurement frame of the accelerometer of MTB boards,
- The measurement frame of the accelerometer and the measurement frame of the gyroscope of EMS boards,
- The measurement frame of the XSens MTX IMU,
- The measurement frame of the FTSens 6-axis Force Torque sensors.
What should be avoided
When defining this workflow we explored several different options combinations. The ones that did not give good results, are listed below with a short motivation of why they were not employed.
- Exporting shrinkwraps with "Merged Solid"
- the resulting geometry file is very large, and expensive memory-wise
- the shrinkwrapping operation sometimes fails
- Exporting shrinkwraps with "Surface subset"
- does not allow the generation of the link meshes
- Creating link geometries with a method that does not employ top-level simplified representations
- This results in messy models that are difficult to maintain and update