base
Abstract Base Modules for Robots.
Package Contents
Classes
An Active Hinge Module. |
|
Collect AttachmentPoints on a modules face. |
|
Body of a modular robot. |
|
A Brick Module. |
|
The core module of a modular robot. |
- class ActiveHinge(rotation: float | modular_robot.body._right_angles.RightAngles, servo1_bounding_box: pyrr.Vector3, servo2_bounding_box: pyrr.Vector3, frame_bounding_box: pyrr.Vector3, frame_offset: float, servo_offset: float, frame_mass: float, servo1_mass: float, servo2_mass: float, joint_offset: float, static_friction: float, dynamic_friction: float, range: float, effort: float, velocity: float, armature: float, pid_gain_p: float, pid_gain_d: float, child_offset: float, sensors: list[modular_robot.body.sensors.Sensor])
Bases:
modular_robot.body._module.Module
An Active Hinge Module.
- property attachment: modular_robot.body._module.Module | None
Get the module attached to this hinge.
- Returns:
The attachment points module.
- property static_friction: float
Get the static friction.
- Returns:
The value.
- property dynamic_friction: float
Get the dynamic friction.
- Returns:
The value.
- property range: float
Get the range of the servo.
- Returns:
The value.
- property effort: float
Get the effort of the servo.
- Returns:
The value.
- property velocity: float
Get the velocity of the servo.
- Returns:
The value.
- property servo1_bounding_box: pyrr.Vector3
Get the bounding box of the first servo part.
Sizes are total length, not half-length from origin. :return: Vector3 with sizes of bbox in x,y,z dimension (m).
- property servo2_bounding_box: pyrr.Vector3
Get the bounding box of the second servo part.
Sizes are total length, not half-length from origin. :return: Vector3 with sizes of bbox in x,y,z dimension (m).
- property frame_bounding_box: pyrr.Vector3
Get the bounding box of the frame.
Sizes are total length, not half-length from origin. :return: Vector3 with sizes of bbox in x,y,z dimension (m).
- property frame_offset: float
Get the offset of the frame (in m).
- Returns:
The value.
- property servo_offset: float
Get the servo offset (in m).
- Returns:
The value.
- property frame_mass: float
Get the frame mass (in kg).
- Returns:
The value.
- property servo1_mass: float
Get the mass of the first servo part (in kg).
- Returns:
The value.
- property servo2_mass: float
Get the mass of the second servo part (in kg).
- Returns:
The value.
- property joint_offset: float
Get the joint offset (in m).
- Returns:
The value.
- property armature: float
Get the armature of the joint.
This represents the inertia of the motor itself when nothing is attached.
- Returns:
The value.
- property pid_gain_p: float
Get the proportional gain of the pid position controller.
- Returns:
The value.
- property pid_gain_d: float
Get the derivative gain of the pid position controller.
- Returns:
The value.
- ATTACHMENT = 0
- attachment_points
The base module only has orientation as its parameter since not all modules are square.
Here we covert the angle of the module to its orientation in space.
- class AttachmentFace(rotation: float | modular_robot.body._right_angles.RightAngles, attachment_points: dict[int, modular_robot.body._attachment_point.AttachmentPoint])
Bases:
modular_robot.body._module.Module
Collect AttachmentPoints on a modules face.
This face can be thought of as a pseudo-module which usually does not have a body on its own.
- class Body(core: modular_robot.body.base._core.Core)
Body of a modular robot.
- property core: modular_robot.body.base._core.Core
Get the core of the Body.
- Returns:
The core.
- classmethod grid_position(module: modular_robot.body._module.Module) pyrr.Vector3
Calculate the position of this module in a 3d grid with the core as center.
The distance between all modules is assumed to be one grid cell. All module angles must be multiples of 90 degrees.
- Parameters:
module – The module to calculate the position for.
- Returns:
The calculated position.
- Raises:
KeyError – In case an attachment point is not found.
- find_modules_of_type(module_type: Type[TModule], exclude: list[Type[TModule]] | None = None) list[TModule]
Find all Modules of a certain type in the robot.
- Parameters:
module_type – The type.
exclude – Module types to be excluded in search.
- Returns:
The list of Modules.
- to_grid() tuple[numpy.typing.NDArray[TModuleNP], pyrr.Vector3[numpy.int_]]
Convert the tree structure to a grid.
The distance between all modules is assumed to be one grid cell. All module angles must be multiples of 90 degrees.
The grid is indexed depth, width, height, or x, y, z, from the perspective of the core.
- Returns:
The created grid with cells set to either a Module or None and a position vector of the core. The position Vector3 is dtype: int.
- class Brick(rotation: float | modular_robot.body._right_angles.RightAngles, mass: float, bounding_box: pyrr.Vector3, child_offset: float, sensors: list[modular_robot.body.sensors.Sensor])
Bases:
modular_robot.body._module.Module
A Brick Module.
- property front: modular_robot.body._module.Module | None
Get the front module of the brick.
- Returns:
The attachment points module.
- property right: modular_robot.body._module.Module | None
Get right module of the brick.
- Returns:
The attachment points module.
- property left: modular_robot.body._module.Module | None
Get the left module of the brick.
- Returns:
The attachment points module.
- property mass: float
Get the mass of the brick (in kg).
- Returns:
The value.
- property bounding_box: pyrr.Vector3
Get the bounding box size.
Sizes are total length, not half-length from origin. :return: Vector3 with sizes of bbox in x,y,z dimension (in m).
- FRONT = 0
- RIGHT = 1
- LEFT = 2
- class Core(rotation: float | modular_robot.body._right_angles.RightAngles, mass: float, bounding_box: pyrr.Vector3, child_offset: float, sensors: list[modular_robot.body.sensors.Sensor])
Bases:
modular_robot.body._module.Module
The core module of a modular robot.
- property mass: float
Get the mass of the Core (in kg).
- Returns:
The value.
- property bounding_box: pyrr.Vector3
Get the bounding box.
Sizes are total length, not half length from origin. :return: Vector3 with sizes of bbox in x,y,z dimension (m).
- property front: modular_robot.body._module.Module | None
Get the front module of the core.
- Returns:
The attachment points module.
- property right: modular_robot.body._module.Module | None
Get the right module of the core.
- Returns:
The attachment points module.
- property back: modular_robot.body._module.Module | None
Get the back module of the core.
- Returns:
The attachment points module.
- property left: modular_robot.body._module.Module | None
Get the left module of the core.
- Returns:
The attachment points module.
- FRONT = 0
- RIGHT = 1
- BACK = 2
- LEFT = 3
- attachment_points
The base module only has orientation as its parameter since not all modules are square.
Here we covert the angle of the module to its orientation in space.