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
name (str) – The name of the joint
type (int) – The joint type, e.g. Joint.REVOLUTE
parent_link (
Link
) – The joint’s parent link.child_link (
Link
) – The joint’s child link.origin (
Frame
) – The joint’s origin frame.axis (
Vector
) – The joint’s axis.limit (list of 2 float) – The lower and upper limits of the joint (used for joint types Joint.REVOLUTE or Joint.PRISMATIC)
**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
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)