Command the robot
Command the robot
command_stop
command_joint_position
- LibIiwa.command_joint_position(position: Union[List[float], ndarray], degrees: bool = False) bool
Move the robot to the specified joint position
- Parameters:
position (7-element list or np.ndarray) – The joint position to move to
degrees (bool, optional) – Whether the position is in degrees or radians (default: radians)
- Raises:
AssertionError – If the position is not a list or numpy array of length 7
- Returns:
True if successful, False otherwise
- Return type:
Example:
>>> # move to joint position [0, 0, 0, -1.57, 0, 1.57, 0] in radians >>> iiwa.command_joint_position([0, 0, 0, -1.57, 0, 1.57, 0]) True >>> # move to joint position [0, 0, 0, -90, 0, 90, 0] in degrees >>> iiwa.command_joint_position([0, 0, 0, -90, 0, 90, 0], degrees=True) True >>> # set only the joint number 4 to -1.57 in radians without moving the other joints >>> iiwa.command_joint_position([np.NaN, np.NaN, np.NaN, -1.57, np.NaN, np.NaN, np.NaN]) True
command_cartesian_pose
- LibIiwa.command_cartesian_pose(position: Union[List[float], ndarray], orientation: Union[List[float], ndarray] = [nan, nan, nan], millimeters: bool = False, degrees: bool = False) bool
Move the robot to the specified cartesian pose
- Parameters:
position (3-element list or np.ndarray) – The cartesian position to move to
orientation (3-element list or np.ndarray, optional) – The cartesian orientation to move to (default: [np.NaN, np.NaN, np.NaN])
millimeters (bool, optional) – Whether the position is in millimeters or meters (default: meters)
degrees (bool, optional) – Whether the orientation is in degrees or radians (default: radians)
- Raises:
AssertionError – If the position is not a list or numpy array of length 3
AssertionError – If the orientation is not a list or numpy array of length 3
- Returns:
True if successful, False otherwise
- Return type:
Example:
>>> # move to cartesian pose [0.65, 0, 0.2] in meters without changing the orientation >>> iiwa.command_cartesian_pose([0.65, 0, 0.2]) True >>> # move to cartesian pose [650, 0, 200] in millimeters without changing the orientation >>> iiwa.command_cartesian_pose([650, 0, 200], millimeters=True) True
command_circular_motion
- LibIiwa.command_circular_motion(auxiliary_position: Union[List[float], ndarray], end_position: Union[List[float], ndarray], millimeters: bool = False) bool
Perform a circular motion
Circular motion is defined by an auxiliary position and an end position. The coordinates of the auxiliary position and end position are Cartesian and absolute. The current frame orientation will be used to calculate the circular motion
- Parameters:
auxiliary_position (3-element list or np.ndarray) – The auxiliary cartesian position with respect to World
end_position (3-element list or np.ndarray) – The end cartesian position with respect to World
millimeters (bool, optional) – Whether the position is in millimeters or meters (default: meters)
- Raises:
AssertionError – If the auxiliary position is not a list or numpy array of length 3
AssertionError – If the end position is not a list or numpy array of length 3
- Returns:
True if successful, False otherwise
- Return type:
Example:
>>> # assuming the robot this joint configuration in degrees: [0, 0, 0, -90, 0, 90, 0] >>> # perfom a circular motion to [0.5, 0.2, 0.65] with auxiliary position [0.6, 0.1, 0.65] >>> iiwa.command_circular_motion([0.6, 0.1, 0.65], [0.5, 0.2, 0.65]) True >>> # same circular motion in millimeters >>> iiwa.command_circular_motion([0.6, 0.1, 0.65], [0.5, 0.2, 0.65], millimeters=True) True