Skip to content

Commit

Permalink
Initial public commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
stepjam committed Jun 26, 2019
0 parents commit 08ed3b2
Show file tree
Hide file tree
Showing 101 changed files with 15,257 additions and 0 deletions.
102 changes: 102 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

./idea
.idea/

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

pyrep/backend/_v_rep_cffi*

30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
dist: xenial
language: python
services:
- xvfb
python:
- "3.6"
before_install:
- sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
- sudo apt-get update -qq
- sudo apt-get install qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev
- sudo apt-get install qt5-default qttools5-dev-tools
install:
- cur=`pwd`
# Pull V-REP
- wget http://coppeliarobotics.com/files/V-REP_PRO_EDU_V3_6_2_Ubuntu16_04.tar.xz
- tar -xf V-REP_PRO_EDU_V3_6_2_Ubuntu16_04.tar.xz
- export VREP_ROOT="$cur/V-REP_PRO_EDU_V3_6_2_Ubuntu16_04"
- echo $VREP_ROOT
# $VREP_ROOT/platforms needed otherwise will get:
# qt.qpa.plugin: Could not load the Qt platform plugin "xcb"
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VREP_ROOT:$VREP_ROOT/platforms
- export QT_QPA_PLATFORM_PLUGIN_PATH=$VREP_ROOT
- pip3 install -r requirements.txt
- python3 setup.py install
# command to run tests
script:
# We need to rename the local folder otherwise we will test this rather than
# the installed version.
- mv pyrep _pyrep
- python3 -m unittest discover tests
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Stephen James

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
185 changes: 185 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# PyRep [![Build Status](https://travis-ci.com/stepjam/PyRep.svg?token=bQxtiYV3p3bPYhzWMoLi&branch=master)](https://travis-ci.com/stepjam/PyRep)

__PyRep is a toolkit for robot learning research, built on top of the virtual
robotics experimentation platform ([V-REP](www.coppeliarobotics.com/)).__

- [Install](#install)
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Supported Robots](#supported-robots)
- [Planned Future Updates](#planned-future-updates)
- [Contributing](#contributing)


## Install

In addition to the PyRep API, you will aso need to download the latest version of V-REP [from the downloads page](http://www.coppeliarobotics.com/downloads.html).

Once you have downloaded V-REP, you can pull PyRep from git:

```bash
git clone https://github.com/stepjam/PyRep.git
cd PyRep
```

Add the following to your *~/.bashrc* file: (__NOTE__: the 'EDIT ME' in the first line)

```bash
export VREP_ROOT=EDIT/ME/PATH/TO/V-REP/INSTALL/DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VREP_ROOT
export QT_QPA_PLATFORM_PLUGIN_PATH=$VREP_ROOT
```

__Remember to source your bashrc after this:__ ```source ~/.bashrc```.

Finally install the python library:

```bash
python3 setup.py install --user
```

You should be good to go!
Try running one of the examples in the *examples/* folder.

_Although you can use V-REP on any platform, communication via PyRep is currently only supported on Linux._

#### Running Headless

If you plan to run on a headless machine, you will also need to run with a virtual framebuffer. E.g.

```bash
sudo apt-get install xvfb
xvfb-run python3 my_pyrep_app.py
```

## Getting Started

1. First take a look at [Usage](#usage) and the examples in the *examples/* folder to see if PyRep might be able to accelerate your research.
2. Take a look at the V-REP [tutorials](http://www.coppeliarobotics.com/helpFiles/en/tutorials.htm).

## Usage

The best way to see how PyRep can help in your research is to look at the examples in the *examples/* folder!

#### Launching the simulation

```python
from pyrep import PyRep

pr = PyRep()
# Launch the application with a scene file in headless mode
pr.launch('scene.ttt', headless=True)
pr.start() # Start the simulation

# Do some stuff

pr.start() # Stop the simulation
pr.shutdown() # Close the application
```


#### Modifying the Scene

```python
from pyrep.objects.shape import Shape
from pyrep.const import PrimitiveShape

object = Shape.create(type=PrimitiveShape.CYLINDER,
color=[r,g,b], size=[w, h, d],
position=[x, y, z])
object.set_color([r, g, b])
object.set_position([x, y, z])
```

#### Using Robots

Robots are designed to be modular; arms are treated separately to grippers.

Use the robot ttm files defined in robots/ttms. These have been altered slightly from the original ones shipped with V-REP to allow them to be used with motional planning out of the box.
The 'tip' of the robot may not be where you want it, so feel free to play around with this.

```python
from pyrep import PyRep
from pyrep.robots.arms.panda import Panda
from pyrep.robots.end_effectors.panda_gripper import PandaGripper

pr = PyRep()
# Launch the application with a scene file that contains a robot
pr.launch('scene_with_panda.ttt')
pr.start() # Start the simulation

arm = Panda() # Get the panda from the scene
gripper = PandaGripper() # Get the panda gripper from the scene

velocities = [.1, .2, .3, .4, .5, .6, .7]
arm.set_joint_target_velocities(velocities)
pr.step() # Step physics simulation

done = False
# Open the gripper halfway at a velocity of 0.04.
while not done:
done = gripper.actuate(0.5, velocity=0.04)
pr.step()

pr.start() # Stop the simulation
pr.shutdown() # Close the application
```

We recommend constructing your robot in a dictionary or a small structure, e.g.


```python
class MyRobot(object):
def __init__(self, arm, gripper):
self.arm = arm
self.gripper = gripper

arm = Panda() # Get the panda from the scene
gripper = PandaGripper() # Get the panda gripper from the scene

# Create robot structure
my_robot_1 = MyRobot(arm, gripper)
# OR
my_robot_2 = {
'arm': arm,
'gripper': gripper
}
```

## Supported Robots

Here is a list of robots currently supported by PyRep:

#### Arms

- Kinova Mico
- Kinova Jaco
- Rethink Baxter
- Rethink Sawyer
- Franka Emika Panda
- Kuka LBR iiwa 7 R800
- Kuka LBR iiwa 14 R820
- Universal Robots UR3
- Universal Robots UR5
- Universal Robots UR10

#### Grippers

- Kinova Mico Hand
- Kinova Jaco Hand
- Rethink Baxter Gripper
- Franka Emika Panda Gripper

Feel free to send pull requests for new robots!

## Planned Future Updates

- Support for mobile bases (including planning)
- Support for MuJoCo
- Sim-to-Real support (e.g. domain randomization)

## Contributing

We want to make PyRep the best tool for rapid robot learning research. If you would like to get involved, then please [get in contact](https://www.doc.ic.ac.uk/~slj12/)!

Pull requests welcome for bug fixes!
Empty file added cffi_build/__init__.py
Empty file.
Loading

0 comments on commit 08ed3b2

Please sign in to comment.