Fix type errors in mujoco Python library.
PiperOrigin-RevId: 559473920 Change-Id: I45056b4a86a062f223d39c60fbc849ef69a5866b
This commit is contained in:
committed by
Copybara-Service
parent
a2de04f5be
commit
b92a9d599c
@@ -77,13 +77,14 @@ the clause:
|
|||||||
self._rect = _render.MjrRect(0, 0, self._width, self._height)
|
self._rect = _render.MjrRect(0, 0, self._width, self._height)
|
||||||
|
|
||||||
# Create render contexts.
|
# Create render contexts.
|
||||||
self._gl_context = gl_context.GLContext(width, height)
|
# TODO(nimrod): Figure out why pytype doesn't like gl_context.GLContext
|
||||||
|
self._gl_context = gl_context.GLContext(width, height) # type: ignore
|
||||||
self._gl_context.make_current()
|
self._gl_context.make_current()
|
||||||
self._mjr_context = _render.MjrContext(
|
self._mjr_context = _render.MjrContext(
|
||||||
model, _enums.mjtFontScale.mjFONTSCALE_150
|
model, _enums.mjtFontScale.mjFONTSCALE_150.value
|
||||||
)
|
)
|
||||||
_render.mjr_setBuffer(
|
_render.mjr_setBuffer(
|
||||||
_enums.mjtFramebuffer.mjFB_OFFSCREEN, self._mjr_context
|
_enums.mjtFramebuffer.mjFB_OFFSCREEN.value, self._mjr_context
|
||||||
)
|
)
|
||||||
|
|
||||||
# Default render flags.
|
# Default render flags.
|
||||||
@@ -231,8 +232,9 @@ the clause:
|
|||||||
if not isinstance(camera, _structs.MjvCamera):
|
if not isinstance(camera, _structs.MjvCamera):
|
||||||
camera_id = camera
|
camera_id = camera
|
||||||
if isinstance(camera_id, str):
|
if isinstance(camera_id, str):
|
||||||
camera_id = _functions.mj_name2id(self._model,
|
camera_id = _functions.mj_name2id(
|
||||||
_enums.mjtObj.mjOBJ_CAMERA, camera_id)
|
self._model, _enums.mjtObj.mjOBJ_CAMERA.value, camera_id
|
||||||
|
)
|
||||||
if camera_id == -1:
|
if camera_id == -1:
|
||||||
raise ValueError(f'The camera "{camera}" does not exist.')
|
raise ValueError(f'The camera "{camera}" does not exist.')
|
||||||
if camera_id < -1 or camera_id >= self._model.ncam:
|
if camera_id < -1 or camera_id >= self._model.ncam:
|
||||||
@@ -257,6 +259,6 @@ the clause:
|
|||||||
data,
|
data,
|
||||||
scene_option,
|
scene_option,
|
||||||
None,
|
None,
|
||||||
camera, _enums.mjtCatBit.mjCAT_ALL,
|
camera, _enums.mjtCatBit.mjCAT_ALL.value,
|
||||||
self._scene,
|
self._scene,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user