pytransform3d.transform_manager.TemporalTransformManager#

class pytransform3d.transform_manager.TemporalTransformManager(strict_check=True, check=True)[source]#

Bases: TransformGraphBase

Manage time-varying transformations.

See Graphs of Time-Dependent Transformations for more information.

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.

__init__(strict_check=True, check=True)[source]#

Methods

__init__([strict_check, check])

add_transform(from_frame, to_frame, A2B)

Register a transformation.

check_consistency()

Check consistency of the known transformations.

connected_components()

Get number of connected components.

get_transform(from_frame, to_frame)

Request a transformation.

get_transform_at_time(from_frame, to_frame, time)

Request a transformation at a given time.

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

current_time

Current time at which we evaluate transformations.

transforms

Rigid transformations between nodes.

property current_time#

Current time at which we evaluate transformations.

property transforms#

Rigid transformations between nodes.

get_transform_at_time(from_frame, to_frame, time)[source]#

Request a transformation at a given time.

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

timefloat

Time at which we request the transformation.

Returns:
A2Barray, shape (4, 4)

Transformation from ‘from_frame’ to ‘to_frame’

Raises:
KeyError

If one of the frames is unknown or there is no connection between them

add_transform(from_frame, to_frame, A2B)#

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

check_consistency()#

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?

connected_components()#

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.

get_transform(from_frame, to_frame)#

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

has_frame(frame)#

Check if frame has been registered.

Parameters:
frameHashable

Frame name

Returns:
has_framebool

Frame is registered

remove_frame(frame)#

Remove a frame (node) from the graph.

Parameters:
frameHashable

The frame to remove.

Returns:
selfTransformManager

This object for chaining.

remove_transform(from_frame, to_frame)#

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

Examples using pytransform3d.transform_manager.TemporalTransformManager#

Managing Transformations over Time

Managing Transformations over Time