timor.task.Tolerance
Attributes
Classes
An absolute 6d-Vector Tolerance |
|
A tolerance that always evaluates to true |
|
Cartesian Space Tolerances (on positions) |
|
Cylindrical space tolerances (on positions). |
|
Axis-aligned cartesian tolerance. |
|
Holds any number of different tolerances and evaluates to true iff all internal tolerances do |
|
Rotation tolerances based on projections of a 4x4 transformation - implements projections. |
|
Constrains the norm of all valid rotations in axis-angles (defines the maximum allowed absolute rotation). |
|
Constrains the maximum rotation around an interval of user-defined axes. |
|
Any tolerance that tolerates spatial attributes (placements). |
|
An interface on numeric tolerances between goals and states that can be expressed as np-arrays |
|
A tolerance of the LN-Distance between two vectors. Default: L2 / Cartesian distance |
Module Contents
- class timor.task.Tolerance.Abs6dPoseTolerance(abs_tolerance)

An absolute 6d-Vector Tolerance
Tolerance on the absolute difference between spatial and angular velocities or accelerations. (6D vector) This makes no distinction between (d)dx, (d)dy, (d)dz and (d)d_alpha, (d)d_beta, (d)d_gamma - so use with care!
A tolerance for a vector valued array
- Parameters:
abs_tolerance (float) – The tolerance value (symmetric)
- __add__(other)
Combine tolerances (logical AND operation)
Adding two tolerances always yields a stronger constraint than either of the summands
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
Two absolute pose tolerances are equal if they have the same tolerance values
- __hash__()
The tolerance value fully determines this class
- __slots__ = ()
- _add_same(other)
Add two tolerances together.
- Parameters:
other (Abs6dPoseTolerance)
- Return type:
- _stratify(v)
Make sure the array is 1-dimensional.
- Parameters:
v (numpy.ndarray)
- Return type:
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
The geometry representing the tolerance in a visualization and the relative offset to the nominal position
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
A default absolute tolerance of 0.001.
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- abstractmethod to_projection()
There is no tolerance projection for this tolerance yet
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- tolerance
- valid(desired, real)
Is valid if the absolute difference between the desired and real is within the tolerance.
- Parameters:
desired (numpy.ndarray)
real (numpy.ndarray)
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize the tolerance in a MeshcatVisualizer
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer) – A meshcat visualizer instance to display the tolerance in.
transform (numpy.ndarray) – The nominal position for which the tolerance is specified
name (Optional[str]) – A display name for the tolerance. Will be set to a random name if not given.
custom_material (Optional[meshcat.geometry.Material]) – Tolerances are displayed in transparent green – a custom material can change the default appearance
- class timor.task.Tolerance.AlwaysValidTolerance

A tolerance that always evaluates to true
- __add__(other)
AlwaysValidTolerance is always weaker than any other tolerance
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
AlwaysValidTolerance is always equal to itself
- __hash__()
There’s just one instance of this tolerance
- __slots__ = ()
- abstractmethod _add_same(other)
This should not be necessary. Raising because it would be a bug if this method would ever be called
- Parameters:
other (AlwaysValidTolerance)
- Return type:
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
The geometry representing the tolerance in a visualization and the relative offset to the nominal position
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
AlwaysValidTolerance default is always valid - who would’ve thought?
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- to_projection()
AlwaysValidTolerance is always valid, so no description is needed
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- valid(desired, real)
You don’t say
- Parameters:
desired (Union[numpy.ndarray, timor.utilities.transformation.TransformationLike])
real (Union[numpy.ndarray, timor.utilities.transformation.TransformationLike])
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
AlwaysValidTolerance is always valid, so no visualization is needed
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer)
transform (numpy.ndarray)
name (Optional[str])
custom_material (Optional[meshcat.geometry.Material])
- class timor.task.Tolerance.Cartesian(a, b, c, frame=NOMINAL_FRAME)

