Source code for omni.isaac.lab.devices.device_base
# Copyright (c) 2022-2024, The Isaac Lab Project Developers.
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
"""Base class for teleoperation interface."""
from abc import ABC, abstractmethod
from collections.abc import Callable
from typing import Any
[docs]class DeviceBase(ABC):
"""An interface class for teleoperation devices."""
[docs] def __init__(self):
"""Initialize the teleoperation interface."""
pass
def __str__(self) -> str:
"""Returns: A string containing the information of joystick."""
return f"{self.__class__.__name__}"
"""
Operations
"""
[docs] @abstractmethod
def reset(self):
"""Reset the internals."""
raise NotImplementedError
[docs] @abstractmethod
def add_callback(self, key: Any, func: Callable):
"""Add additional functions to bind keyboard.
Args:
key: The button to check against.
func: The function to call when key is pressed. The callback function should not
take any arguments.
"""
raise NotImplementedError
[docs] @abstractmethod
def advance(self) -> Any:
"""Provides the joystick event state.
Returns:
The processed output form the joystick.
"""
raise NotImplementedError