pytransform3d.transform_manager.TransformGraphBase#
- class pytransform3d.transform_manager.TransformGraphBase(strict_check=True, check=True)[source]#
Bases:
ABC
Base class for all graphs of rigid transformations.
- Parameters:
- strict_checkbool, optional (default: True)
Raise a ValueError if the transformation matrix is not numerically close enough to a real transformation matrix. Otherwise we print a warning.
- checkbool, optional (default: True)
Check if transformation matrices are valid and requested nodes exist, which might significantly slow down some operations.
Methods
__init__
([strict_check, check])add_transform
(from_frame, to_frame, A2B)Register a transformation.
Check consistency of the known transformations.
Get number of connected components.
get_transform
(from_frame, to_frame)Request a transformation.
has_frame
(frame)Check if frame has been registered.
remove_frame
(frame)Remove a frame (node) from the graph.
remove_transform
(from_frame, to_frame)Remove a transformation.
Attributes
Rigid transformations between nodes.
- abstract property transforms#
Rigid transformations between nodes.
- has_frame(frame)[source]#
Check if frame has been registered.
- Parameters:
- frameHashable
Frame name
- Returns:
- has_framebool
Frame is registered
- add_transform(from_frame, to_frame, A2B)[source]#
Register a transformation.
- Parameters:
- from_frameHashable
Name of the frame for which the transformation is added in the to_frame coordinate system
- to_frameHashable
Name of the frame in which the transformation is defined
- A2BAny
Transformation from ‘from_frame’ to ‘to_frame’
- Returns:
- selfTransformManager
This object for chaining
- remove_transform(from_frame, to_frame)[source]#
Remove a transformation.
Nothing happens if there is no such transformation.
- Parameters:
- from_frameHashable
Name of the frame for which the transformation is added in the to_frame coordinate system
- to_frameHashable
Name of the frame in which the transformation is defined
- Returns:
- selfTransformManager
This object for chaining
- remove_frame(frame)[source]#
Remove a frame (node) from the graph.
- Parameters:
- frameHashable
The frame to remove.
- Returns:
- selfTransformManager
This object for chaining.
- get_transform(from_frame, to_frame)[source]#
Request a transformation.
- Parameters:
- from_frameHashable
Name of the frame for which the transformation is requested in the to_frame coordinate system
- to_frameHashable
Name of the frame in which the transformation is defined
- Returns:
- A2BAny
Transformation from ‘from_frame’ to ‘to_frame’
- Raises:
- KeyError
If one of the frames is unknown or there is no connection between them
- connected_components()[source]#
Get number of connected components.
If the number is larger than 1 there will be frames without connections.
- Returns:
- n_connected_componentsint
Number of connected components.
- check_consistency()[source]#
Check consistency of the known transformations.
The complexity of this is between \(O(n^2)\) and \(O(n^3)\), where \(n\) is the number of nodes. In graphs where each pair of nodes is directly connected the complexity is \(O(n^2)\). In graphs that are actually paths, the complexity is \(O(n^3)\).
- Returns:
- consistentbool
Is the graph consistent, i.e. is A2B always the same as the inverse of B2A?
Examples using pytransform3d.transform_manager.TransformGraphBase
#
Plot with Respect to Different Reference Frames
Managing Transformations over Time
Probabilistic Product of Exponentials