Cartesian Space Tolerances (on positions)
Tolerance is valid if all proj(desired-real) is in the interval [tolerances[:, 0], tolerances[:, 1]]
- Parameters:
a (Union[List[float], Tuple[float, float], numpy.ndarray])
b (Union[List[float], Tuple[float, float], numpy.ndarray])
c (Union[List[float], Tuple[float, float], numpy.ndarray])
frame (timor.utilities.frames.Frame)
- CorrespondingVolumeType: Type[timor.Volume] = None
- __add__(other)
Combine tolerances (logical AND operation)
Adding two tolerances always yields a stronger constraint than either of the summands
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
Two cartesian tolerances are equal if they have the same tolerance values and dtype
- __hash__()
The class is defined by the tolerance bounds that can be hashed
- __slots__ = ()
- _add_same(other)
Combine two pose tolerances
- _frame
- abstractmethod _inv_projection(projected)
Inverse to _projection
Maps a projected element from the tolerances projection space to a placement, being offset from the origin by the values defined in the projection space.
- Parameters:
projected (numpy.ndarray)
- Return type:
- _max_possible
- property _pose_projection_data: Dict[str, Tuple[str] | numpy.ndarray]
- Abstractmethod:
- Return type:
Dict[str, Union[Tuple[str], numpy.ndarray]]
Generate a projection that can be used to describe a tolerance.
To be implemented by children - returns the data for the projection of the pose. The tolerance values should be np arrays though, not lists.
- abstractmethod _projection(nominal)
Maps a placement to the projection space of the tolerance
- Parameters:
- Return type:
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
The geometry representing the tolerance in a visualization and the relative offset to the nominal position
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
- Abstractmethod:
Default tolerance, e.g. for a cartesian tolerance that is 0.001 for all dimensions
- enclosing_volume(limits, offset=Transformation.neutral())
Returns an internal representation of a volume object, described by limits and offsets.
- Parameters:
limits (numpy.ndarray) – The limits of the volume, as a 3x2 array. For each row, the first column represents the lower limit, and the second column represents the upper limit.
offset (timor.utilities.transformation.Transformation) – An optional transformation that is applied to the volume to adjust its position and orientation.
- Returns:
An internal representation of the volume.
- Return type:
timor.Volume
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- property stacked: numpy.ndarray
The tolerances stacked in a 3x2 array
- Return type:
- to_projection()
A dictionary that can be used to specify this tolerance as a tolerated pose projection.
Format: Dictionary with
projection: (proj_0, …, proj_n) <<Tuple of strings>>,
tolerance: (tol_0, …, tol_n) <<Tuple of 2-tuples of tolerances>>
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- valid(desired, real)
For cartesian tolerance, we can check if the tolerance is within the enclosing Volume
- Parameters:
desired (timor.utilities.transformation.TransformationLike)
real (timor.utilities.transformation.TransformationLike)
- Return type:
- property valid_random_deviation: timor.utilities.transformation.Transformation
Used to generate a random but still valid transformation.
Returns a random deviation/distortion that would still satisfy the tolerance, distributed uniformly in the solution space. Useful for sampling valid positions. Always returns a Transformation.
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize the tolerance in a MeshcatVisualizer
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer) – A meshcat visualizer instance to display the tolerance in.
transform (numpy.ndarray) – The nominal position for which the tolerance is specified
name (Optional[str]) – A display name for the tolerance. Will be set to a random name if not given.
custom_material (Optional[meshcat.geometry.Material]) – Tolerances are displayed in transparent green – a custom material can change the default appearance
- class timor.task.Tolerance.CartesianCylindrical(r, phi_cyl=(-np.pi, np.pi), z=(-np.inf, np.inf), frame=NOMINAL_FRAME)

Cylindrical space tolerances (on positions).
The desired placement must be within a space defined by cylinder coordinates r, z and phi. https://en.wikipedia.org/wiki/Cylindrical_coordinate_system
Defines a (partial) cylinder as tolerance.
- Parameters:
r (Union[List[float], Tuple[float, float], numpy.ndarray]) – Lower and upper tolerance for the radius.
phi_cyl (Union[List[float], Tuple[float, float], numpy.ndarray]) – Lower and upper tolerance for angle of cylinder coordinates between -pi and pi (radian)
z (Union[List[float], Tuple[float, float], numpy.ndarray]) – lower and upper tolerance for the cylinder z coordinates.
frame (timor.utilities.frames.Frame)
- CorrespondingVolumeType
- __add__(other)
Custom add method to deal with cartesian/cylinder combinations
Overwrite behavior if the other class is a cartesian with a z-tolerance only: Then it can be seen as cylindrical as well.
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
Two cartesian tolerances are equal if they have the same tolerance values and dtype
- __hash__()
The class is defined by the tolerance bounds that can be hashed
- __slots__ = ()
- _add_same(other)
Combine two pose tolerances
- _frame
- _inv_projection(projected)
Map cylindrical to cartesian coordinates
- Parameters:
projected (numpy.ndarray)
- Return type:
- _max_possible
- property _pose_projection_data: Dict[str, Tuple[str] | numpy.ndarray]
Generate a projection that can be used to describe a tolerance.
To be implemented by children - returns the data for the projection of the pose. The tolerance values should be np arrays though, not lists.
- Return type:
Dict[str, Union[Tuple[str], numpy.ndarray]]
- _projection(nominal)
Map cartesian to cylindrical coordinates
- Parameters:
- Return type:
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
Visualize (partial) cylinder
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
Returns a CartesianCylindrical with default tolerances
- enclosing_volume(limits, offset=Transformation.neutral())
Returns a cylinder volume object.
- Parameters:
limits (numpy.ndarray)
- Return type:
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- property stacked: numpy.ndarray
The tolerances stacked in a 3x2 array
- Return type:
- to_projection()
A dictionary that can be used to specify this tolerance as a tolerated pose projection.
Format: Dictionary with
projection: (proj_0, …, proj_n) <<Tuple of strings>>,
tolerance: (tol_0, …, tol_n) <<Tuple of 2-tuples of tolerances>>
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- valid(desired, real)
For cartesian tolerance, we can check if the tolerance is within the enclosing Volume
- Parameters:
desired (timor.utilities.transformation.TransformationLike)
real (timor.utilities.transformation.TransformationLike)
- Return type:
- property valid_random_deviation: timor.utilities.transformation.Transformation
Used to generate a random but still valid transformation.
Returns a random deviation/distortion that would still satisfy the tolerance, distributed uniformly in the solution space. Useful for sampling valid positions. Always returns a Transformation.
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize the tolerance in a MeshcatVisualizer
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer) – A meshcat visualizer instance to display the tolerance in.
transform (numpy.ndarray) – The nominal position for which the tolerance is specified
name (Optional[str]) – A display name for the tolerance. Will be set to a random name if not given.
custom_material (Optional[meshcat.geometry.Material]) – Tolerances are displayed in transparent green – a custom material can change the default appearance
- class timor.task.Tolerance.CartesianSpheric(r, theta=(0, np.pi), phi_sph=(-np.pi, np.pi), frame=NOMINAL_FRAME)

