Robots that learn to interact with the environment autonomously
Project description
real-robots
Robots that learn to interact with the environment autonomously
Installation
pip install -U real_robots
If everything went well, then you should be able to run :
real-robots-demo
and it should (eventually) open up a small window with a little robotic arm doing random stuff.
Usage
import gym
import numpy as np
import time
import real_robots
from real_robots.policy import BasePolicy
class RandomPolicy(BasePolicy):
def __init__(self, action_space):
self.action_space = action_space
self.action = action_space.sample()
def step(self, observation, reward, done):
if np.random.rand() < 0.05:
self.action = self.action_space.sample()
return self.action
env = gym.make("REALRobot2020-R2J3-v0")
pi = RandomPolicy(env.action_space)
env.render("human")
observation = env.reset()
reward, done = 0, False
for t in range(40):
action = pi.step(observation, reward, done)
observation, reward, done, info = env.step(action)
Local Evaluation
import gym
import numpy as np
import real_robots
from real_robots.policy import BasePolicy
class RandomPolicy(BasePolicy):
def __init__(self, action_space):
self.action_space = action_space
self.action = action_space.sample()
def step(self, observation, reward, done):
if np.random.rand() < 0.05:
self.action = self.action_space.sample()
return self.action
result, detailed_scores = real_robots.evaluate(
RandomPolicy,
environment='R1',
action_type='macro_action',
n_objects=1,
intrinsic_timesteps=1e3,
extrinsic_timesteps=1e3,
extrinsic_trials=3,
visualize=False,
goals_dataset_path='goals-REAL2020-s2020-50-1.npy.npz'
)
# NOTE : You can find goals-REAL2020-s2020-50-1.npy.npz file in the REAL2020 Starter Kit repository
# or you can generate one using the real-robots-generate-goals command.
#
print(result)
# {'score_REAL2020': 0.06529471503519801, 'score_total': 0.06529471503519801}
print(detailed_scores)
# {'REAL2020': [0.00024387094790936833, 0.19553060745741896, 0.00010966670026571288]}
See also our FAQ.
- Free software: MIT license
Features
The REALRobot environment is a standard gym environment.
It includes a 7DoF kuka arm with a 2DoF gripper, a table with 3 objects on it and a camera looking at the table from the top.
For more info on the environment see environment.md.
Authors
- Francesco Mannella
- Emilio Cartoni
- Sharada Mohanty
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
Built Distribution
File details
Details for the file real_robots-0.1.21.tar.gz
.
File metadata
- Download URL: real_robots-0.1.21.tar.gz
- Upload date:
- Size: 9.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e94526bcb70a23e53ca85f3686744356029c0a6ff8c226d9a76d8d59e81bec9 |
|
MD5 | a9d732b4380d325e6d0665385768c440 |
|
BLAKE2b-256 | 4ed05d04f339d4d8b6602be5396bf5f074cc6fdb7b5688fd8603f1924bf13312 |
File details
Details for the file real_robots-0.1.21-py2.py3-none-any.whl
.
File metadata
- Download URL: real_robots-0.1.21-py2.py3-none-any.whl
- Upload date:
- Size: 18.2 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ead227d8025eced524629c19f6736ec251ec4a163174ac03cf8989efad0717ac |
|
MD5 | 2290f89262f6560cca78b537c51c74f1 |
|
BLAKE2b-256 | 23c9a63dbad03debd9289102f1acda1691ff98ae2290b86e2a3fbad7ce0fec2f |