timor.parameterized

Classes

DHJoint

A parameterizable module that represents one joint as defined by DH / MDH parameters.

ParameterizableBody

A body that has a geometry which is subject to change depending on an arbitrary number of parameters.

ParameterizableBoxBody

A module body composed of a box with parameterizable dimensions

ParameterizableCylinderBody

A module body composed of a cylinder with a parameterizable radius and length

ParameterizableJointModule

Abstract base class for parameterizable modules that contain joints.

ParameterizableModule

A parameterizable module may contain bodies that are subject to change and is non-static until frozen.

ParameterizableMultiBody

A parameterizable multi body is a module body made from multiple generic geometries.

ParameterizableSphereBody

A module body composed of a sphere with a parameterizable radius

ParameterizedCylinderLink

This is a module in cylinder shape with connectors at both ends that can be used to construct a robot.

ParameterizedOrthogonalJoint

This is a module in L-shape with connectors at both ends and a joint in the 'elbow'.

ParameterizedOrthogonalLink

This is a module in L-shape with connectors at both ends that can be used to construct a robot.

ParameterizedStraightJoint

This is a module in cylinder shape with connectors at both ends and a joint in the middle.

Module Contents

class timor.parameterized.DHJoint(header, convention_parameters=(1.0, 1.0, np.pi / 2), convention='DH', radius=1.0, mass_density=1.0, limits=((0, float('inf')), (-float('inf'), float('inf')), (-float('inf'), float('inf')), (-2 * np.pi, 2 * np.pi)), joint_type=TimorJointType.revolute, joint_parameters=None, connector_arguments=None)
Inheritance diagram of timor.parameterized.DHJoint

A parameterizable module that represents one joint as defined by DH / MDH parameters.

Creates a parameterized module defined by DH/MDH parameters. The joint is before or after the composed bodies.