https://en.wikipedia.org/wiki/Spherical_coordinate_system
Defines a potentially cut out spherical-shaped tolerance
- Parameters:
r (Union[List[float], Tuple[float, float], numpy.ndarray]) – Lower and upper tolerance for the radius.
theta (Union[List[float], Tuple[float, float], numpy.ndarray]) – lower and upper tolerance for the inclination angle theta between 0 and 180 degree (in radian).
phi_sph (Union[List[float], Tuple[float, float], numpy.ndarray]) – Lower and upper tolerance for the polar angle phi between -180 and 180 degrees (in radian).
frame (timor.utilities.frames.Frame)
- CorrespondingVolumeType
- __add__(other)
Combine tolerances (logical AND operation)
Adding two tolerances always yields a stronger constraint than either of the summands
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
Two cartesian tolerances are equal if they have the same tolerance values and dtype
- __hash__()
The class is defined by the tolerance bounds that can be hashed
- __slots__ = ()
- _add_same(other)
Combine two pose tolerances
- _frame
- _inv_projection(projected)
Map spherical to cartesian coordinates
- Parameters:
projected (numpy.ndarray)
- Return type:
- _max_possible
- property _pose_projection_data: Dict[str, Tuple[str] | numpy.ndarray]
Generate a projection that can be used to describe a tolerance.
To be implemented by children - returns the data for the projection of the pose. The tolerance values should be np arrays though, not lists.
- Return type:
Dict[str, Union[Tuple[str], numpy.ndarray]]
- _projection(nominal)
Map cartesian to spherical coordinates
- Parameters:
- Return type:
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
Visualize a (partial) sphere. Meshcat has no support for this, so we use a Mesh to realize it
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
Returns a CartesianSpheric with default tolerances
- enclosing_volume(limits, offset=Transformation.neutral())
Returns an internal representation of a volume object, described by limits and offsets.
- Parameters:
limits (numpy.ndarray) – The limits of the volume, as a 3x2 array. For each row, the first column represents the lower limit, and the second column represents the upper limit.
offset (timor.utilities.transformation.Transformation) – An optional transformation that is applied to the volume to adjust its position and orientation.
- Returns:
An internal representation of the volume.
- Return type:
timor.Volume
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- property stacked: numpy.ndarray
The tolerances stacked in a 3x2 array
- Return type:
- to_projection()
A dictionary that can be used to specify this tolerance as a tolerated pose projection.
Format: Dictionary with
projection: (proj_0, …, proj_n) <<Tuple of strings>>,
tolerance: (tol_0, …, tol_n) <<Tuple of 2-tuples of tolerances>>
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- valid(desired, real)
For cartesian tolerance, we can check if the tolerance is within the enclosing Volume
- Parameters:
desired (timor.utilities.transformation.TransformationLike)
real (timor.utilities.transformation.TransformationLike)
- Return type:
- property valid_random_deviation: timor.utilities.transformation.Transformation
Used to generate a random but still valid transformation.
Returns a random deviation/distortion that would still satisfy the tolerance, distributed uniformly in the solution space. Useful for sampling valid positions. Always returns a Transformation.
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize the tolerance in a MeshcatVisualizer
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer) – A meshcat visualizer instance to display the tolerance in.
transform (numpy.ndarray) – The nominal position for which the tolerance is specified
name (Optional[str]) – A display name for the tolerance. Will be set to a random name if not given.
custom_material (Optional[meshcat.geometry.Material]) – Tolerances are displayed in transparent green – a custom material can change the default appearance
- class timor.task.Tolerance.CartesianXYZ(x, y, z, frame=NOMINAL_FRAME)

