_brain_cpg_instance
Module Contents
Classes
CPG network brain. |
- class BrainCpgInstance(initial_state: numpy.typing.NDArray[numpy.float_], weight_matrix: numpy.typing.NDArray[numpy.float_], output_mapping: list[tuple[int, modular_robot.body.base.ActiveHinge]])
Bases:
modular_robot.brain._brain_instance.BrainInstance
CPG network brain.
A state array that is integrated over time following the differential equation X’=WX. W is a weight matrix that is multiplied by the state array. The outputs of the controller are defined by the outputs, a list of indices for the state array.
- control(dt: float, sensor_state: modular_robot.sensor_state.ModularRobotSensorState, control_interface: modular_robot._modular_robot_control_interface.ModularRobotControlInterface) None
Control the modular robot.
Sets the active hinge targets to the values in the state array as defined by the mapping provided in the constructor.
- Parameters:
dt – Elapsed seconds since last call to this function.
sensor_state – Interface for reading the current sensor state.
control_interface – Interface for controlling the robot.