Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,3 @@
texinfo_documents = [
(master_doc, "robosuite", "robosuite Documentation", author, "robosuite", "ARISE", "Miscellaneous"),
]

autodoc_mock_imports = [
"robosuite.devices.mjgui",
"robosuite.devices.spacemouse",
"robosuite.devices.keyboard",
"robosuite.devices.device",
]
7 changes: 6 additions & 1 deletion robosuite/devices/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
"""

import numpy as np
from pynput.keyboard import Controller, Key, Listener

from robosuite.devices import Device
from robosuite.utils.log_utils import ROBOSUITE_DEFAULT_LOGGER
from robosuite.utils.transform_utils import rotation_matrix

try:
from pynput.keyboard import Key, Listener
except ImportError as e:
ROBOSUITE_DEFAULT_LOGGER.error(f"Failed to import pynput. Error: {e}.")


class Keyboard(Device):
"""
Expand Down
17 changes: 10 additions & 7 deletions robosuite/devices/spacemouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@
from collections import namedtuple

import numpy as np
from pynput.keyboard import Controller, Key, Listener

from robosuite.utils.log_utils import ROBOSUITE_DEFAULT_LOGGER

try:
import hid
except ModuleNotFoundError as exc:
raise ImportError(
"Unable to load module hid, required to interface with SpaceMouse. "
except ModuleNotFoundError as e:
ROBOSUITE_DEFAULT_LOGGER.error(
f"Unable to load module hid, required to interface with SpaceMouse. "
"Only macOS is officially supported. Install the additional "
"requirements with `pip install -r requirements-extra.txt`"
) from exc
"requirements with `pip install -r requirements-extra.txt` "
f"Error: {e}."
)

from pynput.keyboard import Controller, Key, Listener
try:
from pynput.keyboard import Listener
except ImportError as e:
ROBOSUITE_DEFAULT_LOGGER.error(f"Failed to import pynput. Error: {e}.")

import robosuite.macros as macros
from robosuite.devices import Device
Expand Down
Loading