Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pierfabre committed Jan 24, 2025
1 parent 79706fe commit 899c24c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 5 additions & 4 deletions furuta/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

@dataclass
class RobotModel:
robot = pin.RobotWrapper.BuildFromURDF(
"robot/hardware/URDF/robot.urdf",
package_dirs=[str(Path("robot/hardware/URDF/STL/").absolute())],
)
robot = None
# robot = pin.RobotWrapper.BuildFromURDF(
# "robot/hardware/URDF/robot.urdf",
# package_dirs=[str(Path("robot/hardware/URDF/STL/").absolute())],
# )


class Robot:
Expand Down
7 changes: 3 additions & 4 deletions furuta/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(cls):

@classmethod
@abstractmethod
def display(cls, state: np.ndarray) -> (np.ndarray | None):
def display(cls, state: np.ndarray) -> np.ndarray:
pass

@classmethod
Expand Down Expand Up @@ -65,7 +65,7 @@ def __init__(cls, render_fps: int = 30, render_mode: str = "human"):
cls.screen = None
cls.clock = None

def display(cls, state: np.ndarray):
def display(cls, state: np.ndarray) -> np.ndarray:
# https://github.com/Farama-Foundation/Gymnasium/blob/6baf8708bfb08e37ce3027b529193169eaa230fd/gymnasium/envs/classic_control/cartpole.py#L229
import pygame
from pygame import gfxdraw
Expand Down Expand Up @@ -148,8 +148,7 @@ def display(cls, state: np.ndarray):
cls.clock.tick(cls.render_fps)
pygame.display.flip()

elif cls.render_mode == "rgb_array":
return np.transpose(np.array(pygame.surfarray.pixels3d(cls.screen)), axes=(1, 0, 2))
return np.transpose(np.array(pygame.surfarray.pixels3d(cls.screen)), axes=(1, 0, 2))

def close(cls):
if cls.screen is not None:
Expand Down

0 comments on commit 899c24c

Please sign in to comment.