Axis-aligned cartesian tolerance.
Defines a box-shaped tolerance
- Parameters:
x (Union[List[float], Tuple[float, float], numpy.ndarray]) – Tolerances for x. Usually expected to be of format [negative, positive]
y (Union[List[float], Tuple[float, float], numpy.ndarray]) – Tolerances for y. Usually expected to be of format [negative, positive]
z (Union[List[float], Tuple[float, float], numpy.ndarray]) – Tolerances for z. Usually expected to be of format [negative, positive]
frame (timor.utilities.frames.Frame)
- CorrespondingVolumeType
- __add__(other)
Custom add method to deal with cartesian/cylinder combinations
Overwrite behavior if the other class is a cartesian with a z-tolerance only: Then it can be seen as cylindrical as well.
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
Two cartesian tolerances are equal if they have the same tolerance values and dtype
- __hash__()
The class is defined by the tolerance bounds that can be hashed
- __slots__ = ()
- _add_same(other)
Combine two pose tolerances
- _frame
- _inv_projection(projected)
CartesianXYZ works in default cartesian coordinates
- Parameters:
projected (numpy.ndarray)
- Return type:
- _max_possible
- property _pose_projection_data: Dict[str, Tuple[str] | numpy.ndarray]
Generate a projection that can be used to describe a tolerance.
To be implemented by children - returns the data for the projection of the pose. The tolerance values should be np arrays though, not lists.
- Return type:
Dict[str, Union[Tuple[str], numpy.ndarray]]
- _projection(nominal)
CartesianXYZ works in default cartesian coordinates
- Parameters:
- Return type:
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
That’s a box
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
Returns a CartesianXYZ with default tolerances
- enclosing_volume(limits, offset=Transformation.neutral())
Returns an internal representation of a volume object, described by limits and offsets.
- Parameters:
limits (numpy.ndarray) – The limits of the volume, as a 3x2 array. For each row, the first column represents the lower limit, and the second column represents the upper limit.
offset (timor.utilities.transformation.Transformation) – An optional transformation that is applied to the volume to adjust its position and orientation.
- Returns:
An internal representation of the volume.
- Return type:
timor.Volume
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- property stacked: numpy.ndarray
The tolerances stacked in a 3x2 array
- Return type:
- to_projection()
A dictionary that can be used to specify this tolerance as a tolerated pose projection.
Format: Dictionary with
projection: (proj_0, …, proj_n) <<Tuple of strings>>,
tolerance: (tol_0, …, tol_n) <<Tuple of 2-tuples of tolerances>>
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- valid(desired, real)
For cartesian tolerance, we can check if the tolerance is within the enclosing Volume
- Parameters:
desired (timor.utilities.transformation.TransformationLike)
real (timor.utilities.transformation.TransformationLike)
- Return type:
- property valid_random_deviation: timor.utilities.transformation.Transformation
Used to generate a random but still valid transformation.
Returns a random deviation/distortion that would still satisfy the tolerance, distributed uniformly in the solution space. Useful for sampling valid positions. Always returns a Transformation.
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize the tolerance in a MeshcatVisualizer
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer) – A meshcat visualizer instance to display the tolerance in.
transform (numpy.ndarray) – The nominal position for which the tolerance is specified
name (Optional[str]) – A display name for the tolerance. Will be set to a random name if not given.
custom_material (Optional[meshcat.geometry.Material]) – Tolerances are displayed in transparent green – a custom material can change the default appearance
- class timor.task.Tolerance.Composed(tolerances, sample_time_limits=10.0, simplify_combinations=True)

Holds any number of different tolerances and evaluates to true iff all internal tolerances do
A tolerance combining multiple tolerances of various types
- Parameters:
tolerances (Collection[ToleranceBase]) – Any number of tolerance instances
sample_time_limits (float) – The maximum time to find a random valid sample for the composed tolerance
simplify_combinations (bool) – If true, compatible tolerances (e.g. 2 of the same type) will be merged
- __add__(other)
Combine tolerances (logical AND operation)
Adding two tolerances always yields a stronger constraint than either of the summands
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
Two composed tolerances are equal if they contain the same tolerances
- __hash__()
The class is defined by the tolerance bounds that can be hashed
- __slots__ = ()
- _add_same(other)
Combine two composed tolerances
- _internal
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
The geometry representing the tolerance in a visualization and the relative offset to the nominal position
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- add(other, simplify_combinations=True)
Add a new tolerance to this composed tolerance. Other than tha add operator (+), this changes the instance
- Parameters:
other (ToleranceBase) – The tolerance to add
simplify_combinations (bool) – If true, compatible tolerances (e.g. 2 of the same type) will be merged
- Return type:
None
- classmethod default()
This cannot be done
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- time_limit = 10.0
- to_projection()
Projects all internal tolerances
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- property tolerances: Set[ToleranceBase]
The internal tolerances
- Return type:
Set[ToleranceBase]
- valid(desired, real)
Is valid if all internal tolerances are valid
- Parameters:
desired (Union[numpy.ndarray, timor.utilities.transformation.TransformationLike])
real (Union[numpy.ndarray, timor.utilities.transformation.TransformationLike])
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize all internal tolerances, with a slightly different color than the default to distinguish them
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer)
transform (numpy.ndarray)
name (Optional[str])
custom_material (Optional[meshcat.geometry.Material])
- timor.task.Tolerance.DEFAULT_SPATIAL
- class timor.task.Tolerance.Rotation(frame=NOMINAL_FRAME, *args)

