Package URDFModelica/Links contains the prototypes for robot links as specified by the Unified Robot Description Format URDF ROS Wiki. Models for simple collision simulation are in here too.
The Link model can be any rigid robot part. A link always has an Inertial component, that is a Modelica.Mechanics.MultiBody.Parts.Body with parameters from the corresponding record, which can be zero. Optional components are Collision and Visual. Collision is not simulated, only visualized. There are two ways to visualize visual and collision models. The main way has visualizers from the Standard Library, the other way uses the DLR Visualization 2 library. The user decides which to use when calling the Python script. When a new robot package is created, copies of Link are put in the new Links subpackage for each link together with a parameter record for each link. Thus, the link models can be adapted independently of the parameter definitions, parameters which can be updated at any time without modifying the link models.
In the main link version, visual and collision models use the visualizers from the Modelica.Mechanics.MultiBody.Visualizers package. The correct visualization component (box, cylinder, sphere, CAD file) is selected from all components contained in the Link prototype model.
In the visualization2 link version, visual and collision models are simulated externally. The correct visualization component (box, cylinder, sphere, CAD file) is selected from all components contained in the Link_Visualization2 prototype model. The visualization2 version requires the DLR Visualization 2 library, the free community edition suffices to run the examples. It is activated if the user adds `-v` to the Python translation script.
Collision of links is not simulated but only visualized. The same visualizers from Standard Library or DLR Visualization 2 than for visual simulation are included equally in each link that has collision information. Color is set to {255, 0, 255} (i.e. pink) for easier distinction, transparency is turned on if possible. Collision can be globally turned off with the enableCollision parameter that is propagated through the whole robot.
Proper collision simulation of links against other links or environment is not implemented in this library but left to the user to choose its preferred way. But URDFModelica/Links package contains models that show one simple possibility for collision simulation against planes. It is based on the Modelica.Mechanics.Translational.Components.ElastoGap (normal) and dry Coulomb friction (tangential) with tanh to make it continuously differentiable. CollisionPoint contains one ElastoGap and tangential dry friction element, the rotational degrees of freedom are unconstrained. CollisionBox has eight CollisionPoints, one for each corner of a box. CollisionCylinder has 16 CollisionPoints, effectively creating an octagonal prism. CollisionSphere has twelve CollisionPoints, one for each corner of an icosahedron. There is no dedicated model for collision of meshes or their convex envelope.
In order to get somewhat realistic examples, one CollisionPoint for each leaf is connected to the vector of frame_b from BaseURDF in RunURDF such that mobile robots don't fall beneath the collision counterpart, that is the (x, y) plane at z=0. This is not done for stationary robots (with -s option) that are rigidly connected to the world origin.
The Link model stands as is and does not need to be processed by the Python script to work. One can add a link to any multibody model of Modelica because all parameters have default values and optional components are conditionally included. The advantage of the URDF link compared to a Standard Library body is the attached parameter record with which it is easy to have very different rigid bodies with optional visual and collision models.