google-research / ravens

Train robotic agents to learn pick and place with deep learning for vision-based manipulation in PyBullet. Transporter Nets, CoRL 2020.
https://transporternets.github.io
Apache License 2.0
538 stars 93 forks source link

Implement "continuous" ravens. #11

Closed kevinzakka closed 3 years ago

kevinzakka commented 3 years ago

This PR implements a continuous version of the environments and tasks, which allows us to generate dense trajectories. Specifically it contains:

Here is some example code to illustrate the new API, which closely mimics the discrete one:

env = environment.ContinuousEnvironment(ASSETS_PATH)
task = tasks.StackBlockPyramid(continuous=True)
env.set_task(task)
env.seed(1)
agent = task.oracle(env)  # This is now an instance of `ContinuousOracle`.
obs = env.reset()

info = None
done = False
for i in range(100):
    act = agent.act(obs, info)
    obs, rew, done, info = env.step(act)
    if done:
        print(f"Done at step {i}. Exiting.")
        break

This generates the following trajectory for the StackBlockPyramid task:

https://user-images.githubusercontent.com/10518920/124039895-ac213780-d9b8-11eb-91a2-97577074bbe7.mp4

You can also increase the density of the steps generated by the oracle, which allows you to generate more intermediate observations. Here is a second demonstration generated via agent = task.oracle(env, steps_per_seg=5):

https://user-images.githubusercontent.com/10518920/124040871-9ad92a80-d9ba-11eb-9c6b-524be81f5e56.mp4

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

kevinzakka commented 3 years ago

@googlebot I signed it!

ayzaan commented 3 years ago

Hey @kevinzakka, I was actually able to apply the linter fixes internally and merge the PR that way. Thanks for the contribution!