Rotation tolerances based on projections of a 4x4 transformation - implements projections.
This class does not provide much functionality on its own, but it’s useful to have a rotation super-class.
- Parameters:
frame (timor.utilities.frames.Frame)
- CorrespondingVolumeType: Type[timor.Volume] = None
- __add__(other)
Combine tolerances (logical AND operation)
Adding two tolerances always yields a stronger constraint than either of the summands
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
Two cartesian tolerances are equal if they have the same tolerance values and dtype
- __hash__()
The class is defined by the tolerance bounds that can be hashed
- __slots__ = ()
- _add_same(other)
Combine two pose tolerances
- _frame
- abstractmethod _inv_projection(projected)
Inverse to _projection
Maps a projected element from the tolerances projection space to a placement, being offset from the origin by the values defined in the projection space.
- Parameters:
projected (numpy.ndarray)
- Return type:
- _max_possible: numpy.ndarray
- property _pose_projection_data: Dict[str, Tuple[str] | numpy.ndarray]
- Abstractmethod:
- Return type:
Dict[str, Union[Tuple[str], numpy.ndarray]]
Generate a projection that can be used to describe a tolerance.
To be implemented by children - returns the data for the projection of the pose. The tolerance values should be np arrays though, not lists.
- abstractmethod _projection(nominal)
Maps a placement to the projection space of the tolerance
- Parameters:
- Return type:
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
The geometry representing the tolerance in a visualization and the relative offset to the nominal position
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
- Abstractmethod:
Default tolerance, e.g. for a cartesian tolerance that is 0.001 for all dimensions
- enclosing_volume(limits, offset=Transformation.neutral())
Returns an internal representation of a volume object, described by limits and offsets.
- Parameters:
limits (numpy.ndarray) – The limits of the volume, as a 3x2 array. For each row, the first column represents the lower limit, and the second column represents the upper limit.
offset (timor.utilities.transformation.Transformation) – An optional transformation that is applied to the volume to adjust its position and orientation.
- Returns:
An internal representation of the volume.
- Return type:
timor.Volume
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- property stacked: numpy.ndarray
- Abstractmethod:
- Return type:
The tolerances stacked in an array of dimensions (num_projections, 2)
- to_projection()
A dictionary that can be used to specify this tolerance as a tolerated pose projection.
Format: Dictionary with
projection: (proj_0, …, proj_n) <<Tuple of strings>>,
tolerance: (tol_0, …, tol_n) <<Tuple of 2-tuples of tolerances>>
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- valid(desired, real)
Public interface, makes sure child classes only work on (3,) shaped points
- Parameters:
desired (timor.utilities.transformation.TransformationLike)
real (timor.utilities.transformation.TransformationLike)
- Return type:
- property valid_random_deviation: timor.utilities.transformation.Transformation
Used to generate a random but still valid transformation.
Returns a random deviation/distortion that would still satisfy the tolerance, distributed uniformly in the solution space. Useful for sampling valid positions. Always returns a Transformation.
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize the tolerance in a MeshcatVisualizer
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer) – A meshcat visualizer instance to display the tolerance in.
transform (numpy.ndarray) – The nominal position for which the tolerance is specified
name (Optional[str]) – A display name for the tolerance. Will be set to a random name if not given.
custom_material (Optional[meshcat.geometry.Material]) – Tolerances are displayed in transparent green – a custom material can change the default appearance
- class timor.task.Tolerance.RotationAbsolute(theta, frame=NOMINAL_FRAME)

