An OpenAI Gym Env for Panda
Project description
gym-panda
OpenaAI Gym Franka Emika Panda robot grasping environment implemented with PyBullet
Links
- GitHub: https://github.com/mahyaret/gym-panda
- PyPI: https://pypi.org/project/gym-panda/
- Documentation: https://www.etedal.net/2020/04/pybullet-panda_2.html
- Issue Tracker:https://github.com/mahyaret/gym-panda/issues
- Download: https://pypi.org/project/gym-panda/#files
Install
Install with pip
:
pip install gym-panda
Or, install from source:
git clone https://github.com/mahyaret/gym-panda.git
cd gym-panda
pip install .
Basic Usage
Running an environment:
import gym
import gym_panda
env = gym.make('panda-v0')
env.reset()
for _ in range(100):
env.render()
obs, reward, done, info = env.step(
env.action_space.sample()) # take a random action
env.close()
Running a PD control HACK!
import gym
import gym_panda
env = gym.make('panda-v0')
observation = env.reset()
done = False
error = 0.01
fingers = 1
info = [0.7, 0, 0.1]
k_p = 10
k_d = 1
dt = 1./240. # the default timestep in pybullet is 240 Hz
t = 0
for i_episode in range(20):
observation = env.reset()
fingers = 1
for t in range(100):
env.render()
print(observation)
dx = info[0]-observation[0]
dy = info[1]-observation[1]
target_z = info[2]
if abs(dx) < error and abs(dy) < error and abs(dz) < error:
fingers = 0
if (observation[3]+observation[4])<error+0.02 and fingers==0:
target_z = 0.5
dz = target_z-observation[2]
pd_x = k_p*dx + k_d*dx/dt
pd_y = k_p*dy + k_d*dy/dt
pd_z = k_p*dz + k_d*dz/dt
action = [pd_x,pd_y,pd_z,fingers]
observation, reward, done, info = env.step(action)
if done:
print("Episode finished after {} timesteps".format(t+1))
break
env.close()
Development
- clone the repo:
git clone https://github.com/mahyaret/gym-panda.git
cd gym-panda
- Create/activate the virtual environment:
pipenv shell --python=python3.6
- Install development dependencies:
pipenv install --dev
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gym_panda-0.0.6.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for gym_panda-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af6555f3799d274f75a4530d7cb9e2b6416069ba381a9dc95c48fec1940fb67d |
|
MD5 | 88e0e7a387c07674a39b6509f9d05f91 |
|
BLAKE2b-256 | 0cb5e4c8b45de41e9976b165b55f3052705ee34bbaa4d31f78972f3d7015ee64 |