pycram.orm.base

Implementation of base classes for orm modelling.

Module Contents

Classes

_Base

Dummy class

Base

Base class to add orm functionality to all pycram mappings

MapperArgsMixin

MapperArgsMixin stores __mapper_args__ information for certain subclass-tables.

PositionMixin

PositionMixin holds a foreign key column and its relationship to the referenced table.

QuaternionMixin

QuaternionMixin holds a foreign key column and its relationship to the referenced table.

PoseMixin

PoseMixin holds a foreign key column and its relationship to the referenced table.

ProcessMetaData

ProcessMetaData stores information about the context of this experiment.

Designator

ORM Class holding every performed action and motion serving as every actions and motions root.

Position

ORM Class for 3D positions.

Quaternion

ORM Class for Quaternions.

Pose

ORM Class for Poses.

Color

ORM Class for Colors.

RobotState

ORM Representation of a robots state.

Functions

get_pycram_version_from_git(→ Optional[str])

Get the PyCRAM commit hash that is used to run this version.

pycram.orm.base.get_pycram_version_from_git() str | None

Get the PyCRAM commit hash that is used to run this version.

This assumes that you have gitpython installed and that the PyCRAM git repository on your system can be found with “roscd pycram”.

class pycram.orm.base._Base

Bases: sqlalchemy.orm.DeclarativeBase, sqlalchemy.orm.MappedAsDataclass

Dummy class

type_annotation_map
id: sqlalchemy.orm.Mapped[int]

Unique integer ID as auto incremented primary key.

__tablename__()
class pycram.orm.base.Base

Bases: _Base

Base class to add orm functionality to all pycram mappings

__abstract__ = True
process_metadata_id() sqlalchemy.orm.Mapped[int]
process_metadata()
class pycram.orm.base.MapperArgsMixin

Bases: sqlalchemy.orm.MappedAsDataclass

MapperArgsMixin stores __mapper_args__ information for certain subclass-tables. For information about Mixins, see https://docs.sqlalchemy.org/en/20/orm/declarative_mixins.html

__abstract__ = True
__mapper_args__()
class pycram.orm.base.PositionMixin

Bases: sqlalchemy.orm.MappedAsDataclass

PositionMixin holds a foreign key column and its relationship to the referenced table. For information about Mixins, see https://docs.sqlalchemy.org/en/20/orm/declarative_mixins.html

__abstract__ = True
position_to_init: bool
position_id() sqlalchemy.orm.Mapped[int]
position()
class pycram.orm.base.QuaternionMixin

Bases: sqlalchemy.orm.MappedAsDataclass

QuaternionMixin holds a foreign key column and its relationship to the referenced table. For information about Mixins, see https://docs.sqlalchemy.org/en/20/orm/declarative_mixins.html

__abstract__ = True
orientation_to_init: bool
orientation_id() sqlalchemy.orm.Mapped[int]
orientation()
class pycram.orm.base.PoseMixin

Bases: sqlalchemy.orm.MappedAsDataclass

PoseMixin holds a foreign key column and its relationship to the referenced table. For information about Mixins, see https://docs.sqlalchemy.org/en/20/orm/declarative_mixins.html

__abstract__ = True
pose_to_init: bool
pose_id() sqlalchemy.orm.Mapped[int]
pose()
class pycram.orm.base.ProcessMetaData

Bases: _Base

ProcessMetaData stores information about the context of this experiment.

This class is a singleton and only one MetaData can exist per session.

created_at: sqlalchemy.orm.Mapped[datetime.datetime]

The timestamp where this row got created. This is an aid for versioning.

created_by: sqlalchemy.orm.Mapped[str]

The user that created the experiment.

description: sqlalchemy.orm.Mapped[str]

A description of the purpose (?) of this experiment.

pycram_version: sqlalchemy.orm.Mapped[str]

The PyCRAM version used to generate this row.

_self

The singleton instance.

committed()

Return if this object is in the database or not.

insert(session: sqlalchemy.orm.Session)

Insert this into the database using the session. Skipped if it already is inserted.

classmethod reset()

Reset the singleton instance to None, s. t. next time the class is called a new instance is created.

class pycram.orm.base.Designator

Bases: Base

ORM Class holding every performed action and motion serving as every actions and motions root.

dtype() sqlalchemy.orm.Mapped[str]
__mapper_args__()
class pycram.orm.base.Position

Bases: Base

ORM Class for 3D positions.

x: sqlalchemy.orm.Mapped[float]
y: sqlalchemy.orm.Mapped[float]
z: sqlalchemy.orm.Mapped[float]
class pycram.orm.base.Quaternion

Bases: Base

ORM Class for Quaternions.

x: sqlalchemy.orm.Mapped[float]
y: sqlalchemy.orm.Mapped[float]
z: sqlalchemy.orm.Mapped[float]
w: sqlalchemy.orm.Mapped[float]
class pycram.orm.base.Pose

Bases: PositionMixin, QuaternionMixin, Base

ORM Class for Poses.

time: sqlalchemy.orm.Mapped[datetime.datetime]
frame: sqlalchemy.orm.Mapped[str]
class pycram.orm.base.Color

Bases: Base

ORM Class for Colors.

r: sqlalchemy.orm.Mapped[float]
g: sqlalchemy.orm.Mapped[float]
b: sqlalchemy.orm.Mapped[float]
alpha: sqlalchemy.orm.Mapped[float]
class pycram.orm.base.RobotState

Bases: PoseMixin, Base

ORM Representation of a robots state.

torso_height: sqlalchemy.orm.Mapped[float]

The torso height of the robot.

type: sqlalchemy.orm.Mapped[pycram.datastructures.enums.ObjectType]

The type of the robot.