Skip to content
Merged
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
14 changes: 7 additions & 7 deletions crazyflow/sim/sim.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from functools import partial
from pathlib import Path
from typing import Any, Callable
from typing import Any, Callable, Optional

import jax
import jax.numpy as jnp
Expand Down Expand Up @@ -300,15 +300,15 @@
controls = to_device(cmd, self.device)
self.data = self.data.replace(controls=self.data.controls.replace(thrust=controls))

def render(self):
def render(self, mode: Optional[str] = "human", world: Optional[int] = 0, default_cam_config: Optional[dict] = None):

Check failure on line 303 in crazyflow/sim/sim.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (ANN201)

crazyflow/sim/sim.py:303:9: ANN201 Missing return type annotation for public function `render`
if self.viewer is None:
patch_viewer()
self.viewer = MujocoRenderer(self.mj_model, self.mj_data, max_geom=self.max_visual_geom)
self.mj_data.qpos[:] = self.data.mjx_data.qpos[0, :]
self.mj_data.mocap_pos[:] = self.data.mjx_data.mocap_pos[0, :]
self.mj_data.mocap_quat[:] = self.data.mjx_data.mocap_quat[0, :]
self.viewer = MujocoRenderer(self.mj_model, self.mj_data, max_geom=self.max_visual_geom, default_cam_config=default_cam_config, height=480, width=640)
self.mj_data.qpos[:] = self.data.mjx_data.qpos[world, :]
self.mj_data.mocap_pos[:] = self.data.mjx_data.mocap_pos[world, :]
self.mj_data.mocap_quat[:] = self.data.mjx_data.mocap_quat[world, :]
mujoco.mj_forward(self.mj_model, self.mj_data)
self.viewer.render("human")
return self.viewer.render(mode)

def seed(self, seed: int):
"""Set the JAX rng key for the simulation.
Expand Down
Loading