pycram.helper
Implementation of helper functions and classes for internal usage only.
Functions: _block – wrap multiple statements into a single block.
Classes: GeneratorList – implementation of generator list wrappers.
Module Contents
Classes
Color codes which can be used to highlight Text in the Terminal. For example, |
|
Implementation of generator list wrappers. |
Functions
|
Apllies a list of joint poses calculated by an inverse kinematics solver to a robot |
|
|
|
Convert axis-angle to quaternion. |
|
Multiply two quaternions using the robotics convention (x, y, z, w). |
|
Rotate a vector v using quaternion q. |
|
Multiply two poses. |
- class pycram.helper.bcolors
Color codes which can be used to highlight Text in the Terminal. For example, for warnings. Usage: Firstly import the class into the file. print(f’{bcolors.WARNING} Some Text {bcolors.ENDC}’)
- HEADER = '\x1b[95m'
- OKBLUE = '\x1b[94m'
- OKCYAN = '\x1b[96m'
- OKGREEN = '\x1b[92m'
- WARNING = '\x1b[93m'
- FAIL = '\x1b[91m'
- ENDC = '\x1b[0m'
- BOLD = '\x1b[1m'
- UNDERLINE = '\x1b[4m'
- pycram.helper._apply_ik(robot: pycram.world_concepts.world_object.Object, joint_poses: typing_extensions.List[float], joints: typing_extensions.List[str]) None
Apllies a list of joint poses calculated by an inverse kinematics solver to a robot
- Parameters:
robot – The robot the joint poses should be applied on
joint_poses – The joint poses to be applied
gripper – specifies the gripper for which the ik solution should be applied
- Returns:
None
- pycram.helper.calculate_wrist_tool_offset(wrist_frame: str, tool_frame: str, robot: pycram.world_concepts.world_object.Object) pycram.datastructures.pose.Transform
- pycram.helper.transform(pose: typing_extensions.List[float], transformation: typing_extensions.List[float], local_coords=False)
- class pycram.helper.GeneratorList(generator: typing_extensions.Callable)
Implementation of generator list wrappers.
Generator lists store the elements of a generator, so these can be fetched multiple times.
Methods: get – get the element at a specific index. has – check if an element at a specific index exists.
Create a new generator list.
Arguments: generator – the generator to use.
- get(index: int = 0)
Get the element at a specific index or raise StopIteration if it doesn’t exist.
Arguments: index – the index to get the element of.
- has(index: int) bool
Check if an element at a specific index exists and return True or False.
Arguments: index – the index to check for.
- pycram.helper.axis_angle_to_quaternion(axis: typing_extensions.List, angle: float) typing_extensions.Tuple
Convert axis-angle to quaternion.
- Parameters:
axis – (x, y, z) tuple representing rotation axis.
angle – rotation angle in degree
- Returns:
The quaternion representing the axis angle
- pycram.helper.multiply_quaternions(q1: typing_extensions.List, q2: typing_extensions.List) typing_extensions.List
Multiply two quaternions using the robotics convention (x, y, z, w).
- Parameters:
q1 – The first quaternion
q2 – The second quaternion
- Returns:
The quaternion resulting from the multiplication
- pycram.helper.quaternion_rotate(q: typing_extensions.List, v: typing_extensions.List) typing_extensions.List
Rotate a vector v using quaternion q.
- Parameters:
q – A quaternion of how v should be rotated
v – A vector that should be rotated by q
- Returns:
V rotated by Q as a quaternion
- pycram.helper.multiply_poses(pose1: pycram.datastructures.pose.Pose, pose2: pycram.datastructures.pose.Pose) typing_extensions.Tuple
Multiply two poses.
- Parameters:
pose1 – first Pose that should be multiplied
pose2 – Second Pose that should be multiplied
- Returns:
A Tuple of position and quaternion as result of the multiplication