Constrains the norm of all valid rotations in axis-angles (defines the maximum allowed absolute rotation).
Any rotation can be expressed by exactly one axis and one angle. This tolerance class constrains the angle, irrespective of the axis. In the space of 3D-axis angle rotations $R in mathbb{R}^3$, this tolerance defines a sphere of radius theta around the origin. All rotations with an axis-angle representation within this sphere are valid. :ref: https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation
Defines a maximum absolute rotation tolerance.
- Parameters:
theta (Union[numpy.ndarray, float]) – The maximum allowed absolute rotation in radians. Theoretically, one could define this tolerance with a lower/upper limit structure to also define a minimum rotation needed. This is barely useful though, so other than the other tolerances, this one is defined by a single value.
frame (timor.utilities.frames.Frame)
- CorrespondingVolumeType: Type[timor.Volume] = None
- __add__(other)
Combine tolerances (logical AND operation)
Adding two tolerances always yields a stronger constraint than either of the summands
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
Two cartesian tolerances are equal if they have the same tolerance values and dtype
- __hash__()
The class is defined by the tolerance bounds that can be hashed
- __slots__ = ()
- _add_same(other)
Combine two pose tolerances
- _frame
- _inv_projection(projected)
The projection is not injective, so we this inverse is not a true inverse but includes randomness.
- Parameters:
projected (numpy.ndarray)
- Return type:
- _max_possible
- property _pose_projection_data: Dict[str, Tuple[str] | numpy.ndarray]
Generate a projection that can be used to describe a tolerance.
To be implemented by children - returns the data for the projection of the pose. The tolerance values should be np arrays though, not lists.
- Return type:
Dict[str, Union[Tuple[str], numpy.ndarray]]
- _projection(nominal)
We project any transformation to its axis angle.
- Parameters:
- Return type:
- _theta: numpy.ndarray
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
The geometry representing the tolerance in a visualization and the relative offset to the nominal position
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
Default absolute rotation tolerance, allows a deviation of at most 1/2 degree.
- enclosing_volume(limits, offset=Transformation.neutral())
It does not make sense to obtain a spatial volume from a rotation representation from here.
The rotation tolerance does not actually represent a volume in the spatial sense, but rather a range of possible rotations. Hence, we cannot obtain a typical volume defined in the representation through a direct conversion.
- Parameters:
limits (numpy.ndarray)
- Return type:
timor.Volume
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- property stacked: numpy.ndarray
Just theta
- Return type:
- to_projection()
A dictionary that can be used to specify this tolerance as a tolerated pose projection.
Format: Dictionary with
projection: (proj_0, …, proj_n) <<Tuple of strings>>,
tolerance: (tol_0, …, tol_n) <<Tuple of 2-tuples of tolerances>>
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- valid(desired, real)
Public interface, makes sure child classes only work on (3,) shaped points
- Parameters:
desired (timor.utilities.transformation.TransformationLike)
real (timor.utilities.transformation.TransformationLike)
- Return type:
- property valid_random_deviation: timor.utilities.transformation.Transformation
Used to generate a random but still valid transformation.
Returns a random deviation/distortion that would still satisfy the tolerance, distributed uniformly in the solution space. Useful for sampling valid positions. Always returns a Transformation.
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize the tolerance in a MeshcatVisualizer
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer) – A meshcat visualizer instance to display the tolerance in.
transform (numpy.ndarray) – The nominal position for which the tolerance is specified
name (Optional[str]) – A display name for the tolerance. Will be set to a random name if not given.
custom_material (Optional[meshcat.geometry.Material]) – Tolerances are displayed in transparent green – a custom material can change the default appearance
- class timor.task.Tolerance.RotationAxis(n_x, n_y, n_z, frame=NOMINAL_FRAME)

Constrains the maximum rotation around an interval of user-defined axes.
Any rotation can be expressed by exactly one axis and one angle. This tolerance class constrains the dot direction and extend of a relative rotation between an intended and a real orientation. In the space of 3D-axis angle rotations $R in mathbb{R}^3$, this tolerance defines a hyper-rectangle centered in the origin. All rotations with an axis-angle representation within this rectangle are valid. :ref: https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation
Defines the interval of allowed axis angle rotations.
If the relative rotation between desired and real pose is represented by the axis-angle representation \(v = a_x, a_y, a_z\), where \(\norm{v} = \theta\) is the angle of rotation, then this tolerance constrains the scaled elements of \(v\) to be within the given intervals.
The axis angle tolerance is defined by three parameters:
- Parameters:
n_x (Union[List[float], Tuple[float, float], numpy.ndarray]) – Lower and upper tolerance for the x-part of the scaled rotation axis.
n_y (Union[List[float], Tuple[float, float], numpy.ndarray]) – Lower and upper tolerance for the y-part of the scaled rotation axis.
n_z (Union[List[float], Tuple[float, float], numpy.ndarray]) – Lower and upper tolerance for the z-part of the scaled rotation axis.
frame (timor.utilities.frames.Frame)
- CorrespondingVolumeType: Type[timor.Volume] = None
- __add__(other)
Combine tolerances (logical AND operation)
Adding two tolerances always yields a stronger constraint than either of the summands
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
Two cartesian tolerances are equal if they have the same tolerance values and dtype
- __hash__()
The class is defined by the tolerance bounds that can be hashed
- __slots__ = ()
- _add_same(other)
Combine two pose tolerances
- _frame
- _inv_projection(projected)
4x1 axis-angle representation -> placement.
- Parameters:
projected (numpy.ndarray)
- Return type:
- _max_possible
- _n_x: numpy.ndarray
- _n_y: numpy.ndarray
- _n_z: numpy.ndarray
- property _pose_projection_data: Dict[str, Tuple[str] | numpy.ndarray]
Generate a projection that can be used to describe a tolerance.
To be implemented by children - returns the data for the projection of the pose. The tolerance values should be np arrays though, not lists.
- Return type:
Dict[str, Union[Tuple[str], numpy.ndarray]]
- _projection(nominal)
4x1 axis-angle representation.
- Parameters:
- Return type:
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
The geometry representing the tolerance in a visualization and the relative offset to the nominal position
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
Default axis-angle tolerance, allows a deviation of at most 1/2 degree around each axis.
Note that, opposed to RotationAbsolute, this tolerance can lead to rotations larger than the half degree around an axis, as long as neither of the individual rotation around x, y, z-axis exceeds the threshold.
- enclosing_volume(limits, offset=Transformation.neutral())
Returns an internal representation of a volume object, described by limits and offsets.
- Parameters:
limits (numpy.ndarray) – The limits of the volume, as a 3x2 array. For each row, the first column represents the lower limit, and the second column represents the upper limit.
offset (timor.utilities.transformation.Transformation) – An optional transformation that is applied to the volume to adjust its position and orientation.
- Returns:
An internal representation of the volume.
- Return type:
timor.Volume
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- property stacked: numpy.ndarray
Lower and upper bounds for axis angles.
- Return type:
- to_projection()
A dictionary that can be used to specify this tolerance as a tolerated pose projection.
Format: Dictionary with
projection: (proj_0, …, proj_n) <<Tuple of strings>>,
tolerance: (tol_0, …, tol_n) <<Tuple of 2-tuples of tolerances>>
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- valid(desired, real)
Public interface, makes sure child classes only work on (3,) shaped points
- Parameters:
desired (timor.utilities.transformation.TransformationLike)
real (timor.utilities.transformation.TransformationLike)
- Return type:
- property valid_random_deviation: timor.utilities.transformation.Transformation
Used to generate a random but still valid transformation.
Returns a random deviation/distortion that would still satisfy the tolerance, distributed uniformly in the solution space. Useful for sampling valid positions. Always returns a Transformation.
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize the tolerance in a MeshcatVisualizer
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer) – A meshcat visualizer instance to display the tolerance in.
transform (numpy.ndarray) – The nominal position for which the tolerance is specified
name (Optional[str]) – A display name for the tolerance. Will be set to a random name if not given.
custom_material (Optional[meshcat.geometry.Material]) – Tolerances are displayed in transparent green – a custom material can change the default appearance
- class timor.task.Tolerance.Spatial(frame=NOMINAL_FRAME, *args)

