intermediateTypes#
Contains intermediate representations of bodies and joints to support conversion between FreeCAD and kdFlex formats.
Classes#
Minimal unit quaternion class using x,y,z,w representation. |
|
Simple Homogeneous Transformation object corresponding to a passive rotation + offset. |
|
Basic representation of a triangle mesh. |
|
Basic representation of a Body object. |
|
Basic representation of a joint object. Holds the joint frame relative to each body, plus body names to lookup elsewhere. |
|
Basic intermediate representation of a multibody model. |
Module Contents#
- class intermediateTypes.SimpleQuaternion(xyzw: numpy.ndarray | list | tuple)#
Minimal unit quaternion class using x,y,z,w representation.
- __slots__ = ('_q',)#
- classmethod identity() SimpleQuaternion#
Compute a quaternion corresponding to the identity operation.
- conjugate() SimpleQuaternion#
Get conjugate representation (same as inverse since we’re a unit quaternion).
- __mul__(other: SimpleQuaternion) SimpleQuaternion#
- __mul__(other: numpy.ndarray) numpy.ndarray
Multiply this quaternion A by either another quaternion B (e.g., A * B) or by a vector v (e.g., A * v).
- __repr__()#
Dump quaternion into a string representation.
- class intermediateTypes.SimpleHomTran(/, **data: Any)#
Bases:
pydantic.BaseModelSimple Homogeneous Transformation object corresponding to a passive rotation + offset.
- translation: numpy.ndarray = None#
- rotation: SimpleQuaternion = None#
- __repr__()#
Dump HomTran into a string representation.
- classmethod identity() SimpleHomTran#
Construct a SimpleHomTran corresponding to identity.
- __eq__(other)#
Check equality.
- __mul__(other: SimpleHomTran) SimpleHomTran#
- __mul__(other: numpy.ndarray) numpy.ndarray
Premultiply this by either another SimpleHomTran or a numpy array of 3-vectors.
- inverse() SimpleHomTran#
Get inverse transformation.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class intermediateTypes.MeshData(/, **data: Any)#
Bases:
pydantic.BaseModelBasic representation of a triangle mesh.
- vertices: numpy.ndarray#
- faces: numpy.ndarray#
- __repr__()#
Display mesh concisely as a string.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class intermediateTypes.BasicBody(/, **data: Any)#
Bases:
pydantic.BaseModelBasic representation of a Body object.
- body_frame: SimpleHomTran#
Body frame relative to global origin
- cm_in_body: numpy.ndarray#
Vector from body frame to center-of-mass
- inertia_matrix_in_body: numpy.ndarray#
Inertia matrix in the body frame (not the CM frame)
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class intermediateTypes.BasicJoint(/, **data: Any)#
Bases:
pydantic.BaseModelBasic representation of a joint object. Holds the joint frame relative to each body, plus body names to lookup elsewhere.
- body_1_to_joint: SimpleHomTran#
- body_2_to_joint: SimpleHomTran#
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class intermediateTypes.BasicModelData(/, **data: Any)#
Bases:
pydantic.BaseModelBasic intermediate representation of a multibody model.
- joints: dict[str, BasicJoint]#
- to_yaml(path: str | pathlib.Path | None = None) str#
Write this data structure to a yaml file.
- classmethod from_yaml(yaml_input: str | pathlib.Path) BasicModelData#
Load a yaml input file into an intermediate representation.