pycram.validation.error_checkers#

Classes#

ErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between

PoseErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between

PositionErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between

OrientationErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between

SingleValueErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between

RevoluteJointPositionErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between

PrismaticJointPositionErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between

IterableErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between

MultiJointPositionErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between

Functions#

calculate_pose_error(→ typing_extensions.List[float])

Calculate the error between two poses.

calculate_position_error(→ float)

Calculate the error between two positions.

calculate_orientation_error(→ float)

Calculate the error between two quaternions.

calculate_joint_position_error(→ float)

Calculate the error between two joint positions.

is_error_acceptable(→ bool)

Check if the error is acceptable.

calculate_angle_between_quaternions(→ float)

Calculates the angle between two quaternions.

calculate_quaternion_difference(...)

Calculates the quaternion difference.

Module Contents#

class pycram.validation.error_checkers.ErrorChecker(acceptable_error: typing_extensions.Union[float, typing_extensions.Iterable[float]], is_iterable: typing_extensions.Optional[bool] = False)#

Bases: abc.ABC

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.

_acceptable_error: numpy.ndarray#
tiled_acceptable_error: typing_extensions.Optional[numpy.ndarray] = None#
is_iterable = False#
reset() None#

Reset the error checker.

property acceptable_error: numpy.ndarray#
update_acceptable_error(new_acceptable_error: typing_extensions.Optional[typing_extensions.Iterable[float]] = None, tile_to_match: typing_extensions.Optional[typing_extensions.Sized] = None) None#

Update the acceptable error with a new value, and tile it to match the length of the error if needed.

Parameters:
  • new_acceptable_error – The new acceptable error.

  • tile_to_match – The iterable to match the length of the error with.

update_tiled_acceptable_error(tile_to_match: typing_extensions.Sized) None#

Tile the acceptable error to match the length of the error.

Parameters:

tile_to_match – The object to match the length of the error.

Returns:

The tiled acceptable error.

abstract _calculate_error(value_1: typing_extensions.Any, value_2: typing_extensions.Any) typing_extensions.Union[float, typing_extensions.List[float]]#

Calculate the error between two values.

Parameters:
  • value_1 – The first value.

  • value_2 – The second value.

Returns:

The error between the two values.

calculate_error(value_1: typing_extensions.Any, value_2: typing_extensions.Any) typing_extensions.Union[float, typing_extensions.List[float]]#

Calculate the error between two values.

Parameters:
  • value_1 – The first value.

  • value_2 – The second value.

Returns:

The error between the two values.

is_error_acceptable(value_1: typing_extensions.Any, value_2: typing_extensions.Any) bool#

Check if the error is acceptable.

Parameters:
  • value_1 – The first value.

  • value_2 – The second value.

Returns:

Whether the error is acceptable.

class pycram.validation.error_checkers.PoseErrorChecker(acceptable_error: typing_extensions.Union[typing_extensions.Tuple[float], typing_extensions.Iterable[typing_extensions.Tuple[float]]] = (0.001, np.pi / 180), is_iterable: typing_extensions.Optional[bool] = False)#

Bases: ErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.

_calculate_error(value_1: typing_extensions.Any, value_2: typing_extensions.Any) typing_extensions.List[float]#

Calculate the error between two poses.

Parameters:
  • value_1 – The first pose.

  • value_2 – The second pose.

class pycram.validation.error_checkers.PositionErrorChecker(acceptable_error: typing_extensions.Optional[float] = 0.001, is_iterable: typing_extensions.Optional[bool] = False)#

Bases: ErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.

_calculate_error(value_1: typing_extensions.Any, value_2: typing_extensions.Any) float#

Calculate the error between two positions.

Parameters:
  • value_1 – The first position.

  • value_2 – The second position.

Returns:

The error between the two positions.

class pycram.validation.error_checkers.OrientationErrorChecker(acceptable_error: typing_extensions.Optional[float] = np.pi / 180, is_iterable: typing_extensions.Optional[bool] = False)#

Bases: ErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.

_calculate_error(value_1: typing_extensions.Any, value_2: typing_extensions.Any) float#

Calculate the error between two quaternions.

Parameters:
  • value_1 – The first quaternion.

  • value_2 – The second quaternion.

Returns:

The error between the two quaternions.