Any tolerance that tolerates spatial attributes (placements).
Sanity checks
- Parameters:
frame (timor.utilities.frames.Frame)
- CorrespondingVolumeType: Type[timor.Volume] = None
- __add__(other)
Combine tolerances (logical AND operation)
Adding two tolerances always yields a stronger constraint than either of the summands
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
Two cartesian tolerances are equal if they have the same tolerance values and dtype
- __hash__()
The class is defined by the tolerance bounds that can be hashed
- __slots__ = ()
- _add_same(other)
Combine two pose tolerances
- _frame
- abstractmethod _inv_projection(projected)
Inverse to _projection
Maps a projected element from the tolerances projection space to a placement, being offset from the origin by the values defined in the projection space.
- Parameters:
projected (numpy.ndarray)
- Return type:
- _max_possible: numpy.ndarray
- property _pose_projection_data: Dict[str, Tuple[str] | numpy.ndarray]
- Abstractmethod:
- Return type:
Dict[str, Union[Tuple[str], numpy.ndarray]]
Generate a projection that can be used to describe a tolerance.
To be implemented by children - returns the data for the projection of the pose. The tolerance values should be np arrays though, not lists.
- abstractmethod _projection(nominal)
Maps a placement to the projection space of the tolerance
- Parameters:
- Return type:
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
The geometry representing the tolerance in a visualization and the relative offset to the nominal position
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
- Abstractmethod:
Default tolerance, e.g. for a cartesian tolerance that is 0.001 for all dimensions
- enclosing_volume(limits, offset=Transformation.neutral())
Returns an internal representation of a volume object, described by limits and offsets.
- Parameters:
limits (numpy.ndarray) – The limits of the volume, as a 3x2 array. For each row, the first column represents the lower limit, and the second column represents the upper limit.
offset (timor.utilities.transformation.Transformation) – An optional transformation that is applied to the volume to adjust its position and orientation.
- Returns:
An internal representation of the volume.
- Return type:
timor.Volume
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- property stacked: numpy.ndarray
- Abstractmethod:
- Return type:
The tolerances stacked in an array of dimensions (num_projections, 2)
- to_projection()
A dictionary that can be used to specify this tolerance as a tolerated pose projection.
Format: Dictionary with
projection: (proj_0, …, proj_n) <<Tuple of strings>>,
tolerance: (tol_0, …, tol_n) <<Tuple of 2-tuples of tolerances>>
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- valid(desired, real)
Public interface, makes sure child classes only work on (3,) shaped points
- Parameters:
desired (timor.utilities.transformation.TransformationLike)
real (timor.utilities.transformation.TransformationLike)
- Return type:
- property valid_random_deviation: timor.utilities.transformation.Transformation
Used to generate a random but still valid transformation.
Returns a random deviation/distortion that would still satisfy the tolerance, distributed uniformly in the solution space. Useful for sampling valid positions. Always returns a Transformation.
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize the tolerance in a MeshcatVisualizer
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer) – A meshcat visualizer instance to display the tolerance in.
transform (numpy.ndarray) – The nominal position for which the tolerance is specified
name (Optional[str]) – A display name for the tolerance. Will be set to a random name if not given.
custom_material (Optional[meshcat.geometry.Material]) – Tolerances are displayed in transparent green – a custom material can change the default appearance
- class timor.task.Tolerance.ToleranceBase

