modular_robot_physical

Physical Robot Control and Utils.

Subpackages

Package Contents

Classes

Config

The configuration for running a physical robot.

HardwareType

The types of hardware.

UUIDKey

Wraps a value and implements __eq__ and __hash__ based purely on id(value).

Attributes

PROTOCOL_VERSION

STANDARD_PORT

class Config

The configuration for running a physical robot.

modular_robot: revolve2.modular_robot.ModularRobot

The Modular Robot Object.

hinge_mapping: dict[modular_robot_physical._uuid_key.UUIDKey[revolve2.modular_robot.body.base.ActiveHinge], int]

Hinge mapping: map each active hinge object to a specific Servo with its ID (int).

initial_hinge_positions: dict[modular_robot_physical._uuid_key.UUIDKey[revolve2.modular_robot.body.base.ActiveHinge], float]

Initial positions of the active hinges.

run_duration: int

Duration to run the brain for in seconds.

control_frequency: int

Frequency at which to call the brain control functions in seconds. There currently is a bug where if you set the control frequency to (around) 10 or smaller the program might hang. This is most likely a big in pycapnp and once pycapnp v2 is released this is probably resolved.

inverse_servos: dict[int, bool]

If a servo is mounted in the wrong direction on the body one can fix it by inverting the action. inverse_servos allows you to inverse specific servos with their gpio number as key.

class HardwareType(*args, **kwds)

Bases: enum.Enum

Inheritance diagram of modular_robot_physical.HardwareType

The types of hardware.

v1
v2
PROTOCOL_VERSION = '1.0.2'
STANDARD_PORT = 20812
class UUIDKey(value: _T)

Bases: Generic[_T]

Inheritance diagram of modular_robot_physical.UUIDKey

Wraps a value and implements __eq__ and __hash__ based purely on id(value).

property value: _T

Get the wrapped value.

Returns:

The value.

__eq__(other: object) bool

Compare with another wrapped value using their ids.

Parameters:

other – The object to compare with.

Returns:

Whether their ids are equal.

Raises:

ValueError – If the other objecgt is not an UUIDKey.

__hash__() int

Hash this object using its id only.

Returns:

The hash.