Controller Input Control (Internal)#

Warning

This section documents internal input control components. Users should not use these classes directly.

class go2.modules.input.callback_manager.InputSignalCallbackManager[source]#

Bases: object

Internal manager for controller input callbacks.

Responsibilities:
  • Register/unregister callbacks

  • Detect analog and digital changes

  • Execute callbacks when signals change

Notes

  • Analog signals have configurable thresholds

  • Stick movement is measured as vector distance

  • Call handle(state) with the latest ControllerState each update

_check_analog_trigger(current: float, previous: float, cb: Callback) bool[source]#

Return True if analog change exceeds threshold.

_check_digital_trigger(current: float, previous: float, cb: Callback) bool[source]#

Return True if digital button transitioned from 0 to 1.

_execute(cb: Callback, state: ControllerState) None[source]#

Invoke a callback safely with error handling.

_handle(state: ControllerState) None[source]#

Evaluate the current controller state and execute callbacks.

Parameters:

state (ControllerState) – Latest controller state

_register(signal: InputSignal, callback: Callable[[ControllerState], None], name: str | None = None, threshold: float = 0.1) Callback[source]#

Register a callback for a signal.

Parameters:
  • signal (InputSignal) – The controller signal to monitor

  • callback (Callable[[ControllerState], None]) – Function to call when signal triggers

  • name (Optional[str]) – Human-readable name for the callback

  • threshold (float) – Threshold for analog inputs

Returns:

The registered callback object

Return type:

Callback

_should_trigger(signal: InputSignal, cb: Callback, current_state: ControllerState) bool[source]#

Determine if a callback should fire based on signal changes.

Parameters:
_shutdown() None[source]#

Clear all callbacks and reset manager state.

_stick_changed(stick: str, current_state: ControllerState, threshold: float) bool[source]#

Check if stick movement exceeds threshold (vector magnitude).

_unregister(signal: InputSignal, callback: Callable[[ControllerState], None]) None[source]#

Unregister a previously registered callback.

Parameters:
class go2.modules.input.callback_manager.Callback[source]#

Bases: object

Represents a registered callback for a controller input signal.

callback: Callable[[ControllerState], None]#

Function to call when the signal triggers

name: str | None = None#

Human-readable identifier for the callback

signal: InputSignal#

Signal associated with this callback

threshold: float = 0.1#

Minimum change required to trigger for analog inputs