hyphi_gym.common.simulation
#
MuJoCo-Based Physics Simulation Base Class insipired by: - ‘Gymnasium Robotics’ by Rodrigo de Lazcano, Kallinteris Andreas, Jun Jet Tai, Seungjae Ryan Lee, Jordan Terry (https://github.com/Farama-Foundation/Gymnasium-Robotics) - ‘D4RL: Datasets for Deep Data-Driven Reinforcement Learning’ by Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, Sergey Levine. (https://github.com/Farama-Foundation/D4RL)
Original Code adapted to integrate with hyphi maze generation and env registration
Module Contents#
Classes#
Mujoco Based Simulation Base Class adapted from gymnasium MujocoEnv for target-based hyphi envs |
Attributes#
- hyphi_gym.common.simulation.get_xml#
- class hyphi_gym.common.simulation.Simulation(render_mode: str | None = None, frame_skip=1, position_noise=0)#
Mujoco Based Simulation Base Class adapted from gymnasium MujocoEnv for target-based hyphi envs
- property _robot_obs#
- property dt#
- base_xml: str#
- default_cam_config: dict#
- data: hyphi_gym.utils.mujoco_utils.MujocoData | None#
- model: hyphi_gym.utils.mujoco_utils.MujocoModel | None#
- model_path: str | None#
- setup_world()#
- load_xml(path)#
- load_world()#
Helper function to load a generated world from self.model_path falling back to self.base_xml
- set_world()#
Save current world state for reset
- reset_world()#
- render() numpy.ndarray | None #
- close()#
- _forward()#
- _get_pos(key)#
Helper to retrieve position and velocity
- _get_rot(key)#
Helper to retrieve rotation and velocity
- _set_vel(qvel)#
- _set_pos(qpos)#
- _set_mocap(pos, rot, key)#
- do_simulation(action: numpy.ndarray | None = None)#
Step the simulation applying a ctrl action self.frame_skip-times
- _pos(idx: numpy.ndarray | tuple) numpy.ndarray #
Converts a cell index (i,j) to x and y position in the MuJoCo simulation
- _noisy(pos: numpy.ndarray, noise=None) numpy.ndarray #
Pass an x,y coordinate and it will return the same coordinate with uniform noise added