Skip to content

Commit 223cdfe

Browse files
committed
Initial commit.
0 parents  commit 223cdfe

File tree

11 files changed

+3314
-0
lines changed

11 files changed

+3314
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.pyc
2+
/dist/
3+
/*.egg-info
4+
/env*
5+
/build/
6+
/.eggs/
7+
8+
9+
*.swp

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
=====
2+
vwrap
3+
=====
4+
5+
High-level wrapper for controlling `V-REP`_ simulations with Python.
6+
7+
8+
Locating the Remote API Library
9+
-------------------------------
10+
11+
The (slightly modified) Python bindings to the `remote API`_ packaged
12+
with V-REP itself are included here to simplify usage. The modifications make
13+
it somewhat easier to load the remote API library. Instead of looking for the
14+
binary in the current directory, the library looks for a ``VREP`` environment
15+
variable, which should be set to the root directory of the v-rep install.
16+
17+
18+
.. _V-REP: http://www.coppeliarobotics.com/
19+
.. _remote API: http://www.coppeliarobotics.com/helpFiles/en/remoteApiOverview.htm

examples/test.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
Demonstrates basic usage of vwrap including simulation state control, and
3+
control of joints in the example scene.
4+
"""
5+
6+
import sys
7+
import time
8+
import math
9+
10+
try:
11+
import vwrap
12+
except:
13+
sys.path.insert(0, '..')
14+
import vwrap
15+
16+
17+
if __name__ == '__main__':
18+
with vwrap.VrepSimulation() as sim:
19+
ts = time.time()
20+
scene = vwrap.Scene(sim.client_id)
21+
22+
joint = scene.get_joint("Jaco_joint2")
23+
joint.position = joint.initial_position + math.radians(-10)
24+
joint.update()
25+
26+
time.sleep(2)

examples/test_scene.ttt

592 KB
Binary file not shown.

setup.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from setuptools import setup, find_packages
2+
from os import path
3+
4+
def readme():
5+
with open('README.rst') as f:
6+
return f.read()
7+
8+
setup(
9+
name='vwrap',
10+
version='0.1.0',
11+
12+
description='',
13+
long_description=readme(),
14+
15+
url='https://github.com/ucdrascal/vwrap',
16+
17+
author='Kenneth Lyons',
18+
author_email='[email protected]',
19+
20+
license='GPLv3',
21+
22+
classifiers = [
23+
'Development Status :: 4 - Beta',
24+
'Intended Audience :: Science/Research',
25+
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
26+
'Natural Language :: English',
27+
'Operating System :: OS Independent',
28+
'Programming Language :: Python :: 2',
29+
'Programming Language :: Python :: 3'
30+
],
31+
32+
keywords='vrep robotics simulation',
33+
34+
packages=find_packages()
35+
)

vwrap/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from vwrap.wrapper import *

vwrap/util.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright (C) 2016 Kenneth Lyons <[email protected]>
2+
#
3+
# This file is part of vwrap.
4+
#
5+
# This program is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
18+
import os
19+
import platform
20+
import ctypes
21+
22+
23+
def load_library():
24+
"""
25+
Attempts to locate and load the v-rep remote API library via a VREP
26+
environment variable, which is expected to describe the root installation
27+
directory of v-rep.
28+
"""
29+
try:
30+
vrep_dir = os.environ['VREP']
31+
except KeyError:
32+
raise EnvVarNotSetError("VREP environment variable not set")
33+
34+
lib_dir = os.path.join(
35+
vrep_dir, 'programming', 'remoteApiBindings', 'lib', 'lib')
36+
37+
if platform.architecture()[0] == '64bit':
38+
lib_dir = os.path.join(lib_dir, '64Bit')
39+
else:
40+
lib_dir = os.path.join(lib_dir, '32Bit')
41+
42+
if platform.system() == 'cli':
43+
lib_name = 'remoteApi.dll'
44+
elif platform.system() == 'Windows':
45+
lib_name = 'remoteApi.dll'
46+
elif platform.system() == 'Darwin':
47+
lib_name = 'remoteApi.dylib'
48+
else:
49+
lib_name = 'remoteApi.so'
50+
lib_path = os.path.join(lib_dir, lib_name)
51+
52+
return ctypes.CDLL(lib_path)
53+
54+
55+
class EnvVarNotSetError(RuntimeError):
56+
pass

vwrap/vrep.py

Lines changed: 1465 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)