A gym environment for Low-Cost Robot Arm in Drake.
Create a virtual environment with Python 3.10 and activate it, e.g. with miniconda
:
conda create -y -n gym-drake-lca python=3.10 && conda activate gym-drake-lca
Install gym-drake-lca:
pip install gym-drake-lca
# example.py
import imageio
import gymnasium as gym
import numpy as np
import gym_drake_lca
env = gym.make("LiftCube-v0")
observation, info = env.reset()
frames = []
N = 100
for i in range(N):
env.reset()
action = env.action_space.sample()
observation, reward, terminated, truncated, info = env.step(action)
image = env.render()
frames.append(image)
if terminated or truncated:
observation, info = env.reset()
env.close()
imageio.mimsave("example.mp4", np.stack(frames), fps=25)
Instead of using pip
directly, we use poetry
for development purposes to easily track our dependencies.
If you don't have it already, follow the instructions to install it.
Install the project with dev dependencies:
poetry install --all-extras
# install pre-commit hooks
pre-commit install
# apply style and linter checks on staged files
pre-commit
These instrutions are adapted from gym-aloha This project is adapted from gym-lowcostrobot