Skip to main content
Ctrl+K
Logo image

COMPAS docs

  • Introduction
  • Installation
  • Tutorial
  • Examples
  • API Reference
    • API Reference
  • License
COMPAS.dev
  • API Reference
  • RobotModel
  • RobotModel.add_link

RobotModel.add_link

RobotModel.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:
namestr

The name of the link

visual_mesheslist[Mesh | 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_mesheslist[Mesh], optional

The link’s collision mesh.

**kwargsdict[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(1.0)
>>> mesh = Mesh.from_shape(sphere)
>>> robot = RobotModel("robot")
>>> link = robot.add_link("link0", visual_mesh=mesh)
On this page
  • RobotModel.add_link()

© Copyright COMPAS Association.

Created using Sphinx 8.1.3.

Built with the PyData Sphinx Theme 0.13.3.