nnspike.unit.mode_manager

Classes

ModeManager(course)

Manages the current mode of the robot unit based on image analysis and sensor data.

class nnspike.unit.mode_manager.ModeManager(course)[source]

Manages the current mode of the robot unit based on image analysis and sensor data.

This class is responsible for determining and transitioning between different behavior modes including edge following, obstacle avoidance, and various bottle carrying phases. Mode transitions are determined based on motor position thresholds, image processing results (color detection), and sensor readings.

The class uses toggle flags to prevent repeated transitions and ensures each mode change occurs only once when conditions are met.

__init__(course)[source]

Initialize the ModeManager with a specified course direction.

Parameters:

course (str) – The direction of the course, either “left” or “right”

get_current_mode()[source]

Get the current mode of the action chain.

Return type:

Mode

set_current_mode(mode)[source]
Return type:

None

get_previous_mode()[source]

Get the previous mode of the action chain.

Return type:

Mode

decide_next_mode(image, et)[source]
Return type:

tuple[Mode, bool]