Skip to content

zhongyuchen/gym-worm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gym-worm

OpenAI Gym environments for simulating the nematode C. elegans

Prerequisites

  • python==3.8
  • Swimmer-v3 requires mujoco-py dependencies; Swimmer-v4 requires mujoco dependencies
  • install worm-assets and its dependencies

Dependencies for mujoco-py

  • visit http://roboti.us/ and download MuJoCo 2.0 mujoco200_linux.zip, unzip it and get mujoco200_linux/, rename it to mujoco200/ and put it in ~/.mujoco folder
  • download activation key mjkey.txt and put it in ~/.mujoco folder
  • add environment variables in ~/.bashrc file, and run source ~/.bashrc
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ubuntu/.mujoco/mujoco200/bin
    export MUJOCO_PY_MUJOCO_PATH=/home/ubuntu/.mujoco/mujoco200
    
  • install mujoco-py: pip install mujoco-py==2.0.2.13
  • install gym: pip install gym==0.22.0

Troubleshooting

Many errors may spring up while installing mujoco-py dependencies.

  • run sudo apt update and sudo apt-get update first, and try the following
  • sudo apt install gcc
  • sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3
  • sudo apt install libgl1-mesa-glx --reinstall
  • sudo apt install libgl1-mesa-dev
  • sudo apt-get install libc-dev
  • conda install patchelf or sudo apt-get install patchelf

Dependencies for mujoco

  • install mujoco: pip install mujoco
  • install gym: pip install gym
  • install imageio: pip install imageio
  • install moviepy: pip install moviepy
  • make sure that mujoco-py is NOT installed

Installation

  • install the project in editable mode from local project path pip install -e .

Gym Debugging

Add the following lines in the script, it'll output info messages.

import gym
gym.logger.set_level(gym.logger.DEBUG)

Gym agents

  • Capsule_v0: Capsule-v0 models skating effect with anisotropic friction
  • ellipsoid2d_v0: Ellipsoid2D-v0 with only z-axis rotation dof
  • ellipsoid_v0: Ellipsoid-v0 with specific n_bodies, joint_range and meshes
  • ellipsoid_v1: Ellipsoid-v1 with specific n_bodies, joint_range, meshes and y-axis rotational degree of freedom
  • head: head setup enabling free rotation at head and neck
  • joint: remove joints and its corresponding actuators
  • muscle_ellipsoid2d_v0: ellipsoid swimmer with tendon muscles and only z-axis rotation dof
  • muscle_ellipsoid_v0: ellipsoid swimmer with tendon muscles
  • muscle_swimmer_v0: muscle swimmer with specific n_bodies, joint_range, body_len and muscle_len
  • muscle_worm_v0: muscle swimmer with specific joint_range, body_len, muscle_len and arrangement
  • position_actuator: position actuators
  • sphere_v0: Sphere-v0 with specific n_bodies, joint_range and meshes
  • sphere_v1: Sphere-v1 with specific n_bodies, joint_range, meshes and y-axis rotational degree of freedom
  • swimmer_v3: Swimmer-v3 modified to allow loading model from xml_str
  • swimmer_v3_v1: Swimmer-v3 with specific n_bodies, joint_range and body_len
  • swimmer_v4: Swimmer-v4 modified to allow loading model from xml_str
  • trapped: trap specific bodies

Gym environments

  • agar: agar environment containing composite object as agar based NGM
  • camera: camera setup
  • compositional_env: child models can be attached to parent models in order to create compositional scenes
  • chemotaxis: chemotaxis environment containing a cylinder as chemical source
  • forage: forage environment containing cylinders as chemical sources and box geoms as perimeter
  • frame_sensor: frame sensors for framepos and framequat
  • friction: friction environment containing box geoms as sections of floor with different friction setting
  • gravity: gravity setup
  • maze: maze environment containing box geoms as perimeter and walls
  • pool: pool environment for simulating swimming behavior in 3D space
  • position: position sensors of 3D center of mass and position
  • sensor: actuator sensors
  • tendon: tendon sensors of tendon length and velocity
  • terrain: terrain environment
  • touch: touch sensors at the head and tail
  • tracking: tracking environment containing a controllable sphere as chemical source

Gym wrappers

  • distribution_observation: wrapper for environmental substance distribution
  • muscle_action: wrapper for decoding locomotion outputs of body wall muscles into control signals
  • recorder: wrapper for selecting camera
  • sensor_observation: wrapper for sensor data
  • skip_frame: wrapper for skipping frames

Gym simulations

  • circle: circular action for arena and no action for robot
  • random: random action
  • zero: no action

MuJoCo skin

References

About

OpenAI Gym environments for simulating the nematode C. elegans

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages