ToolModel.add_link
- ToolModel.add_link(name, visual_meshes=None, visual_color=None, collision_meshes=None, **kwargs)[source]
Adds a link to the robot model.
Provides an easy way to programmatically add a link to the robot model.
- Parameters
name (str) – The name of the link
visual_meshes (list of
compas.datastructures.Mesh
orcompas.geometry.Shape
, optional) – The link’s visual mesh.visual_color ([float, float, float], optional) – The rgb color of the mesh. Defaults to (0.8, 0.8, 0.8)
collision_meshes (list[
compas.datastructures.Mesh
], optional) – The link’s collision mesh.**kwargs (dict[str, Any], optional) – The keyword arguments (kwargs) collected in a dict. These allow using non-standard attributes absent in the URDF specification.
- Returns
Link
– The created Link- Raises
ValueError – If the link name is already used in the chain.
Examples
>>> from compas.datastructures import Mesh >>> from compas.geometry import Sphere >>> sphere = Sphere((0, 0, 0), 1) >>> mesh = Mesh.from_shape(sphere) >>> robot = RobotModel('robot') >>> link = robot.add_link('link0', visual_mesh=mesh)