An interface on numeric tolerances between goals and states that can be expressed as np-arrays
- __add__(other)
Combine tolerances (logical AND operation)
Adding two tolerances always yields a stronger constraint than either of the summands
- Parameters:
other (ToleranceBase)
- Return type:
- abstractmethod __eq__(other)
Explicitly fail if not implemented
- abstractmethod __hash__()
Explicitly fail if not implemented
- __slots__ = ()
- abstractmethod _add_same(other)
Used when two tolerances of the same class are used together.
Interface to add a tolerance of the same class to this tolerance. This method is to be called by __add__ and can simplify the combination of multiple tolerances.
- Parameters:
other (ToleranceBase)
- Return type:
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
The geometry representing the tolerance in a visualization and the relative offset to the nominal position
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
- Abstractmethod:
Default tolerance, e.g. for a cartesian tolerance that is 0.001 for all dimensions
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- abstractmethod to_projection()
Describe a tolerance as a projection dictionary
Returns a dictionary that can be dumped in a json to describe the tolerance Inverse operation to from_projection
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- abstractmethod valid(desired, real)
Returns true if <real> is within <desired>’s tolerance (defined by self)
- Parameters:
desired (Union[numpy.ndarray, timor.utilities.transformation.TransformationLike])
real (Union[numpy.ndarray, timor.utilities.transformation.TransformationLike])
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize the tolerance in a MeshcatVisualizer
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer) – A meshcat visualizer instance to display the tolerance in.
transform (numpy.ndarray) – The nominal position for which the tolerance is specified
name (Optional[str]) – A display name for the tolerance. Will be set to a random name if not given.
custom_material (Optional[meshcat.geometry.Material]) – Tolerances are displayed in transparent green – a custom material can change the default appearance
- class timor.task.Tolerance.VectorDistance(tolerance, order=2)

A tolerance of the LN-Distance between two vectors. Default: L2 / Cartesian distance
Create tolerance limiting the distance between two vectors
- Parameters:
- __add__(other)
Combine tolerances (logical AND operation)
Adding two tolerances always yields a stronger constraint than either of the summands
- Parameters:
other (ToleranceBase)
- Return type:
- __eq__(other)
Two Vector distances are equal if they use the same norm and acceptable tolerance
- Parameters:
other – The other Tolerance to compare to
- __hash__()
Vector distance is unique due to order of norm and acceptable tolerance
- __slots__ = ()
- _add_same(other)
Used when two tolerances of the same class are used together.
Interface to add a tolerance of the same class to this tolerance. This method is to be called by __add__ and can simplify the combination of multiple tolerances.
- Parameters:
other (ToleranceBase)
- Return type:
- _visual_color = 65280
- property _visual_geometry: meshcat.geometry.Geometry, timor.utilities.transformation.Transformation
The geometry representing the tolerance in a visualization and the relative offset to the nominal position
- Return type:
(meshcat.geometry.Geometry, timor.utilities.transformation.Transformation)
- _visual_material
- classmethod default()
Default is Euclidean / L2 distance with 1e-4 acceptable distance
- static from_projection(projection, values, frame=NOMINAL_FRAME)
Creates a tolerance from a projection descriptor and an absolute tolerance value.
- Parameters:
projection (str) – The projection descriptor. Valid values: {“x”, “y”, “z”, “r_cyl”, “r_sph”, “theta”, “phi”, “R”, “P”, “Y”, “Alpha”, “Beta”, “Gamma”, “N_x”, “N_y”, “N_z”, “Theta_R”, “A”, “B”, “C”, “D”}
values (Union[List[float], Tuple[float, float], numpy.ndarray]) – The lower and upper bound for the tolerance
frame (timor.utilities.frames.Frame) – The frame in which the tolerance is defined. Defaults to the world frame.
- Returns:
The tolerance class instance
- Return type:
- order = 2
- abstractmethod to_projection()
Create CoBRA conformant dict describing this constraint
- Return type:
Dict[str, Tuple[Union[str, numpy.ndarray], Ellipsis]]
- tolerance
- valid(desired, real)
Return whether desired and real are at most tolerance apart.
- Parameters:
desired (Union[numpy.ndarray]) – Vector to compare to
real (Union[numpy.ndarray]) – Vector to judge
- Return type:
- visualize(viz, transform, name=None, custom_material=None)
Visualize the tolerance in a MeshcatVisualizer
- Parameters:
viz (pinocchio.visualize.MeshcatVisualizer) – A meshcat visualizer instance to display the tolerance in.
transform (numpy.ndarray) – The nominal position for which the tolerance is specified
name (Optional[str]) – A display name for the tolerance. Will be set to a random name if not given.
custom_material (Optional[meshcat.geometry.Material]) – Tolerances are displayed in transparent green – a custom material can change the default appearance