For this module, we assume that there are two bodies: one actual body that, up to the parameters, has an I or L-shape, and one “proxy” body with an empty geometry. These two are connected by a joint. Their order is defined by the convention that can either be DH (the joint is “before the real body” or MDH (the joint is “at the end of the body”).

Parameters:
  • header (timor.Module.ModuleHeader) – The module header for the generated module

  • convention_parameters (Sequence[float, float, float]) – Parameters in order (d, a, alpha)

  • convention (str) – Either DH (Denavit-Hartenberg) or MDH (modified, after Craig)

  • radius (float) – The radius of the cylinder bodies

  • mass_density (float) – The mass density of the bodies’ material (kg/m^3) – assumed to be uniform

  • limits (Sequence[Sequence[float]]) – Optional lower and upper bounds on the radius and parameters (r, d, a, alpha)

  • joint_type (timor.Joints.TimorJointType) – The type of joint to use – currently, needs to be revolute.

  • joint_parameters (Dict[str, any]) – Additional arguments for timor.Joint such as limits or gear ratio; applied to all joints within the module.

  • connector_arguments (Optional[Dict[str, any]]) – Mapping from keyword to 2-tuples of values

__connector_arguments = None
__copy__()

Deactivates the builtin copy method.

__eq__(other)

Equality check for modules. Two modules are equal if they have the same header, bodies, names, and joints.

__getstate__()

For a parameterizable module, we can rely on the default pickling.

__hash__()

Custom hash function for modules that should be uniquely determined by their ID.

__parameter_limits
__setstate__(state)

For a parameterizable module, we can rely on the default pickling.

__slots__ = ()
__str__()

String representation for the module.

_bodies: timor.Bodies.BodySet
_check_unique_connectors()

Sanity check that all connectors are unique

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

static _generate_connectors(ids=('proximal', 'distal'), genders=(Gender.female, Gender.male), types=('', ''), sizes=((), ()))

Generates the connectors for this module.

Parameters:
Return type:

Tuple[timor.Bodies.Connector, Ellipsis]

_get_copy_args()

Returns the arguments to use when copying this module.

Return type:

Tuple

_joint_parameters
_joints: timor.Joints.JointSet
_module_graph: networkx.DiGraph
_radius: float = 1.0
_update_connector_placements()

This updates the connector attached to the actual link

_update_geometry_placements()

Makes sure the two cylinders composing this joint are placed correctly relative to each other.

The body frames are aligned with “beginning” of the geometry here.

_update_joint_placement()

For this module, we assume body coordinate frames to be at the ‘beginning’ of the body

property a: float

The a parameter of the DH/MDH convention.

Return type:

float

property alpha: float

The alpha parameter of the DH/MDH convention.

Return type:

float

property available_connectors: Dict[Tuple[str, str, str], timor.Bodies.Connector]

Returns all connectors of all bodies contained in this module as a mapping ID -> instance

Return type:

Dict[Tuple[str, str, str], timor.Bodies.Connector]

property bodies: timor.Bodies.BodySet

Returns all bodies contained in this module.

Return type:

timor.Bodies.BodySet

build_module_graph()

Builds the directed graph of atomic module elements. See module_graph property for more information.

Return type:

networkx.DiGraph

can_connect(other)

Returns true if at least one of the connectors of this module matches at least one connector of other

Parameters:

other (ModuleBase)

Return type:

bool

property connectors_by_own_id: Dict[str, timor.Bodies.Connector]

Returns a mapping of connector._id values to the instance.

Keep in mind, these are not the composed id’s of the connectors, so they are not unambiguous outside a module!

Return type:

Dict[str, timor.Bodies.Connector]

copy(suffix)

Copies the module and returns the copy.

Parameters:

suffix (str)

Return type:

timor.Module.ModuleBase

property d: float

The d parameter of the DH/MDH convention.

Return type:

float

debug_visualization(viz=None, show_com=True, base_placement=Transformation.neutral())

Do not use this method in proper environment visualizations

Parameters:
  • viz (pinocchio.visualize.MeshcatVisualizer) – MeshcatVisualizer to show debug information in

  • show_com (bool) – show center of mass frame

  • base_placement (numpy.array) – where to show this module in the global frame

Returns:

visualizer object (keep if you want to add more to this)

Return type:

pinocchio.visualize.MeshcatVisualizer

dh_transformation(theta=0)

Computes the DH transformation of this single joint.

Parameters:

theta (float)

Return type:

timor.utilities.transformation.Transformation

freeze()

Returns a static module representation of this module.

Return type:

timor.Module.AtomicModule

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

header: ModuleHeader
property id: str

The unique ID of this module.

Return type:

str

joint
property joints: timor.Joints.JointSet

Returns all joints contained in this module

Return type:

timor.Joints.JointSet

property mass: float

Returns the total mass of the module.

Return type:

float

property module_graph: networkx.DiGraph

The module graph for a parameterizable module has to be recomputed with every resize.

Return type:

networkx.DiGraph

property name: str

Returns the unique name of this module.

Return type:

str

property num_bodies

The number of bodies in this module.

property num_connectors

The number of connectors available in the module.

property num_joints

The number of joints in this module

property parameters: Tuple[float, float, float, float]

Returns the defining parameters (radius, d, a, alpha)

Return type:

Tuple[float, float, float, float]

property radius: float

The radius of the cylinders.

Return type:

float

resize(parameters)

The interface to change the link’s length or radius and adapt the connector placements accordingly.

Parameters:

parameters (Union[Tuple[float, float, float], Tuple[float, float, float, float]]) – A tuple of (radius, d, a, alpha) or (d, a, alpha)

Return type:

None

to_json_data()

Freezes the parameters of this module to serialize it.

Return type:

Dict

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str

class timor.parameterized.ParameterizableBody(body_id, parameters, parameter_limits=None, mass_density=1.0, connectors=(), geometry_placement=Transformation.neutral(), in_module=None)
Inheritance diagram of timor.parameterized.ParameterizableBody

A body that has a geometry which is subject to change depending on an arbitrary number of parameters.

Construct a parameterizable body from a geometry reference and parameters.

A parameterizable body has a fixed geometry type – depending on this type, there is a fixed number of parameters that define the expansion of the geometry in the respective direction. For example, a sphere has a single parameter that defines the radius, a cylinder has two parameters that define the radius and the length, and a box has three parameters that define the expansion in x, y, and z direction.

Parameters:
  • body_id (str) – The unique ID of the body

  • parameters (Iterable[float]) – The number of parameters depends on the geometry type. Their (positive) value defines the expansion of the geometry in the respective direction. For a sphere, this is the radius, for a cylinder, this is the radius and the length, and for a box, this is the expansion in x, y, and z direction.

  • parameter_limits (Optional[Sequence[Sequence[float]]]) – The lower and upper bounds for each parameter. If None is given (default), the bounds are set to [0, inf] for all parameters. Bounds for geometric attributes cannot be negative.

  • mass_density (float) – The mass density of the body (in kg/m^3), implicitly assuming a homogeneous material.

  • connectors (Iterable[timor.Bodies.Connector]) – The connectors of the body - their placement has to be externally and dynamically updated. The connector_placements_valid attribute is used to indicate whether the position of the connectors was updated since the parameters have been changed last time.

  • geometry_placement (timor.utilities.transformation.Transformation) – Parametrized bodies cannot contain composed geometries, so we need to define a relative geometry placement to the origin in order to combine multiple parameterized bodies in a module. This parameter defines the relative transformation between geometry origin and body frame.

  • in_module (timor.Module.ModuleBase) – The module this body is part of. Will be automatically assigned if the body is defined and added to a module later on.

__copy__()

Parameterizable bodies are actually quite easy to copy as geometries are calculated on-the-fly.

__eq__(other)

Parameterizable body equality is given by the original parameters - no need to compute the geometry.

__geometry_type: timor.Geometry.GeometryType = None
__getstate__()

For parameterized bodies, we can rely on the python builtin actually

__hash__()

Hashing is equal to hashes of regular bodies - ID should be unique.

__setstate__(state)

For parameterized bodies, we can rely on the python builtin actually

__slots__ = ()
__str__()

The string representation of a body

Return type:

str

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

_geometry_transformation: timor.utilities.transformation.Transformation
_id: str = ''
_parameter_limits: numpy.array = None
_parameters: List[float]
_visual: timor.Geometry.Geometry | None = None
as_pin_body(placement=Transformation.neutral())

Extracts the body properties that describe a body in a pinocchio robot.

Always places the body in the origin.

Parameters:

placement (timor.utilities.transformation.TransformationLike) – Relative placement of the body to its parent joint

Return type:

PinBody

property collision: timor.Geometry.Geometry
Abstractmethod:

Return type:

timor.Geometry.Geometry

Returns the momentary collision geometry of the body taking the current parameters into account.

For parameterizable bodies, the collision geometry is always the same as the visual geometry. As the visual defaults to collision anyways, we just need to implement the collision geometry here. We implicitly assume that the body frame coincides with the geometry center-of-mass frame.

connector_placements_valid: bool = False
connectors: timor.Bodies.ConnectorSet
freeze()

Freeze the body, i.e. make it immutable by transforming it to an unparameterized body.

Return type:

timor.Bodies.Body

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

property geometry_type: timor.Geometry.GeometryType

The geometry type of the body. Ensured to be in the set of valid geometry types.

Return type:

timor.Geometry.GeometryType

property id: Tuple[None | str, str]

Composed ID: (module ID, body ID)

Return type:

Tuple[Union[None, str], str]

in_module: timor.Module.ModuleBase = None
property inertia: pinocchio.Inertia
Abstractmethod:

Return type:

pinocchio.Inertia

The inertia needs to be dynamically calculated, depending on the geometry.

property mass: float

The mass needs to be dynamically calculated, depending on the geometry expansion.

Return type:

float

mass_density = 1.0
num_parameters: int
property parameter_limits: numpy.array

Returns a copy of the parameter limits of the body.

Return type:

numpy.array

parameter_order: Dict[timor.Geometry.GeometryType, Tuple[str, Ellipsis]]
property parameters: Tuple[float, Ellipsis]

The parameters of the geometry, returned as a tuple to avoid external changes.

Return type:

Tuple[float, Ellipsis]

possible_connections_with(other)

Returns a set of connectors that can connect this with other body.

This method does not check whether the connector IDs of the other body overlap with the connector IDs of this body - this has to be achieved by e.g. putting both bodies in a module or in the same ModulesDB.

Parameters:

other (BodyBase) – Another body

Returns:

A list of matching connector pairs like (this_body_connector, other_body_connector)

Return type:

timor.utilities.dtypes.SingleSet

to_json_data()

Freezes the current body with the currently set parameters and returns the according JSON

Return type:

Dict[str, any]

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str

property visual: timor.Geometry.Geometry

Defaults to collision if not explicitly specified

Return type:

timor.Geometry.Geometry

class timor.parameterized.ParameterizableBoxBody(body_id, parameters, parameter_limits=None, mass_density=1.0, connectors=(), geometry_placement=Transformation.neutral(), in_module=None)
Inheritance diagram of timor.parameterized.ParameterizableBoxBody

A module body composed of a box with parameterizable dimensions

Construct a parameterizable body from a geometry reference and parameters.

A parameterizable body has a fixed geometry type – depending on this type, there is a fixed number of parameters that define the expansion of the geometry in the respective direction. For example, a sphere has a single parameter that defines the radius, a cylinder has two parameters that define the radius and the length, and a box has three parameters that define the expansion in x, y, and z direction.

Parameters:
  • body_id (str) – The unique ID of the body

  • parameters (Iterable[float]) – The number of parameters depends on the geometry type. Their (positive) value defines the expansion of the geometry in the respective direction. For a sphere, this is the radius, for a cylinder, this is the radius and the length, and for a box, this is the expansion in x, y, and z direction.

  • parameter_limits (Optional[Sequence[Sequence[float]]]) – The lower and upper bounds for each parameter. If None is given (default), the bounds are set to [0, inf] for all parameters. Bounds for geometric attributes cannot be negative.

  • mass_density (float) – The mass density of the body (in kg/m^3), implicitly assuming a homogeneous material.

  • connectors (Iterable[timor.Bodies.Connector]) – The connectors of the body - their placement has to be externally and dynamically updated. The connector_placements_valid attribute is used to indicate whether the position of the connectors was updated since the parameters have been changed last time.

  • geometry_placement (timor.utilities.transformation.Transformation) – Parametrized bodies cannot contain composed geometries, so we need to define a relative geometry placement to the origin in order to combine multiple parameterized bodies in a module. This parameter defines the relative transformation between geometry origin and body frame.

  • in_module (timor.Module.ModuleBase) – The module this body is part of. Will be automatically assigned if the body is defined and added to a module later on.

__copy__()

Parameterizable bodies are actually quite easy to copy as geometries are calculated on-the-fly.

__eq__(other)

Parameterizable body equality is given by the original parameters - no need to compute the geometry.

__geometry_type: timor.Geometry.GeometryType = None
__getstate__()

For parameterized bodies, we can rely on the python builtin actually

__hash__()

Hashing is equal to hashes of regular bodies - ID should be unique.

__setstate__(state)

For parameterized bodies, we can rely on the python builtin actually

__slots__ = ()
__str__()

The string representation of a body

Return type:

str

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

_geometry_transformation: timor.utilities.transformation.Transformation
_id: str = ''
_parameter_limits: numpy.array = None
_parameters: List[float]
_visual: timor.Geometry.Geometry | None = None
as_pin_body(placement=Transformation.neutral())

Extracts the body properties that describe a body in a pinocchio robot.

Always places the body in the origin.

Parameters:

placement (timor.utilities.transformation.TransformationLike) – Relative placement of the body to its parent joint

Return type:

PinBody

property collision: timor.Geometry.Box

The collision geometry of the body.

Return type:

timor.Geometry.Box

connector_placements_valid: bool = False
connectors: timor.Bodies.ConnectorSet
freeze()

Freeze the body, i.e. make it immutable by transforming it to an unparameterized body.

Return type:

timor.Bodies.Body

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

geometry_type: timor.Geometry.GeometryType

The geometry type of the body. Ensured to be in the set of valid geometry types.

property id: Tuple[None | str, str]

Composed ID: (module ID, body ID)

Return type:

Tuple[Union[None, str], str]

in_module: timor.Module.ModuleBase = None
property inertia: pinocchio.Inertia

Assuming a homogeneous material, compute the inertia tensor of self for the current parameters

Return type:

pinocchio.Inertia

property mass: float

The mass needs to be dynamically calculated, depending on the geometry expansion.

Return type:

float

mass_density = 1.0
num_parameters: int = 3
property parameter_limits: numpy.array

Returns a copy of the parameter limits of the body.

Return type:

numpy.array

parameter_order: Dict[timor.Geometry.GeometryType, Tuple[str, Ellipsis]]
property parameters: Tuple[float, Ellipsis]

The parameters of the geometry, returned as a tuple to avoid external changes.

Return type:

Tuple[float, Ellipsis]

possible_connections_with(other)

Returns a set of connectors that can connect this with other body.

This method does not check whether the connector IDs of the other body overlap with the connector IDs of this body - this has to be achieved by e.g. putting both bodies in a module or in the same ModulesDB.

Parameters:

other (BodyBase) – Another body

Returns:

A list of matching connector pairs like (this_body_connector, other_body_connector)

Return type:

timor.utilities.dtypes.SingleSet

to_json_data()

Freezes the current body with the currently set parameters and returns the according JSON

Return type:

Dict[str, any]

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str

property visual: timor.Geometry.Geometry

Defaults to collision if not explicitly specified

Return type:

timor.Geometry.Geometry

property x: float

The x dimension of the box.

Return type:

float

property y: float

The y dimension of the box.

Return type:

float

property z: float

The z dimension of the box.

Return type:

float

class timor.parameterized.ParameterizableCylinderBody(body_id, parameters, parameter_limits=None, mass_density=1.0, connectors=(), geometry_placement=Transformation.neutral(), in_module=None)
Inheritance diagram of timor.parameterized.ParameterizableCylinderBody

A module body composed of a cylinder with a parameterizable radius and length

Construct a parameterizable body from a geometry reference and parameters.

A parameterizable body has a fixed geometry type – depending on this type, there is a fixed number of parameters that define the expansion of the geometry in the respective direction. For example, a sphere has a single parameter that defines the radius, a cylinder has two parameters that define the radius and the length, and a box has three parameters that define the expansion in x, y, and z direction.

Parameters:
  • body_id (str) – The unique ID of the body

  • parameters (Iterable[float]) – The number of parameters depends on the geometry type. Their (positive) value defines the expansion of the geometry in the respective direction. For a sphere, this is the radius, for a cylinder, this is the radius and the length, and for a box, this is the expansion in x, y, and z direction.

  • parameter_limits (Optional[Sequence[Sequence[float]]]) – The lower and upper bounds for each parameter. If None is given (default), the bounds are set to [0, inf] for all parameters. Bounds for geometric attributes cannot be negative.

  • mass_density (float) – The mass density of the body (in kg/m^3), implicitly assuming a homogeneous material.

  • connectors (Iterable[timor.Bodies.Connector]) – The connectors of the body - their placement has to be externally and dynamically updated. The connector_placements_valid attribute is used to indicate whether the position of the connectors was updated since the parameters have been changed last time.

  • geometry_placement (timor.utilities.transformation.Transformation) – Parametrized bodies cannot contain composed geometries, so we need to define a relative geometry placement to the origin in order to combine multiple parameterized bodies in a module. This parameter defines the relative transformation between geometry origin and body frame.

  • in_module (timor.Module.ModuleBase) – The module this body is part of. Will be automatically assigned if the body is defined and added to a module later on.

__copy__()

Parameterizable bodies are actually quite easy to copy as geometries are calculated on-the-fly.

__eq__(other)

Parameterizable body equality is given by the original parameters - no need to compute the geometry.

__geometry_type: timor.Geometry.GeometryType
__getstate__()

For parameterized bodies, we can rely on the python builtin actually

__hash__()

Hashing is equal to hashes of regular bodies - ID should be unique.

__setstate__(state)

For parameterized bodies, we can rely on the python builtin actually

__slots__ = ()
__str__()

The string representation of a body

Return type:

str

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

_geometry_transformation: timor.utilities.transformation.Transformation
_id: str = ''
_parameter_limits: numpy.array = None
_parameters: List[float]
_visual: timor.Geometry.Geometry | None = None
as_pin_body(placement=Transformation.neutral())

Extracts the body properties that describe a body in a pinocchio robot.

Always places the body in the origin.

Parameters:

placement (timor.utilities.transformation.TransformationLike) – Relative placement of the body to its parent joint

Return type:

PinBody

property collision: timor.Geometry.Cylinder

The collision geometry of the body.

Return type:

timor.Geometry.Cylinder

connector_placements_valid: bool = False
connectors: timor.Bodies.ConnectorSet
freeze()

Freeze the body, i.e. make it immutable by transforming it to an unparameterized body.

Return type:

timor.Bodies.Body

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

property geometry_type: timor.Geometry.GeometryType

The geometry type of the body. Ensured to be in the set of valid geometry types.

Return type:

timor.Geometry.GeometryType

property id: Tuple[None | str, str]

Composed ID: (module ID, body ID)

Return type:

Tuple[Union[None, str], str]

in_module: timor.Module.ModuleBase = None
property inertia: pinocchio.Inertia

Assuming a homogeneous material, compute the inertia tensor of self for the current parameters

Return type:

pinocchio.Inertia

property l: float

The length of the cylinder.

Return type:

float

property mass: float

The mass needs to be dynamically calculated, depending on the geometry expansion.

Return type:

float

mass_density = 1.0
num_parameters: int = 2
property parameter_limits: numpy.array

Returns a copy of the parameter limits of the body.

Return type:

numpy.array

parameter_order: Dict[timor.Geometry.GeometryType, Tuple[str, Ellipsis]]
property parameters: Tuple[float, Ellipsis]

The parameters of the geometry, returned as a tuple to avoid external changes.

Return type:

Tuple[float, Ellipsis]

possible_connections_with(other)

Returns a set of connectors that can connect this with other body.

This method does not check whether the connector IDs of the other body overlap with the connector IDs of this body - this has to be achieved by e.g. putting both bodies in a module or in the same ModulesDB.

Parameters:

other (BodyBase) – Another body

Returns:

A list of matching connector pairs like (this_body_connector, other_body_connector)

Return type:

timor.utilities.dtypes.SingleSet

property r: float

The radius of the cylinder.

Return type:

float

to_json_data()

Freezes the current body with the currently set parameters and returns the according JSON

Return type:

Dict[str, any]

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str

property visual: timor.Geometry.Geometry

Defaults to collision if not explicitly specified

Return type:

timor.Geometry.Geometry

class timor.parameterized.ParameterizableJointModule(header, bodies, parameters, joint_parameters, joints)
Inheritance diagram of timor.parameterized.ParameterizableJointModule

Abstract base class for parameterizable modules that contain joints.

This mainly checks that joint parameters are valid.

Parameters:
__copy__()

Deactivates the builtin copy method.

__eq__(other)

Equality check for modules. Two modules are equal if they have the same header, bodies, names, and joints.

__getstate__()

For a parameterizable module, we can rely on the default pickling.

__hash__()

Custom hash function for modules that should be uniquely determined by their ID.

__setstate__(state)

For a parameterizable module, we can rely on the default pickling.

__slots__ = ()
__str__()

String representation for the module.

_bodies: timor.Bodies.BodySet
_check_unique_connectors()

Sanity check that all connectors are unique

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

static _generate_connectors(ids=('proximal', 'distal'), genders=(Gender.female, Gender.male), types=('', ''), sizes=((), ()))

Generates the connectors for this module.

Parameters:
Return type:

Tuple[timor.Bodies.Connector, Ellipsis]

abstractmethod _get_copy_args()

Returns the arguments for the copy constructor.

Return type:

Tuple

_joint_parameters
_joints: timor.Joints.JointSet
_module_graph: networkx.DiGraph
abstractmethod _update_connector_placements()

Based on the current body parameters, updates the placements of the connectors.

abstractmethod _update_joint_placement()

Makes sure the joint is always placed in the middle of the module.

property available_connectors: Dict[Tuple[str, str, str], timor.Bodies.Connector]

Returns all connectors of all bodies contained in this module as a mapping ID -> instance

Return type:

Dict[Tuple[str, str, str], timor.Bodies.Connector]

property bodies: timor.Bodies.BodySet

Returns all bodies contained in this module.

Return type:

timor.Bodies.BodySet

build_module_graph()

Builds the directed graph of atomic module elements. See module_graph property for more information.

Return type:

networkx.DiGraph

can_connect(other)

Returns true if at least one of the connectors of this module matches at least one connector of other

Parameters:

other (ModuleBase)

Return type:

bool

property connectors_by_own_id: Dict[str, timor.Bodies.Connector]

Returns a mapping of connector._id values to the instance.

Keep in mind, these are not the composed id’s of the connectors, so they are not unambiguous outside a module!

Return type:

Dict[str, timor.Bodies.Connector]

copy(suffix)

Copies the module and returns the copy.

Parameters:

suffix (str)

Return type:

timor.Module.ModuleBase

debug_visualization(viz=None, show_com=True, base_placement=Transformation.neutral())

Do not use this method in proper environment visualizations

Parameters:
  • viz (pinocchio.visualize.MeshcatVisualizer) – MeshcatVisualizer to show debug information in

  • show_com (bool) – show center of mass frame

  • base_placement (numpy.array) – where to show this module in the global frame

Returns:

visualizer object (keep if you want to add more to this)

Return type:

pinocchio.visualize.MeshcatVisualizer

freeze()

Returns a static module representation of this module.

Return type:

timor.Module.AtomicModule

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

header: ModuleHeader
property id: str

The unique ID of this module.

Return type:

str

property joints: timor.Joints.JointSet

Returns all joints contained in this module

Return type:

timor.Joints.JointSet

property mass: float

Returns the total mass of the module.

Return type:

float

property module_graph: networkx.DiGraph

The module graph for a parameterizable module has to be recomputed with every resize.

Return type:

networkx.DiGraph

property name: str

Returns the unique name of this module.

Return type:

str

property num_bodies

The number of bodies in this module.

property num_connectors

The number of connectors available in the module.

property num_joints

The number of joints in this module

property parameters: Tuple[float, Ellipsis]
Abstractmethod:

Return type:

Tuple[float, Ellipsis]

Returns the parameters of this module.

abstractmethod resize(parameters)

Resizes the module according to the given parameters and updates the connector placements.

Parameters:

parameters (Tuple[float, Ellipsis])

Return type:

None

to_json_data()

Freezes the parameters of this module to serialize it.

Return type:

Dict

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str

class timor.parameterized.ParameterizableModule(header, bodies, joints, parameters)
Inheritance diagram of timor.parameterized.ParameterizableModule

A parameterizable module may contain bodies that are subject to change and is non-static until frozen.

Parameterizable modules can be dynamically resized. The automatic calculation of dynamic properties happens on the basis of the inherent parameterizable bodies – however, as the connector placement must also dynamically be re-computed with every resizing, only simple geometries are supported.

Creates a parameterized module.

Parameters:
__copy__()

Deactivates the builtin copy method.

__eq__(other)

Equality check for modules. Two modules are equal if they have the same header, bodies, names, and joints.

__getstate__()

For a parameterizable module, we can rely on the default pickling.

__hash__()

Custom hash function for modules that should be uniquely determined by their ID.

__setstate__(state)

For a parameterizable module, we can rely on the default pickling.

__slots__ = ()
__str__()

String representation for the module.

_bodies: timor.Bodies.BodySet
_check_unique_connectors()

Sanity check that all connectors are unique

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

static _generate_connectors(ids=('proximal', 'distal'), genders=(Gender.female, Gender.male), types=('', ''), sizes=((), ()))

Generates the connectors for this module.

Parameters:
Return type:

Tuple[timor.Bodies.Connector, Ellipsis]

abstractmethod _get_copy_args()

Returns the arguments for the copy constructor.

Return type:

Tuple

_joints: timor.Joints.JointSet
_module_graph: networkx.DiGraph
abstractmethod _update_connector_placements()

Based on the current body parameters, updates the placements of the connectors.

property available_connectors: Dict[Tuple[str, str, str], timor.Bodies.Connector]

Returns all connectors of all bodies contained in this module as a mapping ID -> instance

Return type:

Dict[Tuple[str, str, str], timor.Bodies.Connector]

property bodies: timor.Bodies.BodySet

Returns all bodies contained in this module.

Return type:

timor.Bodies.BodySet

build_module_graph()

Builds the directed graph of atomic module elements. See module_graph property for more information.

Return type:

networkx.DiGraph

can_connect(other)

Returns true if at least one of the connectors of this module matches at least one connector of other

Parameters:

other (ModuleBase)

Return type:

bool

property connectors_by_own_id: Dict[str, timor.Bodies.Connector]

Returns a mapping of connector._id values to the instance.

Keep in mind, these are not the composed id’s of the connectors, so they are not unambiguous outside a module!

Return type:

Dict[str, timor.Bodies.Connector]

copy(suffix)

Copies the module and returns the copy.

Parameters:

suffix (str)

Return type:

timor.Module.ModuleBase

debug_visualization(viz=None, show_com=True, base_placement=Transformation.neutral())

Do not use this method in proper environment visualizations

Parameters:
  • viz (pinocchio.visualize.MeshcatVisualizer) – MeshcatVisualizer to show debug information in

  • show_com (bool) – show center of mass frame

  • base_placement (numpy.array) – where to show this module in the global frame

Returns:

visualizer object (keep if you want to add more to this)

Return type:

pinocchio.visualize.MeshcatVisualizer

freeze()

Returns a static module representation of this module.

Return type:

timor.Module.AtomicModule

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

header: ModuleHeader
property id: str

The unique ID of this module.

Return type:

str

property joints: timor.Joints.JointSet

Returns all joints contained in this module

Return type:

timor.Joints.JointSet

property mass: float

Returns the total mass of the module.

Return type:

float

property module_graph: networkx.DiGraph

The module graph for a parameterizable module has to be recomputed with every resize.

Return type:

networkx.DiGraph

property name: str

Returns the unique name of this module.

Return type:

str

property num_bodies

The number of bodies in this module.

property num_connectors

The number of connectors available in the module.

property num_joints

The number of joints in this module

property parameters: Tuple[float, Ellipsis]
Abstractmethod:

Return type:

Tuple[float, Ellipsis]

Returns the parameters of this module.

abstractmethod resize(parameters)

Resizes the module according to the given parameters and updates the connector placements.

Parameters:

parameters (Tuple[float, Ellipsis])

Return type:

None

to_json_data()

Freezes the parameters of this module to serialize it.

Return type:

Dict

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str

class timor.parameterized.ParameterizableMultiBody(body_id, geometry_types, parameters, parameter_limits=None, mass_density=1.0, connectors=(), geometry_placements=None, in_module=None)
Inheritance diagram of timor.parameterized.ParameterizableMultiBody

A parameterizable multi body is a module body made from multiple generic geometries.

Initialize a parameterizable body composed of multiple geometries that are placed relative to self’s origin.

A ParameterizableMultiBody can contain an arbitrary number of geometries that are allowed for a ParameterizableBody. Each one of them has a placement transformation relative to the origin of the origin. The inertia, mass and volume of the body are calculated as the sum of the corresponding values of the geometries.

Parameters:
  • body_id (str) – The id of the body

  • geometry_types (Sequence[timor.Geometry.GeometryType]) – The types of the geometries composing this body.

  • parameters (Iterable[float]) – The parameters of the geometries, flattened and in the order the geometries are given

  • parameter_limits (Optional[Sequence[Sequence[float]]]) – The limits of the parameters, flattened and in the same order as parameters (n x 2)

  • mass_density (float) – The mass density of the body - uniform for all geometries

  • geometry_placements (Iterable[timor.utilities.transformation.Transformation]) – The placement transformations between body frame and center of the geometries. They are given in the order of geometry_types. Placements do not automatically change when geometry parameters do.

  • connectors (Iterable[timor.Bodies.Connector])

  • in_module (timor.Module.ModuleBase)

__copy__()

Parameterizable bodies are actually quite easy to copy as geometries are calculated on-the-fly.

__eq__(other)

Parameterizable body equality is given by the original parameters - no need to compute the geometry.

__geometry_type: timor.Geometry.GeometryType = None
__getstate__()

For parameterized bodies, we can rely on the python builtin actually

__hash__()

Hashing is equal to hashes of regular bodies - ID should be unique.

__setstate__(state)

For parameterized bodies, we can rely on the python builtin actually

__slots__ = ()
__str__()

The string representation of a body

Return type:

str

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

_geometry_transformation: Tuple[timor.utilities.transformation.Transformation]
_id: str = ''
_parameter_limits: numpy.array = None
_parameters: List[float]
_visual: timor.Geometry.Geometry | None = None
as_pin_body(placement=Transformation.neutral())

Extracts the body properties that describe a body in a pinocchio robot.

Always places the body in the origin.

Parameters:

placement (timor.utilities.transformation.TransformationLike) – Relative placement of the body to its parent joint

Return type:

PinBody

property collision: timor.Geometry.ComposedGeometry

Returns the collision geometry of the body.

Return type:

timor.Geometry.ComposedGeometry

composing_geometry_types: Tuple[timor.Geometry.GeometryType]
connector_placements_valid: bool = False
connectors: timor.Bodies.ConnectorSet
freeze()

Freeze the body, i.e. make it immutable by transforming it to an unparameterized body.

Return type:

timor.Bodies.Body

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

property geometry_placements: Tuple[timor.utilities.transformation.Transformation]

Returns the placement transformations between body frame and geometry reference frames.

Return type:

Tuple[timor.utilities.transformation.Transformation]

geometry_type: timor.Geometry.GeometryType

The geometry type of the body. Ensured to be in the set of valid geometry types.

geometry_type_to_class: Dict[timor.Geometry.GeometryType, Type[ParameterizableBody]]
static get_num_parameters(gt)

Returns the number of parameters necessary to define the given geometry type.

Parameters:

gt (timor.Geometry.GeometryType)

Return type:

int

property id: Tuple[None | str, str]

Composed ID: (module ID, body ID)

Return type:

Tuple[Union[None, str], str]

in_module: timor.Module.ModuleBase = None
property inertia: pinocchio.Inertia

The inertia is calculated as the sum of the inertia of the composing geometries.

Return type:

pinocchio.Inertia

property mass: float

The mass needs to be dynamically calculated, depending on the geometry expansion.

Return type:

float

mass_density = 1.0
num_geometries
property num_parameters: int

Returns the number of parameters necessary to define all geometries for this body.

Return type:

int

property parameter_limits: numpy.array

Returns a copy of the parameter limits of the body.

Return type:

numpy.array

parameter_order: Dict[timor.Geometry.GeometryType, Tuple[str, Ellipsis]]
property parameters: Tuple[float, Ellipsis]

The parameters of the geometry, returned as a tuple to avoid external changes.

Return type:

Tuple[float, Ellipsis]

possible_connections_with(other)

Returns a set of connectors that can connect this with other body.

This method does not check whether the connector IDs of the other body overlap with the connector IDs of this body - this has to be achieved by e.g. putting both bodies in a module or in the same ModulesDB.

Parameters:

other (BodyBase) – Another body

Returns:

A list of matching connector pairs like (this_body_connector, other_body_connector)

Return type:

timor.utilities.dtypes.SingleSet

print_parameter_info()

A helper method to show the current parameters and how they are mapped to the underlying geometries.

to_json_data()

Freezes the current body with the currently set parameters and returns the according JSON

Return type:

Dict[str, any]

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str

property visual: timor.Geometry.Geometry

Defaults to collision if not explicitly specified

Return type:

timor.Geometry.Geometry

class timor.parameterized.ParameterizableSphereBody(body_id, parameters, parameter_limits=None, mass_density=1.0, connectors=(), geometry_placement=Transformation.neutral(), in_module=None)
Inheritance diagram of timor.parameterized.ParameterizableSphereBody

A module body composed of a sphere with a parameterizable radius

Construct a parameterizable body from a geometry reference and parameters.

A parameterizable body has a fixed geometry type – depending on this type, there is a fixed number of parameters that define the expansion of the geometry in the respective direction. For example, a sphere has a single parameter that defines the radius, a cylinder has two parameters that define the radius and the length, and a box has three parameters that define the expansion in x, y, and z direction.

Parameters:
  • body_id (str) – The unique ID of the body

  • parameters (Iterable[float]) – The number of parameters depends on the geometry type. Their (positive) value defines the expansion of the geometry in the respective direction. For a sphere, this is the radius, for a cylinder, this is the radius and the length, and for a box, this is the expansion in x, y, and z direction.

  • parameter_limits (Optional[Sequence[Sequence[float]]]) – The lower and upper bounds for each parameter. If None is given (default), the bounds are set to [0, inf] for all parameters. Bounds for geometric attributes cannot be negative.

  • mass_density (float) – The mass density of the body (in kg/m^3), implicitly assuming a homogeneous material.

  • connectors (Iterable[timor.Bodies.Connector]) – The connectors of the body - their placement has to be externally and dynamically updated. The connector_placements_valid attribute is used to indicate whether the position of the connectors was updated since the parameters have been changed last time.

  • geometry_placement (timor.utilities.transformation.Transformation) – Parametrized bodies cannot contain composed geometries, so we need to define a relative geometry placement to the origin in order to combine multiple parameterized bodies in a module. This parameter defines the relative transformation between geometry origin and body frame.

  • in_module (timor.Module.ModuleBase) – The module this body is part of. Will be automatically assigned if the body is defined and added to a module later on.

__copy__()

Parameterizable bodies are actually quite easy to copy as geometries are calculated on-the-fly.

__eq__(other)

Parameterizable body equality is given by the original parameters - no need to compute the geometry.

__geometry_type: timor.Geometry.GeometryType
__getstate__()

For parameterized bodies, we can rely on the python builtin actually

__hash__()

Hashing is equal to hashes of regular bodies - ID should be unique.

__setstate__(state)

For parameterized bodies, we can rely on the python builtin actually

__slots__ = ()
__str__()

The string representation of a body

Return type:

str

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

_geometry_transformation: timor.utilities.transformation.Transformation
_id: str = ''
_parameter_limits: numpy.array = None
_parameters: List[float]
_visual: timor.Geometry.Geometry | None = None
as_pin_body(placement=Transformation.neutral())

Extracts the body properties that describe a body in a pinocchio robot.

Always places the body in the origin.

Parameters:

placement (timor.utilities.transformation.TransformationLike) – Relative placement of the body to its parent joint

Return type:

PinBody

property collision: timor.Geometry.Sphere

The collision geometry of the body.

Return type:

timor.Geometry.Sphere

connector_placements_valid: bool = False
connectors: timor.Bodies.ConnectorSet
freeze()

Freeze the body, i.e. make it immutable by transforming it to an unparameterized body.

Return type:

timor.Bodies.Body

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

property geometry_type: timor.Geometry.GeometryType

The geometry type of the body. Ensured to be in the set of valid geometry types.

Return type:

timor.Geometry.GeometryType

property id: Tuple[None | str, str]

Composed ID: (module ID, body ID)

Return type:

Tuple[Union[None, str], str]

in_module: timor.Module.ModuleBase = None
property inertia: pinocchio.Inertia

Assuming a homogeneous material, compute the inertia tensor of self for the current parameters

Return type:

pinocchio.Inertia

property mass: float

The mass needs to be dynamically calculated, depending on the geometry expansion.

Return type:

float

mass_density = 1.0
num_parameters: int = 1
property parameter_limits: numpy.array

Returns a copy of the parameter limits of the body.

Return type:

numpy.array

parameter_order: Dict[timor.Geometry.GeometryType, Tuple[str, Ellipsis]]
property parameters: Tuple[float, Ellipsis]

The parameters of the geometry, returned as a tuple to avoid external changes.

Return type:

Tuple[float, Ellipsis]

possible_connections_with(other)

Returns a set of connectors that can connect this with other body.

This method does not check whether the connector IDs of the other body overlap with the connector IDs of this body - this has to be achieved by e.g. putting both bodies in a module or in the same ModulesDB.

Parameters:

other (BodyBase) – Another body

Returns:

A list of matching connector pairs like (this_body_connector, other_body_connector)

Return type:

timor.utilities.dtypes.SingleSet

property r: float

The radius of the sphere.

Return type:

float

to_json_data()

Freezes the current body with the currently set parameters and returns the according JSON

Return type:

Dict[str, any]

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str

property visual: timor.Geometry.Geometry

Defaults to collision if not explicitly specified

Return type:

timor.Geometry.Geometry

Inheritance diagram of timor.parameterized.ParameterizedCylinderLink

This is a module in cylinder shape with connectors at both ends that can be used to construct a robot.

Creates a parameterized module with one, i-shaped link.

The link has a varying length and radius. Connectors are placed at x=0, y=0 and z chosen s.t. they are aligned with the cylinder’s flat surfaces. The body coordinate system is placed in the center of the cylinder.

Parameters:
  • header (timor.Module.ModuleHeader) – The module header for the generated link module

  • length (float) – The length of the cylinder

  • radius (float) – The radius of the cylinder

  • mass_density (float) – The mass density of the link’s material (kg/m^3) – assumed to be uniform

  • limits (Optional[Sequence[Sequence[float]]]) – Optional lower and upper bounds on the link’s length and radius

  • connector_arguments (Optional[Dict[str, any]]) – Mapping from keyword to 2-tuples of values for gender, size, type.

__connector_arguments = None
__copy__()

Deactivates the builtin copy method.

__eq__(other)

Equality check for modules. Two modules are equal if they have the same header, bodies, names, and joints.

__getstate__()

For a parameterizable module, we can rely on the default pickling.

__hash__()

Custom hash function for modules that should be uniquely determined by their ID.

__setstate__(state)

For a parameterizable module, we can rely on the default pickling.

__slots__ = ()
__str__()

String representation for the module.

_bodies: timor.Bodies.BodySet
_check_unique_connectors()

Sanity check that all connectors are unique

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

static _generate_connectors(ids=('proximal', 'distal'), genders=(Gender.female, Gender.male), types=('', ''), sizes=((), ()))

Generates the connectors for this module.

Parameters:
Return type:

Tuple[timor.Bodies.Connector, Ellipsis]

_get_copy_args()

Returns the arguments for the copy constructor.

Return type:

Tuple

_joints: timor.Joints.JointSet
_length: float = 1.0
_module_graph: networkx.DiGraph
_radius: float = 1.0
_update_connector_placements()

Makes sure the connectors are always placed on the bottom/top and centered in the link.

property available_connectors: Dict[Tuple[str, str, str], timor.Bodies.Connector]

Returns all connectors of all bodies contained in this module as a mapping ID -> instance

Return type:

Dict[Tuple[str, str, str], timor.Bodies.Connector]

property bodies: timor.Bodies.BodySet

Returns all bodies contained in this module.

Return type:

timor.Bodies.BodySet

build_module_graph()

Builds the directed graph of atomic module elements. See module_graph property for more information.

Return type:

networkx.DiGraph

can_connect(other)

Returns true if at least one of the connectors of this module matches at least one connector of other

Parameters:

other (ModuleBase)

Return type:

bool

property connectors_by_own_id: Dict[str, timor.Bodies.Connector]

Returns a mapping of connector._id values to the instance.

Keep in mind, these are not the composed id’s of the connectors, so they are not unambiguous outside a module!

Return type:

Dict[str, timor.Bodies.Connector]

copy(suffix)

Copies the module and returns the copy.

Parameters:

suffix (str)

Return type:

timor.Module.ModuleBase

debug_visualization(viz=None, show_com=True, base_placement=Transformation.neutral())

Do not use this method in proper environment visualizations

Parameters:
  • viz (pinocchio.visualize.MeshcatVisualizer) – MeshcatVisualizer to show debug information in

  • show_com (bool) – show center of mass frame

  • base_placement (numpy.array) – where to show this module in the global frame

Returns:

visualizer object (keep if you want to add more to this)

Return type:

pinocchio.visualize.MeshcatVisualizer

freeze()

Returns a static module representation of this module.

Return type:

timor.Module.AtomicModule

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

header: ModuleHeader
property id: str

The unique ID of this module.

Return type:

str

property joints: timor.Joints.JointSet

Returns all joints contained in this module

Return type:

timor.Joints.JointSet

property length: float

The length of the link.

Return type:

float

property mass: float

Returns the total mass of the module.

Return type:

float

property module_graph: networkx.DiGraph

The module graph for a parameterizable module has to be recomputed with every resize.

Return type:

networkx.DiGraph

property name: str

Returns the unique name of this module.

Return type:

str

property num_bodies

The number of bodies in this module.

property num_connectors

The number of connectors available in the module.

property num_joints

The number of joints in this module

property parameters: Tuple[float, float]

Returns the parameters of this module.

Return type:

Tuple[float, float]

property radius: float

The radius of the link.

Return type:

float

resize(parameters)

The interface to change the link’s length or radius and adapt the connector placements accordingly.

Parameters:

parameters (Tuple[float, float]) – A tuple of (radius, length)

Return type:

None

to_json_data()

Freezes the parameters of this module to serialize it.

Return type:

Dict

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str

class timor.parameterized.ParameterizedOrthogonalJoint(header, lengths=(1.0, 1.0), radius=1.0, mass_density=1.0, limits=((0, float('inf')), (0, float('inf')), (0, float('inf'))), joint_type=TimorJointType.revolute, joint_parameters=None, connector_arguments=None, alpha_rot_x=np.pi / 2, convention_alpha='DH')
Inheritance diagram of timor.parameterized.ParameterizedOrthogonalJoint

This is a module in L-shape with connectors at both ends and a joint in the ‘elbow’.

Creates a parameterized module with two cylinders being orthogonal to each other.

The first cylinder is placed along the z-Axis. The symmetry axes of body 2 run through z=l1, where the z-Axis of the second cylinder is aligned with the y-axis of the first cylinder for q_joint=0. Both have varying length and the same, varying radius. At their connection is a joint, which can be revolute or prismatic. For q_joint=0, the surface of the second cylinder is aligned with z=0. The joint axis is the initial z-Axis.

Parameters:
  • header (timor.Module.ModuleHeader) – The module header for the generated module

  • lengths (Sequence[float, float]) – (l1, l2) for the two bodies in this module

  • radius (float) – The radius of the cylinders

  • mass_density (float) – The mass density of the bodies’ material (kg/m^3) – assumed to be uniform

  • limits (Sequence[Sequence[float]]) – Optional lower and upper bounds on the link’s length and radius (r, l1, l2)

  • joint_type (timor.Joints.TimorJointType) – The type of joint to use \(\in\) (revolute, prismatic)

  • joint_parameters (Dict[str, any]) – Additional arguments for timor.Joint such as limits or gear ratio; applied to all joints within the module.

  • connector_arguments (Optional[Dict[str, any]]) – Mapping from keyword to 2-tuples of values

  • alpha_rot_x (float) – The rotation angle around the x-axis for the second cylinder.

  • convention_alpha (str) – Either DH (apply x-rotation AFTER joint rotation) or MDH (apply x-rotation BEFORE)

__connector_arguments = None
__copy__()

Deactivates the builtin copy method.

__eq__(other)

Equality check for modules. Two modules are equal if they have the same header, bodies, names, and joints.

__getstate__()

For a parameterizable module, we can rely on the default pickling.

__hash__()

Custom hash function for modules that should be uniquely determined by their ID.

__setstate__(state)

For a parameterizable module, we can rely on the default pickling.

__slots__ = ()
__str__()

String representation for the module.

_bodies: timor.Bodies.BodySet
_check_unique_connectors()

Sanity check that all connectors are unique

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

static _generate_connectors(ids=('proximal', 'distal'), genders=(Gender.female, Gender.male), types=('', ''), sizes=((), ()))

Generates the connectors for this module.

Parameters:
Return type:

Tuple[timor.Bodies.Connector, Ellipsis]

_get_copy_args()

Returns the arguments to use when copying this module.

Return type:

Tuple

_joint_parameters
_joints: timor.Joints.JointSet
_module_graph: networkx.DiGraph
_radius: float = 1.0
_update_connector_placements()

Makes sure the connectors are always placed on the bottom/top and centered in the link.

_update_joint_placement()

Makes sure the joint is always placed in the middle of the module.

_x_rotation: float
property available_connectors: Dict[Tuple[str, str, str], timor.Bodies.Connector]

Returns all connectors of all bodies contained in this module as a mapping ID -> instance

Return type:

Dict[Tuple[str, str, str], timor.Bodies.Connector]

property bodies: timor.Bodies.BodySet

Returns all bodies contained in this module.

Return type:

timor.Bodies.BodySet

build_module_graph()

Builds the directed graph of atomic module elements. See module_graph property for more information.

Return type:

networkx.DiGraph

can_connect(other)

Returns true if at least one of the connectors of this module matches at least one connector of other

Parameters:

other (ModuleBase)

Return type:

bool

property connectors_by_own_id: Dict[str, timor.Bodies.Connector]

Returns a mapping of connector._id values to the instance.

Keep in mind, these are not the composed id’s of the connectors, so they are not unambiguous outside a module!

Return type:

Dict[str, timor.Bodies.Connector]

copy(suffix)

Copies the module and returns the copy.

Parameters:

suffix (str)

Return type:

timor.Module.ModuleBase

debug_visualization(viz=None, show_com=True, base_placement=Transformation.neutral())

Do not use this method in proper environment visualizations

Parameters:
  • viz (pinocchio.visualize.MeshcatVisualizer) – MeshcatVisualizer to show debug information in

  • show_com (bool) – show center of mass frame

  • base_placement (numpy.array) – where to show this module in the global frame

Returns:

visualizer object (keep if you want to add more to this)

Return type:

pinocchio.visualize.MeshcatVisualizer

freeze()

Returns a static module representation of this module.

Return type:

timor.Module.AtomicModule

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

header: ModuleHeader
property id: str

The unique ID of this module.

Return type:

str

joint
property joints: timor.Joints.JointSet

Returns all joints contained in this module

Return type:

timor.Joints.JointSet

property l1: float

The length of the proximal body.

Return type:

float

property l2: float

The length of the distal body.

Return type:

float

property mass: float

Returns the total mass of the module.

Return type:

float

property module_graph: networkx.DiGraph

The module graph for a parameterizable module has to be recomputed with every resize.

Return type:

networkx.DiGraph

property name: str

Returns the unique name of this module.

Return type:

str

property num_bodies

The number of bodies in this module.

property num_connectors

The number of connectors available in the module.

property num_joints

The number of joints in this module

property parameters: Tuple[float, float, float]

The parameters of the module.

Return type:

Tuple[float, float, float]

property radius: float

The radius of the bodies.

Return type:

float

resize(parameters)

The interface to change both of the bodies’ length and/or radius and adapt the connector and joint placements.

Parameters:

parameters (Tuple[float, float, float]) – A tuple of (radius, l1, l2)

Return type:

None

to_json_data()

Freezes the parameters of this module to serialize it.

Return type:

Dict

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str

Inheritance diagram of timor.parameterized.ParameterizedOrthogonalLink

This is a module in L-shape with connectors at both ends that can be used to construct a robot.

Creates a parameterized module with one, L-shaped link.

The link has a varying lengths and radius. Connectors are placed at the flat surfaces of the cylinders. The body coordinate systems share origins with the connectors – body coordinate systems are pointing inwards though.

Parameters:
  • header (timor.Module.ModuleHeader) – The module header for the generated link module

  • lengths (Iterable[float]) – The lengths l1 and l2 of the cylinders

  • radius (float) – The radius of the cylinders

  • mass_density (float) – The mass density of the link’s material (kg/m^3) – assumed to be uniform

  • limits (Sequence[Sequence[float]]) – Optional lower and upper bounds on the link’s lengths and radius (r, l1, l2)

  • connector_arguments (Optional[Dict[str, any]]) – Mapping from keyword to 2-tuples of values for gender, size, type.

  • alpha_rot_x (float) – The rotation angle around the x-axis for the second cylinder

__connector_arguments = None
__copy__()

Deactivates the builtin copy method.

__eq__(other)

Equality check for modules. Two modules are equal if they have the same header, bodies, names, and joints.

__getstate__()

For a parameterizable module, we can rely on the default pickling.

__hash__()

Custom hash function for modules that should be uniquely determined by their ID.

__setstate__(state)

For a parameterizable module, we can rely on the default pickling.

__slots__ = ()
__str__()

String representation for the module.

_bodies: timor.Bodies.BodySet
_check_unique_connectors()

Sanity check that all connectors are unique

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

static _generate_connectors(ids=('proximal', 'distal'), genders=(Gender.female, Gender.male), types=('', ''), sizes=((), ()))

Generates the connectors for this module.

Parameters:
Return type:

Tuple[timor.Bodies.Connector, Ellipsis]

_get_copy_args()

Returns the arguments for the copy constructor.

Return type:

Tuple

_joints: timor.Joints.JointSet
_module_graph: networkx.DiGraph
_radius: float = 1.0
_update_connector_placements()

Makes sure the connectors are always placed on the bottom/top and centered in the link.

_update_geometry_placements()

Makes sure the two cylinders composing this link are placed correctly relative to each other.

Assumes the reference frame for this module is aligned with the proximal connector. The frame for the first geometry is centered in the first cylinder, l/2 above the module reference frame. The frame for the second geometry is placed accordingly in the second cylinder.

_x_rotation: float
property available_connectors: Dict[Tuple[str, str, str], timor.Bodies.Connector]

Returns all connectors of all bodies contained in this module as a mapping ID -> instance

Return type:

Dict[Tuple[str, str, str], timor.Bodies.Connector]

property bodies: timor.Bodies.BodySet

Returns all bodies contained in this module.

Return type:

timor.Bodies.BodySet

build_module_graph()

Builds the directed graph of atomic module elements. See module_graph property for more information.

Return type:

networkx.DiGraph

can_connect(other)

Returns true if at least one of the connectors of this module matches at least one connector of other

Parameters:

other (ModuleBase)

Return type:

bool

property connectors_by_own_id: Dict[str, timor.Bodies.Connector]

Returns a mapping of connector._id values to the instance.

Keep in mind, these are not the composed id’s of the connectors, so they are not unambiguous outside a module!

Return type:

Dict[str, timor.Bodies.Connector]

copy(suffix)

Copies the module and returns the copy.

Parameters:

suffix (str)

Return type:

timor.Module.ModuleBase

debug_visualization(viz=None, show_com=True, base_placement=Transformation.neutral())

Do not use this method in proper environment visualizations

Parameters:
  • viz (pinocchio.visualize.MeshcatVisualizer) – MeshcatVisualizer to show debug information in

  • show_com (bool) – show center of mass frame

  • base_placement (numpy.array) – where to show this module in the global frame

Returns:

visualizer object (keep if you want to add more to this)

Return type:

pinocchio.visualize.MeshcatVisualizer

freeze()

Returns a static module representation of this module.

Return type:

timor.Module.AtomicModule

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

header: ModuleHeader
property id: str

The unique ID of this module.

Return type:

str

property joints: timor.Joints.JointSet

Returns all joints contained in this module

Return type:

timor.Joints.JointSet

property l1: float

The length of the first link.

Return type:

float

property l1_position: timor.utilities.transformation.Transformation

Describes the relative transformation between body origin and the geometry frame of the first geometry.

Return type:

timor.utilities.transformation.Transformation

property l2: float

The length of the second (perpendicular) link.

Return type:

float

property l2_position: timor.utilities.transformation.Transformation

Describes the relative transformation between body origin and the geometry frame of the second geometry.

Return type:

timor.utilities.transformation.Transformation

property mass: float

Returns the total mass of the module.

Return type:

float

property module_graph: networkx.DiGraph

The module graph for a parameterizable module has to be recomputed with every resize.

Return type:

networkx.DiGraph

property name: str

Returns the unique name of this module.

Return type:

str

property num_bodies

The number of bodies in this module.

property num_connectors

The number of connectors available in the module.

property num_joints

The number of joints in this module

property parameters: Tuple[float, float, float]

Returns the parameters of this module.

Return type:

Tuple[float, float, float]

property radius: float

The radius of the link.

Return type:

float

resize(parameters)

The interface to change the link’s length or radius and adapt the connector placements accordingly.

Parameters:

parameters (Tuple[float, float, float]) – A tuple of (radius, length)

Return type:

None

to_json_data()

Freezes the parameters of this module to serialize it.

Return type:

Dict

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str

class timor.parameterized.ParameterizedStraightJoint(header, length=1.0, radius=1.0, mass_density=1.0, limits=((0, float('inf')), (0, float('inf'))), joint_type=TimorJointType.revolute, joint_parameters=None, connector_arguments=None)
Inheritance diagram of timor.parameterized.ParameterizedStraightJoint

This is a module in cylinder shape with connectors at both ends and a joint in the middle.

Creates a parameterized module with two cylinders, connected by a joint.

The module has a varying length and radius. Connectors are placed at the flat surfaces of the cylinders that are not attached to the joint.

Parameters:
  • header (timor.Module.ModuleHeader) – The module header for the generated module

  • length (float) – The overall length of the module. Will be divided equally between the two bodies.

  • radius (float) – The radius of the cylinders

  • mass_density (float) – The mass density of the bodies’ material (kg/m^3) – assumed to be uniform

  • limits (Sequence[Sequence[float]]) – Optional lower and upper bounds on the link’s length and radius

  • joint_type (timor.Joints.TimorJointType) – The type of joint to use \(\in\) (revolute, prismatic)

  • joint_parameters (Dict[str, any]) – Additional arguments for timor.Joint such as limits or gear ratio; applied to all joints within the module.

  • connector_arguments (Optional[Dict[str, any]]) – Mapping from keyword to 2-tuples of values

__connector_arguments = None
__copy__()

Deactivates the builtin copy method.

__eq__(other)

Equality check for modules. Two modules are equal if they have the same header, bodies, names, and joints.

__getstate__()

For a parameterizable module, we can rely on the default pickling.

__hash__()

Custom hash function for modules that should be uniquely determined by their ID.

__setstate__(state)

For a parameterizable module, we can rely on the default pickling.

__slots__ = ()
__str__()

String representation for the module.

_bodies: timor.Bodies.BodySet
_check_unique_connectors()

Sanity check that all connectors are unique

static _deduce_package_dir(filepath, content)

Logic for deducing the package directory if the JSONable object is loaded from a file.

Parameters:
  • filepath (pathlib.Path) – The path to the file.

  • content (Union[Dict, List]) – The content of the file parsed into a dictionary.

Note:

This method can be overridden by subclasses to provide custom package directory resolution; e.g. Task.py.

Return type:

pathlib.Path

static _generate_connectors(ids=('proximal', 'distal'), genders=(Gender.female, Gender.male), types=('', ''), sizes=((), ()))

Generates the connectors for this module.

Parameters:
Return type:

Tuple[timor.Bodies.Connector, Ellipsis]

_get_copy_args()

Returns the arguments to use when copying this module.

Return type:

Tuple

_joint_parameters
_joints: timor.Joints.JointSet
_length: float = 1.0
_module_graph: networkx.DiGraph
_radius: float = 1.0
_update_connector_placements()

Makes sure the connectors are always placed on the bottom/top and centered in the link.

_update_joint_placement()

Makes sure the joint is always placed in the middle of the module.

property available_connectors: Dict[Tuple[str, str, str], timor.Bodies.Connector]

Returns all connectors of all bodies contained in this module as a mapping ID -> instance

Return type:

Dict[Tuple[str, str, str], timor.Bodies.Connector]

property bodies: timor.Bodies.BodySet

Returns all bodies contained in this module.

Return type:

timor.Bodies.BodySet

build_module_graph()

Builds the directed graph of atomic module elements. See module_graph property for more information.

Return type:

networkx.DiGraph

can_connect(other)

Returns true if at least one of the connectors of this module matches at least one connector of other

Parameters:

other (ModuleBase)

Return type:

bool

property connectors_by_own_id: Dict[str, timor.Bodies.Connector]

Returns a mapping of connector._id values to the instance.

Keep in mind, these are not the composed id’s of the connectors, so they are not unambiguous outside a module!

Return type:

Dict[str, timor.Bodies.Connector]

copy(suffix)

Copies the module and returns the copy.

Parameters:

suffix (str)

Return type:

timor.Module.ModuleBase

debug_visualization(viz=None, show_com=True, base_placement=Transformation.neutral())

Do not use this method in proper environment visualizations

Parameters:
  • viz (pinocchio.visualize.MeshcatVisualizer) – MeshcatVisualizer to show debug information in

  • show_com (bool) – show center of mass frame

  • base_placement (numpy.array) – where to show this module in the global frame

Returns:

visualizer object (keep if you want to add more to this)

Return type:

pinocchio.visualize.MeshcatVisualizer

freeze()

Returns a static module representation of this module.

Return type:

timor.Module.AtomicModule

classmethod from_json_data(d, *args, **kwargs)

Create from a json description.

Parameters:

d (Dict)

classmethod from_json_file(filepath, *args, **kwargs)

Factory method to load a class instance from a json file.

Parameters:
  • filepath (Union[pathlib.Path, str]) – The path to the json file.

  • args – Additional arguments to pass to the from_json_data factory method of the specific class.

  • kwargs – Additional arguments to pass to the from_json_data factory method of the specific class.

classmethod from_json_string(s, *args, **kwargs)

Create from a json string.

Parameters:

s (str)

header: ModuleHeader
property id: str

The unique ID of this module.

Return type:

str

joint
property joints: timor.Joints.JointSet

Returns all joints contained in this module

Return type:

timor.Joints.JointSet

property length: float

The length of the module (2 * individual body length).

Return type:

float

property mass: float

Returns the total mass of the module.

Return type:

float

property module_graph: networkx.DiGraph

The module graph for a parameterizable module has to be recomputed with every resize.

Return type:

networkx.DiGraph

property name: str

Returns the unique name of this module.

Return type:

str

property num_bodies

The number of bodies in this module.

property num_connectors

The number of connectors available in the module.

property num_joints

The number of joints in this module

property parameters: Tuple[float, float]

The parameters of the module.

Return type:

Tuple[float, float]

property radius: float

The radius of the bodies.

Return type:

float

resize(parameters)

The interface to change both of the bodies’ length and/or radius and adapt the connector and joint placements.

Parameters:

parameters (Tuple[float, float]) – A tuple of (radius, length)

Return type:

None

to_json_data()

Freezes the parameters of this module to serialize it.

Return type:

Dict

to_json_file(save_at, *args, **kwargs)

Writes the instance to a json file.

Parameters:

save_at (Union[pathlib.Path, str]) – File location or folder to write the class to.

to_json_string()

Return the json string representation.

Return type:

str