Core Framework (Internal)#

Warning

This section documents the internal core framework. Users should not use these classes directly.

Base Module#

class go2.core.module.DogModule(name: str)[source]#

Bases: ABC

Base class for all dog functionality modules.

This class defines the common lifecycle shared by all internal modules (e.g., movement, video, etc.). Modules are not meant to be interacted with or instaniated directly. Users should only interact with initialized modules via Go2Controller.

Notes

  • All modules must implement initialize and shutdown.

  • Initialization is idempotent and guarded by _initialized.

  • Modules are created and managed by the module registry.

See also

ModuleRegistry

abstract _initialize() None[source]#

Initialize the module.

This method is called once during module registration to a Go2Controller instance. This should not be called by users.

final _set_hardware_internal(hardware_type: HardwareType) None[source]#

Intitializes the module to use a specific HardwareType. This should not be called by users.

abstract _shutdown() None[source]#

Cleanly shut down the module. This is handled automatically and shouldn’t be called by users.

This method is called during system shutdown and should release any resources acquired during initialization.

is_initialized() bool[source]#

Check whether the module has been initialized.

Returns:

True if the module has completed initialization.

Return type:

bool

Hardware Control#

Hardware Interface#

class go2.hardware.hardware_interface.HardwareInterface[source]#

Bases: ABC

Abstract interface for dog hardware control.

This interface defines the minimum set of motion and posture commands required by the system.

Notes

  • This is an internal abstraction.

  • Users should not subclass this directly.

abstract _initialize() None[source]#

Initialize the hardware interface. This is handled automatically and shouldn’t be called by users. Hardware initialization is linked to the core controller’s initialization. The hardware is guaranteed to be initialized before any other system provided by this package.

Establishes communication with the native or virtual backend.

abstract _move(vx: float, vy: float) None[source]#

Move the dog in the horizontal plane.

Parameters:
  • vx (float) – Forward/backward velocity.

  • vy (float) – Left/right velocity.

abstract _rotate(vrot: float)[source]#

Rotate the dog in place.

Parameters:

vrot (float) – Rotational velocity.

abstract _shutdown() None[source]#

Cleanly shut down the hardware interface. This should not be called by users.

abstract _stand_down() None[source]#

Command the dog to lie down.

abstract _stand_up() None[source]#

Command the dog to stand up.

abstract _stop_move() None[source]#

Immediately stop all movement and clear internal movement command buffer.

Native Hardware#

class go2.hardware.native.native_hardware.NativeHardware[source]#

Bases: HardwareInterface

Hardware interface to execute on the Unitree GO2 itself.

This implementation communicates with the real robot using unitree_sdk2py. It can only used for native execution on the robot.

Warning

  • This class issues real hardware commands.

  • Improper use may cause unexpected robot motion.

_initialize() None[source]#

Initialize the Unitree SDK connection.

This method sets up DDS communication and initializes the sport client.

_move(vx: float, vy: float) None[source]#

Move the dog in the horizontal plane.

Parameters:
  • vx (float) – Forward/backward velocity.

  • vy (float) – Left/right velocity.

_rotate(vrot: float)[source]#

Rotate the dog in place.

Parameters:

vrot (float) – Rotational velocity.

_shutdown() None[source]#

Cleanly shut down the hardware interface. This should not be called by users.

_stand_down() None[source]#

Command the dog to lie down.

_stand_up() None[source]#

Command the dog to stand up.

_stop_move() None[source]#

Immediately stop all movement and clear internal movement command buffer.

Virtual Hardware#

class go2.hardware.virtual.virtual_hardware.VirtualHardware[source]#

Bases: HardwareInterface

Virtual hardware backend for development and testing.

This implementation mimics robot functionality using the Unitree provided Mujoco simulator. The simulator is launched via seperate process during initialization of the hardware.

Dependencies#

_initialize() None[source]#

Initialize the hardware interface. This is handled automatically and shouldn’t be called by users. Hardware initialization is linked to the core controller’s initialization. The hardware is guaranteed to be initialized before any other system provided by this package.

Establishes communication with the native or virtual backend.

_move(vx: float, vy: float) None[source]#

Move the dog in the horizontal plane.

Parameters:
  • vx (float) – Forward/backward velocity.

  • vy (float) – Left/right velocity.

_rotate(vrot: float)[source]#

Rotate the dog in place.

Parameters:

vrot (float) – Rotational velocity.

_shutdown() None[source]#

Cleanly shut down the hardware interface. This should not be called by users.

_stand_down() None[source]#

Command the dog to lie down.

_stand_up() None[source]#

Command the dog to stand up.

_stop_move() None[source]#

Immediately stop all movement and clear internal movement command buffer.

Module Management#

class go2.core.registry.ModuleDescriptor(_module_type: ModuleType, _module_class: Type[T], _display_name: str, _requires_native_hardware: bool = False, _requires_advanced_execution: bool = False)[source]#

Bases: Generic[T]

Descriptor linking a module type to its implementation.

Contains all metadata required to construct and display a module in the system.