stepjam / pyrep Goto Github PK
View Code? Open in Web Editor NEWA toolkit for robot learning research.
License: MIT License
A toolkit for robot learning research.
License: MIT License
Hi Stephen,
I cannot get a custom lua function to run.
in my file, I have a customization script attached to a Dummy object.
test_function=function(inInts, inFloats, inStrings, inBuffer)
print("test")
return {42}, {}, {}, ''
end
and then I call
pr = PyRep()
pr.launch("test_scene_pyrep.ttt", headless=False)
out = pr.script_call("test_function@Dummy", vrepConst.sim_scripttype_customizationscript)
print(out)
but I get the error
RuntimeError: The call failed on the V-REP side. Return value: -1
Any hints?
Calling a function in a customization script of a "remote_api" dummy object used to work fine in V-Rep.
Best,
Mark
It returns "AttributeError: 'ObjectType' object has no attribute 'get_handle'"
Best,
Mark
PS: Thanks for adding the copy() method!
I keep getting an identifier error with this line:
export VREP_ROOT=EDIT/ME/PATH/TO/V-REP/INSTALL/DIR
as,
$ export VREP_ROOT=C:/Program Files/V-REP3/V-REP_PRO_EDU/install
please help me =)
Hi Stepjam,
I was following your instructions on Adding Robots Tutorial, and I think you might had forgotten to explain to click add Ik elements on Kinematics group
, I'm not sure but, the unittest only worked after adding it to the new added ik group.
About the tutorial I have a question about Dummys
, over there you say to:
In the scene hierarchy, the 'target' dummy should be a child of the robot root node, and the tip dummy should be a child of the last node in the robot arm. Position both the dummies at the tip of the arm, and orient the tip dummy such that the z-axis points out from the arm.
Why is that?
I did it, but when I started my simulation on my experiment, the 'target' dummy kept being lost and being in the midle of nowhere, trying to follow the tip, but like it had an delay. So I putted it as an child of the last node in the robot arm.
Is it wrong? Should I be concerned about anything?
Once again, great work!
Thanks!
Hi Stephen,
I tried to install the PyRep, and meet the error as follows:
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/build/pyrep/backend/pyrep/backend/_v_rep_cffi.o -L/home/quantumiracle/research/vrep/PyRep/PyRep -lv_rep -o build/lib.linux-x86_64-3.6/pyrep/backend/_v_rep_cffi.cpython-36m-x86_64-linux-gnu.so /usr/bin/ld: cannot find -lv_rep collect2: error: ld returned 1 exit status error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
And I tried sudo apt-get install python3-dev
and it's already the newest, so it doesn't solved my case.
Moreover, if I tried to install it in a conda environment with python3, the error would be:
/usr/bin/x86_64-linux-gnu-ld: cannot find -lv_rep collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1
Do you know how to solve this?
Thanks,
Hanry
Hi Stephen,
I try to read the distance of a distance object with vrep.simReadDistance
, but the return value is 3.4028232762376986e+36 instead of the value it should return which is 0.6.
In my file, I start the scene
pr = PyRep()
pr.launch(SCENE_FILE, headless=False)
pr.start()
then I get the handle of the distance object and read the distance
handle = vrep.simGetDistanceHandle("Distance")
dist = vrep.simReadDistance(handle)
Adding this model support will be an interesting feature
I'm doing some RL testes using Panda arm, and would like to know how to detect if the robot gripper tip achieved the target. I'm using this, and wanna know if this is right:
done = (Env.actuator.get_tip().get_position()[i] == Env.target.get_position()[i] for i in range(3) )
Is this right or do I have another/better way of doing that?
Hi Stephen,
I have created a pick & place scene, and I'm using signal and script parameters to share informations between scripts.
To illustrate my problem : I'm choosing, via an UI on V-Rep, which type of can will be generated by my generator, and then I load the model & send information about can's shape through a signal.
With PyRep, I'm kind of blocked because I cannot get this Signal or even Load the can's model and look for shape, because shape info is a ScriptParameter.
Did I miss something ? Is there a solution ? Or could you add these functions to PyRep 😄 ?
Cheers
Hi,
I would like to use PyRep as a reinforcement learning environment, so I try to follow the example found here. However, I don't know how to reset the environment properly. I want to reset youbot to the initial state, so inside my reset
function, I call
self.agent.set_2d_pose(pos)
self.agent.set_base_angular_velocities([0,0,0])
return self._get_state()
It seems that the return sensor data is from the last step before reset, and the robot joint velocity is far from zero. How can I reset the environment, do I need to call vrep.simStopSimulation
and vrep.simStopSimulation
or pr.stop()
and pr.start()
? I tried to call pr.stop()
and pr.start()
inside my reset()
function, but the simulation acts weird. How can I restart simulation using pyrep?
Is there a better way to reset except stopping the simulation and restart again?
Thanks!
Hi,
I'm trying to put two Kuka LBR iiwa 7 R800 in the same scene. For my understanding, I should only create two agent with a different internal count, e.g.
agent1 = LBRIwaa7R800()
agent2 = LBRIwaa7R800(1)
but still, when i launch the scripts i get this error: "Handle LBR_iiwa_7_R800_joint20 does not exist.". Am i doing it right?
It got PyRep working, but it does not work within PyCharm. I tried setting the paths within Pycharm but it does not work:
ImportError: libv_rep.so.1: cannot open shared object file: No such file or directory
I am able to run the examples from the terminal within PyCharm.
for accsesing the camera and vision senseors we should use pyrep or import vrep and use the api of vrep for python?
Hi, Stephen, I followed the instruction and I got the following error
I'm not sure what's going on.
PyRep$ python3 setup.py install --user
Output:
copying lua file: pyrep/backend -> /home/xintong/Documents/Apps/V-REP/
generating build/pyrep/backend/pyrep/backend/_v_rep_cffi.c
(already up-to-date)
not modified: 'build/pyrep/backend/pyrep/backend/_v_rep_cffi.c'
running install
running build
running build_py
package init file 'pyrep/robots/mobiles/init.py' not found (or not a regular file)
package init file 'pyrep/robots/mobiles/init.py' not found (or not a regular file)
running build_ext
building 'pyrep.backend._v_rep_cffi' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/xintong/PyRep/cffi_build -I/usr/include/python3.6m -c build/pyrep/backend/pyrep/backend/_v_rep_cffi.c -o build/temp.linux-x86_64-3.6/build/pyrep/backend/pyrep/backend/_v_rep_cffi.o
build/pyrep/backend/pyrep/backend/_v_rep_cffi.c:22:24: fatal error: pyconfig.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Link to URDF for DogBot: https://github.com/ReactRobotics/DogBotV4
While the first image is with textures, the second image is without textures when executing the following:
pr = PyRep()
pr.launch(SCENE_PATH, headless=True)
pr.start()
pr.step()
cam = VisionSensor("camera")
img = cam.capture_rgb()
plt.imshow(img)
plt.show()
pr.stop()
pr.start()
pr.step()
img = cam.capture_rgb()
plt.imshow(img)
plt.show()
pr.stop()
pr.shutdown()
When I run python example_youbot_navigation.py , I get the error
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
GLib-GIO-Message: 20:32:08.861: Using the 'memory' GSettings backend. Your settings will not be saved or shared with other applications.
Using the default Lua library.
Loaded the video compression library.
Add-on script 'vrepAddOnScript-addOnScriptDemo.lua' was loaded.
Add-on script 'vrepAddOnScript-b0RemoteApiServer.lua' was loaded.
Add-on script 'vrepAddOnScript_PyRep.lua' was loaded.
If V-REP crashes now, try to install libgl1-mesa-dev on your system:
>sudo apt install libgl1-mesa-dev
OpenGL: Intel Open Source Technology Center, Renderer: Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2) , Version: 3.0 Mesa 18.0.5
...did not crash.
Simulator launched.
Plugin 'MeshCalc': loading...
Plugin 'MeshCalc': load succeeded.
Plugin 'Assimp': loading...
Plugin 'Assimp': warning: replaced variable 'simAssimp'
Plugin 'Assimp': load succeeded.
Plugin 'BlueZero': loading...
Plugin 'BlueZero': warning: replaced variable 'simB0'
Plugin 'BlueZero': load succeeded.
Plugin 'BubbleRob': loading...
Plugin 'BubbleRob': load succeeded.
Plugin 'Bwf': loading...
Plugin 'Bwf': load succeeded.
Plugin 'CodeEditor': loading...
Plugin 'CodeEditor': load succeeded.
Plugin 'Collada': loading...
Plugin 'Collada': load succeeded.
Plugin 'ConvexDecompose': loading...
Plugin 'ConvexDecompose': load succeeded.
Plugin 'CustomUI': loading...
Plugin 'CustomUI': warning: replaced variable 'simUI'
Plugin 'CustomUI': warning: replaced function 'simUI.insertTableRow@CustomUI'
Plugin 'CustomUI': warning: replaced function 'simUI.removeTableRow@CustomUI'
Plugin 'CustomUI': warning: replaced function 'simUI.insertTableColumn@CustomUI'
Plugin 'CustomUI': warning: replaced function 'simUI.removeTableColumn@CustomUI'
Plugin 'CustomUI': warning: replaced function 'simUI.setScene3DNodeParam@CustomUI'
Plugin 'CustomUI': load succeeded.
Plugin 'DynamicsBullet-2-78': loading...
Plugin 'DynamicsBullet-2-78': load succeeded.
Plugin 'DynamicsBullet-2-83': loading...
Plugin 'DynamicsBullet-2-83': load succeeded.
Plugin 'DynamicsNewton': loading...
Plugin 'DynamicsNewton': load succeeded.
Plugin 'DynamicsOde': loading...
Plugin 'DynamicsOde': load succeeded.
Plugin 'DynamicsVortex': loading...
Plugin 'DynamicsVortex': load succeeded.
Plugin 'ExternalRenderer': loading...
Plugin 'ExternalRenderer': load succeeded.
Plugin 'ICP': loading...
Plugin 'ICP': warning: replaced variable 'simICP'
Plugin 'ICP': load succeeded.
Plugin 'Image': loading...
Plugin 'Image': warning: replaced variable 'simIM'
Plugin 'Image': load succeeded.
Plugin 'K3': loading...
Plugin 'K3': load succeeded.
Plugin 'LuaCommander': loading...
Plugin 'LuaCommander': warning: replaced variable 'simLuaCmd'
Plugin 'LuaCommander': load succeeded.
Plugin 'LuaRemoteApiClient': loading...
Plugin 'LuaRemoteApiClient': load succeeded.
Plugin 'Mtb': loading...
Plugin 'Mtb': load succeeded.
Plugin 'OMPL': loading...
Plugin 'OMPL': warning: replaced variable 'simOMPL'
Plugin 'OMPL': load succeeded.
Plugin 'OpenGL3Renderer': loading...
Plugin 'OpenGL3Renderer': load succeeded.
Plugin 'OpenMesh': loading...
Plugin 'OpenMesh': load succeeded.
Plugin 'Qhull': loading...
Plugin 'Qhull': load succeeded.
Plugin 'RRS1': loading...
Plugin 'RRS1': load succeeded.
Plugin 'ReflexxesTypeII': loading...
Plugin 'ReflexxesTypeII': load succeeded.
Plugin 'RemoteApi': loading...
Starting a remote API server on port 19997
Plugin 'RemoteApi': load succeeded.
Plugin 'RosInterface': loading...
Error with plugin 'RosInterface': load failed (could not load). The plugin probably couldn't load dependency libraries. For additional infos, modify the script 'libLoadErrorCheck.sh', run it and inspect the output.
Plugin 'SDF': loading...
Plugin 'SDF': warning: replaced variable 'simSDF'
Plugin 'SDF': load succeeded.
Plugin 'SurfaceReconstruction': loading...
Plugin 'SurfaceReconstruction': warning: replaced variable 'simSurfRec'
Plugin 'SurfaceReconstruction': load succeeded.
Plugin 'Urdf': loading...
Plugin 'Urdf': load succeeded.
Plugin 'Vision': loading...
Plugin 'Vision': load succeeded.
Using the 'MeshCalc' plugin.
Initializing the Bullet physics engine in plugin 'DynamicsBullet_2_83'...
Engine version: 2.83.7
Plugin version: 10
Initialization successful.
Cannot mix incompatible Qt library (version 0x50907) with this library (version 0x50c01)
Aborted (core dumped)
qmake --version outputs
QMake version 3.1
Using Qt version 5.9.7 in /home/sandipan/miniconda3/envs/python_robotics/lib
qtchooser -l outputs
(python_robotics) sandipan $~ qtchooser -l
4
5
default
qt4-x86_64-linux-gnu
qt4
qt5-x86_64-linux-gnu
qt5
qtchooser -print-env
(python_robotics) sandipan $~ qtchooser -print-env
QT_SELECT="default"
QTTOOLDIR="/usr/lib/qt5/bin"
QTLIBDIR="/usr/lib/x86_64-linux-gnu"
Receiving error:
ModuleNotFoundError: No module named 'pyrep.backend._v_rep_cffi'
After following setup instructions.
Hi Stephen,
I've had a few issues with suppress_std_out_and_err
(link) and threading. When trying to parallelise, for example, simulation and training, it's possible for a print
or logger in the other thread to write to the closed stdout, which causes python to crash.
I had a look but haven't been able to come up with a good way to avoid the possible race condition. Any ideas?
When running the example_turtlebot_navigation.py script, the Turtlebot does not move in the simulator even though the navigation paths are drawn. By contrast, the example_yubot_navigationn.py script does move the Youbot. I noticed that the Turtlebot example has the line:
agent.set_motor_locked_at_zero_velocity(True)
so I changed it to:
agent.set_motor_locked_at_zero_velocity(False)
but the robot still does not move.
Hi Stephen, awesome work on this!
I'm trying to figure out the best way to programmatically create multiple robots in a scene. The issue is that the naming conventions used in RobotComponent
and Arm
don't match up with how V-REP names the new objects.
The most straightforward way seems to be to use the #0, #1, etc. naming convention by using, for example,
self.pr.import_model('<path>/robot_ttms/arms/Panda.ttm@copy')
, but this doesn't match the naming in RobotComponent
.
On the other hand, using self.pr.import_model('<path>/robot_ttms/arms/Panda.ttm')
(without the @copy
) causes the naming in Arm
to fail, and also incorrectly names the new joints sequentially (Panda0 will have joints starting with Joint8, Joint9 etc.).
Wondering if you have come across a nice way to do this? I'm happy to try and put together a pull request, but changing the naming breaks some of the existing examples like the Baxter demo.
Hi Stephen,
in my particular RL problem, I want to simulate 20 simulation steps before the agent observes the new state, because it drops something and has to see where it lands, which takes longer than 1 simulation step. Increasing the simulation time delta by 20 times obviously doesn't work as this will not consider collisions that might happen in between.
I could imagine that I would not be the only one that has a setting like this.
Sending 20 times PyRep.step() is slow (~210ms in my scene), which is the same time as sending 20 times vrep.simxSynchronousTrigger() in the original VREP python API.
I was able to speed this up by a factor of ~20 times by writing a customization script that executes 20 simulation steps at one call as suggested in http://www.forum.coppeliarobotics.com/viewtopic.php?f=9&t=7926 .
One would have to write a customization script containing
function sysCall_init()
stepsToRun=0
end
function start20StepRun()
stepsToRun=20
end
function sysCall_beforeMainScript()
return {doNotRunMainScript=(stepsToRun==0)}
end
function sysCall_actuation()
stepsToRun=stepsToRun-1
end
and then don't use the synchronous mode in VREP.
Unfortunately, this doesn't work with PyRep anymore, and I was wondering if you could add this functionality directly into it, e.g. that PyRep.step() accepts the number of steps as a parameter. This would be an awesome functionality and another bonus for PyRep!
Best,
Mark
Hi,
I am using panda griper to pick a shape. However, the shape always slipping and cannot be lifted. I have set_model_collideable/set_model_respondable=True for both shape and gripper.
Any idea about how to address the issue?
Thanks,
Kevin
When I try to use PyRep in an anaconda env, I got this error:
File "example_baxter_pick_and_pass.py", line 9, in <module>
from pyrep import PyRep
File "/home/dian/.local/lib/python3.7/site-packages/pyrep/__init__.py", line 1, in <module>
from .pyrep import PyRep
File "/home/dian/.local/lib/python3.7/site-packages/pyrep/pyrep.py", line 1, in <module>
from pyrep.backend import vrep, utils
File "/home/dian/.local/lib/python3.7/site-packages/pyrep/backend/vrep.py", line 2, in <module>
from ._v_rep_cffi import ffi, lib
ImportError: /home/dian/Software/V-REP_PRO_EDU_V3_6_2_Ubuntu16_04/libv_rep.so.1: symbol _ZN17QAbstractItemView11eventFilterEP7QObjectP6QEvent, version Qt_5 not defined in file libQt5Widgets.so.5 with link time reference
It works fine if I install in system python interpreter. Does PyRep support working in anaconda now?
I keep getting this error when I try run the examples:
[jason@archlinux PyRep]$ python examples/example_locobot_stack_cube.py
Traceback (most recent call last):
File "examples/example_locobot_stack_cube.py", line 8, in
from pyrep import PyRep
File "/home/jason/.local/lib/python3.7/site-packages/pyrep/init.py", line 1, in
from .pyrep import PyRep
File "/home/jason/.local/lib/python3.7/site-packages/pyrep/pyrep.py", line 1, in
from pyrep.backend import vrep, utils
File "/home/jason/.local/lib/python3.7/site-packages/pyrep/backend/vrep.py", line 2, in
from ._v_rep_cffi import ffi, lib
ImportError: /home/jason/.local/lib/python3.7/site-packages/pyrep/backend/_v_rep_cffi.cpython-37m-x86_64-linux-gnu.so: undefined symbol: simExtGetExitRequest
Hi. I do research in RL and, in order to run an algorithm, I must instantiate two environments/simulations at the same time. However, when I instantiate and launch two PyRep objects, the first scene starts correctly but the second one doesn't seem to start the simulation. The errors are also different when headless is set to False and when it is set to true.
Headless True (for the second vrep only):
WARNING: QApplication was not created in the main() thread.
(python:10027): GLib-CRITICAL **: g_main_context_push_thread_default: assertion 'acquired_context' failed
Then, the second simulation doesn't start.
Headless False:
00003008 $$$ERROR in uiThread_tryToLockForUiEventRead (_handleMouseAndKeyboardAndResizeEvents): not called from the UI thread.
QObject::setParent: Cannot set parent, new parent is in a different thread
It seems the threads are conflicting somehow. Do you know of any solution for this problem? Is it currently possible to instantiate and launch multiple PyRep() objects?
Hi Stephen,
Thanks for the great work!
I am getting the following error when I try to run the example code for locobot. Could you please take a look at it? Thank you!
Using the 'MeshCalc' plugin.
Initializing the Bullet physics engine in plugin 'DynamicsBullet_2_83'...
Engine version: 2.83.7
Plugin version: 10
Initialization successful.
Driving to cube ...
Move arm above cube ...
Traceback (most recent call last):
File "examples/example_locobot_stack_cube.py", line 63, in
move_arm(grasp_point_raised, grasp_point.get_quaternion())
File "examples/example_locobot_stack_cube.py", line 40, in move_arm
ignore_collisions=ignore_collisions)
File "/home/cml/env3.6/lib/python3.6/site-packages/pyrep/robots/arms/arm.py", line 276, in get_path
trials_per_goal, algorithm)
File "/home/cml/env3.6/lib/python3.6/site-packages/pyrep/robots/arms/arm.py", line 234, in get_nonlinear_path
raise ConfigurationPathError('Could not create path.')
pyrep.errors.ConfigurationPathError: Could not create path.
QObject::~QObject: Timers cannot be stopped from another thread
QMutex: destroying locked mutex
Thanks!!
Bo
I'm receiving the error VREP_ROOT not defined during the python3 setup.py install --user part of installation. Guessing this is due to incorrectly editing the path to the VREP installation directory when adding to the bashrc, but after many tries cannot figure out what i could be doing wrong.
Hi Stephen,
how do I open 2 scenes (or the same scene twice) to have different environments for RL?
The following does not work, neither in headless mode nor in GUI mode, and neither with having the same PyRep instance (pr) or two (pr and pr2) for launching the scene files.
Also I noted that after a .launch(), os.path.join(os.path.dirname(os.path.abspath(__file__))
is in the V-REP installation folder (so I copied all scenes there as well).
from pyrep import PyRep
from pyrep.objects.vision_sensor import VisionSensor
import os
from matplotlib import pyplot as plt
if __name__ == "__main__":
SCENE_PATH1 = os.path.join(os.path.dirname(os.path.abspath(__file__)), "texture_test.ttt")
SCENE_PATH2 = os.path.join(os.path.dirname(os.path.abspath(__file__)), "texture_test_copy.ttt")
print(SCENE_PATH1, SCENE_PATH2)
pr = PyRep()
pr.launch(SCENE_PATH1, headless=True)
cam = VisionSensor("Cam")
pr.start()
pr.step()
img = cam.capture_rgb()
plt.imshow(img)
plt.show()
pr.stop()
pr2 = PyRep()
pr2.launch(SCENE_PATH2, headless=True)
cam = VisionSensor("Cam")
pr2.start()
pr2.step()
img = cam.capture_rgb()
plt.imshow(img)
plt.show()
pr2.stop()
Best,
Mark
i just define every thing and setup requirements but after Troubleshooting i still have this error on install the setup.py here it is what consoled after the command :
creating symlink: /mnt/c/Program Files/v-rep3/v-rep_PRO_EDU/libv_rep.so.1 -> /mnt/c/Program Files/v-rep3/v-rep_PRO_EDU/libv_rep.so copying lua file: pyrep/backend -> /mnt/c/Program Files/v-rep3/v-rep_PRO_EDU generating build/pyrep/backend/pyrep/backend/_v_rep_cffi.c (already up-to-date) not modified: 'build/pyrep/backend/pyrep/backend/_v_rep_cffi.c' running install running build running build_py package init file 'pyrep/robots/mobiles/__init__.py' not found (or not a regular file) package init file 'pyrep/robots/mobiles/__init__.py' not found (or not a regular file) running build_ext building 'pyrep.backend._v_rep_cffi' extension x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/mnt/c/users/mohsen/desktop/testlin/pyrep/cffi_build -I/usr/include/python3.6m -c build/pyrep/backend/pyrep/backend/_v_rep_cffi.c -o build/temp.linux-x86_64-3.6/build/pyrep/backend/pyrep/backend/_v_rep_cffi.o x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/build/pyrep/backend/pyrep/backend/_v_rep_cffi.o -L/mnt/c/Program Files/v-rep3/v-rep_PRO_EDU -lv_rep -o build/lib.linux-x86_64-3.6/pyrep/backend/_v_rep_cffi.cpython-36m-x86_64-linux-gnu.so /usr/bin/ld: cannot find -lv_rep collect2: error: ld returned 1 exit status error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
I tried to run example_reinforcement_learning_env.py
but I am getting this error: The 'MeshCalc' plugin could not be initialized
. I am not running the example in headless mode. While launching Vrep manually, everything works fine and the MeshCalc
plugin loads fine. Is there something wrong with my Config? I am using Vrep 3.6.2 and I followed the README for installation of PyRep.
Hi,
I want to get the measurement from SICK S300 Fast, so I call vrep.simReadVisionSensor(handle)
and get the following error
for i in range(auxValuesCount[0]):
TypeError: '_cffi_backend.CData' object cannot be interpreted as an integer
Is this a bug or I am doing something wrong?
Btw, will it be slower if I just run the accosicated child script of SICK S300 Fast, and get the measurement data by calling sim.getStringSignal
?
Hi Stephen,
I found that the speed of learning program with PyRep environments to be significantly lower on headless machine using 'xvfg-run' as you suggested, compared with running on PC with screen. (5-10 times slower)
Do you have any idea to speed it up? Thanks.
Best,
Zihan
Hey stepjam,
Once again, great work.
Now I´m implementing the NAO robot, and right after following your instructions, when running the test_arms_and_configuration_paths.py
, I´m getting the error > no module named ´tests´. I´ve installed PyRep as you suggested:
pip3 install -r requirements.txt python3 setup.py install --user
Do you have any suggestions?
It would be great if PyRep can support Qt 5 GUI in Python.
Would you mind creating a simple example using PyRep and PySide2 ?
Hi Stephen,
I couldn't find any copy() method for objects. How do I do this? Naively using copy.deepcopy() on a cuboid e.g. doesn't work.
Best,
Mark
Hello,
I have been getting this import error: undefined symbol: simExtGetExitRequest
Have y'all experienced this because I think it is different from the other issues that you have reported?
Is there anyway to change the control frequency to 1khz within pyrep? and how
Hi Stephen,
Wondering how you feel about modifying Object.get_parent to return None instead of raising NoParentError in the case that the object is parentless, especially since having no parent is a fairly normal state for objects inserted into the scene. My specific issue at the moment is that Gripper.grasp(parentless_object)
will raise an error. Only potential issue that I see is that it's not possible from the simGetObjectParent API call to tell the difference between "no parent" and "error":
C return value: handle of parent or -1 if the parent doesn't exist or in case of an error
Hi,
I'm trying to install PyRep on macOS Mojave, and I have the following error
python3 setup.py install --user --prefix= creating symlink: /Users/txiao/Documents/libraries/V-REP_PRO_EDU_V3_6_2_Mac/libv_rep.so.1 -> /Users/txiao/Documents/libraries/V-REP_PRO_EDU_V3_6_2_Mac/libv_rep.so copying lua file: pyrep/backend -> /Users/txiao/Documents/libraries/V-REP_PRO_EDU_V3_6_2_Mac generating build/pyrep/backend/pyrep/backend/_v_rep_cffi.c (already up-to-date) not modified: 'build/pyrep/backend/pyrep/backend/_v_rep_cffi.c' running install running build running build_py package init file 'pyrep/robots/mobiles/__init__.py' not found (or not a regular file) package init file 'pyrep/robots/mobiles/__init__.py' not found (or not a regular file) running build_ext building 'pyrep.backend._v_rep_cffi' extension clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/Users/txiao/Documents/libraries/PyRep/cffi_build -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite /include -I/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c build/pyrep/backend/pyrep/backend/_v_rep_cffi.c -o build/temp.maco sx-10.14-x86_64-3.7/build/pyrep/backend/pyrep/backend/_v_rep_cffi.o clang -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/build/pyrep/backend/pyrep/backend/_v_rep_cffi.o -L/Users/txiao/Documents/libraries/V-REP_PRO_EDU_V 3_6_2_Mac -L/usr/local/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/sqlite/lib -lv_rep -o build/lib.macosx-10.14-x86_64-3.7/pyrep/backend/_v_rep_cffi.cpython-37m-da rwin.so ld: library not found for -lv_rep clang: error: linker command failed with exit code 1 (use -v to see invocation) error: command 'clang' failed with exit status 1
Is this a problem with installation on macos or I've done something wrong?
Thanks!
How can we contribute in adding new robots ?
I saw, they're just ttm files which you've mentioned to be modified.
You can allow the opensource community to contribute in that, by sharing the required details.
Hi, instead of launching new environment using pr.launch, can we connect to an existing opened simulation? Maybe by specifying port number?
Hi Stephen,
I receive error signal 11 whith the following traceback:
Error: signal 11:
/home/george/Desktop/V-REP_PRO_EDU_V3_6_2_Ubuntu18_04/libv_rep.so.1(_Z11_segHandleri+0x2b)[0x7f3c5d5d00eb]
/lib/x86_64-linux-gnu/libc.so.6(+0x3ef20)[0x7f3c7efdbf20]
/home/george/Desktop/V-REP_PRO_EDU_V3_6_2_Ubuntu18_04/libQt5Core.so.5(_ZN6QMutex4lockEv+0x15)[0x7f3c5b0ca0b5]
/home/george/Desktop/V-REP_PRO_EDU_V3_6_2_Ubuntu18_04/libQt5Gui.so.5(+0x379f7e)[0x7f3c5c0eff7e]
/home/george/Desktop/V-REP_PRO_EDU_V3_6_2_Ubuntu18_04/libQt5Gui.so.5(+0x37183f)[0x7f3c5c0e783f]
/home/george/Desktop/V-REP_PRO_EDU_V3_6_2_Ubuntu18_04/libQt5Gui.so.5(_ZN18QRasterPaintEngine11updateBrushERK6QBrush+0x87)[0x7f3c5c0eacd7]
/home/george/Desktop/V-REP_PRO_EDU_V3_6_2_Ubuntu18_04/libQt5Gui.so.5(_ZN18QRasterPaintEngine8fillRectERK6QRectFRK6QBrush+0x2a)[0x7f3c5c0eb7aa]
/home/george/Desktop/V-REP_PRO_EDU_V3_6_2_Ubuntu18_04/libQt5Gui.so.5(_ZN8QPainter8fillRectERK5QRectRK6QBrush+0xc5)[0x7f3c5c0fe5d5]
/home/george/Desktop/V-REP_PRO_EDU_V3_6_2_Ubuntu18_04/libQt5Widgets.so.5(_ZNK12QFusionStyle11drawControlEN6QStyle14ControlElementEPK12QStyleOptionP8QPainterPK7QWidget+0x2da7)[0x7f3c5c7cdb67]
/home/george/Desktop/V-REP_PRO_EDU_V3_6_2_Ubuntu18_04/libQt5Widgets.so.5(+0x208c89)[0x7f3c5c7a4c89]
QMutex: destroying locked mutex
Thank you,
Georgios
Namaste!
Wow! This looks very promising!
Do you intend to make PyRep OpenAI-Gym compatible? That would open doors to a lot of Deep Reinforcement Learning.
Hi,
I have a problem when loading/importing a class that uses the simulator in another file.
To illustrate the problem, here is my first simplified Python file test1.py
:
from pyrep import PyRep
from pyrep.objects.shape import Shape, PrimitiveShape
class TestShape(object):
def __init__(self):
self.pr = PyRep()
self.pr.launch('scene.ttt', headless=False)
self.pr.start()
def create_box(self):
shape = Shape.create(type=PrimitiveShape.SPHERE, color=[1, 0, 0, 0.5], size=[1],
position=[0, 0, 2])
def step(self):
self.pr.step()
def close(self):
self.pr.stop()
self.pr.shutdown()
if __name__ == '__main__':
test = TestShape()
test.create_box()
for i in range(1000):
test.step()
test.close()
which, if run, works as expected. You can see a red sphere in the V-REP simulator.
However, when I import the class from another file like test2.py
:
from test1 import TestShape
test = TestShape()
test.create_box()
for i in range(1000):
test.step()
test.close()
The sphere disappear in the simulator... Well, technically it is still there but at the position (x=NaN, y=NaN, z=NaN) according to V-Rep...
How to fix this?
Hi Stephen,
I can only quit PyRep by sending a SIGKILL, it would be nice if would react to SIGINT (CTRL+C) or at least SIGTERM (end signal of debugger)...
Best,
Mark
I am trying to run a simulation in headless mode in which my robot captures an image from the scene and save it to the disk via opencv. My code is as follows:
pr = PyRep()
pr.launch(SCENE_FILE, headless=True)
pr.start()
agent = UR3()
agent.set_joint_positions(initialPos)
pr.step()
cam = VisionSensor('cam')
img = cam.capture_rgb()
img = np.uint8(img)
target_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.imwrite('targ.png', target_image)
However, as a result, the image saved is an empty image with all zeros. How can I get scene image from the simulation?
P.S. I tried it with headless=False
and the result was same.
Hi Stephen and V-REPers,
Just to give you the context, I'm using V-REP to simulate a robot which sort objects and I want to use OpenCV to do the computer vision, so that I can command the robot from Python directly after the image process.
My issue is that I cannot display what robot sees with a classic "cv2.imshow()", and it's made the development quite hard because I'm "blind".
(Btw, cv2imwrite() is working, and I can confirm that simulation is running and capture_rgb() is working as expected)
The code is :
from os.path import dirname, join, abspath
import cv2
import numpy as np
from pyrep import PyRep
from pyrep.objects.vision_sensor import VisionSensor
SCENE_FILE = join(dirname(abspath(__file__)), 'my_simu.ttt')
pr = PyRep()
# Launch the application with a scene file in headless mode
pr.launch(SCENE_FILE, headless=True)
pr.start() # Start the simulation
vs = VisionSensor('Vision_sensor_hand') # The name of the sensor in the vrep scene
# while True:
for i in range(100):
pr.step()
# -- Finding Instant Const -- #
rgb = np.uint8(vs.capture_rgb() * 255) # Capture image and put values between 0 and 255
#depth = vs.capture_depth()
# Processing
# cv2.imwrite('save/{:04d}.jpg'.format(i), rgb)
cv2.imshow('image raw', cv2.cvtColor(rgb))
k = cv2.waitKey(1) & 0xFF
if k == 27:
break
pr.stop() # Stop the simulation
pr.shutdown() # Close the application
The execution leads to
Error: signal 11:
/home/remi/Documents/V-REP_PRO/libv_rep.so.1(_Z11_segHandleri+0x2b)[0x7fab73f7a4ab]
/lib/x86_64-linux-gnu/libc.so.6(+0x3ef20)[0x7faba11a5f20]
/home/remi/.local/lib/python3.6/site-packages/cv2/.libs/libQtCore-6df570dd.so.4.8.7(_ZN16QCoreApplication12libraryPathsEv+0x5b)[0x7fab9a3ea1cb]
/home/remi/.local/lib/python3.6/site-packages/cv2/.libs/libQtCore-6df570dd.so.4.8.7(_ZN14QFactoryLoader6updateEv+0x20)[0x7fab9a3cfd30]
/home/remi/.local/lib/python3.6/site-packages/cv2/.libs/libQtCore-6df570dd.so.4.8.7(_ZN14QFactoryLoaderC2EPKcRK7QStringN2Qt15CaseSensitivityE+0x15a)[0x7fab9a3d001a]
/home/remi/.local/lib/python3.6/site-packages/cv2/.libs/libQtGui-903938cd.so.4.8.7(+0x2646ab)[0x7fab9abeb6ab]
/home/remi/.local/lib/python3.6/site-packages/cv2/.libs/libQtGui-903938cd.so.4.8.7(_ZN19QApplicationPrivate18x11_apply_settingsEv+0x1cd5)[0x7fab9abf1c55]
/home/remi/.local/lib/python3.6/site-packages/cv2/.libs/libQtGui-903938cd.so.4.8.7(+0x26cd2d)[0x7fab9abf3d2d]
/home/remi/.local/lib/python3.6/site-packages/cv2/.libs/libQtGui-903938cd.so.4.8.7(+0x2701a5)[0x7fab9abf71a5]
/home/remi/.local/lib/python3.6/site-packages/cv2/.libs/libQtGui-903938cd.so.4.8.7(_ZN19QApplicationPrivate9constructEP9_XDisplaymm+0xc8)[0x7fab9ab8aa98]
QMutex: destroying locked mute
Have you ever met this issue and is there any solution which can overcome it ?
Cheers 😄
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.