class pycram.validation.error_checkers.SingleValueErrorChecker(acceptable_error: typing_extensions.Optional[float] = 0.001, is_iterable: typing_extensions.Optional[bool] = False)#

Bases: ErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.

_calculate_error(value_1: typing_extensions.Any, value_2: typing_extensions.Any) float#

Calculate the error between two values.

Parameters:
  • value_1 – The first value.

  • value_2 – The second value.

Returns:

The error between the two values.

class pycram.validation.error_checkers.RevoluteJointPositionErrorChecker(acceptable_error: typing_extensions.Optional[float] = np.pi / 180, is_iterable: typing_extensions.Optional[bool] = False)#

Bases: SingleValueErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.

class pycram.validation.error_checkers.PrismaticJointPositionErrorChecker(acceptable_error: typing_extensions.Optional[float] = 0.001, is_iterable: typing_extensions.Optional[bool] = False)#

Bases: SingleValueErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.

class pycram.validation.error_checkers.IterableErrorChecker(acceptable_error: typing_extensions.Optional[typing_extensions.Iterable[float]] = None)#

Bases: ErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.

_calculate_error(value_1: typing_extensions.Any, value_2: typing_extensions.Any) float#

Calculate the error between two values.

Parameters:
  • value_1 – The first value.

  • value_2 – The second value.

Returns:

The error between the two values.

class pycram.validation.error_checkers.MultiJointPositionErrorChecker(joint_types: typing_extensions.List[pycram.datastructures.enums.JointType], acceptable_error: typing_extensions.Optional[typing_extensions.Iterable[float]] = None)#

Bases: IterableErrorChecker

An abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.

joint_types#
_calculate_error(value_1: typing_extensions.Any, value_2: typing_extensions.Any) float#

Calculate the error between two joint positions.

Parameters:
  • value_1 – The first joint position.

  • value_2 – The second joint position.

Returns:

The error between the two joint positions.

pycram.validation.error_checkers.calculate_pose_error(pose_1: pycram.datastructures.pose.PoseStamped, pose_2: pycram.datastructures.pose.PoseStamped) typing_extensions.List[float]#

Calculate the error between two poses.

Parameters:
  • pose_1 – The first pose.

  • pose_2 – The second pose.

Returns:

The error between the two poses.

pycram.validation.error_checkers.calculate_position_error(position_1: typing_extensions.List[float], position_2: typing_extensions.List[float]) float#

Calculate the error between two positions.

Parameters:
  • position_1 – The first position.

  • position_2 – The second position.

Returns:

The error between the two positions.

pycram.validation.error_checkers.calculate_orientation_error(quat_1: typing_extensions.List[float], quat_2: typing_extensions.List[float]) float#

Calculate the error between two quaternions.

Parameters:
  • quat_1 – The first quaternion.

  • quat_2 – The second quaternion.

Returns:

The error between the two quaternions.

pycram.validation.error_checkers.calculate_joint_position_error(joint_position_1: float, joint_position_2: float) float#

Calculate the error between two joint positions.

Parameters:
  • joint_position_1 – The first joint position.

  • joint_position_2 – The second joint position.

Returns:

The error between the two joint positions.

pycram.validation.error_checkers.is_error_acceptable(error: typing_extensions.Union[float, typing_extensions.Iterable[float]], acceptable_error: typing_extensions.Union[float, typing_extensions.Iterable[float]]) bool#

Check if the error is acceptable.

Parameters:
  • error – The error.

  • acceptable_error – The acceptable error.

Returns:

Whether the error is acceptable.

pycram.validation.error_checkers.calculate_angle_between_quaternions(quat_1: typing_extensions.List[float], quat_2: typing_extensions.List[float]) float#

Calculates the angle between two quaternions.

Parameters:
  • quat_1 – The first quaternion.

  • quat_2 – The second quaternion.

Returns:

A float value that represents the angle between the two quaternions.

pycram.validation.error_checkers.calculate_quaternion_difference(quat_1: typing_extensions.List[float], quat_2: typing_extensions.List[float]) typing_extensions.List[float]#

Calculates the quaternion difference.

Parameters:
  • quat_1 – The quaternion of the object at the first time step.

  • quat_2 – The quaternion of the object at the second time step.

Returns:

A list of float values that represent the quaternion difference.