ToolModel.add_joint

ToolModel.add_joint(name, type, parent_link, child_link, origin=None, axis=None, limit=None, **kwargs)[source]

Adds a joint to the robot model.

Provides an easy way to programmatically add a joint to the robot model.

Parameters:
namestr

The name of the joint

typeint

The joint type, e.g. Joint.REVOLUTE

parent_linkLink

The joint’s parent link.

child_linkLink

The joint’s child link.

originFrame

The joint’s origin frame.

axisVector

The joint’s axis.

limitlist of 2 float

The lower and upper limits of the joint (used for joint types Joint.REVOLUTE or Joint.PRISMATIC)

**kwargsdict[str, Any], optional

The keyword arguments (kwargs) collected in a dict. These allow using non-standard attributes absent in the URDF specification.

Returns:
Joint

The created Joint

Raises:
ValueError

If the joint name is already used in the chain.

Examples

>>> from compas.geometry import Frame
>>> robot = RobotModel("robot")
>>> parent_link = robot.add_link("link0")
>>> child_link = robot.add_link("link1")
>>> origin = Frame.worldXY()
>>> axis = (1, 0, 0)
>>> j = robot.add_joint("joint1", Joint.CONTINUOUS, parent_link, child_link, origin, axis)