Closed cyrilli closed 6 years ago
You're on the right track.
VREP is written primarily in Lua, where the main method of programming is through child (or "embedded") scripts. These scripts are often fully contained within the simulator, but for this project, would mean that whenever we want to modify something in the simulation, we would need to eventually re-upload the scene binary to github.
For better version control, rather then keeping code in the simulation, I've instead moved the scripts to their own lua files in ./scenes, (e.g. here's the corresponding remoteApiCommandServer file), which you're right, eventually calls simImportMesh
.
What you're seeing in the simulator with the require('xxx')
is simply VREP looking for this file, and inserting all the text into the embedded script once the simulation has started running. It's similar to the import xxxxx
function in python, but where the entire code-base is copied.
The *.ttm is a "model" in V-REP, and uses a different importing function. Unfortunately, switching grippers right now isn't quite straightforward. For now, you'll have to open the simulation and reverse-engineer how I've set up the BarrettHand. Off the top of my head, here's a few things that will need to change in the simulation:
I'll try and find some time after the holidays to write up a quick guide for how to do this, but can't promise when it'll happen. I'll open a separate issue for it.
Hi, I am learning VREP recently for grasp simulation and find your code very helpful. Now I am trying to make some modifications to your code like replacing the barrett hand with other gripper and loading object I prepared in ttm format.
However, I find the use of
simxCallSciptFunction
insimulator.py
hard to understand. For example in theload_object
function:r = vrep.simxCallScriptFunction(self.clientID, 'remoteApiCommandServer', vrep.sim_scripttype_childscript, 'loadObject', in_ints, in_floats, [object_path], bytearray(), vrep.simx_opmode_blocking)
I understand that this is to remotely call a V-REP script, and you have specified the script type as "vrep.sim_scripttype_childscript", which should be a child script that is attached to an object (in this case it is the dummy remoteApiCommandServer) in the scene. But in the child script attached to remoteApiCommandServer, there is only one line:
require('remoteApiCommandServer')
I guess this python function eventually makes call to the Regular API function
simImportMesh
, so would you please shed some light on how this works?