lsnu commited on
Commit
30747b3
·
verified ·
1 Parent(s): cf8614b

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. external/pyrep/.github/stale.yml +17 -0
  2. external/pyrep/.github/workflows/build.yml +46 -0
  3. external/pyrep/PyRep.egg-info/PKG-INFO +8 -0
  4. external/pyrep/PyRep.egg-info/SOURCES.txt +103 -0
  5. external/pyrep/PyRep.egg-info/dependency_links.txt +1 -0
  6. external/pyrep/PyRep.egg-info/top_level.txt +1 -0
  7. external/pyrep/cffi_build/__init__.py +0 -0
  8. external/pyrep/cffi_build/cffi_build.py +757 -0
  9. external/pyrep/cffi_build/sim.h +712 -0
  10. external/pyrep/docs/Makefile +19 -0
  11. external/pyrep/docs/make.bat +35 -0
  12. external/pyrep/docs/source/conf.py +62 -0
  13. external/pyrep/docs/source/index.rst +24 -0
  14. external/pyrep/docs/source/modules.rst +7 -0
  15. external/pyrep/docs/source/pyrep.objects.rst +78 -0
  16. external/pyrep/docs/source/pyrep.robots.arms.rst +46 -0
  17. external/pyrep/docs/source/pyrep.robots.end_effectors.rst +38 -0
  18. external/pyrep/docs/source/pyrep.robots.rst +30 -0
  19. external/pyrep/docs/source/pyrep.rst +47 -0
  20. external/pyrep/docs/source/pyrep.textures.rst +22 -0
  21. external/pyrep/examples/example_baxter_pick_and_pass.py +115 -0
  22. external/pyrep/examples/example_locobot_stack_cube.py +96 -0
  23. external/pyrep/examples/example_panda_end_effector_control.py +35 -0
  24. external/pyrep/examples/example_panda_ik.py +41 -0
  25. external/pyrep/examples/example_panda_reach_target.py +59 -0
  26. external/pyrep/examples/example_reinforcement_learning_env.py +90 -0
  27. external/pyrep/examples/example_turtlebot_navigation.py +53 -0
  28. external/pyrep/examples/example_youbot_navigation.py +51 -0
  29. external/pyrep/pyrep/backend/__init__.py +0 -0
  30. external/pyrep/pyrep/backend/sim.py +1500 -0
  31. external/pyrep/pyrep/backend/simAddOnScript_PyRep.lua +410 -0
  32. external/pyrep/pyrep/backend/simConst.py +1726 -0
  33. external/pyrep/pyrep/backend/utils.py +76 -0
  34. external/pyrep/pyrep/misc/__init__.py +0 -0
  35. external/pyrep/pyrep/misc/distance.py +49 -0
  36. external/pyrep/pyrep/misc/signals.py +102 -0
  37. external/pyrep/pyrep/objects/__init__.py +10 -0
  38. external/pyrep/pyrep/objects/camera.py +21 -0
  39. external/pyrep/pyrep/objects/cartesian_path.py +107 -0
  40. external/pyrep/pyrep/objects/dummy.py +26 -0
  41. external/pyrep/pyrep/objects/force_sensor.py +34 -0
  42. external/pyrep/pyrep/objects/joint.py +255 -0
  43. external/pyrep/pyrep/objects/light.py +125 -0
  44. external/pyrep/pyrep/objects/object.py +756 -0
  45. external/pyrep/pyrep/objects/octree.py +123 -0
  46. external/pyrep/pyrep/objects/proximity_sensor.py +41 -0
  47. external/pyrep/pyrep/objects/shape.py +584 -0
  48. external/pyrep/pyrep/objects/vision_sensor.py +423 -0
  49. external/pyrep/pyrep/robots/arms/__init__.py +0 -0
  50. external/pyrep/pyrep/robots/arms/arm.py +496 -0
external/pyrep/.github/stale.yml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 60
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 7
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - pinned
8
+ - security
9
+ # Label to use when marking an issue as stale
10
+ staleLabel: stale
11
+ # Comment to post when marking an issue as stale. Set to `false` to disable
12
+ markComment: >
13
+ This issue has been automatically marked as stale because it has not had
14
+ recent activity. It will be closed if no further activity occurs. Thank you
15
+ for your contributions.
16
+ # Comment to post when closing a stale issue. Set to `false` to disable
17
+ closeComment: false
external/pyrep/.github/workflows/build.yml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build
2
+
3
+ # Controls when the action will run.
4
+ # Run this workflow every time a new commit pushed to your repository
5
+ on:
6
+ # Triggers the workflow on push or pull request events.
7
+ push:
8
+ pull_request:
9
+
10
+ # Allows you to run this workflow manually from the Actions tab
11
+ workflow_dispatch:
12
+
13
+ # A workflow run is made up of one or more jobs that can run sequentially or in parallel
14
+ jobs:
15
+ # This workflow contains a single job called "build"
16
+ build:
17
+ # The type of runner that the job will run on
18
+ runs-on: ubuntu-20.04
19
+ env:
20
+ DISPLAY: :0
21
+
22
+ # Steps represent a sequence of tasks that will be executed as part of the job
23
+ steps:
24
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
25
+ - uses: actions/checkout@v2
26
+
27
+ # Runs a set of commands using the runners shell
28
+ - name: Run a multi-line script
29
+ run: |
30
+ sudo apt-get update -qq
31
+ sudo apt-get install -y xvfb qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev qt5-default qttools5-dev-tools
32
+ # start xvfb in the background
33
+ sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
34
+ cur=`pwd`
35
+ wget http://www.coppeliarobotics.com/files/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz
36
+ tar -xf CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz
37
+ export COPPELIASIM_ROOT="$cur/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04"
38
+ echo $COPPELIASIM_ROOT
39
+ ls -al
40
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COPPELIASIM_ROOT:$COPPELIASIM_ROOT/platforms
41
+ export QT_QPA_PLATFORM_PLUGIN_PATH=$COPPELIASIM_ROOT
42
+ pip3 install -r requirements.txt
43
+ pip3 install setuptools
44
+ pip3 install .
45
+ mv pyrep _pyrep
46
+ python3 -m unittest discover tests
external/pyrep/PyRep.egg-info/PKG-INFO ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: PyRep
3
+ Version: 4.1.0.3
4
+ Summary: Python CoppeliaSim wrapper
5
+ Home-page: https://www.doc.ic.ac.uk/~slj12
6
+ Author: Stephen James
7
+ Author-email: slj12@ic.ac.uk
8
+ License-File: LICENSE
external/pyrep/PyRep.egg-info/SOURCES.txt ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ PyRep.egg-info/PKG-INFO
5
+ PyRep.egg-info/SOURCES.txt
6
+ PyRep.egg-info/dependency_links.txt
7
+ PyRep.egg-info/top_level.txt
8
+ pyrep/__init__.py
9
+ pyrep/const.py
10
+ pyrep/errors.py
11
+ pyrep/pyrep.py
12
+ pyrep/backend/__init__.py
13
+ pyrep/backend/sim.py
14
+ pyrep/backend/simConst.py
15
+ pyrep/backend/utils.py
16
+ pyrep/misc/__init__.py
17
+ pyrep/misc/distance.py
18
+ pyrep/misc/signals.py
19
+ pyrep/objects/__init__.py
20
+ pyrep/objects/camera.py
21
+ pyrep/objects/cartesian_path.py
22
+ pyrep/objects/dummy.py
23
+ pyrep/objects/force_sensor.py
24
+ pyrep/objects/joint.py
25
+ pyrep/objects/light.py
26
+ pyrep/objects/object.py
27
+ pyrep/objects/octree.py
28
+ pyrep/objects/proximity_sensor.py
29
+ pyrep/objects/shape.py
30
+ pyrep/objects/vision_sensor.py
31
+ pyrep/robots/__init__.py
32
+ pyrep/robots/robot_component.py
33
+ pyrep/robots/arms/__init__.py
34
+ pyrep/robots/arms/arm.py
35
+ pyrep/robots/arms/baxter.py
36
+ pyrep/robots/arms/dobot.py
37
+ pyrep/robots/arms/dual_panda.py
38
+ pyrep/robots/arms/jaco.py
39
+ pyrep/robots/arms/lbr_iiwa_14_r820.py
40
+ pyrep/robots/arms/lbr_iiwa_7_r800.py
41
+ pyrep/robots/arms/locobot_arm.py
42
+ pyrep/robots/arms/mico.py
43
+ pyrep/robots/arms/panda.py
44
+ pyrep/robots/arms/sawyer.py
45
+ pyrep/robots/arms/ur10.py
46
+ pyrep/robots/arms/ur3.py
47
+ pyrep/robots/arms/ur5.py
48
+ pyrep/robots/arms/xarm7.py
49
+ pyrep/robots/arms/youBot.py
50
+ pyrep/robots/configuration_paths/__init__.py
51
+ pyrep/robots/configuration_paths/arm_configuration_path.py
52
+ pyrep/robots/configuration_paths/configuration_path.py
53
+ pyrep/robots/configuration_paths/holonomic_configuration_path.py
54
+ pyrep/robots/configuration_paths/mobile_configuration_path.py
55
+ pyrep/robots/configuration_paths/nonholonomic_configuration_path.py
56
+ pyrep/robots/end_effectors/__init__.py
57
+ pyrep/robots/end_effectors/baxter_gripper.py
58
+ pyrep/robots/end_effectors/baxter_suction_cup.py
59
+ pyrep/robots/end_effectors/dobot_suction_cup.py
60
+ pyrep/robots/end_effectors/dual_panda_gripper.py
61
+ pyrep/robots/end_effectors/gripper.py
62
+ pyrep/robots/end_effectors/jaco_gripper.py
63
+ pyrep/robots/end_effectors/locobot_gripper.py
64
+ pyrep/robots/end_effectors/mico_gripper.py
65
+ pyrep/robots/end_effectors/panda_gripper.py
66
+ pyrep/robots/end_effectors/robotiq85_gripper.py
67
+ pyrep/robots/end_effectors/suction_cup.py
68
+ pyrep/robots/end_effectors/xarm_gripper.py
69
+ pyrep/robots/mobiles/holonomic_base.py
70
+ pyrep/robots/mobiles/line_tracer.py
71
+ pyrep/robots/mobiles/locobot.py
72
+ pyrep/robots/mobiles/mobile_base.py
73
+ pyrep/robots/mobiles/nonholonomic_base.py
74
+ pyrep/robots/mobiles/turtlebot.py
75
+ pyrep/robots/mobiles/youbot.py
76
+ pyrep/sensors/__init__.py
77
+ pyrep/sensors/accelerometer.py
78
+ pyrep/sensors/gyroscope.py
79
+ pyrep/sensors/spherical_vision_sensor.py
80
+ pyrep/textures/__init__.py
81
+ pyrep/textures/texture.py
82
+ tests/test_accelerometer.py
83
+ tests/test_arms_and_configuration_paths.py
84
+ tests/test_cameras.py
85
+ tests/test_cartesian_paths.py
86
+ tests/test_dummies.py
87
+ tests/test_force_sensors.py
88
+ tests/test_grippers.py
89
+ tests/test_gyroscope.py
90
+ tests/test_joint_groups.py
91
+ tests/test_joints.py
92
+ tests/test_lights.py
93
+ tests/test_misc.py
94
+ tests/test_mobiles_and_configuration_paths.py
95
+ tests/test_mobiles_with_arms.py
96
+ tests/test_objects.py
97
+ tests/test_octrees.py
98
+ tests/test_proximity_sensors.py
99
+ tests/test_pyrep.py
100
+ tests/test_shapes.py
101
+ tests/test_spherical_vision_sensors.py
102
+ tests/test_suction_cups.py
103
+ tests/test_vision_sensors.py
external/pyrep/PyRep.egg-info/dependency_links.txt ADDED
@@ -0,0 +1 @@
 
 
1
+
external/pyrep/PyRep.egg-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ pyrep
external/pyrep/cffi_build/__init__.py ADDED
File without changes
external/pyrep/cffi_build/cffi_build.py ADDED
@@ -0,0 +1,757 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from cffi import FFI
2
+ import os
3
+ import glob
4
+ from shutil import copyfile
5
+
6
+ # Get PYREP root and find the needed files to compile the cffi lib.
7
+
8
+ if 'COPPELIASIM_ROOT' not in os.environ:
9
+ raise RuntimeError('COPPELIASIM_ROOT not defined.')
10
+
11
+ if not os.path.exists(os.environ['COPPELIASIM_ROOT']):
12
+ raise RuntimeError('COPPELIASIM_ROOT defined, but is not a valid path.')
13
+
14
+ ffibuilder = FFI()
15
+
16
+ ffibuilder.cdef("""
17
+ // ==============
18
+ // simTypes.h
19
+ // ==============
20
+
21
+ // Various types used in the interface functions:
22
+ typedef unsigned char simBool;
23
+ typedef char simChar;
24
+ typedef int simInt;
25
+ typedef float simFloat;
26
+ typedef double simDouble;
27
+ typedef void simVoid;
28
+ typedef unsigned char simUChar;
29
+ typedef unsigned int simUInt;
30
+ typedef unsigned long long int simUInt64;
31
+
32
+ struct SScriptCallBack
33
+ {
34
+ simInt objectID;
35
+ simInt scriptID;
36
+ simInt stackID;
37
+ simChar waitUntilZero;
38
+ simChar* raiseErrorWithMessage;
39
+ };
40
+
41
+ struct SShapeVizInfo
42
+ {
43
+ simFloat* vertices;
44
+ simInt verticesSize;
45
+ simInt* indices;
46
+ simInt indicesSize;
47
+ simFloat shadingAngle;
48
+ simFloat* normals;
49
+ simFloat colors[9];
50
+ simChar* texture; /*rgba*/
51
+ simInt textureId;
52
+ simInt textureRes[2];
53
+ simFloat* textureCoords;
54
+ simInt textureApplyMode;
55
+ simInt textureOptions; /* not just textures options */
56
+ };
57
+
58
+ struct SLuaCallBack
59
+ {
60
+ simInt objectID;
61
+ simBool* inputBool;
62
+ simInt* inputInt;
63
+ simFloat* inputFloat;
64
+ simChar* inputChar;
65
+ simInt inputArgCount;
66
+ simInt* inputArgTypeAndSize;
67
+ simBool* outputBool;
68
+ simInt* outputInt;
69
+ simFloat* outputFloat;
70
+ simChar* outputChar;
71
+ simInt outputArgCount;
72
+ simInt* outputArgTypeAndSize;
73
+ simChar waitUntilZero;
74
+ simChar* inputCharBuff;
75
+ simChar* outputCharBuff;
76
+ simInt scriptID;
77
+ simDouble* inputDouble;
78
+ simDouble* outputDouble;
79
+ };
80
+
81
+ struct SSyncMsg
82
+ {
83
+ unsigned char msg;
84
+ void* data;
85
+ size_t dataSize;
86
+ };
87
+
88
+ struct SSyncRt
89
+ {
90
+ unsigned char objTypes[3];
91
+ int objHandles[3];
92
+ };
93
+
94
+ typedef int (*contactCallback)(int,int,int,int*,float*);
95
+ typedef int (*jointCtrlCallback)(int,int,int,const int*,const float*,float*);
96
+
97
+
98
+ // ==============
99
+ // sim.h
100
+ // ==============
101
+
102
+ simInt simRunSimulator(const simChar* applicationName,simInt options,simVoid(*initCallBack)(),simVoid(*loopCallBack)(),simVoid(*deinitCallBack)());
103
+ simInt simRunSimulatorEx(const simChar* applicationName,simInt options,simVoid(*initCallBack)(),simVoid(*loopCallBack)(),simVoid(*deinitCallBack)(),simInt stopDelay,const simChar* sceneOrModelToLoad);
104
+ simVoid* simGetMainWindow(simInt type);
105
+ simChar* simGetLastError();
106
+ simInt simSetBooleanParameter(simInt parameter,simBool boolState);
107
+ simInt simGetBooleanParameter(simInt parameter);
108
+ simInt simSetBoolParameter(simInt parameter,simBool boolState);
109
+ simInt simGetBoolParameter(simInt parameter);
110
+ simInt simSetIntegerParameter(simInt parameter,simInt intState);
111
+ simInt simGetIntegerParameter(simInt parameter,simInt* intState);
112
+ simInt simSetInt32Parameter(simInt parameter,simInt intState);
113
+ simInt simGetInt32Parameter(simInt parameter,simInt* intState);
114
+ simInt simGetUInt64Parameter(simInt parameter,simUInt64* intState);
115
+ simInt simSetFloatingParameter(simInt parameter,simFloat floatState);
116
+ simInt simGetFloatingParameter(simInt parameter,simFloat* floatState);
117
+ simInt simSetFloatParameter(simInt parameter,simFloat floatState);
118
+ simInt simGetFloatParameter(simInt parameter,simFloat* floatState);
119
+ simInt simSetStringParameter(simInt parameter,const simChar* str);
120
+ simChar* simGetStringParameter(simInt parameter);
121
+ simInt simGetObjectHandle(const simChar* objectName);
122
+ simInt simRemoveObject(simInt objectHandle);
123
+ simInt simRemoveModel(simInt objectHandle);
124
+ simChar* simGetObjectName(simInt objectHandle);
125
+ simInt simGetObjects(simInt index,simInt objectType);
126
+ simInt simSetObjectName(simInt objectHandle,const simChar* objectName);
127
+ simInt simGetCollectionHandle(const simChar* collectionName);
128
+ simInt simRemoveCollection(simInt collectionHandle);
129
+ simInt simEmptyCollection(simInt collectionHandle);
130
+ simChar* simGetCollectionName(simInt collectionHandle);
131
+ simInt simSetCollectionName(simInt collectionHandle,const simChar* collectionName);
132
+ simInt simGetObjectMatrix(simInt objectHandle,simInt relativeToObjectHandle,simFloat* matrix);
133
+ simInt simSetObjectMatrix(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* matrix);
134
+ simInt simGetObjectPosition(simInt objectHandle,simInt relativeToObjectHandle,simFloat* position);
135
+ simInt simSetObjectPosition(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* position);
136
+ simInt simGetObjectOrientation(simInt objectHandle,simInt relativeToObjectHandle,simFloat* eulerAngles);
137
+ simInt simGetObjectQuaternion(simInt objectHandle,simInt relativeToObjectHandle,simFloat* quaternion);
138
+ simInt simSetObjectQuaternion(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* quaternion);
139
+ simInt simSetObjectOrientation(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* eulerAngles);
140
+ simInt simGetJointPosition(simInt objectHandle,simFloat* position);
141
+ simInt simSetJointPosition(simInt objectHandle,simFloat position);
142
+ simInt simSetJointTargetPosition(simInt objectHandle,simFloat targetPosition);
143
+ simInt simGetJointTargetPosition(simInt objectHandle,simFloat* targetPosition);
144
+ simInt simSetJointMaxForce(simInt objectHandle,simFloat forceOrTorque);
145
+ simInt simGetPathPosition(simInt objectHandle,simFloat* position);
146
+ simInt simSetPathPosition(simInt objectHandle,simFloat position);
147
+ simInt simGetPathLength(simInt objectHandle,simFloat* length);
148
+ simInt simGetJointMatrix(simInt objectHandle,simFloat* matrix);
149
+ simInt simSetSphericalJointMatrix(simInt objectHandle,const simFloat* matrix);
150
+ simInt simGetJointInterval(simInt objectHandle,simBool* cyclic,simFloat* interval);
151
+ simInt simSetJointInterval(simInt objectHandle,simBool cyclic,const simFloat* interval);
152
+ simInt simGetObjectParent(simInt objectHandle);
153
+ simInt simGetObjectChild(simInt objectHandle,simInt index);
154
+ simInt simSetObjectParent(simInt objectHandle,simInt parentObjectHandle,simBool keepInPlace);
155
+ simInt simGetObjectType(simInt objectHandle);
156
+ simInt simGetJointType(simInt objectHandle);
157
+ simInt simBuildIdentityMatrix(simFloat* matrix);
158
+ simInt simCopyMatrix(const simFloat* matrixIn,simFloat* matrixOut);
159
+ simInt simBuildMatrix(const simFloat* position,const simFloat* eulerAngles,simFloat* matrix);
160
+ simInt simBuildMatrixQ(const simFloat* position,const simFloat* quaternion,simFloat* matrix);
161
+ simInt simGetEulerAnglesFromMatrix(const simFloat* matrix,simFloat* eulerAngles);
162
+ simInt simGetQuaternionFromMatrix(const simFloat* matrix,simFloat* quaternion);
163
+ simInt simInvertMatrix(simFloat* matrix);
164
+ simInt simMultiplyMatrices(const simFloat* matrixIn1,const simFloat* matrixIn2,simFloat* matrixOut);
165
+ simInt simInterpolateMatrices(const simFloat* matrixIn1,const simFloat* matrixIn2,simFloat interpolFactor,simFloat* matrixOut);
166
+ simInt simTransformVector(const simFloat* matrix,simFloat* vect);
167
+ simInt simReservedCommand(simInt v,simInt w);
168
+ simFloat simGetSimulationTime();
169
+ simInt simGetSimulationState();
170
+ simFloat simGetSystemTime();
171
+ simInt simGetSystemTimeInMilliseconds(); // deprecated
172
+ simUInt simGetSystemTimeInMs(simInt previousTime);
173
+ simInt simLoadScene(const simChar* filename);
174
+ simInt simCloseScene();
175
+ simInt simSaveScene(const simChar* filename);
176
+ simInt simLoadModel(const simChar* filename);
177
+ simInt simSaveModel(simInt baseOfModelHandle,const simChar* filename);
178
+ simChar* simGetSimulatorMessage(simInt* messageID,simInt* auxiliaryData,simInt* returnedDataSize);
179
+ simInt simAddModuleMenuEntry(const simChar* entryLabel,simInt itemCount,simInt* itemHandles);
180
+ simInt simSetModuleMenuItemState(simInt itemHandle,simInt state,const simChar* label);
181
+ simInt simDoesFileExist(const simChar* filename);
182
+ simInt simIsObjectInSelection(simInt objectHandle);
183
+ simInt simAddObjectToSelection(simInt what,simInt objectHandle);
184
+ simInt simRemoveObjectFromSelection(simInt what,simInt objectHandle);
185
+ simInt simGetObjectSelectionSize();
186
+ simInt simGetObjectLastSelection();
187
+ simInt simGetObjectSelection(simInt* objectHandles);
188
+ simInt simHandleCollision(simInt collisionObjectHandle);
189
+ simInt simReadCollision(simInt collisionObjectHandle);
190
+ simInt simHandleDistance(simInt distanceObjectHandle,simFloat* smallestDistance);
191
+ simInt simReadDistance(simInt distanceObjectHandle,simFloat* smallestDistance);
192
+ simInt simHandleProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);
193
+ simInt simReadProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);
194
+ simInt simHandleIkGroup(simInt ikGroupHandle);
195
+ simInt simCheckIkGroup(simInt ikGroupHandle,simInt jointCnt,const simInt* jointHandles,simFloat* jointValues,const simInt* jointOptions);
196
+ simInt simHandleDynamics(simFloat deltaTime);
197
+ simInt simGetScriptHandle(const simChar* scriptName);
198
+ simInt simSetScriptText(simInt scriptHandle,const simChar* scriptText);
199
+ const simChar* simGetScriptText(simInt scriptHandle);
200
+ simInt simGetScriptProperty(simInt scriptHandle,simInt* scriptProperty,simInt* associatedObjectHandle);
201
+ simInt simAssociateScriptWithObject(simInt scriptHandle,simInt associatedObjectHandle);
202
+ simInt simGetScript(simInt index);
203
+ simInt simGetScriptAssociatedWithObject(simInt objectHandle);
204
+ simInt simGetCustomizationScriptAssociatedWithObject(simInt objectHandle);
205
+ simInt simGetObjectAssociatedWithScript(simInt scriptHandle);
206
+ simChar* simGetScriptName(simInt scriptHandle);
207
+ simInt simHandleMainScript();
208
+ simInt simResetScript(simInt scriptHandle);
209
+ simInt simAddScript(simInt scriptProperty);
210
+ simInt simRemoveScript(simInt scriptHandle);
211
+ simInt simRefreshDialogs(simInt refreshDegree);
212
+ simInt simGetCollisionHandle(const simChar* collisionObjectName);
213
+ simInt simGetDistanceHandle(const simChar* distanceObjectName);
214
+ simInt simGetIkGroupHandle(const simChar* ikGroupName);
215
+ simInt simResetCollision(simInt collisionObjectHandle);
216
+ simInt simResetDistance(simInt distanceObjectHandle);
217
+ simInt simResetProximitySensor(simInt sensorHandle);
218
+ simInt simCheckProximitySensor(simInt sensorHandle,simInt entityHandle,simFloat* detectedPoint);
219
+ simInt simCheckProximitySensorEx(simInt sensorHandle,simInt entityHandle,simInt detectionMode,simFloat detectionThreshold,simFloat maxAngle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);
220
+ simInt simCheckProximitySensorEx2(simInt sensorHandle,simFloat* vertexPointer,simInt itemType,simInt itemCount,simInt detectionMode,simFloat detectionThreshold,simFloat maxAngle,simFloat* detectedPoint,simFloat* normalVector);
221
+ simChar* simCreateBuffer(simInt size);
222
+ simInt simReleaseBuffer(const simChar* buffer);
223
+ simInt simCheckCollision(simInt entity1Handle,simInt entity2Handle);
224
+ simInt simCheckCollisionEx(simInt entity1Handle,simInt entity2Handle,simFloat** intersectionSegments);
225
+ simInt simCheckDistance(simInt entity1Handle,simInt entity2Handle,simFloat threshold,simFloat* distanceData);
226
+ simChar* simGetObjectConfiguration(simInt objectHandle);
227
+ simInt simSetObjectConfiguration(const simChar* data);
228
+ simChar* simGetConfigurationTree(simInt objectHandle);
229
+ simInt simSetConfigurationTree(const simChar* data);
230
+ simInt simSetSimulationTimeStep(simFloat timeStep);
231
+ simFloat simGetSimulationTimeStep();
232
+ simInt simGetRealTimeSimulation();
233
+ simInt simIsRealTimeSimulationStepNeeded();
234
+ simInt simAdjustRealTimeTimer(simInt instanceIndex,simFloat deltaTime);
235
+ simInt simGetSimulationPassesPerRenderingPass();
236
+ simInt simAdvanceSimulationByOneStep();
237
+ simInt simStartSimulation();
238
+ simInt simStopSimulation();
239
+ simInt simPauseSimulation();
240
+ simInt simLoadModule(const simChar* filenameAndPath,const simChar* pluginName);
241
+ simInt simUnloadModule(simInt pluginhandle);
242
+ simVoid* simSendModuleMessage(simInt message,simInt* auxiliaryData,simVoid* customData,simInt* replyData);
243
+ simVoid* simBroadcastMessage(simInt* auxiliaryData,simVoid* customData,simInt* replyData);
244
+ simChar* simGetModuleName(simInt index,simUChar* moduleVersion);
245
+ simInt simFloatingViewAdd(simFloat posX,simFloat posY,simFloat sizeX,simFloat sizeY,simInt options);
246
+ simInt simFloatingViewRemove(simInt floatingViewHandle);
247
+ simInt simAdjustView(simInt viewHandleOrIndex,simInt associatedViewableObjectHandle,simInt options,const simChar* viewLabel);
248
+ simInt simSetLastError(const simChar* funcName,const simChar* errorMessage);
249
+ simInt simHandleGraph(simInt graphHandle,simFloat simulationTime);
250
+ simInt simResetGraph(simInt graphHandle);
251
+ simInt simSetNavigationMode(simInt navigationMode);
252
+ simInt simGetNavigationMode();
253
+ simInt simSetPage(simInt index);
254
+ simInt simGetPage();
255
+ simInt simDisplayDialog(const simChar* titleText,const simChar* mainText,simInt dialogType,const simChar* initialText,const simFloat* titleColors,const simFloat* dialogColors,simInt* elementHandle);
256
+ simInt simGetDialogResult(simInt genericDialogHandle);
257
+ simChar* simGetDialogInput(simInt genericDialogHandle);
258
+ simInt simEndDialog(simInt genericDialogHandle);
259
+ simInt simRegisterScriptCallbackFunction(const simChar* funcNameAtPluginName,const simChar* callTips,simVoid(*callBack)(struct SScriptCallBack* cb));
260
+ simInt simRegisterScriptVariable(const simChar* varNameAtPluginName,const simChar* varValue,simInt stackHandle);
261
+ simInt simSetJointTargetVelocity(simInt objectHandle,simFloat targetVelocity);
262
+ simInt simGetJointTargetVelocity(simInt objectHandle,simFloat* targetVelocity);
263
+ simInt simSetPathTargetNominalVelocity(simInt objectHandle,simFloat targetNominalVelocity);
264
+ simInt simCopyPasteObjects(simInt* objectHandles,simInt objectCount,simInt options);
265
+ simInt simScaleSelectedObjects(simFloat scalingFactor,simBool scalePositionsToo);
266
+ simInt simScaleObjects(const simInt* objectHandles,simInt objectCount,simFloat scalingFactor,simBool scalePositionsToo);
267
+ simInt simDeleteSelectedObjects();
268
+ simInt simGetObjectUniqueIdentifier(simInt objectHandle,simInt* uniqueIdentifier);
269
+ simInt simSendData(simInt targetID,simInt dataHeader,const simChar* dataName,const simChar* data,simInt dataLength,simInt antennaHandle,simFloat actionRadius,simFloat emissionAngle1,simFloat emissionAngle2,simFloat persistence);
270
+ simChar* simReceiveData(simInt dataHeader,const simChar* dataName,simInt antennaHandle,simInt index,simInt* dataLength,simInt* senderID,simInt* dataHeaderR,simChar** dataNameR);
271
+ simInt simSetGraphUserData(simInt graphHandle,const simChar* dataStreamName,simFloat data);
272
+ simInt simAddDrawingObject(simInt objectType,simFloat size,simFloat duplicateTolerance,simInt parentObjectHandle,simInt maxItemCount,const simFloat* ambient_diffuse,const simFloat* setToNULL,const simFloat* specular,const simFloat* emission);
273
+ simInt simRemoveDrawingObject(simInt objectHandle);
274
+ simInt simAddDrawingObjectItem(simInt objectHandle,const simFloat* itemData);
275
+ simInt simAddParticleObject(simInt objectType,simFloat size,simFloat density,const simVoid* params,simFloat lifeTime,simInt maxItemCount,const simFloat* ambient_diffuse,const simFloat* setToNULL,const simFloat* specular,const simFloat* emission);
276
+ simInt simRemoveParticleObject(simInt objectHandle);
277
+ simInt simAddParticleObjectItem(simInt objectHandle,const simFloat* itemData);
278
+ simFloat simGetObjectSizeFactor(simInt objectHandle);
279
+ simInt simAnnounceSceneContentChange();
280
+ simInt simSetIntegerSignal(const simChar* signalName,simInt signalValue);
281
+ simInt simGetIntegerSignal(const simChar* signalName,simInt* signalValue);
282
+ simInt simClearIntegerSignal(const simChar* signalName);
283
+ simInt simSetFloatSignal(const simChar* signalName,simFloat signalValue);
284
+ simInt simGetFloatSignal(const simChar* signalName,simFloat* signalValue);
285
+ simInt simClearFloatSignal(const simChar* signalName);
286
+ simInt simSetDoubleSignal(const simChar* signalName,simDouble signalValue);
287
+ simInt simGetDoubleSignal(const simChar* signalName,simDouble* signalValue);
288
+ simInt simClearDoubleSignal(const simChar* signalName);
289
+ simInt simSetStringSignal(const simChar* signalName,const simChar* signalValue,simInt stringLength);
290
+ simChar* simGetStringSignal(const simChar* signalName,simInt* stringLength);
291
+ simInt simClearStringSignal(const simChar* signalName);
292
+ simChar* simGetSignalName(simInt signalIndex,simInt signalType);
293
+ simInt simSetObjectProperty(simInt objectHandle,simInt prop);
294
+ simInt simGetObjectProperty(simInt objectHandle);
295
+ simInt simSetObjectSpecialProperty(simInt objectHandle,simInt prop);
296
+ simInt simGetObjectSpecialProperty(simInt objectHandle);
297
+ simInt simGetPositionOnPath(simInt pathHandle,simFloat relativeDistance,simFloat* position);
298
+ simInt simGetDataOnPath(simInt pathHandle,simFloat relativeDistance,simInt dataType,simInt* intData,simFloat* floatData);
299
+ simInt simGetOrientationOnPath(simInt pathHandle,simFloat relativeDistance,simFloat* eulerAngles);
300
+ simInt simGetClosestPositionOnPath(simInt pathHandle,simFloat* absolutePosition,simFloat* pathPosition);
301
+ simInt simReadForceSensor(simInt objectHandle,simFloat* forceVector,simFloat* torqueVector);
302
+ simInt simBreakForceSensor(simInt objectHandle);
303
+ simInt simGetShapeVertex(simInt shapeHandle,simInt groupElementIndex,simInt vertexIndex,simFloat* relativePosition);
304
+ simInt simGetShapeTriangle(simInt shapeHandle,simInt groupElementIndex,simInt triangleIndex,simInt* vertexIndices,simFloat* triangleNormals);
305
+ simInt simSetLightParameters(simInt objectHandle,simInt state,const simFloat* setToNULL,const simFloat* diffusePart,const simFloat* specularPart);
306
+ simInt simGetLightParameters(simInt objectHandle,simFloat* setToNULL,simFloat* diffusePart,simFloat* specularPart);
307
+ simInt simGetVelocity(simInt shapeHandle,simFloat* linearVelocity,simFloat* angularVelocity);
308
+ simInt simGetObjectVelocity(simInt objectHandle,simFloat* linearVelocity,simFloat* angularVelocity);
309
+ simInt simAddForceAndTorque(simInt shapeHandle,const simFloat* force,const simFloat* torque);
310
+ simInt simAddForce(simInt shapeHandle,const simFloat* position,const simFloat* force);
311
+ simInt simSetExplicitHandling(simInt generalObjectHandle,int explicitFlags);
312
+ simInt simGetExplicitHandling(simInt generalObjectHandle);
313
+ simInt simGetLinkDummy(simInt dummyHandle);
314
+ simInt simSetLinkDummy(simInt dummyHandle,simInt linkedDummyHandle);
315
+ simInt simSetModelProperty(simInt objectHandle,simInt modelProperty);
316
+ simInt simGetModelProperty(simInt objectHandle);
317
+ simInt simSetShapeColor(simInt shapeHandle,const simChar* colorName,simInt colorComponent,const simFloat* rgbData);
318
+ simInt simGetShapeColor(simInt shapeHandle,const simChar* colorName,simInt colorComponent,simFloat* rgbData);
319
+ simInt simResetDynamicObject(simInt objectHandle);
320
+ simInt simSetJointMode(simInt jointHandle,simInt jointMode,simInt options);
321
+ simInt simGetJointMode(simInt jointHandle,simInt* options);
322
+ simInt simSerialOpen(const simChar* portString,simInt baudRate,simVoid* reserved1,simVoid* reserved2);
323
+ simInt simSerialClose(simInt portHandle);
324
+ simInt simSerialSend(simInt portHandle,const simChar* data,simInt dataLength);
325
+ simInt simSerialRead(simInt portHandle,simChar* buffer,simInt dataLengthToRead);
326
+ simInt simSerialCheck(simInt portHandle);
327
+ simInt simGetContactInfo(simInt dynamicPass,simInt objectHandle,simInt index,simInt* objectHandles,simFloat* contactInfo);
328
+ simInt simSetThreadIsFree(simBool freeMode);
329
+ simInt simTubeOpen(simInt dataHeader,const simChar* dataName,simInt readBufferSize,simBool notUsedButKeepZero);
330
+ simInt simTubeClose(simInt tubeHandle);
331
+ simInt simTubeWrite(simInt tubeHandle,const simChar* data,simInt dataLength);
332
+ simChar* simTubeRead(simInt tubeHandle,simInt* dataLength);
333
+ simInt simTubeStatus(simInt tubeHandle,simInt* readPacketsCount,simInt* writePacketsCount);
334
+ simInt simAuxiliaryConsoleOpen(const simChar* title,simInt maxLines,simInt mode,const simInt* position,const simInt* size,const simFloat* textColor,const simFloat* backgroundColor);
335
+ simInt simAuxiliaryConsoleClose(simInt consoleHandle);
336
+ simInt simAuxiliaryConsoleShow(simInt consoleHandle,simBool showState);
337
+ simInt simAuxiliaryConsolePrint(simInt consoleHandle,const simChar* text);
338
+ simInt simImportShape(simInt fileformat,const simChar* pathAndFilename,simInt options,simFloat identicalVerticeTolerance,simFloat scalingFactor);
339
+ simInt simImportMesh(simInt fileformat,const simChar* pathAndFilename,simInt options,simFloat identicalVerticeTolerance,simFloat scalingFactor,simFloat*** vertices,simInt** verticesSizes,simInt*** indices,simInt** indicesSizes,simFloat*** reserved,simChar*** names);
340
+ simInt simExportMesh(simInt fileformat,const simChar* pathAndFilename,simInt options,simFloat scalingFactor,simInt elementCount,const simFloat** vertices,const simInt* verticesSizes,const simInt** indices,const simInt* indicesSizes,simFloat** reserved,const simChar** names);
341
+ simInt simCreateMeshShape(simInt options,simFloat shadingAngle,const simFloat* vertices,simInt verticesSize,const simInt* indices,simInt indicesSize,simFloat* reserved);
342
+ simInt simCreatePureShape(simInt primitiveType,simInt options,const simFloat* sizes,simFloat mass,const simInt* precision);
343
+ simInt simCreateHeightfieldShape(simInt options,simFloat shadingAngle,simInt xPointCount,simInt yPointCount,simFloat xSize,const simFloat* heights);
344
+ simInt simGetShapeMesh(simInt shapeHandle,simFloat** vertices,simInt* verticesSize,simInt** indices,simInt* indicesSize,simFloat** normals);
345
+ simInt simAddBanner(const simChar* label,simFloat size,simInt options,const simFloat* positionAndEulerAngles,simInt parentObjectHandle,const simFloat* labelColors,const simFloat* backgroundColors);
346
+ simInt simRemoveBanner(simInt bannerID);
347
+ simInt simCreateJoint(simInt jointType,simInt jointMode,simInt options,const simFloat* sizes,const simFloat* colorA,const simFloat* colorB);
348
+ simInt simGetObjectIntParameter(simInt objectHandle,simInt parameterID,simInt* parameter);
349
+ simInt simSetObjectIntParameter(simInt objectHandle,simInt parameterID,simInt parameter);
350
+ simInt simGetObjectInt32Parameter(simInt objectHandle,simInt parameterID,simInt* parameter);
351
+ simInt simSetObjectInt32Parameter(simInt objectHandle,simInt parameterID,simInt parameter);
352
+ simInt simGetObjectFloatParameter(simInt objectHandle,simInt parameterID,simFloat* parameter);
353
+ simInt simSetObjectFloatParameter(simInt objectHandle,simInt parameterID,simFloat parameter);
354
+ simChar* simGetObjectStringParameter(simInt objectHandle,simInt parameterID,simInt* parameterLength);
355
+ simInt simSetObjectStringParameter(simInt objectHandle,simInt parameterID,simChar* parameter,simInt parameterLength);
356
+ simInt simSetSimulationPassesPerRenderingPass(simInt p);
357
+ simInt simGetRotationAxis(const simFloat* matrixStart,const simFloat* matrixGoal,simFloat* axis,simFloat* angle);
358
+ simInt simRotateAroundAxis(const simFloat* matrixIn,const simFloat* axis,const simFloat* axisPos,simFloat angle,simFloat* matrixOut);
359
+ simInt simGetJointForce(simInt jointHandle,simFloat* forceOrTorque);
360
+ simInt simGetJointMaxForce(simInt jointHandle,simFloat* forceOrTorque);
361
+ simInt simSetArrayParameter(simInt parameter,const simVoid* arrayOfValues);
362
+ simInt simGetArrayParameter(simInt parameter,simVoid* arrayOfValues);
363
+ simInt simSetIkGroupProperties(simInt ikGroupHandle,simInt resolutionMethod,simInt maxIterations,simFloat damping,void* reserved);
364
+ simInt simSetIkElementProperties(simInt ikGroupHandle,simInt tipDummyHandle,simInt constraints,const simFloat* precision,const simFloat* weight,void* reserved);
365
+ simInt simCameraFitToView(simInt viewHandleOrIndex,simInt objectCount,const simInt* objectHandles,simInt options,simFloat scaling);
366
+ simInt simPersistentDataWrite(const simChar* dataName,const simChar* dataValue,simInt dataLength,simInt options);
367
+ simChar* simPersistentDataRead(const simChar* dataName,simInt* dataLength);
368
+ simInt simIsHandleValid(simInt generalObjectHandle,simInt generalObjectType);
369
+ simInt simHandleVisionSensor(simInt visionSensorHandle,simFloat** auxValues,simInt** auxValuesCount);
370
+ simInt simReadVisionSensor(simInt visionSensorHandle,simFloat** auxValues,simInt** auxValuesCount);
371
+ simInt simResetVisionSensor(simInt visionSensorHandle);
372
+ simInt simCheckVisionSensor(simInt visionSensorHandle,simInt entityHandle,simFloat** auxValues,simInt** auxValuesCount);
373
+ simFloat* simCheckVisionSensorEx(simInt visionSensorHandle,simInt entityHandle,simBool returnImage);
374
+ simInt simGetVisionSensorResolution(simInt visionSensorHandle,simInt* resolution);
375
+ simFloat* simGetVisionSensorImage(simInt visionSensorHandle);
376
+ simUChar* simGetVisionSensorCharImage(simInt visionSensorHandle,simInt* resolutionX,simInt* resolutionY);
377
+ simFloat* simGetVisionSensorDepthBuffer(simInt visionSensorHandle);
378
+ simInt simSetVisionSensorImage(simInt visionSensorHandle,const simFloat* image);
379
+ simInt simSetVisionSensorCharImage(simInt visionSensorHandle,const simUChar* image);
380
+ simInt simRMLPosition(simInt dofs,simDouble timeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxVelAccelJerk,const simBool* selection,const simDouble* targetPosVel,simDouble* newPosVelAccel,simVoid* auxData);
381
+ simInt simRMLVelocity(simInt dofs,simDouble timeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxAccelJerk,const simBool* selection,const simDouble* targetVel,simDouble* newPosVelAccel,simVoid* auxData);
382
+ simInt simRMLPos(simInt dofs,simDouble smallestTimeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxVelAccelJerk,const simBool* selection,const simDouble* targetPosVel,simVoid* auxData);
383
+ simInt simRMLVel(simInt dofs,simDouble smallestTimeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxAccelJerk,const simBool* selection,const simDouble* targetVel,simVoid* auxData);
384
+ simInt simRMLStep(simInt handle,simDouble timeStep,simDouble* newPosVelAccel,simVoid* auxData,simVoid* reserved);
385
+ simInt simRMLRemove(simInt handle);
386
+ simChar* simFileDialog(simInt mode,const simChar* title,const simChar* startPath,const simChar* initName,const simChar* extName,const simChar* ext);
387
+ simInt simMsgBox(simInt dlgType,simInt buttons,const simChar* title,const simChar* message);
388
+ simInt simCreateDummy(simFloat size,const simFloat* color);
389
+ simInt simSetShapeMassAndInertia(simInt shapeHandle,simFloat mass,const simFloat* inertiaMatrix,const simFloat* centerOfMass,const simFloat* transformation);
390
+ simInt simGetShapeMassAndInertia(simInt shapeHandle,simFloat* mass,simFloat* inertiaMatrix,simFloat* centerOfMass,const simFloat* transformation);
391
+ simInt simGroupShapes(const simInt* shapeHandles,simInt shapeCount);
392
+ simInt* simUngroupShape(simInt shapeHandle,simInt* shapeCount);
393
+ simInt simCreateProximitySensor(simInt sensorType,simInt subType,simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);
394
+ simInt simCreateForceSensor(simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);
395
+ simInt simCreateVisionSensor(simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);
396
+ simInt simConvexDecompose(simInt shapeHandle,simInt options,const simInt* intParams,const simFloat* floatParams);
397
+ simInt simCreatePath(simInt attributes,const simInt* intParams,const simFloat* floatParams,const simFloat* color);
398
+ simInt simInsertPathCtrlPoints(simInt pathHandle,simInt options,simInt startIndex,simInt ptCnt,const simVoid* ptData);
399
+ simInt simCutPathCtrlPoints(simInt pathHandle,simInt startIndex,simInt ptCnt);
400
+ simFloat* simGetIkGroupMatrix(simInt ikGroupHandle,simInt options,simInt* matrixSize);
401
+ simInt simAddGhost(simInt ghostGroup,simInt objectHandle,simInt options,simFloat startTime,simFloat endTime,const simFloat* color);
402
+ simInt simModifyGhost(simInt ghostGroup,simInt ghostId,simInt operation,simFloat floatValue,simInt options,simInt optionsMask,const simFloat* colorOrTransformation);
403
+ simVoid simQuitSimulator(simBool ignoredArgument);
404
+ simInt simGetThreadId();
405
+ simInt simLockResources(simInt lockType,simInt reserved);
406
+ simInt simUnlockResources(simInt lockHandle);
407
+ simInt simEnableEventCallback(simInt eventCallbackType,const simChar* plugin,simInt reserved);
408
+ simInt simSetShapeMaterial(simInt shapeHandle,simInt materialIdOrShapeHandle);
409
+ simInt simGetTextureId(const simChar* textureName,simInt* resolution);
410
+ simChar* simReadTexture(simInt textureId,simInt options,simInt posX,simInt posY,simInt sizeX,simInt sizeY);
411
+ simInt simWriteTexture(simInt textureId,simInt options,const simChar* data,simInt posX,simInt posY,simInt sizeX,simInt sizeY,simFloat interpol);
412
+ simInt simCreateTexture(const simChar* fileName,simInt options,const simFloat* planeSizes,const simFloat* scalingUV,const simFloat* xy_g,simInt fixedResolution,simInt* textureId,simInt* resolution,const simVoid* reserved);
413
+ simInt simWriteCustomDataBlock(simInt objectHandle,const simChar* tagName,const simChar* data,simInt dataSize);
414
+ simChar* simReadCustomDataBlock(simInt objectHandle,const simChar* tagName,simInt* dataSize);
415
+ simChar* simReadCustomDataBlockTags(simInt objectHandle,simInt* tagCount);
416
+ simInt simAddPointCloud(simInt pageMask,simInt layerMask,simInt objectHandle,simInt options,simFloat pointSize,simInt ptCnt,const simFloat* pointCoordinates,const simChar* defaultColors,const simChar* pointColors,const simFloat* pointNormals);
417
+ simInt simModifyPointCloud(simInt pointCloudHandle,simInt operation,const simInt* intParam,const simFloat* floatParam);
418
+ simInt simGetShapeGeomInfo(simInt shapeHandle,simInt* intData,simFloat* floatData,simVoid* reserved);
419
+ simInt* simGetObjectsInTree(simInt treeBaseHandle,simInt objectType,simInt options,simInt* objectCount);
420
+ simInt simSetObjectSizeValues(simInt objectHandle,const simFloat* sizeValues);
421
+ simInt simGetObjectSizeValues(simInt objectHandle,simFloat* sizeValues);
422
+ simInt simScaleObject(simInt objectHandle,simFloat xScale,simFloat yScale,simFloat zScale,simInt options);
423
+ simInt simSetShapeTexture(simInt shapeHandle,simInt textureId,simInt mappingMode,simInt options,const simFloat* uvScaling,const simFloat* position,const simFloat* orientation);
424
+ simInt simGetShapeTextureId(simInt shapeHandle);
425
+ simInt* simGetCollectionObjects(simInt collectionHandle,simInt* objectCount);
426
+ simInt simSetScriptAttribute(simInt scriptHandle,simInt attributeID,simFloat floatVal,simInt intOrBoolVal);
427
+ simInt simGetScriptAttribute(simInt scriptHandle,simInt attributeID,simFloat* floatVal,simInt* intOrBoolVal);
428
+ simInt simReorientShapeBoundingBox(simInt shapeHandle,simInt relativeToHandle,simInt reservedSetToZero);
429
+ simInt simSwitchThread();
430
+ simInt simCreateIkGroup(simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);
431
+ simInt simRemoveIkGroup(simInt ikGroupHandle);
432
+ simInt simCreateIkElement(simInt ikGroupHandle,simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);
433
+ simInt simCreateCollection(const simChar* collectionName,simInt options);
434
+ simInt simAddObjectToCollection(simInt collectionHandle,simInt objectHandle,simInt what,simInt options);
435
+ simInt simSaveImage(const simUChar* image,const simInt* resolution,simInt options,const simChar* filename,simInt quality,simVoid* reserved);
436
+ simUChar* simLoadImage(simInt* resolution,simInt options,const simChar* filename,simVoid* reserved);
437
+ simUChar* simGetScaledImage(const simUChar* imageIn,const simInt* resolutionIn,simInt* resolutionOut,simInt options,simVoid* reserved);
438
+ simInt simTransformImage(simUChar* image,const simInt* resolution,simInt options,const simFloat* floatParams,const simInt* intParams,simVoid* reserved);
439
+ simInt simGetQHull(const simFloat* inVertices,simInt inVerticesL,simFloat** verticesOut,simInt* verticesOutL,simInt** indicesOut,simInt* indicesOutL,simInt reserved1,const simFloat* reserved2);
440
+ simInt simGetDecimatedMesh(const simFloat* inVertices,simInt inVerticesL,const simInt* inIndices,simInt inIndicesL,simFloat** verticesOut,simInt* verticesOutL,simInt** indicesOut,simInt* indicesOutL,simFloat decimationPercent,simInt reserved1,const simFloat* reserved2);
441
+ simInt simExportIk(const simChar* pathAndFilename,simInt reserved1,simVoid* reserved2);
442
+ simInt simCallScriptFunctionEx(simInt scriptHandleOrType,const simChar* functionNameAtScriptName,simInt stackId);
443
+ simInt simComputeJacobian(simInt ikGroupHandle,simInt options,simVoid* reserved);
444
+ simInt simGetConfigForTipPose(simInt ikGroupHandle,simInt jointCnt,const simInt* jointHandles,simFloat thresholdDist,simInt maxTimeInMs,simFloat* retConfig,const simFloat* metric,simInt collisionPairCnt,const simInt* collisionPairs,const simInt* jointOptions,const simFloat* lowLimits,const simFloat* ranges,simVoid* reserved);
445
+ simFloat* simGenerateIkPath(simInt ikGroupHandle,simInt jointCnt,const simInt* jointHandles,simInt ptCnt,simInt collisionPairCnt,const simInt* collisionPairs,const simInt* jointOptions,simVoid* reserved);
446
+ simChar* simGetExtensionString(simInt objectHandle,simInt index,const char* key);
447
+ simInt simComputeMassAndInertia(simInt shapeHandle,simFloat density);
448
+ simInt simCreateStack();
449
+ simInt simReleaseStack(simInt stackHandle);
450
+ simInt simCopyStack(simInt stackHandle);
451
+ simInt simPushNullOntoStack(simInt stackHandle);
452
+ simInt simPushBoolOntoStack(simInt stackHandle,simBool value);
453
+ simInt simPushInt32OntoStack(simInt stackHandle,simInt value);
454
+ simInt simPushFloatOntoStack(simInt stackHandle,simFloat value);
455
+ simInt simPushDoubleOntoStack(simInt stackHandle,simDouble value);
456
+ simInt simPushStringOntoStack(simInt stackHandle,const simChar* value,simInt stringSize);
457
+ simInt simPushUInt8TableOntoStack(simInt stackHandle,const simUChar* values,simInt valueCnt);
458
+ simInt simPushInt32TableOntoStack(simInt stackHandle,const simInt* values,simInt valueCnt);
459
+ simInt simPushFloatTableOntoStack(simInt stackHandle,const simFloat* values,simInt valueCnt);
460
+ simInt simPushDoubleTableOntoStack(simInt stackHandle,const simDouble* values,simInt valueCnt);
461
+ simInt simPushTableOntoStack(simInt stackHandle);
462
+ simInt simInsertDataIntoStackTable(simInt stackHandle);
463
+ simInt simGetStackSize(simInt stackHandle);
464
+ simInt simPopStackItem(simInt stackHandle,simInt count);
465
+ simInt simMoveStackItemToTop(simInt stackHandle,simInt cIndex);
466
+ simInt simIsStackValueNull(simInt stackHandle);
467
+ simInt simGetStackBoolValue(simInt stackHandle,simBool* boolValue);
468
+ simInt simGetStackInt32Value(simInt stackHandle,simInt* numberValue);
469
+ simInt simGetStackFloatValue(simInt stackHandle,simFloat* numberValue);
470
+ simInt simGetStackDoubleValue(simInt stackHandle,simDouble* numberValue);
471
+ simChar* simGetStackStringValue(simInt stackHandle,simInt* stringSize);
472
+ simInt simGetStackTableInfo(simInt stackHandle,simInt infoType);
473
+ simInt simGetStackUInt8Table(simInt stackHandle,simUChar* array,simInt count);
474
+ simInt simGetStackInt32Table(simInt stackHandle,simInt* array,simInt count);
475
+ simInt simGetStackFloatTable(simInt stackHandle,simFloat* array,simInt count);
476
+ simInt simGetStackDoubleTable(simInt stackHandle,simDouble* array,simInt count);
477
+ simInt simUnfoldStackTable(simInt stackHandle);
478
+ simInt simDebugStack(simInt stackHandle,simInt cIndex);
479
+ simInt simSetScriptVariable(simInt scriptHandleOrType,const simChar* variableNameAtScriptName,simInt stackHandle);
480
+ simFloat simGetEngineFloatParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);
481
+ simInt simGetEngineInt32Parameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);
482
+ simBool simGetEngineBoolParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);
483
+ simInt simSetEngineFloatParameter(simInt paramId,simInt objectHandle,const simVoid* object,simFloat val);
484
+ simInt simSetEngineInt32Parameter(simInt paramId,simInt objectHandle,const simVoid* object,simInt val);
485
+ simInt simSetEngineBoolParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool val);
486
+ simInt simCreateOctree(simFloat voxelSize,simInt options,simFloat pointSize,simVoid* reserved);
487
+ simInt simCreatePointCloud(simFloat maxVoxelSize,simInt maxPtCntPerVoxel,simInt options,simFloat pointSize,simVoid* reserved);
488
+ simInt simSetPointCloudOptions(simInt pointCloudHandle,simFloat maxVoxelSize,simInt maxPtCntPerVoxel,simInt options,simFloat pointSize,simVoid* reserved);
489
+ simInt simGetPointCloudOptions(simInt pointCloudHandle,simFloat* maxVoxelSize,simInt* maxPtCntPerVoxel,simInt* options,simFloat* pointSize,simVoid* reserved);
490
+ simInt simInsertVoxelsIntoOctree(simInt octreeHandle,simInt options,const simFloat* pts,simInt ptCnt,const simUChar* color,const simUInt* tag,simVoid* reserved);
491
+ simInt simRemoveVoxelsFromOctree(simInt octreeHandle,simInt options,const simFloat* pts,simInt ptCnt,simVoid* reserved);
492
+ simInt simInsertPointsIntoPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,const simUChar* color,simVoid* optionalValues);
493
+ simInt simRemovePointsFromPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,simFloat tolerance,simVoid* reserved);
494
+ simInt simIntersectPointsWithPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,simFloat tolerance,simVoid* reserved);
495
+ const float* simGetOctreeVoxels(simInt octreeHandle,simInt* ptCnt,simVoid* reserved);
496
+ const float* simGetPointCloudPoints(simInt pointCloudHandle,simInt* ptCnt,simVoid* reserved);
497
+ simInt simInsertObjectIntoOctree(simInt octreeHandle,simInt objectHandle,simInt options,const simUChar* color,simUInt tag,simVoid* reserved);
498
+ simInt simSubtractObjectFromOctree(simInt octreeHandle,simInt objectHandle,simInt options,simVoid* reserved);
499
+ simInt simInsertObjectIntoPointCloud(simInt pointCloudHandle,simInt objectHandle,simInt options,simFloat gridSize,const simUChar* color,simVoid* optionalValues);
500
+ simInt simSubtractObjectFromPointCloud(simInt pointCloudHandle,simInt objectHandle,simInt options,simFloat tolerance,simVoid* reserved);
501
+ simInt simCheckOctreePointOccupancy(simInt octreeHandle,simInt options,const simFloat* points,simInt ptCnt,simUInt* tag,simUInt64* location,simVoid* reserved);
502
+ simChar* simOpenTextEditor(const simChar* initText,const simChar* xml,simInt* various);
503
+ simChar* simPackTable(simInt stackHandle,simInt* bufferSize);
504
+ simInt simUnpackTable(simInt stackHandle,const simChar* buffer,simInt bufferSize);
505
+ simInt simSetReferencedHandles(simInt objectHandle,simInt count,const simInt* referencedHandles,const simInt* reserved1,const simInt* reserved2);
506
+ simInt simGetReferencedHandles(simInt objectHandle,simInt** referencedHandles,simInt** reserved1,simInt** reserved2);
507
+ simInt simGetShapeViz(simInt shapeHandle,simInt index,struct SShapeVizInfo* info);
508
+ simInt simExecuteScriptString(simInt scriptHandleOrType,const simChar* stringAtScriptName,simInt stackHandle);
509
+ simChar* simGetApiFunc(simInt scriptHandleOrType,const simChar* apiWord);
510
+ simChar* simGetApiInfo(simInt scriptHandleOrType,const simChar* apiWord);
511
+ simInt simSetModuleInfo(const simChar* moduleName,simInt infoType,const simChar* stringInfo,simInt intInfo);
512
+ simInt simGetModuleInfo(const simChar* moduleName,simInt infoType,simChar** stringInfo,simInt* intInfo);
513
+ simInt simIsDeprecated(const simChar* funcOrConst);
514
+ simChar* simGetPersistentDataTags(simInt* tagCount);
515
+ simInt simEventNotification(const simChar* event);
516
+ simInt simApplyTexture(simInt shapeHandle,const simFloat* textureCoordinates,simInt textCoordSize,const simUChar* texture,const simInt* textureResolution,simInt options);
517
+ simInt simSetJointDependency(simInt jointHandle,simInt masterJointHandle,simFloat offset,simFloat coeff);
518
+ simInt simSetStringNamedParam(const simChar* paramName,const simChar* stringParam,simInt paramLength);
519
+ simChar* simGetStringNamedParam(const simChar* paramName,simInt* paramLength);
520
+ simChar* simGetUserParameter(simInt objectHandle,const simChar* parameterName,simInt* parameterLength);
521
+ simInt simSetUserParameter(simInt objectHandle,const simChar* parameterName,const simChar* parameterValue,simInt parameterLength);
522
+ simInt simAddLog(const simChar* pluginName,simInt verbosityLevel,const simChar* logMsg);
523
+
524
+
525
+
526
+ simInt _simGetContactCallbackCount();
527
+ const void* _simGetContactCallback(simInt index);
528
+ simVoid _simSetDynamicSimulationIconCode(simVoid* object,simInt code);
529
+ simVoid _simSetDynamicObjectFlagForVisualization(simVoid* object,simInt flag);
530
+ simInt _simGetObjectListSize(simInt objType);
531
+ const simVoid* _simGetObjectFromIndex(simInt objType,simInt index);
532
+ simInt _simGetObjectID(const simVoid* object);
533
+ simInt _simGetObjectType(const simVoid* object);
534
+ const simVoid** _simGetObjectChildren(const simVoid* object,simInt* count);
535
+ const simVoid* _simGetGeomProxyFromShape(const simVoid* shape);
536
+ const simVoid* _simGetParentObject(const simVoid* object);
537
+ const simVoid* _simGetObject(int objID);
538
+ simVoid _simGetObjectLocalTransformation(const simVoid* object,simFloat* pos,simFloat* quat,simBool excludeFirstJointTransformation);
539
+ simVoid _simSetObjectLocalTransformation(simVoid* object,const simFloat* pos,const simFloat* quat);
540
+ simVoid _simSetObjectCumulativeTransformation(simVoid* object,const simFloat* pos,const simFloat* quat,simBool keepChildrenInPlace);
541
+ simVoid _simGetObjectCumulativeTransformation(const simVoid* object,simFloat* pos,simFloat* quat,simBool excludeFirstJointTransformation);
542
+ simBool _simIsShapeDynamicallyStatic(const simVoid* shape);
543
+ simInt _simGetTreeDynamicProperty(const simVoid* object);
544
+ simInt _simGetDummyLinkType(const simVoid* dummy,simInt* linkedDummyID);
545
+ simInt _simGetJointMode(const simVoid* joint);
546
+ simBool _simIsJointInHybridOperation(const simVoid* joint);
547
+ simVoid _simDisableDynamicTreeForManipulation(const simVoid* object,simBool disableFlag);
548
+ simBool _simIsShapeDynamicallyRespondable(const simVoid* shape);
549
+ simInt _simGetDynamicCollisionMask(const simVoid* shape);
550
+ const simVoid* _simGetLastParentForLocalGlobalCollidable(const simVoid* shape);
551
+ simVoid _simSetShapeIsStaticAndNotRespondableButDynamicTag(const simVoid* shape,simBool tag);
552
+ simBool _simGetShapeIsStaticAndNotRespondableButDynamicTag(const simVoid* shape);
553
+ simVoid _simSetJointPosition(const simVoid* joint,simFloat pos);
554
+ simFloat _simGetJointPosition(const simVoid* joint);
555
+ simVoid _simSetDynamicMotorPositionControlTargetPosition(const simVoid* joint,simFloat pos);
556
+ simVoid _simGetInitialDynamicVelocity(const simVoid* shape,simFloat* vel);
557
+ simVoid _simSetInitialDynamicVelocity(simVoid* shape,const simFloat* vel);
558
+ simVoid _simGetInitialDynamicAngVelocity(const simVoid* shape,simFloat* angularVel);
559
+ simVoid _simSetInitialDynamicAngVelocity(simVoid* shape,const simFloat* angularVel);
560
+ simBool _simGetStartSleeping(const simVoid* shape);
561
+ simBool _simGetWasPutToSleepOnce(const simVoid* shape);
562
+ simBool _simGetDynamicsFullRefreshFlag(const simVoid* object);
563
+ simVoid _simSetDynamicsFullRefreshFlag(const simVoid* object,simBool flag);
564
+ simVoid _simSetGeomProxyDynamicsFullRefreshFlag(simVoid* geomData,simBool flag);
565
+ simBool _simGetGeomProxyDynamicsFullRefreshFlag(const simVoid* geomData);
566
+ simVoid _simSetShapeDynamicVelocity(simVoid* shape,const simFloat* linear,const simFloat* angular);
567
+ simVoid _simGetAdditionalForceAndTorque(const simVoid* shape,simFloat* force,simFloat* torque);
568
+ simVoid _simClearAdditionalForceAndTorque(const simVoid* shape);
569
+ simBool _simGetJointPositionInterval(const simVoid* joint,simFloat* minValue,simFloat* rangeValue);
570
+ simInt _simGetJointType(const simVoid* joint);
571
+ simBool _simIsForceSensorBroken(const simVoid* forceSensor);
572
+ simVoid _simGetDynamicForceSensorLocalTransformationPart2(const simVoid* forceSensor,simFloat* pos,simFloat* quat);
573
+ simBool _simIsDynamicMotorEnabled(const simVoid* joint);
574
+ simBool _simIsDynamicMotorPositionCtrlEnabled(const simVoid* joint);
575
+ simBool _simIsDynamicMotorTorqueModulationEnabled(const simVoid* joint);
576
+ simVoid _simGetMotorPid(const simVoid* joint,simFloat* pParam,simFloat* iParam,simFloat* dParam);
577
+ simFloat _simGetDynamicMotorTargetPosition(const simVoid* joint);
578
+ simFloat _simGetDynamicMotorTargetVelocity(const simVoid* joint);
579
+ simFloat _simGetDynamicMotorMaxForce(const simVoid* joint);
580
+ simFloat _simGetDynamicMotorUpperLimitVelocity(const simVoid* joint);
581
+ simVoid _simSetDynamicMotorReflectedPositionFromDynamicEngine(simVoid* joint,simFloat pos);
582
+ simVoid _simSetJointSphericalTransformation(simVoid* joint,const simFloat* quat);
583
+ simVoid _simAddForceSensorCumulativeForcesAndTorques(simVoid* forceSensor,const simFloat* force,const simFloat* torque,int totalPassesCount);
584
+ simVoid _simAddJointCumulativeForcesOrTorques(simVoid* joint,simFloat forceOrTorque,int totalPassesCount);
585
+ simVoid _simSetDynamicJointLocalTransformationPart2(simVoid* joint,const simFloat* pos,const simFloat* quat);
586
+ simVoid _simSetDynamicForceSensorLocalTransformationPart2(simVoid* forceSensor,const simFloat* pos,const simFloat* quat);
587
+ simVoid _simSetDynamicJointLocalTransformationPart2IsValid(simVoid* joint,simBool valid);
588
+ simVoid _simSetDynamicForceSensorLocalTransformationPart2IsValid(simVoid* forceSensor,simBool valid);
589
+ const simVoid* _simGetGeomWrapFromGeomProxy(const simVoid* geomData);
590
+ simVoid _simGetLocalInertiaFrame(const simVoid* geomInfo,simFloat* pos,simFloat* quat);
591
+ simInt _simGetPurePrimitiveType(const simVoid* geomInfo);
592
+ simBool _simIsGeomWrapGeometric(const simVoid* geomInfo);
593
+ simBool _simIsGeomWrapConvex(const simVoid* geomInfo);
594
+ simInt _simGetGeometricCount(const simVoid* geomInfo);
595
+ simVoid _simGetAllGeometrics(const simVoid* geomInfo,simVoid** allGeometrics);
596
+ simVoid _simGetPurePrimitiveSizes(const simVoid* geometric,simFloat* sizes);
597
+ simVoid _simMakeDynamicAnnouncement(int announceType);
598
+ simVoid _simGetVerticesLocalFrame(const simVoid* geometric,simFloat* pos,simFloat* quat);
599
+ const simFloat* _simGetHeightfieldData(const simVoid* geometric,simInt* xCount,simInt* yCount,simFloat* minHeight,simFloat* maxHeight);
600
+ simVoid _simGetCumulativeMeshes(const simVoid* geomInfo,simFloat** vertices,simInt* verticesSize,simInt** indices,simInt* indicesSize);
601
+ simFloat _simGetMass(const simVoid* geomInfo);
602
+ simVoid _simGetPrincipalMomentOfInertia(const simVoid* geomInfo,simFloat* inertia);
603
+ simVoid _simGetGravity(simFloat* gravity);
604
+ simInt _simGetTimeDiffInMs(simInt previousTime);
605
+ simBool _simDoEntitiesCollide(simInt entity1ID,simInt entity2ID,simInt* cacheBuffer,simBool overrideCollidableFlagIfShape1,simBool overrideCollidableFlagIfShape2,simBool pathOrMotionPlanningRoutineCalling);
606
+ simBool _simGetDistanceBetweenEntitiesIfSmaller(simInt entity1ID,simInt entity2ID,simFloat* distance,simFloat* ray,simInt* cacheBuffer,simBool overrideMeasurableFlagIfNonCollection1,simBool overrideMeasurableFlagIfNonCollection2,simBool pathPlanningRoutineCalling);
607
+ simInt _simHandleJointControl(const simVoid* joint,simInt auxV,const simInt* inputValuesInt,const simFloat* inputValuesFloat,simFloat* outputValues);
608
+ simInt _simHandleCustomContact(simInt objHandle1,simInt objHandle2,simInt engine,simInt* dataInt,simFloat* dataFloat);
609
+ const simVoid* _simGetIkGroupObject(int ikGroupID);
610
+ simInt _simMpHandleIkGroupObject(const simVoid* ikGroup);
611
+ simFloat _simGetPureHollowScaling(const simVoid* geometric);
612
+ simInt _simGetJointCallbackCallOrder(const simVoid* joint);
613
+ simVoid _simDynCallback(const simInt* intData,const simFloat* floatData);
614
+
615
+
616
+ // Following courtesy of Stephen James:
617
+ simInt simExtLaunchUIThread(const simChar* applicationName,simInt options,const simChar* sceneOrModelOrUiToLoad,const simChar* applicationDir_);
618
+ simInt simExtCanInitSimThread();
619
+ simInt simExtSimThreadInit();
620
+ simInt simExtSimThreadDestroy();
621
+ simInt simExtPostExitRequest();
622
+ simInt simExtGetExitRequest();
623
+ simInt simExtStep(simBool stepIfRunning);
624
+ simInt simExtCallScriptFunction(simInt scriptHandleOrType, const simChar* functionNameAtScriptName,
625
+ const simInt* inIntData, simInt inIntCnt,
626
+ const simFloat* inFloatData, simInt inFloatCnt,
627
+ const simChar** inStringData, simInt inStringCnt,
628
+ const simChar* inBufferData, simInt inBufferCnt,
629
+ simInt** outIntData, simInt* outIntCnt,
630
+ simFloat** outFloatData, simInt* outFloatCnt,
631
+ simChar*** outStringData, simInt* outStringCnt,
632
+ simChar** outBufferData, simInt* outBufferSize);
633
+
634
+
635
+ // Deprecated begin
636
+ simInt simGetMaterialId(const simChar* materialName);
637
+ simInt simGetShapeMaterial(simInt shapeHandle);
638
+ simInt simHandleVarious();
639
+ simInt simSerialPortOpen(simInt portNumber,simInt baudRate,simVoid* reserved1,simVoid* reserved2);
640
+ simInt simSerialPortClose(simInt portNumber);
641
+ simInt simSerialPortSend(simInt portNumber,const simChar* data,simInt dataLength);
642
+ simInt simSerialPortRead(simInt portNumber,simChar* buffer,simInt dataLengthToRead);
643
+ simInt simJointGetForce(simInt jointHandle,simFloat* forceOrTorque);
644
+ simInt simGetPathPlanningHandle(const simChar* pathPlanningObjectName);
645
+ simInt simGetMotionPlanningHandle(const simChar* motionPlanningObjectName);
646
+ simInt simGetMpConfigForTipPose(simInt motionPlanningObjectHandle,simInt options,simFloat closeNodesDistance,simInt trialCount,const simFloat* tipPose,simInt maxTimeInMs,simFloat* outputJointPositions,const simFloat* referenceConfigs,simInt referenceConfigCount,const simFloat* jointWeights,const simInt* jointBehaviour,simInt correctionPasses);
647
+ simFloat* simFindMpPath(simInt motionPlanningObjectHandle,const simFloat* startConfig,const simFloat* goalConfig,simInt options,simFloat stepSize,simInt* outputConfigsCnt,simInt maxTimeInMs,simFloat* reserved,const simInt* auxIntParams,const simFloat* auxFloatParams);
648
+ simFloat* simSimplifyMpPath(simInt motionPlanningObjectHandle,const simFloat* pathBuffer,simInt configCnt,simInt options,simFloat stepSize,simInt increment,simInt* outputConfigsCnt,simInt maxTimeInMs,simFloat* reserved,const simInt* auxIntParams,const simFloat* auxFloatParams);
649
+ simFloat* simFindIkPath(simInt motionPlanningObjectHandle,const simFloat* startConfig,const simFloat* goalPose,simInt options,simFloat stepSize,simInt* outputConfigsCnt,simFloat* reserved,const simInt* auxIntParams,const simFloat* auxFloatParams);
650
+ simFloat* simGetMpConfigTransition(simInt motionPlanningObjectHandle,const simFloat* startConfig,const simFloat* goalConfig,simInt options,const simInt* select,simFloat calcStepSize,simFloat maxOutStepSize,simInt wayPointCnt,const simFloat* wayPoints,simInt* outputConfigsCnt,const simInt* auxIntParams,const simFloat* auxFloatParams);
651
+ simInt simCreateMotionPlanning(simInt jointCnt,const simInt* jointHandles,const simInt* jointRangeSubdivisions,const simFloat* jointMetricWeights,simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);
652
+ simInt simRemoveMotionPlanning(simInt motionPlanningHandle);
653
+ simInt simSearchPath(simInt pathPlanningObjectHandle,simFloat maximumSearchTime);
654
+ simInt simInitializePathSearch(simInt pathPlanningObjectHandle,simFloat maximumSearchTime,simFloat searchTimeStep);
655
+ simInt simPerformPathSearchStep(simInt temporaryPathSearchObject,simBool abortSearch);
656
+ simInt simLockInterface(simBool locked);
657
+ simInt simCopyPasteSelectedObjects();
658
+ simInt simResetPath(simInt pathHandle);
659
+ simInt simHandlePath(simInt pathHandle,simFloat deltaTime);
660
+ simInt simResetJoint(simInt jointHandle);
661
+ simInt simHandleJoint(simInt jointHandle,simFloat deltaTime);
662
+ simInt simAppendScriptArrayEntry(const simChar* reservedSetToNull,simInt scriptHandleOrType,const simChar* arrayNameAtScriptName,const simChar* keyName,const simChar* data,const simInt* what);
663
+ simInt simClearScriptVariable(const simChar* reservedSetToNull,simInt scriptHandleOrType,const simChar* variableNameAtScriptName);
664
+ simVoid _simGetJointOdeParameters(const simVoid* joint,simFloat* stopERP,simFloat* stopCFM,simFloat* bounce,simFloat* fudge,simFloat* normalCFM);
665
+ simVoid _simGetJointBulletParameters(const simVoid* joint,simFloat* stopERP,simFloat* stopCFM,simFloat* normalCFM);
666
+ simVoid _simGetOdeMaxContactFrictionCFMandERP(const simVoid* geomInfo,simInt* maxContacts,simFloat* friction,simFloat* cfm,simFloat* erp);
667
+ simBool _simGetBulletCollisionMargin(const simVoid* geomInfo,simFloat* margin,simInt* otherProp);
668
+ simBool _simGetBulletStickyContact(const simVoid* geomInfo);
669
+ simFloat _simGetBulletRestitution(const simVoid* geomInfo);
670
+ simVoid _simGetVortexParameters(const simVoid* object,simInt version,simFloat* floatParams,simInt* intParams);
671
+ simVoid _simGetNewtonParameters(const simVoid* object,simInt* version,simFloat* floatParams,simInt* intParams);
672
+ simVoid _simGetDamping(const simVoid* geomInfo,simFloat* linDamping,simFloat* angDamping);
673
+ simFloat _simGetFriction(const simVoid* geomInfo);
674
+ simInt simAddSceneCustomData(simInt header,const simChar* data,simInt dataLength);
675
+ simInt simGetSceneCustomDataLength(simInt header);
676
+ simInt simGetSceneCustomData(simInt header,simChar* data);
677
+ simInt simAddObjectCustomData(simInt objectHandle,simInt header,const simChar* data,simInt dataLength);
678
+ simInt simGetObjectCustomDataLength(simInt objectHandle,simInt header);
679
+ simInt simGetObjectCustomData(simInt objectHandle,simInt header,simChar* data);
680
+ simInt simCreateUI(const simChar* uiName,simInt menuAttributes,const simInt* clientSize,const simInt* cellSize,simInt* buttonHandles);
681
+ simInt simCreateUIButton(simInt uiHandle,const simInt* position,const simInt* size,simInt buttonProperty);
682
+ simInt simGetUIHandle(const simChar* uiName);
683
+ simInt simGetUIProperty(simInt uiHandle);
684
+ simInt simGetUIEventButton(simInt uiHandle,simInt* auxiliaryValues);
685
+ simInt simSetUIProperty(simInt uiHandle,simInt elementProperty);
686
+ simInt simGetUIButtonProperty(simInt uiHandle,simInt buttonHandle);
687
+ simInt simSetUIButtonProperty(simInt uiHandle,simInt buttonHandle,simInt buttonProperty);
688
+ simInt simGetUIButtonSize(simInt uiHandle,simInt buttonHandle,simInt* size);
689
+ simInt simSetUIButtonLabel(simInt uiHandle,simInt buttonHandle,const simChar* upStateLabel,const simChar* downStateLabel);
690
+ simChar* simGetUIButtonLabel(simInt uiHandle,simInt buttonHandle);
691
+ simInt simSetUISlider(simInt uiHandle,simInt buttonHandle,simInt position);
692
+ simInt simGetUISlider(simInt uiHandle,simInt buttonHandle);
693
+ simInt simSetUIButtonColor(simInt uiHandle,simInt buttonHandle,const simFloat* upStateColor,const simFloat* downStateColor,const simFloat* labelColor);
694
+ simInt simSetUIButtonTexture(simInt uiHandle,simInt buttonHandle,const simInt* size,const simChar* textureData);
695
+ simInt simCreateUIButtonArray(simInt uiHandle,simInt buttonHandle);
696
+ simInt simSetUIButtonArrayColor(simInt uiHandle,simInt buttonHandle,const simInt* position,const simFloat* color);
697
+ simInt simDeleteUIButtonArray(simInt uiHandle,simInt buttonHandle);
698
+ simInt simRemoveUI(simInt uiHandle);
699
+ simInt simSetUIPosition(simInt uiHandle,const simInt* position);
700
+ simInt simGetUIPosition(simInt uiHandle,simInt* position);
701
+ simInt simLoadUI(const simChar* filename,simInt maxCount,simInt* uiHandles);
702
+ simInt simSaveUI(simInt count,const simInt* uiHandles,const simChar* filename);
703
+ simInt simHandleGeneralCallbackScript(simInt callbackId,simInt callbackTag,simVoid* additionalData);
704
+ simInt simRegisterCustomLuaFunction(const simChar* funcName,const simChar* callTips,const simInt* inputArgumentTypes,simVoid(*callBack)(struct SLuaCallBack* p));
705
+ simInt simRegisterCustomLuaVariable(const simChar* varName,const simChar* varValue);
706
+ simInt simRegisterContactCallback(simInt(*callBack)(simInt,simInt,simInt,simInt*,simFloat*));
707
+ simInt simRegisterJointCtrlCallback(simInt(*callBack)(simInt,simInt,simInt,const simInt*,const simFloat*,simFloat*));
708
+ simInt simGetMechanismHandle(const simChar* mechanismName);
709
+ simInt simHandleMechanism(simInt mechanismHandle);
710
+ simInt simHandleCustomizationScripts(simInt callType);
711
+ simInt simSetVisionSensorFilter(simInt visionSensorHandle,simInt filterIndex,simInt options,const simInt* pSizes,const simUChar* bytes,const simInt* ints,const simFloat* floats,const simUChar* custom);
712
+ simInt simGetVisionSensorFilter(simInt visionSensorHandle,simInt filterIndex,simInt* options,simInt* pSizes,simUChar** bytes,simInt** ints,simFloat** floats,simUChar** custom);
713
+ simChar* simGetScriptSimulationParameter(simInt scriptHandle,const simChar* parameterName,simInt* parameterLength);
714
+ simInt simSetScriptSimulationParameter(simInt scriptHandle,const simChar* parameterName,const simChar* parameterValue,simInt parameterLength);
715
+ simInt simSetJointForce(simInt objectHandle,simFloat forceOrTorque);
716
+ simInt simHandleMill(simInt millHandle,simFloat* removedSurfaceAndVolume);
717
+ simInt simResetMill(simInt millHandle);
718
+ simInt simResetMilling(simInt objectHandle);
719
+ simInt simApplyMilling(simInt objectHandle);
720
+ simBool _simGetParentFollowsDynamic(const simVoid* shape);
721
+ simInt simGetNameSuffix(const simChar* name);
722
+ simInt simSetNameSuffix(simInt nameSuffixNumber);
723
+ simInt simAddStatusbarMessage(const simChar* message);
724
+ simChar* simGetScriptRawBuffer(simInt scriptHandle,simInt bufferHandle);
725
+ simInt simSetScriptRawBuffer(simInt scriptHandle,const simChar* buffer,simInt bufferSize);
726
+ simInt simReleaseScriptRawBuffer(simInt scriptHandle,simInt bufferHandle);
727
+
728
+ """)
729
+
730
+ cwd = os.getcwd()
731
+ cffi_path = os.path.join(cwd, 'cffi_build')
732
+
733
+ ffibuilder.set_source(
734
+ "pyrep.backend._sim_cffi",
735
+ """
736
+ #include "sim.h" // the C header of the library
737
+ """,
738
+ libraries=['coppeliaSim'],
739
+ library_dirs=[os.environ['COPPELIASIM_ROOT']],
740
+ include_dirs=[cffi_path])
741
+
742
+ # For some reason, cffi makes it such that it looks for libv_rep.so.1
743
+ # rather than libv_rep.so. So we add a symlink.
744
+ path = os.path.join(os.environ['COPPELIASIM_ROOT'], 'libcoppeliaSim.so')
745
+ if not os.path.exists(path + '.1'):
746
+ print('creating symlink: %s -> %s' % (path + '.1', path))
747
+ os.symlink(path, path + '.1')
748
+
749
+ # Copy lua functions to the VREP_ROOT
750
+ print('copying lua file: %s -> %s' % ('pyrep/backend',
751
+ os.environ['COPPELIASIM_ROOT']))
752
+ lua_script_fname = 'simAddOnScript_PyRep.lua'
753
+ copyfile(os.path.join('pyrep/backend', lua_script_fname),
754
+ os.path.join(os.environ['COPPELIASIM_ROOT'], lua_script_fname))
755
+
756
+ if __name__ == "__main__":
757
+ ffibuilder.compile(verbose=True)
external/pyrep/cffi_build/sim.h ADDED
@@ -0,0 +1,712 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ // ==============
3
+ // simTypes.h
4
+ // ==============
5
+
6
+ // Various types used in the interface functions:
7
+ typedef unsigned char simBool;
8
+ typedef char simChar;
9
+ typedef int simInt;
10
+ typedef float simFloat;
11
+ typedef double simDouble;
12
+ typedef void simVoid;
13
+ typedef unsigned char simUChar;
14
+ typedef unsigned int simUInt;
15
+ typedef unsigned long long int simUInt64;
16
+
17
+ struct SScriptCallBack
18
+ {
19
+ simInt objectID;
20
+ simInt scriptID;
21
+ simInt stackID;
22
+ simChar waitUntilZero;
23
+ simChar* raiseErrorWithMessage;
24
+ };
25
+
26
+ struct SShapeVizInfo
27
+ {
28
+ simFloat* vertices;
29
+ simInt verticesSize;
30
+ simInt* indices;
31
+ simInt indicesSize;
32
+ simFloat shadingAngle;
33
+ simFloat* normals;
34
+ simFloat colors[9];
35
+ simChar* texture; /*rgba*/
36
+ simInt textureId;
37
+ simInt textureRes[2];
38
+ simFloat* textureCoords;
39
+ simInt textureApplyMode;
40
+ simInt textureOptions; /* not just textures options */
41
+ };
42
+
43
+ struct SLuaCallBack
44
+ {
45
+ simInt objectID;
46
+ simBool* inputBool;
47
+ simInt* inputInt;
48
+ simFloat* inputFloat;
49
+ simChar* inputChar;
50
+ simInt inputArgCount;
51
+ simInt* inputArgTypeAndSize;
52
+ simBool* outputBool;
53
+ simInt* outputInt;
54
+ simFloat* outputFloat;
55
+ simChar* outputChar;
56
+ simInt outputArgCount;
57
+ simInt* outputArgTypeAndSize;
58
+ simChar waitUntilZero;
59
+ simChar* inputCharBuff;
60
+ simChar* outputCharBuff;
61
+ simInt scriptID;
62
+ simDouble* inputDouble;
63
+ simDouble* outputDouble;
64
+ };
65
+
66
+ struct SSyncMsg
67
+ {
68
+ unsigned char msg;
69
+ void* data;
70
+ size_t dataSize;
71
+ };
72
+
73
+ struct SSyncRt
74
+ {
75
+ unsigned char objTypes[3];
76
+ int objHandles[3];
77
+ };
78
+
79
+ typedef int (*contactCallback)(int,int,int,int*,float*);
80
+ typedef int (*jointCtrlCallback)(int,int,int,const int*,const float*,float*);
81
+
82
+
83
+ // ==============
84
+ // sim.h
85
+ // ==============
86
+
87
+ simInt simRunSimulator(const simChar* applicationName,simInt options,simVoid(*initCallBack)(),simVoid(*loopCallBack)(),simVoid(*deinitCallBack)());
88
+ simInt simRunSimulatorEx(const simChar* applicationName,simInt options,simVoid(*initCallBack)(),simVoid(*loopCallBack)(),simVoid(*deinitCallBack)(),simInt stopDelay,const simChar* sceneOrModelToLoad);
89
+ simVoid* simGetMainWindow(simInt type);
90
+ simChar* simGetLastError();
91
+ simInt simSetBooleanParameter(simInt parameter,simBool boolState);
92
+ simInt simGetBooleanParameter(simInt parameter);
93
+ simInt simSetBoolParameter(simInt parameter,simBool boolState);
94
+ simInt simGetBoolParameter(simInt parameter);
95
+ simInt simSetIntegerParameter(simInt parameter,simInt intState);
96
+ simInt simGetIntegerParameter(simInt parameter,simInt* intState);
97
+ simInt simSetInt32Parameter(simInt parameter,simInt intState);
98
+ simInt simGetInt32Parameter(simInt parameter,simInt* intState);
99
+ simInt simGetUInt64Parameter(simInt parameter,simUInt64* intState);
100
+ simInt simSetFloatingParameter(simInt parameter,simFloat floatState);
101
+ simInt simGetFloatingParameter(simInt parameter,simFloat* floatState);
102
+ simInt simSetFloatParameter(simInt parameter,simFloat floatState);
103
+ simInt simGetFloatParameter(simInt parameter,simFloat* floatState);
104
+ simInt simSetStringParameter(simInt parameter,const simChar* str);
105
+ simChar* simGetStringParameter(simInt parameter);
106
+ simInt simGetObjectHandle(const simChar* objectName);
107
+ simInt simRemoveObject(simInt objectHandle);
108
+ simInt simRemoveModel(simInt objectHandle);
109
+ simChar* simGetObjectName(simInt objectHandle);
110
+ simInt simGetObjects(simInt index,simInt objectType);
111
+ simInt simSetObjectName(simInt objectHandle,const simChar* objectName);
112
+ simInt simGetCollectionHandle(const simChar* collectionName);
113
+ simInt simRemoveCollection(simInt collectionHandle);
114
+ simInt simEmptyCollection(simInt collectionHandle);
115
+ simChar* simGetCollectionName(simInt collectionHandle);
116
+ simInt simSetCollectionName(simInt collectionHandle,const simChar* collectionName);
117
+ simInt simGetObjectMatrix(simInt objectHandle,simInt relativeToObjectHandle,simFloat* matrix);
118
+ simInt simSetObjectMatrix(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* matrix);
119
+ simInt simGetObjectPosition(simInt objectHandle,simInt relativeToObjectHandle,simFloat* position);
120
+ simInt simSetObjectPosition(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* position);
121
+ simInt simGetObjectOrientation(simInt objectHandle,simInt relativeToObjectHandle,simFloat* eulerAngles);
122
+ simInt simGetObjectQuaternion(simInt objectHandle,simInt relativeToObjectHandle,simFloat* quaternion);
123
+ simInt simSetObjectQuaternion(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* quaternion);
124
+ simInt simSetObjectOrientation(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* eulerAngles);
125
+ simInt simGetJointPosition(simInt objectHandle,simFloat* position);
126
+ simInt simSetJointPosition(simInt objectHandle,simFloat position);
127
+ simInt simSetJointTargetPosition(simInt objectHandle,simFloat targetPosition);
128
+ simInt simGetJointTargetPosition(simInt objectHandle,simFloat* targetPosition);
129
+ simInt simSetJointMaxForce(simInt objectHandle,simFloat forceOrTorque);
130
+ simInt simGetPathPosition(simInt objectHandle,simFloat* position);
131
+ simInt simSetPathPosition(simInt objectHandle,simFloat position);
132
+ simInt simGetPathLength(simInt objectHandle,simFloat* length);
133
+ simInt simGetJointMatrix(simInt objectHandle,simFloat* matrix);
134
+ simInt simSetSphericalJointMatrix(simInt objectHandle,const simFloat* matrix);
135
+ simInt simGetJointInterval(simInt objectHandle,simBool* cyclic,simFloat* interval);
136
+ simInt simSetJointInterval(simInt objectHandle,simBool cyclic,const simFloat* interval);
137
+ simInt simGetObjectParent(simInt objectHandle);
138
+ simInt simGetObjectChild(simInt objectHandle,simInt index);
139
+ simInt simSetObjectParent(simInt objectHandle,simInt parentObjectHandle,simBool keepInPlace);
140
+ simInt simGetObjectType(simInt objectHandle);
141
+ simInt simGetJointType(simInt objectHandle);
142
+ simInt simBuildIdentityMatrix(simFloat* matrix);
143
+ simInt simCopyMatrix(const simFloat* matrixIn,simFloat* matrixOut);
144
+ simInt simBuildMatrix(const simFloat* position,const simFloat* eulerAngles,simFloat* matrix);
145
+ simInt simBuildMatrixQ(const simFloat* position,const simFloat* quaternion,simFloat* matrix);
146
+ simInt simGetEulerAnglesFromMatrix(const simFloat* matrix,simFloat* eulerAngles);
147
+ simInt simGetQuaternionFromMatrix(const simFloat* matrix,simFloat* quaternion);
148
+ simInt simInvertMatrix(simFloat* matrix);
149
+ simInt simMultiplyMatrices(const simFloat* matrixIn1,const simFloat* matrixIn2,simFloat* matrixOut);
150
+ simInt simInterpolateMatrices(const simFloat* matrixIn1,const simFloat* matrixIn2,simFloat interpolFactor,simFloat* matrixOut);
151
+ simInt simTransformVector(const simFloat* matrix,simFloat* vect);
152
+ simInt simReservedCommand(simInt v,simInt w);
153
+ simFloat simGetSimulationTime();
154
+ simInt simGetSimulationState();
155
+ simFloat simGetSystemTime();
156
+ simInt simGetSystemTimeInMilliseconds(); // deprecated
157
+ simUInt simGetSystemTimeInMs(simInt previousTime);
158
+ simInt simLoadScene(const simChar* filename);
159
+ simInt simCloseScene();
160
+ simInt simSaveScene(const simChar* filename);
161
+ simInt simLoadModel(const simChar* filename);
162
+ simInt simSaveModel(simInt baseOfModelHandle,const simChar* filename);
163
+ simChar* simGetSimulatorMessage(simInt* messageID,simInt* auxiliaryData,simInt* returnedDataSize);
164
+ simInt simAddModuleMenuEntry(const simChar* entryLabel,simInt itemCount,simInt* itemHandles);
165
+ simInt simSetModuleMenuItemState(simInt itemHandle,simInt state,const simChar* label);
166
+ simInt simDoesFileExist(const simChar* filename);
167
+ simInt simIsObjectInSelection(simInt objectHandle);
168
+ simInt simAddObjectToSelection(simInt what,simInt objectHandle);
169
+ simInt simRemoveObjectFromSelection(simInt what,simInt objectHandle);
170
+ simInt simGetObjectSelectionSize();
171
+ simInt simGetObjectLastSelection();
172
+ simInt simGetObjectSelection(simInt* objectHandles);
173
+ simInt simHandleCollision(simInt collisionObjectHandle);
174
+ simInt simReadCollision(simInt collisionObjectHandle);
175
+ simInt simHandleDistance(simInt distanceObjectHandle,simFloat* smallestDistance);
176
+ simInt simReadDistance(simInt distanceObjectHandle,simFloat* smallestDistance);
177
+ simInt simHandleProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);
178
+ simInt simReadProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);
179
+ simInt simHandleIkGroup(simInt ikGroupHandle);
180
+ simInt simCheckIkGroup(simInt ikGroupHandle,simInt jointCnt,const simInt* jointHandles,simFloat* jointValues,const simInt* jointOptions);
181
+ simInt simHandleDynamics(simFloat deltaTime);
182
+ simInt simGetScriptHandle(const simChar* scriptName);
183
+ simInt simSetScriptText(simInt scriptHandle,const simChar* scriptText);
184
+ const simChar* simGetScriptText(simInt scriptHandle);
185
+ simInt simGetScriptProperty(simInt scriptHandle,simInt* scriptProperty,simInt* associatedObjectHandle);
186
+ simInt simAssociateScriptWithObject(simInt scriptHandle,simInt associatedObjectHandle);
187
+ simInt simGetScript(simInt index);
188
+ simInt simGetScriptAssociatedWithObject(simInt objectHandle);
189
+ simInt simGetCustomizationScriptAssociatedWithObject(simInt objectHandle);
190
+ simInt simGetObjectAssociatedWithScript(simInt scriptHandle);
191
+ simChar* simGetScriptName(simInt scriptHandle);
192
+ simInt simHandleMainScript();
193
+ simInt simResetScript(simInt scriptHandle);
194
+ simInt simAddScript(simInt scriptProperty);
195
+ simInt simRemoveScript(simInt scriptHandle);
196
+ simInt simRefreshDialogs(simInt refreshDegree);
197
+ simInt simGetCollisionHandle(const simChar* collisionObjectName);
198
+ simInt simGetDistanceHandle(const simChar* distanceObjectName);
199
+ simInt simGetIkGroupHandle(const simChar* ikGroupName);
200
+ simInt simResetCollision(simInt collisionObjectHandle);
201
+ simInt simResetDistance(simInt distanceObjectHandle);
202
+ simInt simResetProximitySensor(simInt sensorHandle);
203
+ simInt simCheckProximitySensor(simInt sensorHandle,simInt entityHandle,simFloat* detectedPoint);
204
+ simInt simCheckProximitySensorEx(simInt sensorHandle,simInt entityHandle,simInt detectionMode,simFloat detectionThreshold,simFloat maxAngle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);
205
+ simInt simCheckProximitySensorEx2(simInt sensorHandle,simFloat* vertexPointer,simInt itemType,simInt itemCount,simInt detectionMode,simFloat detectionThreshold,simFloat maxAngle,simFloat* detectedPoint,simFloat* normalVector);
206
+ simChar* simCreateBuffer(simInt size);
207
+ simInt simReleaseBuffer(const simChar* buffer);
208
+ simInt simCheckCollision(simInt entity1Handle,simInt entity2Handle);
209
+ simInt simCheckCollisionEx(simInt entity1Handle,simInt entity2Handle,simFloat** intersectionSegments);
210
+ simInt simCheckDistance(simInt entity1Handle,simInt entity2Handle,simFloat threshold,simFloat* distanceData);
211
+ simChar* simGetObjectConfiguration(simInt objectHandle);
212
+ simInt simSetObjectConfiguration(const simChar* data);
213
+ simChar* simGetConfigurationTree(simInt objectHandle);
214
+ simInt simSetConfigurationTree(const simChar* data);
215
+ simInt simSetSimulationTimeStep(simFloat timeStep);
216
+ simFloat simGetSimulationTimeStep();
217
+ simInt simGetRealTimeSimulation();
218
+ simInt simIsRealTimeSimulationStepNeeded();
219
+ simInt simAdjustRealTimeTimer(simInt instanceIndex,simFloat deltaTime);
220
+ simInt simGetSimulationPassesPerRenderingPass();
221
+ simInt simAdvanceSimulationByOneStep();
222
+ simInt simStartSimulation();
223
+ simInt simStopSimulation();
224
+ simInt simPauseSimulation();
225
+ simInt simLoadModule(const simChar* filenameAndPath,const simChar* pluginName);
226
+ simInt simUnloadModule(simInt pluginhandle);
227
+ simVoid* simSendModuleMessage(simInt message,simInt* auxiliaryData,simVoid* customData,simInt* replyData);
228
+ simVoid* simBroadcastMessage(simInt* auxiliaryData,simVoid* customData,simInt* replyData);
229
+ simChar* simGetModuleName(simInt index,simUChar* moduleVersion);
230
+ simInt simFloatingViewAdd(simFloat posX,simFloat posY,simFloat sizeX,simFloat sizeY,simInt options);
231
+ simInt simFloatingViewRemove(simInt floatingViewHandle);
232
+ simInt simAdjustView(simInt viewHandleOrIndex,simInt associatedViewableObjectHandle,simInt options,const simChar* viewLabel);
233
+ simInt simSetLastError(const simChar* funcName,const simChar* errorMessage);
234
+ simInt simHandleGraph(simInt graphHandle,simFloat simulationTime);
235
+ simInt simResetGraph(simInt graphHandle);
236
+ simInt simSetNavigationMode(simInt navigationMode);
237
+ simInt simGetNavigationMode();
238
+ simInt simSetPage(simInt index);
239
+ simInt simGetPage();
240
+ simInt simDisplayDialog(const simChar* titleText,const simChar* mainText,simInt dialogType,const simChar* initialText,const simFloat* titleColors,const simFloat* dialogColors,simInt* elementHandle);
241
+ simInt simGetDialogResult(simInt genericDialogHandle);
242
+ simChar* simGetDialogInput(simInt genericDialogHandle);
243
+ simInt simEndDialog(simInt genericDialogHandle);
244
+ simInt simRegisterScriptCallbackFunction(const simChar* funcNameAtPluginName,const simChar* callTips,simVoid(*callBack)(struct SScriptCallBack* cb));
245
+ simInt simRegisterScriptVariable(const simChar* varNameAtPluginName,const simChar* varValue,simInt stackHandle);
246
+ simInt simSetJointTargetVelocity(simInt objectHandle,simFloat targetVelocity);
247
+ simInt simGetJointTargetVelocity(simInt objectHandle,simFloat* targetVelocity);
248
+ simInt simSetPathTargetNominalVelocity(simInt objectHandle,simFloat targetNominalVelocity);
249
+ simInt simCopyPasteObjects(simInt* objectHandles,simInt objectCount,simInt options);
250
+ simInt simScaleSelectedObjects(simFloat scalingFactor,simBool scalePositionsToo);
251
+ simInt simScaleObjects(const simInt* objectHandles,simInt objectCount,simFloat scalingFactor,simBool scalePositionsToo);
252
+ simInt simDeleteSelectedObjects();
253
+ simInt simGetObjectUniqueIdentifier(simInt objectHandle,simInt* uniqueIdentifier);
254
+ simInt simSendData(simInt targetID,simInt dataHeader,const simChar* dataName,const simChar* data,simInt dataLength,simInt antennaHandle,simFloat actionRadius,simFloat emissionAngle1,simFloat emissionAngle2,simFloat persistence);
255
+ simChar* simReceiveData(simInt dataHeader,const simChar* dataName,simInt antennaHandle,simInt index,simInt* dataLength,simInt* senderID,simInt* dataHeaderR,simChar** dataNameR);
256
+ simInt simSetGraphUserData(simInt graphHandle,const simChar* dataStreamName,simFloat data);
257
+ simInt simAddDrawingObject(simInt objectType,simFloat size,simFloat duplicateTolerance,simInt parentObjectHandle,simInt maxItemCount,const simFloat* ambient_diffuse,const simFloat* setToNULL,const simFloat* specular,const simFloat* emission);
258
+ simInt simRemoveDrawingObject(simInt objectHandle);
259
+ simInt simAddDrawingObjectItem(simInt objectHandle,const simFloat* itemData);
260
+ simInt simAddParticleObject(simInt objectType,simFloat size,simFloat density,const simVoid* params,simFloat lifeTime,simInt maxItemCount,const simFloat* ambient_diffuse,const simFloat* setToNULL,const simFloat* specular,const simFloat* emission);
261
+ simInt simRemoveParticleObject(simInt objectHandle);
262
+ simInt simAddParticleObjectItem(simInt objectHandle,const simFloat* itemData);
263
+ simFloat simGetObjectSizeFactor(simInt objectHandle);
264
+ simInt simAnnounceSceneContentChange();
265
+ simInt simSetIntegerSignal(const simChar* signalName,simInt signalValue);
266
+ simInt simGetIntegerSignal(const simChar* signalName,simInt* signalValue);
267
+ simInt simClearIntegerSignal(const simChar* signalName);
268
+ simInt simSetFloatSignal(const simChar* signalName,simFloat signalValue);
269
+ simInt simGetFloatSignal(const simChar* signalName,simFloat* signalValue);
270
+ simInt simClearFloatSignal(const simChar* signalName);
271
+ simInt simSetDoubleSignal(const simChar* signalName,simDouble signalValue);
272
+ simInt simGetDoubleSignal(const simChar* signalName,simDouble* signalValue);
273
+ simInt simClearDoubleSignal(const simChar* signalName);
274
+ simInt simSetStringSignal(const simChar* signalName,const simChar* signalValue,simInt stringLength);
275
+ simChar* simGetStringSignal(const simChar* signalName,simInt* stringLength);
276
+ simInt simClearStringSignal(const simChar* signalName);
277
+ simChar* simGetSignalName(simInt signalIndex,simInt signalType);
278
+ simInt simSetObjectProperty(simInt objectHandle,simInt prop);
279
+ simInt simGetObjectProperty(simInt objectHandle);
280
+ simInt simSetObjectSpecialProperty(simInt objectHandle,simInt prop);
281
+ simInt simGetObjectSpecialProperty(simInt objectHandle);
282
+ simInt simGetPositionOnPath(simInt pathHandle,simFloat relativeDistance,simFloat* position);
283
+ simInt simGetDataOnPath(simInt pathHandle,simFloat relativeDistance,simInt dataType,simInt* intData,simFloat* floatData);
284
+ simInt simGetOrientationOnPath(simInt pathHandle,simFloat relativeDistance,simFloat* eulerAngles);
285
+ simInt simGetClosestPositionOnPath(simInt pathHandle,simFloat* absolutePosition,simFloat* pathPosition);
286
+ simInt simReadForceSensor(simInt objectHandle,simFloat* forceVector,simFloat* torqueVector);
287
+ simInt simBreakForceSensor(simInt objectHandle);
288
+ simInt simGetShapeVertex(simInt shapeHandle,simInt groupElementIndex,simInt vertexIndex,simFloat* relativePosition);
289
+ simInt simGetShapeTriangle(simInt shapeHandle,simInt groupElementIndex,simInt triangleIndex,simInt* vertexIndices,simFloat* triangleNormals);
290
+ simInt simSetLightParameters(simInt objectHandle,simInt state,const simFloat* setToNULL,const simFloat* diffusePart,const simFloat* specularPart);
291
+ simInt simGetLightParameters(simInt objectHandle,simFloat* setToNULL,simFloat* diffusePart,simFloat* specularPart);
292
+ simInt simGetVelocity(simInt shapeHandle,simFloat* linearVelocity,simFloat* angularVelocity);
293
+ simInt simGetObjectVelocity(simInt objectHandle,simFloat* linearVelocity,simFloat* angularVelocity);
294
+ simInt simAddForceAndTorque(simInt shapeHandle,const simFloat* force,const simFloat* torque);
295
+ simInt simAddForce(simInt shapeHandle,const simFloat* position,const simFloat* force);
296
+ simInt simSetExplicitHandling(simInt generalObjectHandle,int explicitFlags);
297
+ simInt simGetExplicitHandling(simInt generalObjectHandle);
298
+ simInt simGetLinkDummy(simInt dummyHandle);
299
+ simInt simSetLinkDummy(simInt dummyHandle,simInt linkedDummyHandle);
300
+ simInt simSetModelProperty(simInt objectHandle,simInt modelProperty);
301
+ simInt simGetModelProperty(simInt objectHandle);
302
+ simInt simSetShapeColor(simInt shapeHandle,const simChar* colorName,simInt colorComponent,const simFloat* rgbData);
303
+ simInt simGetShapeColor(simInt shapeHandle,const simChar* colorName,simInt colorComponent,simFloat* rgbData);
304
+ simInt simResetDynamicObject(simInt objectHandle);
305
+ simInt simSetJointMode(simInt jointHandle,simInt jointMode,simInt options);
306
+ simInt simGetJointMode(simInt jointHandle,simInt* options);
307
+ simInt simSerialOpen(const simChar* portString,simInt baudRate,simVoid* reserved1,simVoid* reserved2);
308
+ simInt simSerialClose(simInt portHandle);
309
+ simInt simSerialSend(simInt portHandle,const simChar* data,simInt dataLength);
310
+ simInt simSerialRead(simInt portHandle,simChar* buffer,simInt dataLengthToRead);
311
+ simInt simSerialCheck(simInt portHandle);
312
+ simInt simGetContactInfo(simInt dynamicPass,simInt objectHandle,simInt index,simInt* objectHandles,simFloat* contactInfo);
313
+ simInt simSetThreadIsFree(simBool freeMode);
314
+ simInt simTubeOpen(simInt dataHeader,const simChar* dataName,simInt readBufferSize,simBool notUsedButKeepZero);
315
+ simInt simTubeClose(simInt tubeHandle);
316
+ simInt simTubeWrite(simInt tubeHandle,const simChar* data,simInt dataLength);
317
+ simChar* simTubeRead(simInt tubeHandle,simInt* dataLength);
318
+ simInt simTubeStatus(simInt tubeHandle,simInt* readPacketsCount,simInt* writePacketsCount);
319
+ simInt simAuxiliaryConsoleOpen(const simChar* title,simInt maxLines,simInt mode,const simInt* position,const simInt* size,const simFloat* textColor,const simFloat* backgroundColor);
320
+ simInt simAuxiliaryConsoleClose(simInt consoleHandle);
321
+ simInt simAuxiliaryConsoleShow(simInt consoleHandle,simBool showState);
322
+ simInt simAuxiliaryConsolePrint(simInt consoleHandle,const simChar* text);
323
+ simInt simImportShape(simInt fileformat,const simChar* pathAndFilename,simInt options,simFloat identicalVerticeTolerance,simFloat scalingFactor);
324
+ simInt simImportMesh(simInt fileformat,const simChar* pathAndFilename,simInt options,simFloat identicalVerticeTolerance,simFloat scalingFactor,simFloat*** vertices,simInt** verticesSizes,simInt*** indices,simInt** indicesSizes,simFloat*** reserved,simChar*** names);
325
+ simInt simExportMesh(simInt fileformat,const simChar* pathAndFilename,simInt options,simFloat scalingFactor,simInt elementCount,const simFloat** vertices,const simInt* verticesSizes,const simInt** indices,const simInt* indicesSizes,simFloat** reserved,const simChar** names);
326
+ simInt simCreateMeshShape(simInt options,simFloat shadingAngle,const simFloat* vertices,simInt verticesSize,const simInt* indices,simInt indicesSize,simFloat* reserved);
327
+ simInt simCreatePureShape(simInt primitiveType,simInt options,const simFloat* sizes,simFloat mass,const simInt* precision);
328
+ simInt simCreateHeightfieldShape(simInt options,simFloat shadingAngle,simInt xPointCount,simInt yPointCount,simFloat xSize,const simFloat* heights);
329
+ simInt simGetShapeMesh(simInt shapeHandle,simFloat** vertices,simInt* verticesSize,simInt** indices,simInt* indicesSize,simFloat** normals);
330
+ simInt simAddBanner(const simChar* label,simFloat size,simInt options,const simFloat* positionAndEulerAngles,simInt parentObjectHandle,const simFloat* labelColors,const simFloat* backgroundColors);
331
+ simInt simRemoveBanner(simInt bannerID);
332
+ simInt simCreateJoint(simInt jointType,simInt jointMode,simInt options,const simFloat* sizes,const simFloat* colorA,const simFloat* colorB);
333
+ simInt simGetObjectIntParameter(simInt objectHandle,simInt parameterID,simInt* parameter);
334
+ simInt simSetObjectIntParameter(simInt objectHandle,simInt parameterID,simInt parameter);
335
+ simInt simGetObjectInt32Parameter(simInt objectHandle,simInt parameterID,simInt* parameter);
336
+ simInt simSetObjectInt32Parameter(simInt objectHandle,simInt parameterID,simInt parameter);
337
+ simInt simGetObjectFloatParameter(simInt objectHandle,simInt parameterID,simFloat* parameter);
338
+ simInt simSetObjectFloatParameter(simInt objectHandle,simInt parameterID,simFloat parameter);
339
+ simChar* simGetObjectStringParameter(simInt objectHandle,simInt parameterID,simInt* parameterLength);
340
+ simInt simSetObjectStringParameter(simInt objectHandle,simInt parameterID,simChar* parameter,simInt parameterLength);
341
+ simInt simSetSimulationPassesPerRenderingPass(simInt p);
342
+ simInt simGetRotationAxis(const simFloat* matrixStart,const simFloat* matrixGoal,simFloat* axis,simFloat* angle);
343
+ simInt simRotateAroundAxis(const simFloat* matrixIn,const simFloat* axis,const simFloat* axisPos,simFloat angle,simFloat* matrixOut);
344
+ simInt simGetJointForce(simInt jointHandle,simFloat* forceOrTorque);
345
+ simInt simGetJointMaxForce(simInt jointHandle,simFloat* forceOrTorque);
346
+ simInt simSetArrayParameter(simInt parameter,const simVoid* arrayOfValues);
347
+ simInt simGetArrayParameter(simInt parameter,simVoid* arrayOfValues);
348
+ simInt simSetIkGroupProperties(simInt ikGroupHandle,simInt resolutionMethod,simInt maxIterations,simFloat damping,void* reserved);
349
+ simInt simSetIkElementProperties(simInt ikGroupHandle,simInt tipDummyHandle,simInt constraints,const simFloat* precision,const simFloat* weight,void* reserved);
350
+ simInt simCameraFitToView(simInt viewHandleOrIndex,simInt objectCount,const simInt* objectHandles,simInt options,simFloat scaling);
351
+ simInt simPersistentDataWrite(const simChar* dataName,const simChar* dataValue,simInt dataLength,simInt options);
352
+ simChar* simPersistentDataRead(const simChar* dataName,simInt* dataLength);
353
+ simInt simIsHandleValid(simInt generalObjectHandle,simInt generalObjectType);
354
+ simInt simHandleVisionSensor(simInt visionSensorHandle,simFloat** auxValues,simInt** auxValuesCount);
355
+ simInt simReadVisionSensor(simInt visionSensorHandle,simFloat** auxValues,simInt** auxValuesCount);
356
+ simInt simResetVisionSensor(simInt visionSensorHandle);
357
+ simInt simCheckVisionSensor(simInt visionSensorHandle,simInt entityHandle,simFloat** auxValues,simInt** auxValuesCount);
358
+ simFloat* simCheckVisionSensorEx(simInt visionSensorHandle,simInt entityHandle,simBool returnImage);
359
+ simInt simGetVisionSensorResolution(simInt visionSensorHandle,simInt* resolution);
360
+ simFloat* simGetVisionSensorImage(simInt visionSensorHandle);
361
+ simUChar* simGetVisionSensorCharImage(simInt visionSensorHandle,simInt* resolutionX,simInt* resolutionY);
362
+ simFloat* simGetVisionSensorDepthBuffer(simInt visionSensorHandle);
363
+ simInt simSetVisionSensorImage(simInt visionSensorHandle,const simFloat* image);
364
+ simInt simSetVisionSensorCharImage(simInt visionSensorHandle,const simUChar* image);
365
+ simInt simRMLPosition(simInt dofs,simDouble timeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxVelAccelJerk,const simBool* selection,const simDouble* targetPosVel,simDouble* newPosVelAccel,simVoid* auxData);
366
+ simInt simRMLVelocity(simInt dofs,simDouble timeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxAccelJerk,const simBool* selection,const simDouble* targetVel,simDouble* newPosVelAccel,simVoid* auxData);
367
+ simInt simRMLPos(simInt dofs,simDouble smallestTimeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxVelAccelJerk,const simBool* selection,const simDouble* targetPosVel,simVoid* auxData);
368
+ simInt simRMLVel(simInt dofs,simDouble smallestTimeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxAccelJerk,const simBool* selection,const simDouble* targetVel,simVoid* auxData);
369
+ simInt simRMLStep(simInt handle,simDouble timeStep,simDouble* newPosVelAccel,simVoid* auxData,simVoid* reserved);
370
+ simInt simRMLRemove(simInt handle);
371
+ simChar* simFileDialog(simInt mode,const simChar* title,const simChar* startPath,const simChar* initName,const simChar* extName,const simChar* ext);
372
+ simInt simMsgBox(simInt dlgType,simInt buttons,const simChar* title,const simChar* message);
373
+ simInt simCreateDummy(simFloat size,const simFloat* color);
374
+ simInt simSetShapeMassAndInertia(simInt shapeHandle,simFloat mass,const simFloat* inertiaMatrix,const simFloat* centerOfMass,const simFloat* transformation);
375
+ simInt simGetShapeMassAndInertia(simInt shapeHandle,simFloat* mass,simFloat* inertiaMatrix,simFloat* centerOfMass,const simFloat* transformation);
376
+ simInt simGroupShapes(const simInt* shapeHandles,simInt shapeCount);
377
+ simInt* simUngroupShape(simInt shapeHandle,simInt* shapeCount);
378
+ simInt simCreateProximitySensor(simInt sensorType,simInt subType,simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);
379
+ simInt simCreateForceSensor(simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);
380
+ simInt simCreateVisionSensor(simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);
381
+ simInt simConvexDecompose(simInt shapeHandle,simInt options,const simInt* intParams,const simFloat* floatParams);
382
+ simInt simCreatePath(simInt attributes,const simInt* intParams,const simFloat* floatParams,const simFloat* color);
383
+ simInt simInsertPathCtrlPoints(simInt pathHandle,simInt options,simInt startIndex,simInt ptCnt,const simVoid* ptData);
384
+ simInt simCutPathCtrlPoints(simInt pathHandle,simInt startIndex,simInt ptCnt);
385
+ simFloat* simGetIkGroupMatrix(simInt ikGroupHandle,simInt options,simInt* matrixSize);
386
+ simInt simAddGhost(simInt ghostGroup,simInt objectHandle,simInt options,simFloat startTime,simFloat endTime,const simFloat* color);
387
+ simInt simModifyGhost(simInt ghostGroup,simInt ghostId,simInt operation,simFloat floatValue,simInt options,simInt optionsMask,const simFloat* colorOrTransformation);
388
+ simVoid simQuitSimulator(simBool ignoredArgument);
389
+ simInt simGetThreadId();
390
+ simInt simLockResources(simInt lockType,simInt reserved);
391
+ simInt simUnlockResources(simInt lockHandle);
392
+ simInt simEnableEventCallback(simInt eventCallbackType,const simChar* plugin,simInt reserved);
393
+ simInt simSetShapeMaterial(simInt shapeHandle,simInt materialIdOrShapeHandle);
394
+ simInt simGetTextureId(const simChar* textureName,simInt* resolution);
395
+ simChar* simReadTexture(simInt textureId,simInt options,simInt posX,simInt posY,simInt sizeX,simInt sizeY);
396
+ simInt simWriteTexture(simInt textureId,simInt options,const simChar* data,simInt posX,simInt posY,simInt sizeX,simInt sizeY,simFloat interpol);
397
+ simInt simCreateTexture(const simChar* fileName,simInt options,const simFloat* planeSizes,const simFloat* scalingUV,const simFloat* xy_g,simInt fixedResolution,simInt* textureId,simInt* resolution,const simVoid* reserved);
398
+ simInt simWriteCustomDataBlock(simInt objectHandle,const simChar* tagName,const simChar* data,simInt dataSize);
399
+ simChar* simReadCustomDataBlock(simInt objectHandle,const simChar* tagName,simInt* dataSize);
400
+ simChar* simReadCustomDataBlockTags(simInt objectHandle,simInt* tagCount);
401
+ simInt simAddPointCloud(simInt pageMask,simInt layerMask,simInt objectHandle,simInt options,simFloat pointSize,simInt ptCnt,const simFloat* pointCoordinates,const simChar* defaultColors,const simChar* pointColors,const simFloat* pointNormals);
402
+ simInt simModifyPointCloud(simInt pointCloudHandle,simInt operation,const simInt* intParam,const simFloat* floatParam);
403
+ simInt simGetShapeGeomInfo(simInt shapeHandle,simInt* intData,simFloat* floatData,simVoid* reserved);
404
+ simInt* simGetObjectsInTree(simInt treeBaseHandle,simInt objectType,simInt options,simInt* objectCount);
405
+ simInt simSetObjectSizeValues(simInt objectHandle,const simFloat* sizeValues);
406
+ simInt simGetObjectSizeValues(simInt objectHandle,simFloat* sizeValues);
407
+ simInt simScaleObject(simInt objectHandle,simFloat xScale,simFloat yScale,simFloat zScale,simInt options);
408
+ simInt simSetShapeTexture(simInt shapeHandle,simInt textureId,simInt mappingMode,simInt options,const simFloat* uvScaling,const simFloat* position,const simFloat* orientation);
409
+ simInt simGetShapeTextureId(simInt shapeHandle);
410
+ simInt* simGetCollectionObjects(simInt collectionHandle,simInt* objectCount);
411
+ simInt simSetScriptAttribute(simInt scriptHandle,simInt attributeID,simFloat floatVal,simInt intOrBoolVal);
412
+ simInt simGetScriptAttribute(simInt scriptHandle,simInt attributeID,simFloat* floatVal,simInt* intOrBoolVal);
413
+ simInt simReorientShapeBoundingBox(simInt shapeHandle,simInt relativeToHandle,simInt reservedSetToZero);
414
+ simInt simSwitchThread();
415
+ simInt simCreateIkGroup(simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);
416
+ simInt simRemoveIkGroup(simInt ikGroupHandle);
417
+ simInt simCreateIkElement(simInt ikGroupHandle,simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);
418
+ simInt simCreateCollection(const simChar* collectionName,simInt options);
419
+ simInt simAddObjectToCollection(simInt collectionHandle,simInt objectHandle,simInt what,simInt options);
420
+ simInt simSaveImage(const simUChar* image,const simInt* resolution,simInt options,const simChar* filename,simInt quality,simVoid* reserved);
421
+ simUChar* simLoadImage(simInt* resolution,simInt options,const simChar* filename,simVoid* reserved);
422
+ simUChar* simGetScaledImage(const simUChar* imageIn,const simInt* resolutionIn,simInt* resolutionOut,simInt options,simVoid* reserved);
423
+ simInt simTransformImage(simUChar* image,const simInt* resolution,simInt options,const simFloat* floatParams,const simInt* intParams,simVoid* reserved);
424
+ simInt simGetQHull(const simFloat* inVertices,simInt inVerticesL,simFloat** verticesOut,simInt* verticesOutL,simInt** indicesOut,simInt* indicesOutL,simInt reserved1,const simFloat* reserved2);
425
+ simInt simGetDecimatedMesh(const simFloat* inVertices,simInt inVerticesL,const simInt* inIndices,simInt inIndicesL,simFloat** verticesOut,simInt* verticesOutL,simInt** indicesOut,simInt* indicesOutL,simFloat decimationPercent,simInt reserved1,const simFloat* reserved2);
426
+ simInt simExportIk(const simChar* pathAndFilename,simInt reserved1,simVoid* reserved2);
427
+ simInt simCallScriptFunctionEx(simInt scriptHandleOrType,const simChar* functionNameAtScriptName,simInt stackId);
428
+ simInt simComputeJacobian(simInt ikGroupHandle,simInt options,simVoid* reserved);
429
+ simInt simGetConfigForTipPose(simInt ikGroupHandle,simInt jointCnt,const simInt* jointHandles,simFloat thresholdDist,simInt maxTimeInMs,simFloat* retConfig,const simFloat* metric,simInt collisionPairCnt,const simInt* collisionPairs,const simInt* jointOptions,const simFloat* lowLimits,const simFloat* ranges,simVoid* reserved);
430
+ simFloat* simGenerateIkPath(simInt ikGroupHandle,simInt jointCnt,const simInt* jointHandles,simInt ptCnt,simInt collisionPairCnt,const simInt* collisionPairs,const simInt* jointOptions,simVoid* reserved);
431
+ simChar* simGetExtensionString(simInt objectHandle,simInt index,const char* key);
432
+ simInt simComputeMassAndInertia(simInt shapeHandle,simFloat density);
433
+ simInt simCreateStack();
434
+ simInt simReleaseStack(simInt stackHandle);
435
+ simInt simCopyStack(simInt stackHandle);
436
+ simInt simPushNullOntoStack(simInt stackHandle);
437
+ simInt simPushBoolOntoStack(simInt stackHandle,simBool value);
438
+ simInt simPushInt32OntoStack(simInt stackHandle,simInt value);
439
+ simInt simPushFloatOntoStack(simInt stackHandle,simFloat value);
440
+ simInt simPushDoubleOntoStack(simInt stackHandle,simDouble value);
441
+ simInt simPushStringOntoStack(simInt stackHandle,const simChar* value,simInt stringSize);
442
+ simInt simPushUInt8TableOntoStack(simInt stackHandle,const simUChar* values,simInt valueCnt);
443
+ simInt simPushInt32TableOntoStack(simInt stackHandle,const simInt* values,simInt valueCnt);
444
+ simInt simPushFloatTableOntoStack(simInt stackHandle,const simFloat* values,simInt valueCnt);
445
+ simInt simPushDoubleTableOntoStack(simInt stackHandle,const simDouble* values,simInt valueCnt);
446
+ simInt simPushTableOntoStack(simInt stackHandle);
447
+ simInt simInsertDataIntoStackTable(simInt stackHandle);
448
+ simInt simGetStackSize(simInt stackHandle);
449
+ simInt simPopStackItem(simInt stackHandle,simInt count);
450
+ simInt simMoveStackItemToTop(simInt stackHandle,simInt cIndex);
451
+ simInt simIsStackValueNull(simInt stackHandle);
452
+ simInt simGetStackBoolValue(simInt stackHandle,simBool* boolValue);
453
+ simInt simGetStackInt32Value(simInt stackHandle,simInt* numberValue);
454
+ simInt simGetStackFloatValue(simInt stackHandle,simFloat* numberValue);
455
+ simInt simGetStackDoubleValue(simInt stackHandle,simDouble* numberValue);
456
+ simChar* simGetStackStringValue(simInt stackHandle,simInt* stringSize);
457
+ simInt simGetStackTableInfo(simInt stackHandle,simInt infoType);
458
+ simInt simGetStackUInt8Table(simInt stackHandle,simUChar* array,simInt count);
459
+ simInt simGetStackInt32Table(simInt stackHandle,simInt* array,simInt count);
460
+ simInt simGetStackFloatTable(simInt stackHandle,simFloat* array,simInt count);
461
+ simInt simGetStackDoubleTable(simInt stackHandle,simDouble* array,simInt count);
462
+ simInt simUnfoldStackTable(simInt stackHandle);
463
+ simInt simDebugStack(simInt stackHandle,simInt cIndex);
464
+ simInt simSetScriptVariable(simInt scriptHandleOrType,const simChar* variableNameAtScriptName,simInt stackHandle);
465
+ simFloat simGetEngineFloatParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);
466
+ simInt simGetEngineInt32Parameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);
467
+ simBool simGetEngineBoolParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);
468
+ simInt simSetEngineFloatParameter(simInt paramId,simInt objectHandle,const simVoid* object,simFloat val);
469
+ simInt simSetEngineInt32Parameter(simInt paramId,simInt objectHandle,const simVoid* object,simInt val);
470
+ simInt simSetEngineBoolParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool val);
471
+ simInt simCreateOctree(simFloat voxelSize,simInt options,simFloat pointSize,simVoid* reserved);
472
+ simInt simCreatePointCloud(simFloat maxVoxelSize,simInt maxPtCntPerVoxel,simInt options,simFloat pointSize,simVoid* reserved);
473
+ simInt simSetPointCloudOptions(simInt pointCloudHandle,simFloat maxVoxelSize,simInt maxPtCntPerVoxel,simInt options,simFloat pointSize,simVoid* reserved);
474
+ simInt simGetPointCloudOptions(simInt pointCloudHandle,simFloat* maxVoxelSize,simInt* maxPtCntPerVoxel,simInt* options,simFloat* pointSize,simVoid* reserved);
475
+ simInt simInsertVoxelsIntoOctree(simInt octreeHandle,simInt options,const simFloat* pts,simInt ptCnt,const simUChar* color,const simUInt* tag,simVoid* reserved);
476
+ simInt simRemoveVoxelsFromOctree(simInt octreeHandle,simInt options,const simFloat* pts,simInt ptCnt,simVoid* reserved);
477
+ simInt simInsertPointsIntoPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,const simUChar* color,simVoid* optionalValues);
478
+ simInt simRemovePointsFromPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,simFloat tolerance,simVoid* reserved);
479
+ simInt simIntersectPointsWithPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,simFloat tolerance,simVoid* reserved);
480
+ const float* simGetOctreeVoxels(simInt octreeHandle,simInt* ptCnt,simVoid* reserved);
481
+ const float* simGetPointCloudPoints(simInt pointCloudHandle,simInt* ptCnt,simVoid* reserved);
482
+ simInt simInsertObjectIntoOctree(simInt octreeHandle,simInt objectHandle,simInt options,const simUChar* color,simUInt tag,simVoid* reserved);
483
+ simInt simSubtractObjectFromOctree(simInt octreeHandle,simInt objectHandle,simInt options,simVoid* reserved);
484
+ simInt simInsertObjectIntoPointCloud(simInt pointCloudHandle,simInt objectHandle,simInt options,simFloat gridSize,const simUChar* color,simVoid* optionalValues);
485
+ simInt simSubtractObjectFromPointCloud(simInt pointCloudHandle,simInt objectHandle,simInt options,simFloat tolerance,simVoid* reserved);
486
+ simInt simCheckOctreePointOccupancy(simInt octreeHandle,simInt options,const simFloat* points,simInt ptCnt,simUInt* tag,simUInt64* location,simVoid* reserved);
487
+ simChar* simOpenTextEditor(const simChar* initText,const simChar* xml,simInt* various);
488
+ simChar* simPackTable(simInt stackHandle,simInt* bufferSize);
489
+ simInt simUnpackTable(simInt stackHandle,const simChar* buffer,simInt bufferSize);
490
+ simInt simSetReferencedHandles(simInt objectHandle,simInt count,const simInt* referencedHandles,const simInt* reserved1,const simInt* reserved2);
491
+ simInt simGetReferencedHandles(simInt objectHandle,simInt** referencedHandles,simInt** reserved1,simInt** reserved2);
492
+ simInt simGetShapeViz(simInt shapeHandle,simInt index,struct SShapeVizInfo* info);
493
+ simInt simExecuteScriptString(simInt scriptHandleOrType,const simChar* stringAtScriptName,simInt stackHandle);
494
+ simChar* simGetApiFunc(simInt scriptHandleOrType,const simChar* apiWord);
495
+ simChar* simGetApiInfo(simInt scriptHandleOrType,const simChar* apiWord);
496
+ simInt simSetModuleInfo(const simChar* moduleName,simInt infoType,const simChar* stringInfo,simInt intInfo);
497
+ simInt simGetModuleInfo(const simChar* moduleName,simInt infoType,simChar** stringInfo,simInt* intInfo);
498
+ simInt simIsDeprecated(const simChar* funcOrConst);
499
+ simChar* simGetPersistentDataTags(simInt* tagCount);
500
+ simInt simEventNotification(const simChar* event);
501
+ simInt simApplyTexture(simInt shapeHandle,const simFloat* textureCoordinates,simInt textCoordSize,const simUChar* texture,const simInt* textureResolution,simInt options);
502
+ simInt simSetJointDependency(simInt jointHandle,simInt masterJointHandle,simFloat offset,simFloat coeff);
503
+ simInt simSetStringNamedParam(const simChar* paramName,const simChar* stringParam,simInt paramLength);
504
+ simChar* simGetStringNamedParam(const simChar* paramName,simInt* paramLength);
505
+ simChar* simGetUserParameter(simInt objectHandle,const simChar* parameterName,simInt* parameterLength);
506
+ simInt simSetUserParameter(simInt objectHandle,const simChar* parameterName,const simChar* parameterValue,simInt parameterLength);
507
+ simInt simAddLog(const simChar* pluginName,simInt verbosityLevel,const simChar* logMsg);
508
+
509
+
510
+
511
+ simInt _simGetContactCallbackCount();
512
+ const void* _simGetContactCallback(simInt index);
513
+ simVoid _simSetDynamicSimulationIconCode(simVoid* object,simInt code);
514
+ simVoid _simSetDynamicObjectFlagForVisualization(simVoid* object,simInt flag);
515
+ simInt _simGetObjectListSize(simInt objType);
516
+ const simVoid* _simGetObjectFromIndex(simInt objType,simInt index);
517
+ simInt _simGetObjectID(const simVoid* object);
518
+ simInt _simGetObjectType(const simVoid* object);
519
+ const simVoid** _simGetObjectChildren(const simVoid* object,simInt* count);
520
+ const simVoid* _simGetGeomProxyFromShape(const simVoid* shape);
521
+ const simVoid* _simGetParentObject(const simVoid* object);
522
+ const simVoid* _simGetObject(int objID);
523
+ simVoid _simGetObjectLocalTransformation(const simVoid* object,simFloat* pos,simFloat* quat,simBool excludeFirstJointTransformation);
524
+ simVoid _simSetObjectLocalTransformation(simVoid* object,const simFloat* pos,const simFloat* quat);
525
+ simVoid _simSetObjectCumulativeTransformation(simVoid* object,const simFloat* pos,const simFloat* quat,simBool keepChildrenInPlace);
526
+ simVoid _simGetObjectCumulativeTransformation(const simVoid* object,simFloat* pos,simFloat* quat,simBool excludeFirstJointTransformation);
527
+ simBool _simIsShapeDynamicallyStatic(const simVoid* shape);
528
+ simInt _simGetTreeDynamicProperty(const simVoid* object);
529
+ simInt _simGetDummyLinkType(const simVoid* dummy,simInt* linkedDummyID);
530
+ simInt _simGetJointMode(const simVoid* joint);
531
+ simBool _simIsJointInHybridOperation(const simVoid* joint);
532
+ simVoid _simDisableDynamicTreeForManipulation(const simVoid* object,simBool disableFlag);
533
+ simBool _simIsShapeDynamicallyRespondable(const simVoid* shape);
534
+ simInt _simGetDynamicCollisionMask(const simVoid* shape);
535
+ const simVoid* _simGetLastParentForLocalGlobalCollidable(const simVoid* shape);
536
+ simVoid _simSetShapeIsStaticAndNotRespondableButDynamicTag(const simVoid* shape,simBool tag);
537
+ simBool _simGetShapeIsStaticAndNotRespondableButDynamicTag(const simVoid* shape);
538
+ simVoid _simSetJointPosition(const simVoid* joint,simFloat pos);
539
+ simFloat _simGetJointPosition(const simVoid* joint);
540
+ simVoid _simSetDynamicMotorPositionControlTargetPosition(const simVoid* joint,simFloat pos);
541
+ simVoid _simGetInitialDynamicVelocity(const simVoid* shape,simFloat* vel);
542
+ simVoid _simSetInitialDynamicVelocity(simVoid* shape,const simFloat* vel);
543
+ simVoid _simGetInitialDynamicAngVelocity(const simVoid* shape,simFloat* angularVel);
544
+ simVoid _simSetInitialDynamicAngVelocity(simVoid* shape,const simFloat* angularVel);
545
+ simBool _simGetStartSleeping(const simVoid* shape);
546
+ simBool _simGetWasPutToSleepOnce(const simVoid* shape);
547
+ simBool _simGetDynamicsFullRefreshFlag(const simVoid* object);
548
+ simVoid _simSetDynamicsFullRefreshFlag(const simVoid* object,simBool flag);
549
+ simVoid _simSetGeomProxyDynamicsFullRefreshFlag(simVoid* geomData,simBool flag);
550
+ simBool _simGetGeomProxyDynamicsFullRefreshFlag(const simVoid* geomData);
551
+ simVoid _simSetShapeDynamicVelocity(simVoid* shape,const simFloat* linear,const simFloat* angular);
552
+ simVoid _simGetAdditionalForceAndTorque(const simVoid* shape,simFloat* force,simFloat* torque);
553
+ simVoid _simClearAdditionalForceAndTorque(const simVoid* shape);
554
+ simBool _simGetJointPositionInterval(const simVoid* joint,simFloat* minValue,simFloat* rangeValue);
555
+ simInt _simGetJointType(const simVoid* joint);
556
+ simBool _simIsForceSensorBroken(const simVoid* forceSensor);
557
+ simVoid _simGetDynamicForceSensorLocalTransformationPart2(const simVoid* forceSensor,simFloat* pos,simFloat* quat);
558
+ simBool _simIsDynamicMotorEnabled(const simVoid* joint);
559
+ simBool _simIsDynamicMotorPositionCtrlEnabled(const simVoid* joint);
560
+ simBool _simIsDynamicMotorTorqueModulationEnabled(const simVoid* joint);
561
+ simVoid _simGetMotorPid(const simVoid* joint,simFloat* pParam,simFloat* iParam,simFloat* dParam);
562
+ simFloat _simGetDynamicMotorTargetPosition(const simVoid* joint);
563
+ simFloat _simGetDynamicMotorTargetVelocity(const simVoid* joint);
564
+ simFloat _simGetDynamicMotorMaxForce(const simVoid* joint);
565
+ simFloat _simGetDynamicMotorUpperLimitVelocity(const simVoid* joint);
566
+ simVoid _simSetDynamicMotorReflectedPositionFromDynamicEngine(simVoid* joint,simFloat pos);
567
+ simVoid _simSetJointSphericalTransformation(simVoid* joint,const simFloat* quat);
568
+ simVoid _simAddForceSensorCumulativeForcesAndTorques(simVoid* forceSensor,const simFloat* force,const simFloat* torque,int totalPassesCount);
569
+ simVoid _simAddJointCumulativeForcesOrTorques(simVoid* joint,simFloat forceOrTorque,int totalPassesCount);
570
+ simVoid _simSetDynamicJointLocalTransformationPart2(simVoid* joint,const simFloat* pos,const simFloat* quat);
571
+ simVoid _simSetDynamicForceSensorLocalTransformationPart2(simVoid* forceSensor,const simFloat* pos,const simFloat* quat);
572
+ simVoid _simSetDynamicJointLocalTransformationPart2IsValid(simVoid* joint,simBool valid);
573
+ simVoid _simSetDynamicForceSensorLocalTransformationPart2IsValid(simVoid* forceSensor,simBool valid);
574
+ const simVoid* _simGetGeomWrapFromGeomProxy(const simVoid* geomData);
575
+ simVoid _simGetLocalInertiaFrame(const simVoid* geomInfo,simFloat* pos,simFloat* quat);
576
+ simInt _simGetPurePrimitiveType(const simVoid* geomInfo);
577
+ simBool _simIsGeomWrapGeometric(const simVoid* geomInfo);
578
+ simBool _simIsGeomWrapConvex(const simVoid* geomInfo);
579
+ simInt _simGetGeometricCount(const simVoid* geomInfo);
580
+ simVoid _simGetAllGeometrics(const simVoid* geomInfo,simVoid** allGeometrics);
581
+ simVoid _simGetPurePrimitiveSizes(const simVoid* geometric,simFloat* sizes);
582
+ simVoid _simMakeDynamicAnnouncement(int announceType);
583
+ simVoid _simGetVerticesLocalFrame(const simVoid* geometric,simFloat* pos,simFloat* quat);
584
+ const simFloat* _simGetHeightfieldData(const simVoid* geometric,simInt* xCount,simInt* yCount,simFloat* minHeight,simFloat* maxHeight);
585
+ simVoid _simGetCumulativeMeshes(const simVoid* geomInfo,simFloat** vertices,simInt* verticesSize,simInt** indices,simInt* indicesSize);
586
+ simFloat _simGetMass(const simVoid* geomInfo);
587
+ simVoid _simGetPrincipalMomentOfInertia(const simVoid* geomInfo,simFloat* inertia);
588
+ simVoid _simGetGravity(simFloat* gravity);
589
+ simInt _simGetTimeDiffInMs(simInt previousTime);
590
+ simBool _simDoEntitiesCollide(simInt entity1ID,simInt entity2ID,simInt* cacheBuffer,simBool overrideCollidableFlagIfShape1,simBool overrideCollidableFlagIfShape2,simBool pathOrMotionPlanningRoutineCalling);
591
+ simBool _simGetDistanceBetweenEntitiesIfSmaller(simInt entity1ID,simInt entity2ID,simFloat* distance,simFloat* ray,simInt* cacheBuffer,simBool overrideMeasurableFlagIfNonCollection1,simBool overrideMeasurableFlagIfNonCollection2,simBool pathPlanningRoutineCalling);
592
+ simInt _simHandleJointControl(const simVoid* joint,simInt auxV,const simInt* inputValuesInt,const simFloat* inputValuesFloat,simFloat* outputValues);
593
+ simInt _simHandleCustomContact(simInt objHandle1,simInt objHandle2,simInt engine,simInt* dataInt,simFloat* dataFloat);
594
+ const simVoid* _simGetIkGroupObject(int ikGroupID);
595
+ simInt _simMpHandleIkGroupObject(const simVoid* ikGroup);
596
+ simFloat _simGetPureHollowScaling(const simVoid* geometric);
597
+ simInt _simGetJointCallbackCallOrder(const simVoid* joint);
598
+ simVoid _simDynCallback(const simInt* intData,const simFloat* floatData);
599
+
600
+
601
+ // Following courtesy of Stephen James:
602
+ simInt simExtLaunchUIThread(const simChar* applicationName,simInt options,const simChar* sceneOrModelOrUiToLoad,const simChar* applicationDir_);
603
+ simInt simExtCanInitSimThread();
604
+ simInt simExtSimThreadInit();
605
+ simInt simExtSimThreadDestroy();
606
+ simInt simExtPostExitRequest();
607
+ simInt simExtGetExitRequest();
608
+ simInt simExtStep(simBool stepIfRunning);
609
+ simInt simExtCallScriptFunction(simInt scriptHandleOrType, const simChar* functionNameAtScriptName,
610
+ const simInt* inIntData, simInt inIntCnt,
611
+ const simFloat* inFloatData, simInt inFloatCnt,
612
+ const simChar** inStringData, simInt inStringCnt,
613
+ const simChar* inBufferData, simInt inBufferCnt,
614
+ simInt** outIntData, simInt* outIntCnt,
615
+ simFloat** outFloatData, simInt* outFloatCnt,
616
+ simChar*** outStringData, simInt* outStringCnt,
617
+ simChar** outBufferData, simInt* outBufferSize);
618
+
619
+
620
+ // Deprecated begin
621
+ simInt simGetMaterialId(const simChar* materialName);
622
+ simInt simGetShapeMaterial(simInt shapeHandle);
623
+ simInt simHandleVarious();
624
+ simInt simSerialPortOpen(simInt portNumber,simInt baudRate,simVoid* reserved1,simVoid* reserved2);
625
+ simInt simSerialPortClose(simInt portNumber);
626
+ simInt simSerialPortSend(simInt portNumber,const simChar* data,simInt dataLength);
627
+ simInt simSerialPortRead(simInt portNumber,simChar* buffer,simInt dataLengthToRead);
628
+ simInt simJointGetForce(simInt jointHandle,simFloat* forceOrTorque);
629
+ simInt simGetPathPlanningHandle(const simChar* pathPlanningObjectName);
630
+ simInt simGetMotionPlanningHandle(const simChar* motionPlanningObjectName);
631
+ simInt simGetMpConfigForTipPose(simInt motionPlanningObjectHandle,simInt options,simFloat closeNodesDistance,simInt trialCount,const simFloat* tipPose,simInt maxTimeInMs,simFloat* outputJointPositions,const simFloat* referenceConfigs,simInt referenceConfigCount,const simFloat* jointWeights,const simInt* jointBehaviour,simInt correctionPasses);
632
+ simFloat* simFindMpPath(simInt motionPlanningObjectHandle,const simFloat* startConfig,const simFloat* goalConfig,simInt options,simFloat stepSize,simInt* outputConfigsCnt,simInt maxTimeInMs,simFloat* reserved,const simInt* auxIntParams,const simFloat* auxFloatParams);
633
+ simFloat* simSimplifyMpPath(simInt motionPlanningObjectHandle,const simFloat* pathBuffer,simInt configCnt,simInt options,simFloat stepSize,simInt increment,simInt* outputConfigsCnt,simInt maxTimeInMs,simFloat* reserved,const simInt* auxIntParams,const simFloat* auxFloatParams);
634
+ simFloat* simFindIkPath(simInt motionPlanningObjectHandle,const simFloat* startConfig,const simFloat* goalPose,simInt options,simFloat stepSize,simInt* outputConfigsCnt,simFloat* reserved,const simInt* auxIntParams,const simFloat* auxFloatParams);
635
+ simFloat* simGetMpConfigTransition(simInt motionPlanningObjectHandle,const simFloat* startConfig,const simFloat* goalConfig,simInt options,const simInt* select,simFloat calcStepSize,simFloat maxOutStepSize,simInt wayPointCnt,const simFloat* wayPoints,simInt* outputConfigsCnt,const simInt* auxIntParams,const simFloat* auxFloatParams);
636
+ simInt simCreateMotionPlanning(simInt jointCnt,const simInt* jointHandles,const simInt* jointRangeSubdivisions,const simFloat* jointMetricWeights,simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);
637
+ simInt simRemoveMotionPlanning(simInt motionPlanningHandle);
638
+ simInt simSearchPath(simInt pathPlanningObjectHandle,simFloat maximumSearchTime);
639
+ simInt simInitializePathSearch(simInt pathPlanningObjectHandle,simFloat maximumSearchTime,simFloat searchTimeStep);
640
+ simInt simPerformPathSearchStep(simInt temporaryPathSearchObject,simBool abortSearch);
641
+ simInt simLockInterface(simBool locked);
642
+ simInt simCopyPasteSelectedObjects();
643
+ simInt simResetPath(simInt pathHandle);
644
+ simInt simHandlePath(simInt pathHandle,simFloat deltaTime);
645
+ simInt simResetJoint(simInt jointHandle);
646
+ simInt simHandleJoint(simInt jointHandle,simFloat deltaTime);
647
+ simInt simAppendScriptArrayEntry(const simChar* reservedSetToNull,simInt scriptHandleOrType,const simChar* arrayNameAtScriptName,const simChar* keyName,const simChar* data,const simInt* what);
648
+ simInt simClearScriptVariable(const simChar* reservedSetToNull,simInt scriptHandleOrType,const simChar* variableNameAtScriptName);
649
+ simVoid _simGetJointOdeParameters(const simVoid* joint,simFloat* stopERP,simFloat* stopCFM,simFloat* bounce,simFloat* fudge,simFloat* normalCFM);
650
+ simVoid _simGetJointBulletParameters(const simVoid* joint,simFloat* stopERP,simFloat* stopCFM,simFloat* normalCFM);
651
+ simVoid _simGetOdeMaxContactFrictionCFMandERP(const simVoid* geomInfo,simInt* maxContacts,simFloat* friction,simFloat* cfm,simFloat* erp);
652
+ simBool _simGetBulletCollisionMargin(const simVoid* geomInfo,simFloat* margin,simInt* otherProp);
653
+ simBool _simGetBulletStickyContact(const simVoid* geomInfo);
654
+ simFloat _simGetBulletRestitution(const simVoid* geomInfo);
655
+ simVoid _simGetVortexParameters(const simVoid* object,simInt version,simFloat* floatParams,simInt* intParams);
656
+ simVoid _simGetNewtonParameters(const simVoid* object,simInt* version,simFloat* floatParams,simInt* intParams);
657
+ simVoid _simGetDamping(const simVoid* geomInfo,simFloat* linDamping,simFloat* angDamping);
658
+ simFloat _simGetFriction(const simVoid* geomInfo);
659
+ simInt simAddSceneCustomData(simInt header,const simChar* data,simInt dataLength);
660
+ simInt simGetSceneCustomDataLength(simInt header);
661
+ simInt simGetSceneCustomData(simInt header,simChar* data);
662
+ simInt simAddObjectCustomData(simInt objectHandle,simInt header,const simChar* data,simInt dataLength);
663
+ simInt simGetObjectCustomDataLength(simInt objectHandle,simInt header);
664
+ simInt simGetObjectCustomData(simInt objectHandle,simInt header,simChar* data);
665
+ simInt simCreateUI(const simChar* uiName,simInt menuAttributes,const simInt* clientSize,const simInt* cellSize,simInt* buttonHandles);
666
+ simInt simCreateUIButton(simInt uiHandle,const simInt* position,const simInt* size,simInt buttonProperty);
667
+ simInt simGetUIHandle(const simChar* uiName);
668
+ simInt simGetUIProperty(simInt uiHandle);
669
+ simInt simGetUIEventButton(simInt uiHandle,simInt* auxiliaryValues);
670
+ simInt simSetUIProperty(simInt uiHandle,simInt elementProperty);
671
+ simInt simGetUIButtonProperty(simInt uiHandle,simInt buttonHandle);
672
+ simInt simSetUIButtonProperty(simInt uiHandle,simInt buttonHandle,simInt buttonProperty);
673
+ simInt simGetUIButtonSize(simInt uiHandle,simInt buttonHandle,simInt* size);
674
+ simInt simSetUIButtonLabel(simInt uiHandle,simInt buttonHandle,const simChar* upStateLabel,const simChar* downStateLabel);
675
+ simChar* simGetUIButtonLabel(simInt uiHandle,simInt buttonHandle);
676
+ simInt simSetUISlider(simInt uiHandle,simInt buttonHandle,simInt position);
677
+ simInt simGetUISlider(simInt uiHandle,simInt buttonHandle);
678
+ simInt simSetUIButtonColor(simInt uiHandle,simInt buttonHandle,const simFloat* upStateColor,const simFloat* downStateColor,const simFloat* labelColor);
679
+ simInt simSetUIButtonTexture(simInt uiHandle,simInt buttonHandle,const simInt* size,const simChar* textureData);
680
+ simInt simCreateUIButtonArray(simInt uiHandle,simInt buttonHandle);
681
+ simInt simSetUIButtonArrayColor(simInt uiHandle,simInt buttonHandle,const simInt* position,const simFloat* color);
682
+ simInt simDeleteUIButtonArray(simInt uiHandle,simInt buttonHandle);
683
+ simInt simRemoveUI(simInt uiHandle);
684
+ simInt simSetUIPosition(simInt uiHandle,const simInt* position);
685
+ simInt simGetUIPosition(simInt uiHandle,simInt* position);
686
+ simInt simLoadUI(const simChar* filename,simInt maxCount,simInt* uiHandles);
687
+ simInt simSaveUI(simInt count,const simInt* uiHandles,const simChar* filename);
688
+ simInt simHandleGeneralCallbackScript(simInt callbackId,simInt callbackTag,simVoid* additionalData);
689
+ simInt simRegisterCustomLuaFunction(const simChar* funcName,const simChar* callTips,const simInt* inputArgumentTypes,simVoid(*callBack)(struct SLuaCallBack* p));
690
+ simInt simRegisterCustomLuaVariable(const simChar* varName,const simChar* varValue);
691
+ simInt simRegisterContactCallback(simInt(*callBack)(simInt,simInt,simInt,simInt*,simFloat*));
692
+ simInt simRegisterJointCtrlCallback(simInt(*callBack)(simInt,simInt,simInt,const simInt*,const simFloat*,simFloat*));
693
+ simInt simGetMechanismHandle(const simChar* mechanismName);
694
+ simInt simHandleMechanism(simInt mechanismHandle);
695
+ simInt simHandleCustomizationScripts(simInt callType);
696
+ simInt simSetVisionSensorFilter(simInt visionSensorHandle,simInt filterIndex,simInt options,const simInt* pSizes,const simUChar* bytes,const simInt* ints,const simFloat* floats,const simUChar* custom);
697
+ simInt simGetVisionSensorFilter(simInt visionSensorHandle,simInt filterIndex,simInt* options,simInt* pSizes,simUChar** bytes,simInt** ints,simFloat** floats,simUChar** custom);
698
+ simChar* simGetScriptSimulationParameter(simInt scriptHandle,const simChar* parameterName,simInt* parameterLength);
699
+ simInt simSetScriptSimulationParameter(simInt scriptHandle,const simChar* parameterName,const simChar* parameterValue,simInt parameterLength);
700
+ simInt simSetJointForce(simInt objectHandle,simFloat forceOrTorque);
701
+ simInt simHandleMill(simInt millHandle,simFloat* removedSurfaceAndVolume);
702
+ simInt simResetMill(simInt millHandle);
703
+ simInt simResetMilling(simInt objectHandle);
704
+ simInt simApplyMilling(simInt objectHandle);
705
+ simBool _simGetParentFollowsDynamic(const simVoid* shape);
706
+ simInt simGetNameSuffix(const simChar* name);
707
+ simInt simSetNameSuffix(simInt nameSuffixNumber);
708
+ simInt simAddStatusbarMessage(const simChar* message);
709
+ simChar* simGetScriptRawBuffer(simInt scriptHandle,simInt bufferHandle);
710
+ simInt simSetScriptRawBuffer(simInt scriptHandle,const simChar* buffer,simInt bufferSize);
711
+ simInt simReleaseScriptRawBuffer(simInt scriptHandle,simInt bufferHandle);
712
+ // Deprecated end
external/pyrep/docs/Makefile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line.
5
+ SPHINXOPTS =
6
+ SPHINXBUILD = sphinx-build
7
+ SOURCEDIR = source
8
+ BUILDDIR = _build
9
+
10
+ # Put it first so that "make" without argument is like "make help".
11
+ help:
12
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13
+
14
+ .PHONY: help Makefile
15
+
16
+ # Catch-all target: route all unknown targets to Sphinx using the new
17
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18
+ %: Makefile
19
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
external/pyrep/docs/make.bat ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @ECHO OFF
2
+
3
+ pushd %~dp0
4
+
5
+ REM Command file for Sphinx documentation
6
+
7
+ if "%SPHINXBUILD%" == "" (
8
+ set SPHINXBUILD=sphinx-build
9
+ )
10
+ set SOURCEDIR=.
11
+ set BUILDDIR=_build
12
+
13
+ if "%1" == "" goto help
14
+
15
+ %SPHINXBUILD% >NUL 2>NUL
16
+ if errorlevel 9009 (
17
+ echo.
18
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19
+ echo.installed, then set the SPHINXBUILD environment variable to point
20
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
21
+ echo.may add the Sphinx directory to PATH.
22
+ echo.
23
+ echo.If you don't have Sphinx installed, grab it from
24
+ echo.http://sphinx-doc.org/
25
+ exit /b 1
26
+ )
27
+
28
+ %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
29
+ goto end
30
+
31
+ :help
32
+ %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
33
+
34
+ :end
35
+ popd
external/pyrep/docs/source/conf.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # This file only contains a selection of the most common options. For a full
4
+ # list see the documentation:
5
+ # http://www.sphinx-doc.org/en/master/config
6
+
7
+ # -- Path setup --------------------------------------------------------------
8
+
9
+ # If extensions (or modules to document with autodoc) are in another directory,
10
+ # add these directories to sys.path here. If the directory is relative to the
11
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
12
+ #
13
+ import os
14
+ import sys
15
+ sys.path.insert(0, os.path.abspath('../../'))
16
+
17
+
18
+ # -- Project information -----------------------------------------------------
19
+
20
+ project = 'PyRep'
21
+ copyright = '2019, Stephen James'
22
+ author = 'Stephen James'
23
+
24
+
25
+ # -- General configuration ---------------------------------------------------
26
+
27
+ # Add any Sphinx extension module names here, as strings. They can be
28
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
29
+ # ones.
30
+ extensions = [
31
+ 'sphinx.ext.autodoc',
32
+ 'sphinx.ext.coverage',
33
+ 'sphinx.ext.napoleon'
34
+ ]
35
+
36
+ autodoc_mock_imports = ["pyrep.backend._sim_cffi"]
37
+
38
+ # Add any paths that contain templates here, relative to this directory.
39
+ templates_path = ['_templates']
40
+
41
+ # List of patterns, relative to source directory, that match files and
42
+ # directories to ignore when looking for source files.
43
+ # This pattern also affects html_static_path and html_extra_path.
44
+ exclude_patterns = []
45
+
46
+
47
+ # -- Options for HTML output -------------------------------------------------
48
+
49
+ # The theme to use for HTML and HTML Help pages. See the documentation for
50
+ # a list of builtin themes.
51
+ #
52
+ html_theme = 'sphinx_rtd_theme'
53
+
54
+ # Add any paths that contain custom static files (such as style sheets) here,
55
+ # relative to this directory. They are copied after the builtin static files,
56
+ # so a file named "default.css" will overwrite the builtin "default.css".
57
+ html_static_path = ['_static']
58
+
59
+ master_doc = 'index'
60
+
61
+
62
+ # -- Extension configuration -------------------------------------------------
external/pyrep/docs/source/index.rst ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .. PyRep documentation master file, created by
2
+ sphinx-quickstart on Sun May 12 18:33:59 2019.
3
+ You can adapt this file completely to your liking, but it should at least
4
+ contain the root `toctree` directive.
5
+
6
+ Welcome to PyRep's documentation!
7
+ =================================
8
+
9
+ PyRep is a toolkit for robot learning research, built on top of the virtual robotics experimentation platform (V-REP).
10
+
11
+ See the `Github page <https://github.com/stepjam/PyRep/>`_ for install instructions and examples.
12
+
13
+ .. toctree::
14
+ :maxdepth: 4
15
+ :caption: Contents:
16
+
17
+ pyrep
18
+
19
+ Indices and tables
20
+ ==================
21
+
22
+ * :ref:`genindex`
23
+ * :ref:`modindex`
24
+ * :ref:`search`
external/pyrep/docs/source/modules.rst ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ pyrep
2
+ =====
3
+
4
+ .. toctree::
5
+ :maxdepth: 4
6
+
7
+ pyrep
external/pyrep/docs/source/pyrep.objects.rst ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pyrep.objects package
2
+ =====================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ pyrep.objects.cartesian\_path module
8
+ ------------------------------------
9
+
10
+ .. automodule:: pyrep.objects.cartesian_path
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ pyrep.objects.dummy module
16
+ --------------------------
17
+
18
+ .. automodule:: pyrep.objects.dummy
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ pyrep.objects.force\_sensor module
24
+ ----------------------------------
25
+
26
+ .. automodule:: pyrep.objects.force_sensor
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
30
+
31
+ pyrep.objects.joint module
32
+ --------------------------
33
+
34
+ .. automodule:: pyrep.objects.joint
35
+ :members:
36
+ :undoc-members:
37
+ :show-inheritance:
38
+
39
+ pyrep.objects.object module
40
+ ---------------------------
41
+
42
+ .. automodule:: pyrep.objects.object
43
+ :members:
44
+ :undoc-members:
45
+ :show-inheritance:
46
+
47
+ pyrep.objects.proximity\_sensor module
48
+ --------------------------------------
49
+
50
+ .. automodule:: pyrep.objects.proximity_sensor
51
+ :members:
52
+ :undoc-members:
53
+ :show-inheritance:
54
+
55
+ pyrep.objects.shape module
56
+ --------------------------
57
+
58
+ .. automodule:: pyrep.objects.shape
59
+ :members:
60
+ :undoc-members:
61
+ :show-inheritance:
62
+
63
+ pyrep.objects.vision\_sensor module
64
+ -----------------------------------
65
+
66
+ .. automodule:: pyrep.objects.vision_sensor
67
+ :members:
68
+ :undoc-members:
69
+ :show-inheritance:
70
+
71
+
72
+ Module contents
73
+ ---------------
74
+
75
+ .. automodule:: pyrep.objects
76
+ :members:
77
+ :undoc-members:
78
+ :show-inheritance:
external/pyrep/docs/source/pyrep.robots.arms.rst ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pyrep.robots.arms package
2
+ =========================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ pyrep.robots.arms.arm module
8
+ ----------------------------
9
+
10
+ .. automodule:: pyrep.robots.arms.arm
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ pyrep.robots.arms.configuration\_path module
16
+ --------------------------------------------
17
+
18
+ .. automodule:: pyrep.robots.arms.configuration_path
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ pyrep.robots.arms.mico module
24
+ -----------------------------
25
+
26
+ .. automodule:: pyrep.robots.arms.mico
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
30
+
31
+ pyrep.robots.arms.panda module
32
+ ------------------------------
33
+
34
+ .. automodule:: pyrep.robots.arms.panda
35
+ :members:
36
+ :undoc-members:
37
+ :show-inheritance:
38
+
39
+
40
+ Module contents
41
+ ---------------
42
+
43
+ .. automodule:: pyrep.robots.arms
44
+ :members:
45
+ :undoc-members:
46
+ :show-inheritance:
external/pyrep/docs/source/pyrep.robots.end_effectors.rst ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pyrep.robots.end\_effectors package
2
+ ===================================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ pyrep.robots.end\_effectors.gripper module
8
+ ------------------------------------------
9
+
10
+ .. automodule:: pyrep.robots.end_effectors.gripper
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ pyrep.robots.end\_effectors.mico\_gripper module
16
+ ------------------------------------------------
17
+
18
+ .. automodule:: pyrep.robots.end_effectors.mico_gripper
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ pyrep.robots.end\_effectors.panda\_gripper module
24
+ -------------------------------------------------
25
+
26
+ .. automodule:: pyrep.robots.end_effectors.panda_gripper
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
30
+
31
+
32
+ Module contents
33
+ ---------------
34
+
35
+ .. automodule:: pyrep.robots.end_effectors
36
+ :members:
37
+ :undoc-members:
38
+ :show-inheritance:
external/pyrep/docs/source/pyrep.robots.rst ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pyrep.robots package
2
+ ====================
3
+
4
+ Subpackages
5
+ -----------
6
+
7
+ .. toctree::
8
+
9
+ pyrep.robots.arms
10
+ pyrep.robots.end_effectors
11
+
12
+ Submodules
13
+ ----------
14
+
15
+ pyrep.robots.robot\_component module
16
+ ------------------------------------
17
+
18
+ .. automodule:: pyrep.robots.robot_component
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+
24
+ Module contents
25
+ ---------------
26
+
27
+ .. automodule:: pyrep.robots
28
+ :members:
29
+ :undoc-members:
30
+ :show-inheritance:
external/pyrep/docs/source/pyrep.rst ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pyrep package
2
+ =============
3
+
4
+ Subpackages
5
+ -----------
6
+
7
+ .. toctree::
8
+
9
+ pyrep.backend
10
+ pyrep.objects
11
+ pyrep.robots
12
+
13
+ Submodules
14
+ ----------
15
+
16
+ pyrep.const module
17
+ ------------------
18
+
19
+ .. automodule:: pyrep.const
20
+ :members:
21
+ :undoc-members:
22
+ :show-inheritance:
23
+
24
+ pyrep.errors module
25
+ -------------------
26
+
27
+ .. automodule:: pyrep.errors
28
+ :members:
29
+ :undoc-members:
30
+ :show-inheritance:
31
+
32
+ pyrep.pyrep module
33
+ ------------------
34
+
35
+ .. automodule:: pyrep.pyrep
36
+ :members:
37
+ :undoc-members:
38
+ :show-inheritance:
39
+
40
+
41
+ Module contents
42
+ ---------------
43
+
44
+ .. automodule:: pyrep
45
+ :members:
46
+ :undoc-members:
47
+ :show-inheritance:
external/pyrep/docs/source/pyrep.textures.rst ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pyrep.objects package
2
+ =====================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ pyrep.textures.texture module
8
+ ------------------------------------
9
+
10
+ .. automodule:: pyrep.textures.texture
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+
16
+ Module contents
17
+ ---------------
18
+
19
+ .. automodule:: pyrep.textures
20
+ :members:
21
+ :undoc-members:
22
+ :show-inheritance:
external/pyrep/examples/example_baxter_pick_and_pass.py ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ A baxter picks up a cup with its left arm and then passes it to its right arm.
3
+ This script contains examples of:
4
+ - Path planning (linear and non-linear).
5
+ - Using multiple arms.
6
+ - Using a gripper.
7
+ """
8
+ from os.path import dirname, join, abspath
9
+ from pyrep import PyRep
10
+ from pyrep.robots.arms.baxter import BaxterLeft, BaxterRight
11
+ from pyrep.robots.end_effectors.baxter_gripper import BaxterGripper
12
+ from pyrep.objects.dummy import Dummy
13
+ from pyrep.objects.shape import Shape
14
+
15
+ SCENE_FILE = join(dirname(abspath(__file__)), 'scene_baxter_pick_and_pass.ttt')
16
+ pr = PyRep()
17
+
18
+ pr.launch(SCENE_FILE, headless=False)
19
+ pr.start()
20
+
21
+ baxter_left = BaxterLeft()
22
+ baxter_right = BaxterRight()
23
+ baxter_gripper_left = BaxterGripper(0)
24
+ baxter_gripper_right = BaxterGripper(1)
25
+
26
+ cup = Shape('Cup')
27
+ waypoints = [Dummy('waypoint%d' % i) for i in range(7)]
28
+
29
+ print('Planning path for left arm to cup ...')
30
+ path = baxter_left.get_path(position=waypoints[0].get_position(),
31
+ quaternion=waypoints[0].get_quaternion())
32
+ path.visualize() # Let's see what the path looks like
33
+ print('Executing plan ...')
34
+ done = False
35
+ while not done:
36
+ done = path.step()
37
+ pr.step()
38
+ path.clear_visualization()
39
+
40
+ print('Planning path closer to cup ...')
41
+ path = baxter_left.get_path(position=waypoints[1].get_position(),
42
+ quaternion=waypoints[1].get_quaternion())
43
+ print('Executing plan ...')
44
+ done = False
45
+ while not done:
46
+ done = path.step()
47
+ pr.step()
48
+
49
+ print('Closing left gripper ...')
50
+ while not baxter_gripper_left.actuate(0.0, 0.4):
51
+ pr.step()
52
+ baxter_gripper_left.grasp(cup)
53
+
54
+ print('Planning path to lift cup ...')
55
+ path = baxter_left.get_path(position=waypoints[2].get_position(),
56
+ quaternion=waypoints[2].get_quaternion(),
57
+ ignore_collisions=True)
58
+ print('Executing plan ...')
59
+ done = False
60
+ while not done:
61
+ done = path.step()
62
+ pr.step()
63
+
64
+ print('Planning path for right arm to cup ...')
65
+ path = baxter_right.get_path(position=waypoints[3].get_position(),
66
+ quaternion=waypoints[3].get_quaternion())
67
+ print('Executing Plan ...')
68
+ done = False
69
+ while not done:
70
+ done = path.step()
71
+ pr.step()
72
+
73
+ print('Planning path closer to cup ...')
74
+ path = baxter_right.get_path(position=waypoints[4].get_position(),
75
+ quaternion=waypoints[4].get_quaternion())
76
+ print('Executing plan ...')
77
+ done = False
78
+ while not done:
79
+ done = path.step()
80
+ pr.step()
81
+
82
+ print('Closing right gripper ...')
83
+ while not baxter_gripper_right.actuate(0.0, 0.4):
84
+ pr.step()
85
+
86
+ print('Opening left gripper ...')
87
+ while not baxter_gripper_left.actuate(1.0, 0.4):
88
+ pr.step()
89
+
90
+ # Left gripper releases, right gripper grasps.
91
+ baxter_gripper_left.release()
92
+ baxter_gripper_right.grasp(cup)
93
+ pr.step()
94
+
95
+ print('Planning path for left arm to home position ...')
96
+ path_l = baxter_left.get_path(position=waypoints[5].get_position(),
97
+ quaternion=waypoints[5].get_quaternion())
98
+
99
+ print('Planning path for right arm to home position ...')
100
+ path_r = baxter_right.get_path(position=waypoints[6].get_position(),
101
+ quaternion=waypoints[6].get_quaternion())
102
+
103
+ print('Executing plan on both arms ...')
104
+ done_l = done_r = False
105
+ while not done_l or not done_r:
106
+ if not done_l:
107
+ done_l = path_l.step()
108
+ if not done_r:
109
+ done_r = path_r.step()
110
+ pr.step()
111
+
112
+ print('Done ...')
113
+ input('Press enter to finish ...')
114
+ pr.stop()
115
+ pr.shutdown()
external/pyrep/examples/example_locobot_stack_cube.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Facebook/CMU LoCoBot drives to a cube, picks it up, and takes it to a target.
3
+ This script contains examples of:
4
+ - Linear mobile paths on a non-holonomic platform
5
+ - How to use the combination of a mobile base, manipulator, and gripper.
6
+ """
7
+ from os.path import dirname, join, abspath
8
+ from pyrep import PyRep
9
+ from pyrep.robots.mobiles.locobot import LoCoBot
10
+ from pyrep.robots.arms.locobot_arm import LoCoBotArm
11
+ from pyrep.robots.end_effectors.locobot_gripper import LoCoBotGripper
12
+ from pyrep.objects.shape import Shape
13
+ from pyrep.objects.dummy import Dummy
14
+
15
+ SCENE_FILE = join(dirname(abspath(__file__)), 'scene_locobot_stack_cube.ttt')
16
+ pr = PyRep()
17
+ pr.launch(SCENE_FILE, headless=False)
18
+ pr.start()
19
+
20
+ base = LoCoBot()
21
+ arm = LoCoBotArm()
22
+ gripper = LoCoBotGripper()
23
+
24
+ base.set_motor_locked_at_zero_velocity(True)
25
+
26
+
27
+ def drive_to_position(position, orientation):
28
+ base_path = base.get_linear_path(position, orientation)
29
+ base_path.visualize()
30
+ done = False
31
+ while not done:
32
+ done = base_path.step()
33
+ pr.step()
34
+ pr.step()
35
+
36
+
37
+ def move_arm(position, quaternion, ignore_collisions=False):
38
+ arm_path = arm.get_path(position,
39
+ quaternion=quaternion,
40
+ ignore_collisions=ignore_collisions)
41
+ arm_path.visualize()
42
+ done = False
43
+ while not done:
44
+ done = arm_path.step()
45
+ pr.step()
46
+ arm_path.clear_visualization()
47
+
48
+
49
+ cuboid = Shape('cuboid')
50
+ goal = Shape('goal')
51
+ grasp_point = Dummy('grasp_point')
52
+
53
+ drive_pos = cuboid.get_position()
54
+ drive_pos[1] -= 0.3
55
+
56
+ print('Driving to cube ...')
57
+ drive_to_position(drive_pos, 0)
58
+
59
+ grasp_point_raised = grasp_point.get_position()
60
+ grasp_point_raised[2] += 0.075
61
+
62
+ print('Move arm above cube ...')
63
+ move_arm(grasp_point_raised, grasp_point.get_quaternion())
64
+
65
+ print('Arm approach cube ...')
66
+ move_arm(grasp_point.get_position(), grasp_point.get_quaternion(), True)
67
+
68
+ print('Closing gripper ...')
69
+ while not gripper.actuate(0.0, 0.4):
70
+ pr.step()
71
+ gripper.grasp(cuboid)
72
+
73
+ print('Lift cube ...')
74
+ move_arm(grasp_point_raised, grasp_point.get_quaternion(), True)
75
+
76
+ drive_pos = goal.get_position()
77
+ drive_pos[1] -= 0.35
78
+
79
+ print('Driving to goal ...')
80
+ drive_to_position(drive_pos, 0)
81
+
82
+ goal_point_raised = goal.get_position()
83
+ goal_point_raised[2] += 0.05
84
+
85
+ print('Move arm above goal ...')
86
+ move_arm(goal_point_raised, grasp_point.get_quaternion())
87
+
88
+ print('Drop cube ...')
89
+ gripper.release()
90
+ while not gripper.actuate(1.0, 0.4):
91
+ pr.step()
92
+
93
+ print('Done!')
94
+
95
+ pr.stop()
96
+ pr.shutdown()
external/pyrep/examples/example_panda_end_effector_control.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ A Franka Panda moves using delta end effector pose control.
3
+ This script contains examples of:
4
+ - IK calculations.
5
+ - Joint movement by setting joint target positions.
6
+ """
7
+ from os.path import dirname, join, abspath
8
+ from pyrep import PyRep
9
+ from pyrep.robots.arms.panda import Panda
10
+
11
+ SCENE_FILE = join(dirname(abspath(__file__)), 'scene_panda_reach_target.ttt')
12
+ DELTA = 0.01
13
+ pr = PyRep()
14
+ pr.launch(SCENE_FILE, headless=False)
15
+ pr.start()
16
+ agent = Panda()
17
+
18
+ starting_joint_positions = agent.get_joint_positions()
19
+ pos, quat = agent.get_tip().get_position(), agent.get_tip().get_quaternion()
20
+
21
+
22
+ def move(index, delta):
23
+ pos[index] += delta
24
+ new_joint_angles = agent.solve_ik_via_jacobian(pos, quaternion=quat)
25
+ agent.set_joint_target_positions(new_joint_angles)
26
+ pr.step()
27
+
28
+
29
+ [move(2, -DELTA) for _ in range(20)]
30
+ [move(1, -DELTA) for _ in range(20)]
31
+ [move(2, DELTA) for _ in range(10)]
32
+ [move(1, DELTA) for _ in range(20)]
33
+
34
+ pr.stop()
35
+ pr.shutdown()
external/pyrep/examples/example_panda_ik.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ A Franka Panda inverse kinematics example
3
+ This script contains examples of:
4
+ - IK calculations.
5
+ """
6
+ from os.path import dirname, join, abspath
7
+ from pyrep import PyRep
8
+ from pyrep.errors import IKError
9
+ from pyrep.robots.arms.panda import Panda
10
+
11
+ SCENE_FILE = join(dirname(abspath(__file__)), 'scene_panda_reach_target.ttt')
12
+ pr = PyRep()
13
+ pr.launch(SCENE_FILE, headless=False, responsive_ui=True)
14
+ pr.start()
15
+ agent = Panda()
16
+
17
+ starting_joint_positions = agent.get_joint_positions()
18
+ (x, y, z), q = agent.get_tip().get_position(), agent.get_tip().get_quaternion()
19
+
20
+ # Try solving via linearisation
21
+ new_joint_pos = agent.solve_ik_via_jacobian([x, y, z - 0.01], quaternion=q)
22
+ new_joint_pos = agent.solve_ik_via_jacobian([x, y, z - 0.05], quaternion=q)
23
+ new_joint_pos = agent.solve_ik_via_jacobian([x, y, z - 0.1], quaternion=q)
24
+ new_joint_pos = agent.solve_ik_via_jacobian([x, y, z - 0.2], quaternion=q)
25
+
26
+ # This will fail because the distance between start and goal is too far
27
+ try:
28
+ new_joint_pos = agent.solve_ik_via_jacobian([x, y, z - 0.4], quaternion=q)
29
+ except IKError:
30
+ # So let's swap to an alternative IK method...
31
+ # This returns 'max_configs' number of joint positions
32
+ input('Press key to run solve_ik_via_sampling...')
33
+ new_joint_pos = agent.solve_ik_via_sampling([x, y, z - 0.4], quaternion=q)[0]
34
+
35
+ # Because the arm is in Forxe/Torque mode, we need to temporarily disable
36
+ # dynamics in order to instantaneously move joints.
37
+ agent.set_joint_positions(new_joint_pos, disable_dynamics=True)
38
+ input('Press any key to finish...')
39
+
40
+ pr.stop()
41
+ pr.shutdown()
external/pyrep/examples/example_panda_reach_target.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ A Franka Panda reaches for 10 randomly places targets.
3
+ This script contains examples of:
4
+ - Linear (IK) paths.
5
+ - Scene manipulation (creating an object and moving it).
6
+ """
7
+ from os.path import dirname, join, abspath
8
+ from pyrep import PyRep
9
+ from pyrep.robots.arms.panda import Panda
10
+ from pyrep.objects.shape import Shape
11
+ from pyrep.const import PrimitiveShape
12
+ from pyrep.errors import ConfigurationPathError
13
+ import numpy as np
14
+ import math
15
+
16
+ LOOPS = 10
17
+ SCENE_FILE = join(dirname(abspath(__file__)), 'scene_panda_reach_target.ttt')
18
+ pr = PyRep()
19
+ pr.launch(SCENE_FILE, headless=False)
20
+ pr.start()
21
+ agent = Panda()
22
+
23
+ # We could have made this target in the scene, but lets create one dynamically
24
+ target = Shape.create(type=PrimitiveShape.SPHERE,
25
+ size=[0.05, 0.05, 0.05],
26
+ color=[1.0, 0.1, 0.1],
27
+ static=True, respondable=False)
28
+
29
+ position_min, position_max = [0.8, -0.2, 1.0], [1.0, 0.2, 1.4]
30
+
31
+ starting_joint_positions = agent.get_joint_positions()
32
+
33
+ for i in range(LOOPS):
34
+
35
+ # Reset the arm at the start of each 'episode'
36
+ agent.set_joint_positions(starting_joint_positions)
37
+
38
+ # Get a random position within a cuboid and set the target position
39
+ pos = list(np.random.uniform(position_min, position_max))
40
+ target.set_position(pos)
41
+
42
+ # Get a path to the target (rotate so z points down)
43
+ try:
44
+ path = agent.get_path(
45
+ position=pos, euler=[0, math.radians(180), 0])
46
+ except ConfigurationPathError as e:
47
+ print('Could not find path')
48
+ continue
49
+
50
+ # Step the simulation and advance the agent along the path
51
+ done = False
52
+ while not done:
53
+ done = path.step()
54
+ pr.step()
55
+
56
+ print('Reached target %d!' % i)
57
+
58
+ pr.stop()
59
+ pr.shutdown()
external/pyrep/examples/example_reinforcement_learning_env.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ An example of how one might use PyRep to create their RL environments.
3
+ In this case, the Franka Panda must reach a randomly placed target.
4
+ This script contains examples of:
5
+ - RL environment example.
6
+ - Scene manipulation.
7
+ - Environment resets.
8
+ - Setting joint properties (control loop disabled, motor locked at 0 vel)
9
+ """
10
+ from os.path import dirname, join, abspath
11
+ from pyrep import PyRep
12
+ from pyrep.robots.arms.panda import Panda
13
+ from pyrep.objects.shape import Shape
14
+ import numpy as np
15
+
16
+ SCENE_FILE = join(dirname(abspath(__file__)),
17
+ 'scene_reinforcement_learning_env.ttt')
18
+ POS_MIN, POS_MAX = [0.8, -0.2, 1.0], [1.0, 0.2, 1.4]
19
+ EPISODES = 5
20
+ EPISODE_LENGTH = 200
21
+
22
+
23
+ class ReacherEnv(object):
24
+
25
+ def __init__(self):
26
+ self.pr = PyRep()
27
+ self.pr.launch(SCENE_FILE, headless=False)
28
+ self.pr.start()
29
+ self.agent = Panda()
30
+ self.agent.set_control_loop_enabled(False)
31
+ self.agent.set_motor_locked_at_zero_velocity(True)
32
+ self.target = Shape('target')
33
+ self.agent_ee_tip = self.agent.get_tip()
34
+ self.initial_joint_positions = self.agent.get_joint_positions()
35
+
36
+ def _get_state(self):
37
+ # Return state containing arm joint angles/velocities & target position
38
+ return np.concatenate([self.agent.get_joint_positions(),
39
+ self.agent.get_joint_velocities(),
40
+ self.target.get_position()])
41
+
42
+ def reset(self):
43
+ # Get a random position within a cuboid and set the target position
44
+ pos = list(np.random.uniform(POS_MIN, POS_MAX))
45
+ self.target.set_position(pos)
46
+ self.agent.set_joint_positions(self.initial_joint_positions)
47
+ return self._get_state()
48
+
49
+ def step(self, action):
50
+ self.agent.set_joint_target_velocities(action) # Execute action on arm
51
+ self.pr.step() # Step the physics simulation
52
+ ax, ay, az = self.agent_ee_tip.get_position()
53
+ tx, ty, tz = self.target.get_position()
54
+ # Reward is negative distance to target
55
+ reward = -np.sqrt((ax - tx) ** 2 + (ay - ty) ** 2 + (az - tz) ** 2)
56
+ return reward, self._get_state()
57
+
58
+ def shutdown(self):
59
+ self.pr.stop()
60
+ self.pr.shutdown()
61
+
62
+
63
+ class Agent(object):
64
+
65
+ def act(self, state):
66
+ del state
67
+ return list(np.random.uniform(-1.0, 1.0, size=(7,)))
68
+
69
+ def learn(self, replay_buffer):
70
+ del replay_buffer
71
+ pass
72
+
73
+
74
+ env = ReacherEnv()
75
+ agent = Agent()
76
+ replay_buffer = []
77
+
78
+ for e in range(EPISODES):
79
+
80
+ print('Starting episode %d' % e)
81
+ state = env.reset()
82
+ for i in range(EPISODE_LENGTH):
83
+ action = agent.act(state)
84
+ reward, next_state = env.step(action)
85
+ replay_buffer.append((state, action, reward, next_state))
86
+ state = next_state
87
+ agent.learn(replay_buffer)
88
+
89
+ print('Done!')
90
+ env.shutdown()
external/pyrep/examples/example_turtlebot_navigation.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ A turtlebot reaches for 4 randomly places targets.
3
+ This script contains examples of:
4
+ - Non-linear mobile paths to reach a target with collision avoidance
5
+ """
6
+ from os.path import dirname, join, abspath
7
+ from pyrep import PyRep
8
+ from pyrep.robots.mobiles.turtlebot import TurtleBot
9
+ from pyrep.objects.shape import Shape
10
+ from pyrep.const import PrimitiveShape
11
+ import numpy as np
12
+
13
+ LOOPS = 4
14
+ SCENE_FILE = join(dirname(abspath(__file__)), 'scene_turtlebot_navigation.ttt')
15
+ pr = PyRep()
16
+ pr.launch(SCENE_FILE, headless=False)
17
+ pr.start()
18
+ agent = TurtleBot()
19
+
20
+ # We could have made this target in the scene, but lets create one dynamically
21
+ target = Shape.create(type=PrimitiveShape.SPHERE,
22
+ size=[0.05, 0.05, 0.05],
23
+ color=[1.0, 0.1, 0.1],
24
+ static=True, respondable=False)
25
+
26
+ position_min, position_max = [-0.5, 1, 0.1], [0.5, 1.5, 0.1]
27
+
28
+ starting_pose = agent.get_2d_pose()
29
+
30
+ agent.set_motor_locked_at_zero_velocity(True)
31
+
32
+ for i in range(LOOPS):
33
+ agent.set_2d_pose(starting_pose)
34
+
35
+ # Get a random position within a cuboid and set the target position
36
+ pos = list(np.random.uniform(position_min, position_max))
37
+ target.set_position(pos)
38
+
39
+ path = agent.get_nonlinear_path(position=pos, angle=0)
40
+
41
+ path.visualize()
42
+ done = False
43
+
44
+ while not done:
45
+ done = path.step()
46
+ pr.step()
47
+
48
+ path.clear_visualization()
49
+
50
+ print('Reached target %d!' % i)
51
+
52
+ pr.stop()
53
+ pr.shutdown()
external/pyrep/examples/example_youbot_navigation.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ A Kuka youBot reaches for 4 randomly places targets.
3
+ This script contains examples of:
4
+ - Linear mobile paths with an omnidirectional robot to reach a target.
5
+ """
6
+ from os.path import dirname, join, abspath
7
+ from pyrep import PyRep
8
+ from pyrep.robots.mobiles.youbot import YouBot
9
+ from pyrep.objects.shape import Shape
10
+ from pyrep.const import PrimitiveShape
11
+ import numpy as np
12
+
13
+ LOOPS = 4
14
+ SCENE_FILE = join(dirname(abspath(__file__)), 'scene_youbot_navigation.ttt')
15
+ pr = PyRep()
16
+ pr.launch(SCENE_FILE, headless=False)
17
+ pr.start()
18
+ agent = YouBot()
19
+
20
+ # We could have made this target in the scene, but lets create one dynamically
21
+ target = Shape.create(type=PrimitiveShape.SPHERE,
22
+ size=[0.05, 0.05, 0.05],
23
+ color=[1.0, 0.1, 0.1],
24
+ static=True, respondable=False)
25
+
26
+ position_min, position_max = [-0.5, 1.4, 0.1], [1.0, 0.5, 0.1]
27
+
28
+ starting_pose = agent.get_2d_pose()
29
+
30
+ for i in range(LOOPS):
31
+ agent.set_2d_pose(starting_pose)
32
+
33
+ # Get a random position within a cuboid and set the target position
34
+ pos = list(np.random.uniform(position_min, position_max))
35
+ target.set_position(pos)
36
+
37
+ path = agent.get_linear_path(position=pos, angle=0)
38
+
39
+ path.visualize()
40
+
41
+ done = False
42
+ while not done:
43
+ done = path.step()
44
+ pr.step()
45
+
46
+ path.clear_visualization()
47
+
48
+ print('Reached target %d!' % i)
49
+
50
+ pr.stop()
51
+ pr.shutdown()
external/pyrep/pyrep/backend/__init__.py ADDED
File without changes
external/pyrep/pyrep/backend/sim.py ADDED
@@ -0,0 +1,1500 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from .simConst import *
2
+ from ._sim_cffi import ffi, lib
3
+ import numpy as np
4
+ import collections
5
+
6
+
7
+ SShapeVizInfo = collections.namedtuple(
8
+ 'SShapeVizInfo',
9
+ [
10
+ 'vertices',
11
+ 'indices',
12
+ 'normals',
13
+ 'shadingAngle',
14
+ 'colors',
15
+ 'texture',
16
+ 'textureId',
17
+ 'textureRes',
18
+ 'textureCoords',
19
+ 'textureApplyMode',
20
+ 'textureOptions',
21
+ ],
22
+ )
23
+
24
+
25
+ def _check_return(ret):
26
+ if ret < 0:
27
+ raise RuntimeError(
28
+ 'The call failed on the V-REP side. Return value: %d' % ret)
29
+
30
+
31
+ def _check_null_return(val):
32
+ if val == ffi.NULL:
33
+ raise RuntimeError(
34
+ 'The call failed on the V-REP side by returning null.')
35
+
36
+
37
+ def _check_set_object_parameter(ret):
38
+ if ret == 0:
39
+ raise RuntimeError(
40
+ 'Parameter could not be set (e.g. because the parameterID doesn\'t '
41
+ 'exist, or because the specified object doesn\'t correspond to the '
42
+ 'correct type)')
43
+
44
+
45
+ def simExtLaunchUIThread(options, scene, pyrep_root):
46
+ lib.simExtLaunchUIThread(
47
+ 'PyRep'.encode('ascii'), options, scene.encode('ascii'),
48
+ pyrep_root.encode('ascii'))
49
+
50
+
51
+ def simExtSimThreadInit():
52
+ lib.simExtSimThreadInit()
53
+
54
+
55
+ def simExtCanInitSimThread():
56
+ return bool(lib.simExtCanInitSimThread())
57
+
58
+
59
+ def simExtSimThreadDestroy():
60
+ lib.simExtSimThreadDestroy()
61
+
62
+
63
+ def simExtPostExitRequest():
64
+ lib.simExtPostExitRequest()
65
+
66
+
67
+ def simExtGetExitRequest():
68
+ return bool(lib.simExtGetExitRequest())
69
+
70
+
71
+ def simExtStep(stepIfRunning=True):
72
+ lib.simExtStep(stepIfRunning)
73
+
74
+
75
+ def simStartSimulation():
76
+ lib.simStartSimulation()
77
+
78
+
79
+ def simStopSimulation():
80
+ lib.simStopSimulation()
81
+
82
+
83
+ def simPauseSimulation():
84
+ return lib.simPauseSimulation()
85
+
86
+
87
+ def simQuitSimulator(doNotDisplayMessages):
88
+ lib.simQuitSimulator(doNotDisplayMessages)
89
+
90
+
91
+ def hasObjectHandle(objectName):
92
+ handle = lib.simGetObjectHandle(objectName.encode('ascii'))
93
+ if handle:
94
+ return handle >= 0
95
+ return False
96
+
97
+ def simGetObjectHandle(objectName):
98
+ handle = lib.simGetObjectHandle(objectName.encode('ascii'))
99
+ if handle < 0:
100
+ raise RuntimeError('Handle %s does not exist.' % objectName)
101
+ return handle
102
+
103
+
104
+ def simGetIkGroupHandle(ikGroupName):
105
+ handle = lib.simGetIkGroupHandle(ikGroupName.encode('ascii'))
106
+ if handle <= 0:
107
+ raise RuntimeError('Ik group does not exist.')
108
+ return handle
109
+
110
+
111
+ def simSetIkElementProperties(ikGroupHandle, tipDummyHandle, constraints,
112
+ precision=None, weight=None):
113
+ if precision is None:
114
+ precision = ffi.NULL
115
+ if weight is None:
116
+ weight = ffi.NULL
117
+ reserved = ffi.NULL
118
+ ret = lib.simSetIkElementProperties(
119
+ ikGroupHandle, tipDummyHandle, constraints, precision, weight, reserved)
120
+ _check_return(ret)
121
+ return ret
122
+
123
+
124
+ def simSetIkGroupProperties(ikGroupHandle, resolutionMethod, maxIterations, damping):
125
+ reserved = ffi.NULL
126
+ ret = lib.simSetIkGroupProperties(
127
+ ikGroupHandle, resolutionMethod, maxIterations, damping, reserved)
128
+ _check_return(ret)
129
+ return ret
130
+
131
+
132
+ def simGetObjectPosition(objectHandle, relativeToObjectHandle):
133
+ position = ffi.new('float[3]')
134
+ lib.simGetObjectPosition(objectHandle, relativeToObjectHandle, position)
135
+ return list(position)
136
+
137
+
138
+ def simGetJointPosition(jointHandle):
139
+ position = ffi.new('float *')
140
+ lib.simGetJointPosition(jointHandle, position)
141
+ return position[0]
142
+
143
+
144
+ def simSetJointPosition(jointHandle, position):
145
+ lib.simSetJointPosition(jointHandle, position)
146
+
147
+
148
+ def simGetJointMatrix(jointHandle):
149
+ matrix = ffi.new('float[12]')
150
+ lib.simGetJointMatrix(jointHandle, matrix)
151
+ return list(matrix)
152
+
153
+
154
+ def simSetSphericalJointMatrix(jointHandle, matrix):
155
+ lib.simSetSphericalJointMatrix(jointHandle, matrix)
156
+
157
+
158
+ def simGetJointTargetVelocity(jointHandle):
159
+ vel = ffi.new('float *')
160
+ lib.simGetJointTargetVelocity(jointHandle, vel)
161
+ return vel[0]
162
+
163
+
164
+ def simSetJointTargetVelocity(jointHandle, targetVelocity):
165
+ lib.simSetJointTargetVelocity(jointHandle, targetVelocity)
166
+
167
+
168
+ def simGetJointTargetPosition(jointHandle):
169
+ position = ffi.new('float *')
170
+ lib.simGetJointTargetPosition(jointHandle, position)
171
+ return position[0]
172
+
173
+
174
+ def simSetJointTargetPosition(jointHandle, targetPosition):
175
+ lib.simSetJointTargetPosition(jointHandle, targetPosition)
176
+
177
+
178
+ def simGetJointForce(jointHandle):
179
+ force = ffi.new('float *')
180
+ ret = lib.simGetJointForce(jointHandle, force)
181
+ _check_return(ret)
182
+ if ret == 0:
183
+ raise RuntimeError('No value available yet.')
184
+ return force[0]
185
+
186
+
187
+ def simSetJointForce(jointHandle, force):
188
+ lib.simSetJointForce(jointHandle, force)
189
+
190
+
191
+ def simGetJointMaxForce(jointHandle):
192
+ force = ffi.new('float *')
193
+ ret = lib.simGetJointMaxForce(jointHandle, force)
194
+ _check_return(ret)
195
+ if ret == 0:
196
+ raise RuntimeError('No value available yet.')
197
+ return force[0]
198
+
199
+
200
+ def simSetJointMaxForce(jointHandle, force):
201
+ lib.simSetJointMaxForce(jointHandle, force)
202
+
203
+
204
+ def simGetJointInterval(jointHandle):
205
+ cyclic = ffi.new('char *')
206
+ interval = ffi.new('float [2]')
207
+ ret = lib.simGetJointInterval(jointHandle, cyclic, interval)
208
+ _check_return(ret)
209
+ return ffi.string(cyclic).decode('utf-8') != '', list(interval)
210
+
211
+
212
+ def simSetJointInterval(jointHandle, cyclic, interval):
213
+ ret = lib.simSetJointInterval(jointHandle, cyclic, interval)
214
+ _check_return(ret)
215
+
216
+
217
+ def simCreateForceSensor(options, intParams, floatParams, color):
218
+ if color is None:
219
+ color = ffi.NULL
220
+ handle = lib.simCreateForceSensor(options, intParams, floatParams, color)
221
+ _check_return(handle)
222
+ return handle
223
+
224
+
225
+ def simBreakForceSensor(forceSensorHandle):
226
+ lib.simBreakForceSensor(forceSensorHandle)
227
+
228
+
229
+ def simReadForceSensor(forceSensorHandle):
230
+ forceVector = ffi.new('float[3]')
231
+ torqueVector = ffi.new('float[3]')
232
+ state = lib.simReadForceSensor(forceSensorHandle, forceVector, torqueVector)
233
+ return state, list(forceVector), list(torqueVector)
234
+
235
+
236
+ def simReleaseBuffer(pointer):
237
+ lib.simReleaseBuffer(pointer)
238
+
239
+
240
+ def simCreateVisionSensor(options, intParams, floatParams, color):
241
+ if color is None:
242
+ color = ffi.NULL
243
+ ret = lib.simCreateVisionSensor(options, intParams, floatParams, color)
244
+ _check_return(ret)
245
+ return ret
246
+
247
+
248
+ def simHandleVisionSensor(sensorHandle):
249
+ auxValues = ffi.new('float **')
250
+ auxValuesCount = ffi.new('int **')
251
+ ret = lib.simHandleVisionSensor(
252
+ sensorHandle, auxValues, auxValuesCount)
253
+ _check_return(ret)
254
+
255
+ k1 = 0
256
+ outAuxValues = []
257
+ for i in range(auxValuesCount[0][0]):
258
+ k2 = k1 + auxValuesCount[0][i + 1]
259
+ outAuxValues.extend([x for x in auxValues[0][k1:k2]])
260
+
261
+ simReleaseBuffer(ffi.cast('char *', auxValues[0]))
262
+ simReleaseBuffer(ffi.cast('char *', auxValuesCount[0]))
263
+ return ret, outAuxValues
264
+
265
+
266
+ def simReadVisionSensor(sensorHandle):
267
+ auxValues = ffi.new('float **')
268
+ auxValuesCount = ffi.new('int **')
269
+ state = lib.simReadVisionSensor(sensorHandle, auxValues, auxValuesCount)
270
+ auxValues2 = []
271
+ if state == 0:
272
+ s = 0
273
+ for i in range(auxValuesCount[0]):
274
+ auxValues2.append(auxValues[s:s+auxValuesCount[i+1]])
275
+ s += auxValuesCount[i+1]
276
+ #free C buffers
277
+ simReleaseBuffer(auxValues)
278
+ simReleaseBuffer(auxValuesCount)
279
+ return state, auxValues2
280
+
281
+
282
+ def simGetVisionSensorImage(sensorHandle, resolution):
283
+ img_buffer = lib.simGetVisionSensorImage(sensorHandle)
284
+ T = ffi.getctype(ffi.typeof(img_buffer).item) # Buffer data type
285
+ s = ffi.sizeof(T) # datatype size
286
+ np_T = np.dtype('f{:d}'.format(s)) # Numpy equivalent, e.g. float is 'f4'
287
+ # Wrap the buffer with numpy.
288
+ img = np.frombuffer(ffi.buffer(img_buffer, resolution[0]*resolution[1]*3*s), np_T)
289
+ img = img.reshape(resolution[1], resolution[0], 3)
290
+ img = np.flip(img, 0).copy() # Image is upside-down
291
+ simReleaseBuffer(ffi.cast('char *', img_buffer))
292
+ return img
293
+
294
+
295
+ def simGetVisionSensorDepthBuffer(sensorHandle, resolution, in_meters):
296
+ if in_meters:
297
+ sensorHandle += sim_handleflag_depthbuffermeters
298
+ img_buffer = lib.simGetVisionSensorDepthBuffer(sensorHandle)
299
+ T = ffi.getctype(ffi.typeof(img_buffer).item) # Buffer data type
300
+ s = ffi.sizeof(T) # datatype size
301
+ np_T = np.dtype('f{:d}'.format(s)) # Numpy equivalent, e.g. float is 'f4'
302
+ # Wrap the buffer with numpy.
303
+ img = np.frombuffer(ffi.buffer(img_buffer, resolution[0]*resolution[1]*s), np_T)
304
+ img = img.reshape(resolution[1], resolution[0])
305
+ img = np.flip(img, 0).copy() # Image is upside-down
306
+ simReleaseBuffer(ffi.cast('char *', img_buffer))
307
+ return img
308
+
309
+
310
+ def simGetVisionSensorResolution(sensorHandle):
311
+ resolution = ffi.new('int[2]')
312
+ ret = lib.simGetVisionSensorResolution(sensorHandle, resolution)
313
+ _check_return(ret)
314
+ return list(resolution)
315
+
316
+
317
+ def simGetObjectChild(parentObjectHandle, childIndex):
318
+ val = lib.simGetObjectChild(parentObjectHandle, childIndex)
319
+ _check_return(val)
320
+ return val
321
+
322
+
323
+ def simGetObjectParent(childObjectHandle):
324
+ val = lib.simGetObjectParent(childObjectHandle)
325
+ _check_return(val)
326
+ return val
327
+
328
+
329
+ def simReadProximitySensor(sensorHandle):
330
+ detectedPoint = ffi.new('float[3]')
331
+ detectedObjectHandle = ffi.new('int *')
332
+ detectedSurfaceNormalVector = ffi.new('float[3]')
333
+ state = lib.simReadProximitySensor(
334
+ sensorHandle, detectedPoint, detectedObjectHandle,
335
+ detectedSurfaceNormalVector)
336
+ _check_return(state)
337
+ return (state, detectedObjectHandle, list(detectedPoint),
338
+ list(detectedSurfaceNormalVector))
339
+
340
+
341
+ def simCheckProximitySensor(sensorHandle, entityHandle):
342
+ detectedPoint = ffi.new('float[3]')
343
+ state = lib.simCheckProximitySensor(
344
+ sensorHandle, entityHandle, detectedPoint)
345
+ _check_return(state)
346
+ return state, list(detectedPoint)
347
+
348
+
349
+ def simLoadModel(modelPathAndName):
350
+ val = lib.simLoadModel(modelPathAndName.encode('ascii'))
351
+ _check_return(val)
352
+ return val
353
+
354
+
355
+ def simLoadScene(scenePathAndName):
356
+ val = lib.simLoadScene(scenePathAndName.encode('ascii'))
357
+ _check_return(val)
358
+ return val
359
+
360
+
361
+ def simSaveModel(modelHandle, modelPathAndName):
362
+ val = lib.simSaveModel(modelHandle, modelPathAndName.encode('ascii'))
363
+ _check_return(val)
364
+ return val
365
+
366
+
367
+ def simSaveScene(filename):
368
+ val = lib.simSaveScene(filename.encode('ascii'))
369
+ _check_return(val)
370
+ return val
371
+
372
+
373
+ def simGetObjectName(objectHandle):
374
+ name_raw = lib.simGetObjectName(objectHandle)
375
+ if name_raw == ffi.NULL:
376
+ return ''
377
+ name = ffi.string(name_raw).decode('utf-8')
378
+ simReleaseBuffer(name_raw)
379
+ return name
380
+
381
+
382
+ def simSetObjectName(objectHandle, name):
383
+ ret = lib.simSetObjectName(objectHandle, name.encode('ascii'))
384
+ _check_return(ret)
385
+
386
+
387
+ def simAddStatusbarMessage(message):
388
+ return lib.simAddStatusbarMessage(message.encode('ascii'))
389
+
390
+
391
+ def simGetObjectOrientation(objectHandle, relativeToObjectHandle):
392
+ eulerAngles = ffi.new('float[3]')
393
+ ret = lib.simGetObjectOrientation(
394
+ objectHandle, relativeToObjectHandle, eulerAngles)
395
+ _check_return(ret)
396
+ return list(eulerAngles)
397
+
398
+
399
+ def simGetObjectQuaternion(objectHandle, relativeToObjectHandle):
400
+ quaternion = ffi.new('float[4]')
401
+ ret = lib.simGetObjectQuaternion(
402
+ objectHandle, relativeToObjectHandle, quaternion)
403
+ _check_return(ret)
404
+ return list(quaternion)
405
+
406
+
407
+ def simSetObjectOrientation(objectHandle, relativeToObjectHandle, eulerAngles):
408
+ ret = lib.simSetObjectOrientation(
409
+ objectHandle, relativeToObjectHandle, eulerAngles)
410
+ _check_return(ret)
411
+
412
+
413
+ def simSetObjectQuaternion(objectHandle, relativeToObjectHandle, quaternion):
414
+ ret = lib.simSetObjectQuaternion(
415
+ objectHandle, relativeToObjectHandle, quaternion)
416
+ _check_return(ret)
417
+
418
+
419
+ def simSetObjectPosition(objectHandle, relativeToObjectHandle, position):
420
+ ret = lib.simSetObjectPosition(
421
+ objectHandle, relativeToObjectHandle, position)
422
+ _check_return(ret)
423
+
424
+
425
+ def simSetObjectParent(objectHandle, parentObject, keepInPlace):
426
+ ret = lib.simSetObjectParent(objectHandle, parentObject, keepInPlace)
427
+ _check_return(ret)
428
+
429
+
430
+ def simGetArrayParameter(paramIdentifier):
431
+ paramValues = ffi.new('float[3]')
432
+ ret = lib.simGetArrayParameter(paramIdentifier, paramValues)
433
+ _check_return(ret)
434
+ return list(paramValues)
435
+
436
+
437
+ def simSetArrayParameter(paramIdentifier, paramValues):
438
+ ret = lib.simSetArrayParameter(paramIdentifier, paramValues)
439
+ _check_return(ret)
440
+
441
+
442
+ def simGetBoolParameter(parameter):
443
+ ret = lib.simGetBoolParameter(parameter)
444
+ _check_return(ret)
445
+ return ret
446
+
447
+
448
+ def simSetBoolParameter(parameter, value):
449
+ ret = lib.simSetBoolParameter(parameter, value)
450
+ _check_return(ret)
451
+
452
+
453
+ def simGetInt32Parameter(parameter):
454
+ ret = lib.simGetInt32Parameter(parameter)
455
+ _check_return(ret)
456
+ return ret
457
+
458
+
459
+ def simSetInt32Parameter(parameter, value):
460
+ ret = lib.simSetInt32Parameter(parameter, value)
461
+ _check_return(ret)
462
+
463
+
464
+ def simGetFloatParameter(parameter):
465
+ ret = lib.simGetFloatParameter(parameter)
466
+ _check_return(ret)
467
+ return ret
468
+
469
+
470
+ def simSetFloatParameter(parameter, value):
471
+ ret = lib.simSetFloatParameter(parameter, value)
472
+ _check_return(ret)
473
+
474
+
475
+ def simSetStringParameter(parameter, value):
476
+ ret = lib.simSetStringParameter(parameter, value.encode('ascii'))
477
+ _check_return(ret)
478
+
479
+
480
+ def simGetStringParameter(parameter):
481
+ val = lib.simGetStringParameter(parameter)
482
+ _check_null_return(val)
483
+ sval = ffi.string(val).decode('utf-8')
484
+ simReleaseBuffer(val)
485
+ return sval
486
+
487
+
488
+ def simGetEngineFloatParameter(parameter, objectHandle):
489
+ ok = ffi.new('unsigned char *')
490
+ ret = lib.simGetEngineFloatParameter(parameter, objectHandle, ffi.NULL, ok)
491
+ _check_return(ret)
492
+ return ret
493
+
494
+
495
+ def simSetEngineFloatParameter(parameter, objectHandle, val):
496
+ ret = lib.simSetEngineFloatParameter(parameter, objectHandle, ffi.NULL,
497
+ val)
498
+ _check_return(ret)
499
+ return ret
500
+
501
+
502
+ def simGetCollisionHandle(collisionObjectName):
503
+ ret = lib.simGetCollisionHandle(collisionObjectName.encode('ascii'))
504
+ _check_return(ret)
505
+ return ret
506
+
507
+
508
+ def simGetCollectionHandle(collectionName):
509
+ ret = lib.simGetCollectionHandle(collectionName.encode('ascii'))
510
+ _check_return(ret)
511
+ return ret
512
+
513
+
514
+ def simGetDistanceHandle(distanceObjectName):
515
+ ret = lib.simGetDistanceHandle(distanceObjectName.encode('ascii'))
516
+ _check_return(ret)
517
+ return ret
518
+
519
+
520
+ def simReadCollision(collisionObjectHandle):
521
+ ret = lib.simReadCollision(collisionObjectHandle)
522
+ _check_return(ret)
523
+ return ret
524
+
525
+
526
+ def simReadDistance(distanceObjectHandle):
527
+ minimumDistance = ffi.new('float *')
528
+ ret = lib.simReadDistance(distanceObjectHandle, minimumDistance)
529
+ _check_return(ret)
530
+ return minimumDistance[0]
531
+
532
+
533
+ def simHandleDistance(distanceObjectHandle):
534
+ minimumDistance = ffi.new('float *')
535
+ ret = lib.simHandleDistance(distanceObjectHandle, minimumDistance)
536
+ _check_return(ret)
537
+ return ret
538
+
539
+
540
+ def simRemoveObject(objectHandle):
541
+ ret = lib.simRemoveObject(objectHandle)
542
+ _check_return(ret)
543
+
544
+
545
+ def simRemoveModel(objectHandle):
546
+ ret = lib.simRemoveModel(objectHandle)
547
+ _check_return(ret)
548
+
549
+
550
+ def simCloseScene():
551
+ ret = lib.simCloseScene()
552
+ _check_return(ret)
553
+
554
+
555
+ def simGetObjects(objectType):
556
+ prev_handle = 0
557
+ i = 0
558
+ handles = []
559
+ while prev_handle != -1:
560
+ prev_handle = lib.simGetObjects(i, objectType)
561
+ i += 1
562
+ if prev_handle > -1:
563
+ handles.append(prev_handle)
564
+ return handles
565
+
566
+
567
+ def simSetObjectInt32Parameter(objectHandle, parameter, value):
568
+ ret = lib.simSetObjectInt32Parameter(objectHandle, parameter, value)
569
+ _check_set_object_parameter(ret)
570
+ _check_return(ret)
571
+
572
+
573
+ def simGetObjectInt32Parameter(objectHandle, parameter):
574
+ value = ffi.new('int *')
575
+ ret = lib.simGetObjectInt32Parameter(objectHandle, parameter, value)
576
+ _check_set_object_parameter(ret)
577
+ _check_return(ret)
578
+ return value[0]
579
+
580
+
581
+ def simSetObjectFloatParameter(objectHandle, parameter, value):
582
+ ret = lib.simSetObjectFloatParameter(objectHandle, parameter, value)
583
+ _check_set_object_parameter(ret)
584
+ _check_return(ret)
585
+
586
+
587
+ def simGetObjectFloatParameter(objectHandle, parameter):
588
+ value = ffi.new('float *')
589
+ ret = lib.simGetObjectFloatParameter(objectHandle, parameter, value)
590
+ _check_set_object_parameter(ret)
591
+ _check_return(ret)
592
+ return value[0]
593
+
594
+
595
+ def simGetModelProperty(objectHandle):
596
+ ret = lib.simGetModelProperty(objectHandle)
597
+ _check_return(ret)
598
+ return ret
599
+
600
+
601
+ def simSetModelProperty(objectHandle, prop):
602
+ ret = lib.simSetModelProperty(objectHandle, prop)
603
+ _check_return(ret)
604
+
605
+
606
+ def simGetObjectSpecialProperty(objectHandle):
607
+ ret = lib.simGetObjectSpecialProperty(objectHandle)
608
+ _check_return(ret)
609
+ return ret
610
+
611
+
612
+ def simSetObjectSpecialProperty(objectHandle, prop):
613
+ ret = lib.simSetObjectSpecialProperty(objectHandle, prop)
614
+ _check_return(ret)
615
+
616
+
617
+ def simCreateDummy(size, color):
618
+ if color is None:
619
+ color = ffi.NULL
620
+ ret = lib.simCreateDummy(size, color)
621
+ _check_return(ret)
622
+ return ret
623
+
624
+
625
+ def simGetObjectVelocity(objectHandle):
626
+ linearVel = ffi.new('float[3]')
627
+ angularVel = ffi.new('float[3]')
628
+ ret = lib.simGetObjectVelocity(objectHandle, linearVel, angularVel)
629
+ _check_return(ret)
630
+ return list(linearVel), list(angularVel)
631
+
632
+
633
+ def simCreateStack():
634
+ ret = lib.simCreateStack()
635
+ _check_return(ret)
636
+ return ret
637
+
638
+
639
+ def simReleaseStack(stackHandle):
640
+ ret = lib.simReleaseStack(stackHandle)
641
+ _check_return(ret)
642
+
643
+
644
+ def simPushInt32OntoStack(stackHandle, value):
645
+ ret = lib.simPushInt32OntoStack(stackHandle, value)
646
+ _check_return(ret)
647
+
648
+
649
+ def simGetStackInt32Value(stackHandle):
650
+ value = ffi.new('int *')
651
+ ret = lib.simGetStackInt32Value(stackHandle, value)
652
+ _check_return(ret)
653
+ return value[0]
654
+
655
+
656
+ def simPushFloatOntoStack(stackHandle, value):
657
+ ret = lib.simPushFloatOntoStack(stackHandle, value)
658
+ _check_return(ret)
659
+
660
+
661
+ def simGetStackFloatValue(stackHandle):
662
+ value = ffi.new('float *')
663
+ ret = lib.simGetStackFloatValue(stackHandle, value)
664
+ _check_return(ret)
665
+ return value[0]
666
+
667
+
668
+ def simPushStringOntoStack(stackHandle, value):
669
+ ret = lib.simPushStringOntoStack(stackHandle, value.encode('ascii'), 0)
670
+ _check_return(ret)
671
+
672
+
673
+ def simGetStackStringValue(stackHandle):
674
+ val = lib.simGetStackFloatValue(stackHandle, ffi.NULL)
675
+ _check_null_return(val)
676
+ sval = ffi.string(val).decode('utf-8')
677
+ simReleaseBuffer(val)
678
+ return sval
679
+
680
+
681
+ def simExtCallScriptFunction(functionNameAtScriptName, scriptHandleOrType,
682
+ inputInts, inputFloats, inputStrings, inputBuffer):
683
+ char_pointers = []
684
+ for s in inputStrings:
685
+ char_pointers.append(ffi.new('char[]', s.encode('ascii')))
686
+ strIn = ffi.new('char *[]', char_pointers)
687
+ outInt = ffi.new('int **')
688
+ outIntCnt = ffi.new('int *')
689
+ outFloat = ffi.new('float **')
690
+ outFloatCnt = ffi.new('int *')
691
+ outString = ffi.new('char ***')
692
+ outStringCnt = ffi.new('int *')
693
+ outBuffer = ffi.new('char **')
694
+ outBufferSize = ffi.new('int *')
695
+
696
+ ret = lib.simExtCallScriptFunction(
697
+ scriptHandleOrType, functionNameAtScriptName.encode('ascii'),
698
+ inputInts, len(inputInts),
699
+ inputFloats, len(inputFloats),
700
+ strIn, len(inputStrings),
701
+ str(inputBuffer).encode('ascii'), len(str(inputBuffer)),
702
+ outInt, outIntCnt, outFloat, outFloatCnt,
703
+ outString, outStringCnt, outBuffer, outBufferSize)
704
+ _check_return(ret)
705
+
706
+ ret_ints = [outInt[0][i] for i in range(outIntCnt[0])]
707
+ ret_floats = [outFloat[0][i] for i in range(outFloatCnt[0])]
708
+ ret_strings = [ffi.string(outString[0][i]).decode('utf-8')
709
+ for i in range(outStringCnt[0])]
710
+ ret_buffer = ''
711
+ if outBufferSize[0] > 0:
712
+ ret_buffer = ffi.string(outBuffer[0]).decode('utf-8')
713
+
714
+ simReleaseBuffer(ffi.cast('char *', outInt[0]))
715
+ simReleaseBuffer(ffi.cast('char *', outFloat[0]))
716
+ [simReleaseBuffer(outString[0][i]) for i in range(outStringCnt[0])]
717
+ simReleaseBuffer(outBuffer[0])
718
+
719
+ return ret_ints, ret_floats, ret_strings, ret_buffer
720
+
721
+
722
+ def simCreatePureShape(primitiveType, options, sizes, mass, precision):
723
+ if precision is None:
724
+ precision = ffi.NULL
725
+ handle = lib.simCreatePureShape(
726
+ primitiveType, options, sizes, mass, precision)
727
+ _check_return(handle)
728
+ return handle
729
+
730
+
731
+ def simGroupShapes(shapeHandles, merge=False):
732
+ l = len(shapeHandles)
733
+ handle = lib.simGroupShapes(shapeHandles, -l if merge else l)
734
+ _check_return(handle)
735
+ return handle
736
+
737
+
738
+ def simGetShapeColor(shapeHandle, colorName, colorComponent):
739
+ rgbData = ffi.new('float[3]')
740
+ if colorName is None or len(colorName) == 0:
741
+ colorName = ffi.NULL
742
+ res = lib.simGetShapeColor(shapeHandle, colorName, colorComponent, rgbData)
743
+ _check_return(res)
744
+ return list(rgbData)
745
+
746
+
747
+ def simSetShapeColor(shapeHandle, colorName, colorComponent, rgbData):
748
+ if colorName is None or len(colorName) == 0:
749
+ colorName = ffi.NULL
750
+ res = lib.simSetShapeColor(shapeHandle, colorName, colorComponent, rgbData)
751
+ _check_return(res)
752
+
753
+
754
+ def simReorientShapeBoundingBox(shapeHandle, relativeToHandle):
755
+ ret = lib.simReorientShapeBoundingBox(shapeHandle, relativeToHandle, 0)
756
+ _check_return(ret)
757
+
758
+
759
+ def simGetObjectMatrix(objectHandle, relativeToObjectHandle):
760
+ matrix = ffi.new('float[12]')
761
+ ret = lib.simGetObjectMatrix(objectHandle, relativeToObjectHandle, matrix)
762
+ _check_return(ret)
763
+ return list(matrix)
764
+
765
+
766
+ def simGetObjectsInTree(treeBaseHandle, objectType, options):
767
+ objectCount = ffi.new('int *')
768
+ handles = lib.simGetObjectsInTree(treeBaseHandle, objectType, options,
769
+ objectCount)
770
+ _check_null_return(handles)
771
+ ret = [handles[i] for i in range(objectCount[0])]
772
+ simReleaseBuffer(ffi.cast('char *', handles))
773
+ return ret
774
+
775
+
776
+ def simGetExtensionString(objectHandle, index, key):
777
+ ext = lib.simGetExtensionString(objectHandle, index, key.encode('ascii'))
778
+ if ext == ffi.NULL:
779
+ return ''
780
+ exts = ffi.string(ext).decode('utf-8')
781
+ simReleaseBuffer(ext)
782
+ return exts
783
+
784
+
785
+ def simGetObjectType(objectHandle):
786
+ ret = lib.simGetObjectType(objectHandle)
787
+ _check_return(ret)
788
+ return ret
789
+
790
+
791
+ def simGetConfigurationTree(objectHandle):
792
+ config = lib.simGetConfigurationTree(objectHandle)
793
+ _check_null_return(config)
794
+ # TODO: Not use what to do about the encoding here
795
+ # configs = ffi.string(config)
796
+ # simReleaseBuffer(config)
797
+ return config
798
+
799
+
800
+ def simSetConfigurationTree(data):
801
+ ret = lib.simSetConfigurationTree(data)
802
+ _check_return(ret)
803
+
804
+
805
+ def simRotateAroundAxis(matrix, axis, axisPos, angle):
806
+ matrixOut = ffi.new('float[12]')
807
+ ret = lib.simRotateAroundAxis(matrix, axis, axisPos, angle, matrixOut)
808
+ _check_return(ret)
809
+ return list(matrixOut)
810
+
811
+
812
+ def simSetObjectMatrix(objectHandle, relativeToObjectHandle, matrix):
813
+ ret = lib.simSetObjectMatrix(objectHandle, relativeToObjectHandle, matrix)
814
+ _check_return(ret)
815
+
816
+
817
+ def simCheckCollision(entity1Handle, entity2Handle):
818
+ state = lib.simCheckCollision(entity1Handle, entity2Handle)
819
+ _check_return(state)
820
+ return state
821
+
822
+
823
+ def simGetPositionOnPath(pathHandle, relativeDistance):
824
+ position = ffi.new('float[3]')
825
+ ret = lib.simGetPositionOnPath(pathHandle, relativeDistance, position)
826
+ _check_return(ret)
827
+ return list(position)
828
+
829
+
830
+ def simGetOrientationOnPath(pathHandle, relativeDistance):
831
+ orientation = ffi.new('float[3]')
832
+ ret = lib.simGetOrientationOnPath(pathHandle, relativeDistance, orientation)
833
+ _check_return(ret)
834
+ return list(orientation)
835
+
836
+
837
+ def simAddDrawingObject(objectType, size, duplicateTolerance,
838
+ parentObjectHandle, maxItemCount, ambient_diffuse=None,
839
+ specular=None, emission=None):
840
+ """
841
+
842
+ :param objectType: A drawing object type. e.g. sim_drawing_points.
843
+ :param size: Size of the item. Width of lines or size of points are in
844
+ pixels, other sizes are in meters.
845
+ :param duplicateTolerance: If different from 0.0, then will only add the
846
+ item if there is no other item within duplicateTolerance distance.
847
+ :param parentObjectHandle: Handle of the scene object where the drawing
848
+ items should keep attached to.
849
+ :param maxItemCount: Maximum number of items this object can hold.
850
+ :param ambient_diffuse: Ambient/diffuse color.
851
+ :param specular: Default specular color.
852
+ :param emission: Default emissive color.
853
+ :return: Handle of the drawing object.
854
+ """
855
+ if ambient_diffuse is None:
856
+ ambient_diffuse = ffi.NULL
857
+ if specular is None:
858
+ specular = ffi.NULL
859
+ if emission is None:
860
+ emission = ffi.NULL
861
+ handle = lib.simAddDrawingObject(
862
+ objectType, size, duplicateTolerance, parentObjectHandle, maxItemCount,
863
+ ambient_diffuse, ffi.NULL, specular, emission)
864
+ _check_return(handle)
865
+ return handle
866
+
867
+
868
+ def simRemoveDrawingObject(objectHandle):
869
+ ret = lib.simRemoveDrawingObject(objectHandle)
870
+ _check_return(ret)
871
+
872
+
873
+ def simAddDrawingObjectItem(objectHandle, itemData):
874
+ """
875
+
876
+ :param objectHandle: Handle of a drawing object.
877
+ :param itemData: If the item is a point item, 3 values are required (x;y;z).
878
+ If the item is a line item, 6 values are required, and if the item is a
879
+ triangle item, 9 values are required. If None, then the drawing object
880
+ is emptied of all its items.
881
+ :return:
882
+ """
883
+ if itemData is None:
884
+ itemData = ffi.NULL
885
+ ret = lib.simAddDrawingObjectItem(objectHandle, itemData)
886
+ _check_return(ret)
887
+
888
+
889
+ def simGetSimulationTimeStep():
890
+ step = lib.simGetSimulationTimeStep()
891
+ _check_return(step)
892
+ return step
893
+
894
+
895
+ def simResetDynamicObject(objectHandle):
896
+ ret = lib.simResetDynamicObject(objectHandle)
897
+ _check_return(ret)
898
+
899
+
900
+ def simGetJointType(objectHandle):
901
+ type = lib.simGetJointType(objectHandle)
902
+ _check_return(type)
903
+ return type
904
+
905
+
906
+ def simRMLPos(dofs, smallestTimeStep, flags, currentPosVelAccel,
907
+ maxVelAccelJerk, selection, targetPosVel):
908
+ smallestTimeStep = ffi.cast('double', smallestTimeStep)
909
+ handle = lib.simRMLPos(dofs, smallestTimeStep, flags, currentPosVelAccel,
910
+ maxVelAccelJerk, selection, targetPosVel, ffi.NULL)
911
+ _check_return(handle)
912
+ return handle
913
+
914
+
915
+ def simRMLVel(dofs, smallestTimeStep, flags, currentPosVelAccel, maxAccelJerk,
916
+ selection, targetVel):
917
+ handle = lib.simRMLVel(dofs, smallestTimeStep, flags, currentPosVelAccel,
918
+ maxAccelJerk, selection, targetVel, ffi.NULL)
919
+ _check_return(handle)
920
+ return handle
921
+
922
+
923
+ def simRMLStep(handle, timeStep, dofs):
924
+ newPosVelAccel = ffi.new('double[%d]' % (dofs * 3))
925
+ # timeStep = ffi.cast('double', timeStep)
926
+ state = lib.simRMLStep(handle, timeStep, newPosVelAccel, ffi.NULL, ffi.NULL)
927
+ _check_return(state)
928
+ return state, list(newPosVelAccel)
929
+
930
+
931
+ def simRMLRemove(handle):
932
+ ret = lib.simRMLRemove(handle)
933
+ _check_return(ret)
934
+
935
+
936
+ def simImportMesh(fileformat, pathAndFilename, options,
937
+ identicalVerticeTolerance, scalingFactor):
938
+ outVerticies = ffi.new('float ***')
939
+ outVerticiesCount = ffi.new('int **')
940
+ outIndices = ffi.new('int ***')
941
+ outIndicesCount = ffi.new('int **')
942
+ outNames = ffi.new('char ***')
943
+ count = lib.simImportMesh(
944
+ fileformat, pathAndFilename.encode('ascii'), options,
945
+ identicalVerticeTolerance, scalingFactor, outVerticies,
946
+ outVerticiesCount, outIndices, outIndicesCount, ffi.NULL, outNames)
947
+ _check_return(count)
948
+ retVerticies = [[outVerticies[0][i][j]
949
+ for j in range(outVerticiesCount[0][i])]
950
+ for i in range(count)]
951
+ retIndices = [[outIndices[0][i][j]
952
+ for j in range(outIndicesCount[0][i])]
953
+ for i in range(count)]
954
+ retNames = [ffi.string(outNames[0][i]).decode('utf-8')
955
+ for i in range(count)]
956
+ for i in range(count):
957
+ simReleaseBuffer(ffi.cast('char *', outVerticies[0][i]))
958
+ simReleaseBuffer(ffi.cast('char *', outIndices[0][i]))
959
+ simReleaseBuffer(outNames[0][i])
960
+ simReleaseBuffer(ffi.cast('char *', outVerticies[0]))
961
+ simReleaseBuffer(ffi.cast('char *', outVerticiesCount[0]))
962
+ simReleaseBuffer(ffi.cast('char *', outIndices[0]))
963
+ simReleaseBuffer(ffi.cast('char *', outIndicesCount[0]))
964
+ simReleaseBuffer(ffi.cast('char *', outNames[0]))
965
+ return retVerticies, retIndices, retNames
966
+
967
+
968
+ def simImportShape(fileformat, pathAndFilename, options,
969
+ identicalVerticeTolerance, scalingFactor):
970
+ handle = lib.simImportShape(
971
+ fileformat, pathAndFilename.encode('ascii'), options,
972
+ identicalVerticeTolerance, scalingFactor)
973
+ _check_return(handle)
974
+ return handle
975
+
976
+
977
+ def simCreateMeshShape(options, shadingAngle, vertices, indices):
978
+ ret = lib.simCreateMeshShape(options, shadingAngle, vertices, len(vertices),
979
+ indices, len(indices), ffi.NULL)
980
+ return ret
981
+
982
+
983
+ def simGetShapeMesh(shapeHandle):
984
+ outVerticies = ffi.new('float **')
985
+ outVerticiesCount = ffi.new('int *')
986
+ outIndices = ffi.new('int **')
987
+ outIndicesCount = ffi.new('int *')
988
+ # outNormals is 3 times the size of outIndicesCount
989
+ outNormals = ffi.new('float **')
990
+
991
+ ret = lib.simGetShapeMesh(shapeHandle, outVerticies, outVerticiesCount,
992
+ outIndices, outIndicesCount, outNormals)
993
+ _check_return(ret)
994
+ retVerticies = [outVerticies[0][i]
995
+ for i in range(outVerticiesCount[0])]
996
+ retIndices = [outIndices[0][i]
997
+ for i in range(outIndicesCount[0])]
998
+ outNormals = [outIndices[0][i]
999
+ for i in range(outIndicesCount[0] * 3)]
1000
+
1001
+ simReleaseBuffer(ffi.cast('char *', outVerticies[0]))
1002
+ simReleaseBuffer(ffi.cast('char *', outIndices[0]))
1003
+ simReleaseBuffer(ffi.cast('char *', outNormals[0]))
1004
+
1005
+ return retVerticies, retIndices, outNormals
1006
+
1007
+
1008
+ def simGetShapeViz(shapeHandle, index):
1009
+ info = ffi.new('struct SShapeVizInfo *')
1010
+ ret = lib.simGetShapeViz(shapeHandle, index, info)
1011
+ _check_return(ret)
1012
+
1013
+ vertices = [info.vertices[i] for i in range(info.verticesSize)]
1014
+ indices = [info.indices[i] for i in range(info.indicesSize)]
1015
+ normals = [info.normals[i] for i in range(info.indicesSize * 3)]
1016
+ colors = list(info.colors)
1017
+ textureSize = info.textureRes[0] * info.textureRes[1] * 4
1018
+ if textureSize == 0:
1019
+ texture = []
1020
+ textureCoords = []
1021
+ else:
1022
+ texture = np.frombuffer(
1023
+ ffi.buffer(info.texture, textureSize), np.uint8)
1024
+ texture = texture.tolist()
1025
+ textureCoords = [info.textureCoords[i] for i in
1026
+ range(info.indicesSize * 2)]
1027
+
1028
+ return SShapeVizInfo(
1029
+ vertices=vertices,
1030
+ indices=indices,
1031
+ normals=normals,
1032
+ shadingAngle=info.shadingAngle,
1033
+ colors=colors,
1034
+ texture=texture,
1035
+ textureId=info.textureId,
1036
+ textureRes=info.textureRes,
1037
+ textureCoords=textureCoords,
1038
+ textureApplyMode=info.textureApplyMode,
1039
+ textureOptions=info.textureOptions,
1040
+ )
1041
+
1042
+
1043
+ def simConvexDecompose(shapeHandle, options, intParams, floatParams):
1044
+ return lib.simConvexDecompose(shapeHandle, options, intParams, floatParams)
1045
+
1046
+
1047
+ def simGetJointMode(shapeHandle):
1048
+ options = ffi.new('int*')
1049
+ mode = lib.simGetJointMode(shapeHandle, options)
1050
+ _check_return(mode)
1051
+ return mode
1052
+
1053
+
1054
+ def simSetJointMode(shapeHandle, mode):
1055
+ options = 0
1056
+ ret = lib.simSetJointMode(shapeHandle, mode, options)
1057
+ _check_return(ret)
1058
+
1059
+
1060
+ def simCreatePath(attributes, intParams, floatParams, color):
1061
+ handle = lib.simCreatePath(attributes, intParams, floatParams, color + [0.]*3 + [0.25]*3 + [0.]*3)
1062
+ _check_return(handle)
1063
+ return handle
1064
+
1065
+
1066
+ def simAddScript(type):
1067
+ handle = lib.simAddScript(type)
1068
+ _check_return(handle)
1069
+ return handle
1070
+
1071
+
1072
+ def simAssociateScriptWithObject(scriptHandle, objectHandle):
1073
+ ret = lib.simAssociateScriptWithObject(scriptHandle, objectHandle)
1074
+ _check_return(ret)
1075
+
1076
+
1077
+ def simSetScriptText(scriptHandle, scriptText):
1078
+ ret = lib.simSetScriptText(scriptHandle, scriptText.encode('ascii'))
1079
+ _check_return(ret)
1080
+
1081
+
1082
+ def simGetScriptText(scriptHandle):
1083
+ ret = lib.simGetScriptText(scriptHandle)
1084
+ ret = ffi.string(ret).decode('utf-8')
1085
+ return ret
1086
+
1087
+
1088
+ def simGetScriptAssociatedWithObject(objectHandle):
1089
+ ret = lib.simGetScriptAssociatedWithObject(objectHandle)
1090
+ return ret
1091
+
1092
+
1093
+ def simApplyTexture(shapeHandle, textureCoordinates, textCoordSize,
1094
+ texture, textureResolution, options):
1095
+ ret = lib.simApplyTexture(shapeHandle, textureCoordinates, textCoordSize,
1096
+ texture, textureResolution, options)
1097
+ _check_return(ret)
1098
+ return ret
1099
+
1100
+
1101
+ def simCreateTexture(fileName, options):
1102
+ # The textureID param that is returned from simCreateTexture seems
1103
+ # to be incorrect (in regards to calling simGetShapeTextureId on the
1104
+ # generated plane).
1105
+ handle = lib.simCreateTexture(fileName.encode('ascii'), options, ffi.NULL,
1106
+ ffi.NULL, ffi.NULL, 0, ffi.NULL, ffi.NULL,
1107
+ ffi.NULL)
1108
+ _check_return(handle)
1109
+ return handle
1110
+
1111
+
1112
+ def simSetShapeTexture(shapeHandle, textureId, mappingMode, options, uvScaling,
1113
+ position, orientation):
1114
+ if position is None:
1115
+ position = ffi.NULL
1116
+ if orientation is None:
1117
+ orientation = ffi.NULL
1118
+
1119
+ handle = lib.simSetShapeTexture(shapeHandle, textureId, mappingMode,
1120
+ options, uvScaling, position, orientation)
1121
+ _check_return(handle)
1122
+
1123
+
1124
+ def simGetShapeTextureId(objectHandle):
1125
+ ret = lib.simGetShapeTextureId(objectHandle)
1126
+ _check_return(ret)
1127
+ return ret
1128
+
1129
+
1130
+ def simCopyPasteObjects(objectHandles, options):
1131
+ handles = ffi.new('int[]', objectHandles)
1132
+ ret = lib.simCopyPasteObjects(handles, len(objectHandles), options)
1133
+ _check_return(ret)
1134
+ return list(handles)
1135
+
1136
+
1137
+ def simHandleIkGroup(ikGroupHandle):
1138
+ ret = lib.simHandleIkGroup(ikGroupHandle)
1139
+ _check_return(ret)
1140
+ return ret
1141
+
1142
+
1143
+ def simCheckIkGroup(ikGroupHandle, jointHandles):
1144
+ jointValues = ffi.new('float[%d]' % len(jointHandles))
1145
+ ret = lib.simCheckIkGroup(
1146
+ ikGroupHandle, len(jointHandles), jointHandles, jointValues, ffi.NULL)
1147
+ _check_return(ret)
1148
+ return ret, list(jointValues)
1149
+
1150
+
1151
+ def simComputeJacobian(ikGroupHandle, options):
1152
+ # Only works when joints that are in IK or hybrid mode
1153
+ ret = lib.simComputeJacobian(ikGroupHandle, options, ffi.NULL)
1154
+ _check_return(ret)
1155
+
1156
+
1157
+ def simGetIkGroupMatrix(ikGroupHandle, options):
1158
+ matrixSize = ffi.new('int[2]')
1159
+ ret = lib.simGetIkGroupMatrix(ikGroupHandle, options, matrixSize)
1160
+ flatJacobian = [ret[i] for i in range(matrixSize[0] * matrixSize[1])]
1161
+ # matrixSize[0] represents the row count of the Jacobian.
1162
+ # matrixSize[0] represents the column count of the Jacobian.
1163
+ return flatJacobian, list(matrixSize)
1164
+
1165
+
1166
+ def simCheckDistance(entity1Handle, entity2Handle, threshold):
1167
+ distanceData = ffi.new('float [7]')
1168
+ ret = lib.simCheckDistance(
1169
+ entity1Handle, entity2Handle, threshold, distanceData)
1170
+ _check_return(ret)
1171
+ return list(distanceData)
1172
+
1173
+
1174
+ def simSetExplicitHandling(generalObjectHandle, explicitFlags):
1175
+ ret = lib.simSetExplicitHandling(generalObjectHandle, explicitFlags)
1176
+ _check_return(ret)
1177
+
1178
+
1179
+ def simGetExplicitHandling(generalObjectHandle):
1180
+ flag = lib.simGetExplicitHandling(generalObjectHandle)
1181
+ _check_return(flag)
1182
+ return flag
1183
+
1184
+
1185
+ def simUngroupShape(shapeHandle):
1186
+ count = ffi.new('int*')
1187
+ shapes = lib.simUngroupShape(shapeHandle, count)
1188
+ _check_null_return(shapes)
1189
+ handles = [shapes[i] for i in range(count[0])]
1190
+ # simReleaseBuffer(shapes)
1191
+ return handles
1192
+
1193
+
1194
+ def simInvertMatrix(matrix):
1195
+ c_matrix = ffi.new('float []', matrix)
1196
+ ret = lib.simInvertMatrix(c_matrix)
1197
+ _check_return(ret)
1198
+ return list(c_matrix)
1199
+
1200
+
1201
+ def simMultiplyMatrices(inMatrix1, inMatrix2):
1202
+ outMatrix = ffi.new('float []', len(inMatrix1))
1203
+ ret = lib.simMultiplyMatrices(inMatrix1, inMatrix2, outMatrix)
1204
+ _check_return(ret)
1205
+ _check_null_return(outMatrix)
1206
+ return list(outMatrix)
1207
+
1208
+
1209
+ def simGetEulerAnglesFromMatrix(rotationMatrix):
1210
+ eulerAngles = ffi.new('float [3]')
1211
+ ret = lib.simGetEulerAnglesFromMatrix(rotationMatrix, eulerAngles)
1212
+ _check_return(ret)
1213
+ _check_null_return(eulerAngles)
1214
+ return list(eulerAngles)
1215
+
1216
+
1217
+ def simGetSimulationTime():
1218
+ time = lib.simGetSimulationTime()
1219
+ _check_return(time)
1220
+ return time
1221
+
1222
+
1223
+ def simSetIntegerSignal(signalName, signalValue):
1224
+ ret = lib.simSetIntegerSignal(signalName.encode('ascii'), signalValue)
1225
+ _check_return(ret)
1226
+
1227
+
1228
+ def simGetIntegerSignal(signalName):
1229
+ val = ffi.new('int*')
1230
+ ret = lib.simGetIntegerSignal(signalName.encode('ascii'), val)
1231
+ _check_return(ret)
1232
+ return ret, val[0]
1233
+
1234
+
1235
+ def simClearIntegerSignal(signalName):
1236
+ ret = lib.simClearIntegerSignal(signalName.encode('ascii'))
1237
+ _check_return(ret)
1238
+ return ret
1239
+
1240
+
1241
+ def simSetFloatSignal(signalName, signalValue):
1242
+ ret = lib.simSetFloatSignal(signalName.encode('ascii'), signalValue)
1243
+ _check_return(ret)
1244
+
1245
+
1246
+ def simGetFloatSignal(signalName):
1247
+ val = ffi.new('float*')
1248
+ ret = lib.simGetFloatSignal(signalName.encode('ascii'), val)
1249
+ _check_return(ret)
1250
+ return ret, val[0]
1251
+
1252
+
1253
+ def simClearFloatSignal(signalName):
1254
+ ret = lib.simClearFloatSignal(signalName.encode('ascii'))
1255
+ _check_return(ret)
1256
+ return ret
1257
+
1258
+
1259
+ def simSetDoubleSignal(signalName, signalValue):
1260
+ ret = lib.simSetDoubleSignal(signalName.encode('ascii'), signalValue)
1261
+ _check_return(ret)
1262
+
1263
+
1264
+ def simGetDoubleSignal(signalName):
1265
+ val = ffi.new('double*')
1266
+ ret = lib.simGetDoubleSignal(signalName.encode('ascii'), val)
1267
+ _check_return(ret)
1268
+ return ret, val[0]
1269
+
1270
+
1271
+ def simClearDoubleSignal(signalName):
1272
+ ret = lib.simClearDoubleSignal(signalName.encode('ascii'))
1273
+ _check_return(ret)
1274
+ return ret
1275
+
1276
+
1277
+ def simSetStringSignal(signalName, signalValue):
1278
+ ret = lib.simSetStringSignal(
1279
+ signalName.encode('ascii'), signalValue.encode('ascii'),
1280
+ len(signalValue))
1281
+ _check_return(ret)
1282
+
1283
+
1284
+ def simGetStringSignal(signalName):
1285
+ valLen = ffi.new('int*')
1286
+ str_ret = lib.simGetStringSignal(signalName.encode('ascii'), valLen)
1287
+ if str_ret == ffi.NULL:
1288
+ # No value.
1289
+ return 0, None
1290
+ val = ffi.string(str_ret[0:valLen[0]]).decode('utf-8')
1291
+ simReleaseBuffer(ffi.cast('char *', str_ret))
1292
+ return 1, val
1293
+
1294
+
1295
+ def simClearStringSignal(signalName):
1296
+ ret = lib.simClearStringSignal(signalName.encode('ascii'))
1297
+ _check_return(ret)
1298
+ return ret
1299
+
1300
+
1301
+ def simSetUserParameter(objectHandle, parameterName, parameterValue):
1302
+ # TODO: currently not used by PyRep.
1303
+ # User params functionality missing in CoppeliaSim.
1304
+ parameterLength = len(parameterValue)
1305
+ ret = lib.simSetUserParameter(
1306
+ objectHandle, parameterName.encode('ascii'),
1307
+ parameterValue.encode('ascii'), parameterLength)
1308
+ _check_return(ret)
1309
+
1310
+
1311
+ def simGetUserParameter(objectHandle, parameterName):
1312
+ # TODO: currently not used by PyRep.
1313
+ # User params functionality missing in CoppeliaSim.
1314
+ parameterLength = ffi.new('int*')
1315
+ parameterValue = lib.simGetUserParameter(
1316
+ objectHandle, parameterName.encode('ascii'), parameterLength)
1317
+ _check_null_return(parameterValue)
1318
+ val = ffi.string((parameterValue[0][:parameterLength[0]])).decode('utf-8')
1319
+ simReleaseBuffer(ffi.cast('char *', parameterValue))
1320
+ return val
1321
+
1322
+
1323
+ def simCreateOctree(voxelSize, options, pointSize):
1324
+ ret = lib.simCreateOctree(voxelSize, options, pointSize, ffi.NULL)
1325
+ _check_return(ret)
1326
+ return ret
1327
+
1328
+
1329
+ def simInsertVoxelsIntoOctree(octreeHandle, options, points, color, tag):
1330
+ if color is None:
1331
+ color = ffi.NULL
1332
+ if tag is None:
1333
+ tag = ffi.NULL
1334
+ ret = lib.simInsertVoxelsIntoOctree(octreeHandle, options, points,
1335
+ len(points)//3, color, tag, ffi.NULL)
1336
+ _check_return(ret)
1337
+ return ret
1338
+
1339
+
1340
+ def simRemoveVoxelsFromOctree(octreeHandle, options, points):
1341
+ if points is None:
1342
+ points = ffi.NULL
1343
+ if points is ffi.NULL:
1344
+ pointCount = 0
1345
+ else:
1346
+ pointCount = len(points)//3
1347
+ ret = lib.simRemoveVoxelsFromOctree(octreeHandle, options, points,
1348
+ pointCount, ffi.NULL)
1349
+ _check_return(ret)
1350
+ return ret
1351
+
1352
+
1353
+ def simGetOctreeVoxels(octreeHandle):
1354
+ pointCountPointer = ffi.new('int *')
1355
+ ret = lib.simGetOctreeVoxels(octreeHandle, pointCountPointer, ffi.NULL)
1356
+ if ret == ffi.NULL:
1357
+ return []
1358
+ pointCount = pointCountPointer[0]
1359
+ return list(ret[0:pointCount*3])
1360
+
1361
+
1362
+ def simInsertObjectIntoOctree(octreeHandle, objectHandle, options,
1363
+ color, tag):
1364
+ if color is None:
1365
+ color = ffi.NULL
1366
+ ret = lib.simInsertObjectIntoOctree(octreeHandle, objectHandle, options,
1367
+ color, tag, ffi.NULL)
1368
+ _check_return(ret)
1369
+ return ret
1370
+
1371
+
1372
+ def simSubtractObjectFromOctree(octreeHandle, objectHandle, options):
1373
+ ret = lib.simSubtractObjectFromOctree(octreeHandle, objectHandle, options,
1374
+ ffi.NULL)
1375
+ _check_return(ret)
1376
+ return ret
1377
+
1378
+
1379
+ def simCheckOctreePointOccupancy(octreeHandle, options, points):
1380
+ ret = lib.simCheckOctreePointOccupancy(octreeHandle, options, points,
1381
+ len(points)//3, ffi.NULL, ffi.NULL,
1382
+ ffi.NULL)
1383
+ _check_return(ret)
1384
+ if ret == 1:
1385
+ return True
1386
+ else:
1387
+ return False
1388
+
1389
+
1390
+ def simGetContactInfo(contact_obj_handle, get_contact_normal):
1391
+ index = 0
1392
+ contact_list = []
1393
+ result = 1
1394
+
1395
+ while result > 0:
1396
+ if get_contact_normal:
1397
+ contact = ffi.new('float[9]')
1398
+ ext = sim_handleflag_extended
1399
+ else:
1400
+ contact = ffi.new('float[6]')
1401
+ ext = 0
1402
+
1403
+ object_handles = ffi.new('int[2]')
1404
+ result = lib.simGetContactInfo(sim_handle_all, contact_obj_handle, index + ext, object_handles,
1405
+ contact)
1406
+ contact_info = {
1407
+ "contact": list(contact),
1408
+ "contact_handles": list(object_handles)
1409
+ }
1410
+ contact_list.append(contact_info)
1411
+ index += 1
1412
+ contact_list.pop(-1) # remove the all zero value
1413
+ return contact_list
1414
+
1415
+
1416
+ def simGetConfigForTipPose(ikGroupHandle, jointHandles, thresholdDist, maxTimeInMs, metric, collisionPairs, jointOptions, lowLimits, ranges):
1417
+ jointCnt = len(jointHandles)
1418
+ collisionPairCnt = len(collisionPairs) // 2
1419
+ collisionPairs = ffi.NULL if len(collisionPairs) == 0 else collisionPairs
1420
+ retConfigm = ffi.new('float[%d]' % jointCnt)
1421
+ reserved = ffi.NULL
1422
+ metric = ffi.NULL if metric is None else metric
1423
+ jointOptions = ffi.NULL if jointOptions is None else jointOptions
1424
+ ret = lib.simGetConfigForTipPose(
1425
+ ikGroupHandle, jointCnt, jointHandles, thresholdDist,
1426
+ maxTimeInMs, retConfigm, metric, collisionPairCnt, collisionPairs,
1427
+ jointOptions, lowLimits, ranges, reserved)
1428
+ _check_return(ret)
1429
+ _check_null_return(retConfigm)
1430
+ return list(retConfigm) if ret == 1 else []
1431
+
1432
+
1433
+ def generateIkPath(ikGroupHandle, jointHandles, ptCnt, collisionPairs, jointOptions):
1434
+ jointCnt = len(jointHandles)
1435
+ collisionPairCnt = len(collisionPairs) // 2
1436
+ collisionPairs = ffi.NULL if len(collisionPairs) == 0 else collisionPairs
1437
+ reserved = ffi.NULL
1438
+ jointOptions = ffi.NULL if jointOptions is None else jointOptions
1439
+ ret = lib.simGenerateIkPath(
1440
+ ikGroupHandle, jointCnt, jointHandles, ptCnt, collisionPairCnt,
1441
+ collisionPairs, jointOptions, reserved)
1442
+ return [] if ret == ffi.NULL else [ret[i] for i in range(ptCnt * jointCnt)]
1443
+
1444
+
1445
+ def simGetDecimatedMesh(inVertices, inIndices, decimationPercent):
1446
+ outVerticies = ffi.new('float **')
1447
+ outVerticiesCount = ffi.new('int *')
1448
+ outIndices = ffi.new('int **')
1449
+ outIndicesCount = ffi.new('int *')
1450
+ # outNormals is 3 times the size of outIndicesCount
1451
+ # outNormals = ffi.new('float **')
1452
+
1453
+ ret = lib.simGetDecimatedMesh(inVertices, len(inVertices),
1454
+ inIndices, len(inIndices),
1455
+ outVerticies, outVerticiesCount,
1456
+ outIndices, outIndicesCount,
1457
+ decimationPercent, 0, ffi.NULL)
1458
+ _check_return(ret)
1459
+ retVerticies = [outVerticies[0][i]
1460
+ for i in range(outVerticiesCount[0])]
1461
+ retIndices = [outIndices[0][i]
1462
+ for i in range(outIndicesCount[0])]
1463
+
1464
+ simReleaseBuffer(ffi.cast('char *', outVerticies[0]))
1465
+ simReleaseBuffer(ffi.cast('char *', outIndices[0]))
1466
+
1467
+ return retVerticies, retIndices
1468
+
1469
+
1470
+ def simComputeMassAndInertia(shapeHandle, density):
1471
+ ret = lib.simComputeMassAndInertia(shapeHandle, density)
1472
+ _check_return(ret)
1473
+ return ret
1474
+
1475
+
1476
+ def simAddForce(shapeHandle, position, force):
1477
+ ret = lib.simAddForce(shapeHandle, position, force)
1478
+ _check_return(ret)
1479
+
1480
+
1481
+ def simAddForceAndTorque(shapeHandle, force, torque):
1482
+ ret = lib.simAddForceAndTorque(shapeHandle,
1483
+ ffi.NULL if force is None else force,
1484
+ ffi.NULL if torque is None else torque)
1485
+ _check_return(ret)
1486
+
1487
+
1488
+ def simSetLightParameters(shapeHandle, state, diffusePart=None, specularPart=None):
1489
+ ret = lib.simSetLightParameters(shapeHandle, state, ffi.NULL,
1490
+ ffi.NULL if diffusePart is None else diffusePart,
1491
+ ffi.NULL if specularPart is None else specularPart)
1492
+ _check_return(ret)
1493
+
1494
+
1495
+ def simGetLightParameters(shapeHandle):
1496
+ diffusePart = ffi.new('float[3]')
1497
+ specularPart = ffi.new('float[3]')
1498
+ ret = lib.simGetLightParameters(shapeHandle, ffi.NULL, diffusePart, specularPart)
1499
+ _check_return(ret)
1500
+ return ret, list(diffusePart), list(specularPart)
external/pyrep/pyrep/backend/simAddOnScript_PyRep.lua ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- Additional PyRep functionality. To be placed in the CoppeliaSim root directory.
2
+
3
+ function sysCall_init()
4
+ end
5
+
6
+ function sysCall_cleanup()
7
+ end
8
+
9
+ function sysCall_addOnScriptSuspend()
10
+ end
11
+
12
+ function sysCall_addOnScriptResume()
13
+ end
14
+
15
+ function sysCall_nonSimulation()
16
+ end
17
+
18
+ function sysCall_beforeMainScript()
19
+ end
20
+
21
+ function sysCall_beforeInstanceSwitch()
22
+ end
23
+
24
+ function sysCall_afterInstanceSwitch()
25
+ end
26
+
27
+ function sysCall_beforeSimulation()
28
+ end
29
+
30
+ function sysCall_afterSimulation()
31
+ end
32
+
33
+ _getConfig=function(jh)
34
+ -- Returns the current robot configuration
35
+ local config={}
36
+ for i=1,#jh,1 do
37
+ config[i]=sim.getJointPosition(jh[i])
38
+ end
39
+ return config
40
+ end
41
+
42
+ _setConfig=function(jh, config)
43
+ -- Applies the specified configuration to the robot
44
+ if config then
45
+ for i=1,#jh,1 do
46
+ sim.setJointPosition(jh[i],config[i])
47
+ end
48
+ end
49
+ end
50
+
51
+ _getConfigDistance=function(jointHandles,config1,config2)
52
+ -- Returns the distance (in configuration space) between two configurations
53
+ local d=0
54
+ for i=1,#jointHandles,1 do
55
+ -- TODO *metric[i] should be here to give a weight to each joint.
56
+ local dx=(config1[i]-config2[i])*1.0
57
+ d=d+dx*dx
58
+ end
59
+ return math.sqrt(d)
60
+ end
61
+
62
+ _sliceFromOffset=function(array, offset)
63
+ sliced = {}
64
+ for i=1,#array-offset,1 do
65
+ sliced[i] = array[i+offset]
66
+ end
67
+ return sliced
68
+ end
69
+
70
+ _findPath=function(goalConfigs,cnt,jointHandles,algorithm,collisionPairs)
71
+ -- Here we do path planning between the specified start and goal configurations. We run the search cnt times,
72
+ -- and return the shortest path, and its length
73
+
74
+ local startConfig = _getConfig(jointHandles)
75
+ local task=simOMPL.createTask('task')
76
+ simOMPL.setVerboseLevel(task, 0)
77
+
78
+ alg = _getAlgorithm(algorithm)
79
+
80
+ simOMPL.setAlgorithm(task,alg)
81
+
82
+ local jSpaces={}
83
+ for i=1,#jointHandles,1 do
84
+ jh = jointHandles[i]
85
+ cyclic, interval = sim.getJointInterval(jh)
86
+ -- If there are huge intervals, then limit them
87
+ if interval[1] < -6.28 and interval[2] > 6.28 then
88
+ pos=sim.getJointPosition(jh)
89
+ interval[1] = -6.28
90
+ interval[2] = 6.28
91
+ end
92
+ local proj=i
93
+ if i>3 then proj=0 end
94
+ jSpaces[i]=simOMPL.createStateSpace('j_space'..i,simOMPL.StateSpaceType.joint_position,jh,{interval[1]},{interval[2]},proj)
95
+ end
96
+
97
+ simOMPL.setStateSpace(task, jSpaces)
98
+ if collisionPairs ~= nil then
99
+ simOMPL.setCollisionPairs(task, collisionPairs)
100
+ end
101
+ simOMPL.setStartState(task, startConfig)
102
+ simOMPL.setGoalState(task, goalConfigs[1])
103
+ for i=2,#goalConfigs,1 do
104
+ simOMPL.addGoalState(task,goalConfigs[i])
105
+ end
106
+ local path=nil
107
+ local l=999999999999
108
+ for i=1,cnt,1 do
109
+ search_time = 4
110
+ local res,_path=simOMPL.compute(task,search_time,-1,300)
111
+
112
+ -- Path can sometimes touch on invalid state during simplifying
113
+ if res and _path then
114
+ local is_valid=true
115
+ local jhl=#jointHandles
116
+ local pc=#_path/jhl
117
+ for i=1,pc-1,1 do
118
+ local config={}
119
+ for j=1,jhl,1 do
120
+ config[j]=_path[(i-1)*jhl+j]
121
+ end
122
+ is_valid=simOMPL.isStateValid(task, config)
123
+ if not is_valid then
124
+ break
125
+ end
126
+ end
127
+
128
+ if is_valid then
129
+ local _l=_getPathLength(_path, jointHandles)
130
+ if _l<l then
131
+ l=_l
132
+ path=_path
133
+ end
134
+ end
135
+ end
136
+ end
137
+ simOMPL.destroyTask(task)
138
+ return path,l
139
+ end
140
+
141
+ _getAlgorithm=function(algorithm)
142
+ -- Returns correct algorithm functions from user string
143
+ alg = nil
144
+ if algorithm == 'BiTRRT' then
145
+ alg = simOMPL.Algorithm.BiTRRT
146
+ elseif algorithm == 'BITstar' then
147
+ alg = simOMPL.Algorithm.BITstar
148
+ elseif algorithm == 'BKPIECE1' then
149
+ alg = simOMPL.Algorithm.BKPIECE1
150
+ elseif algorithm == 'CForest' then
151
+ alg = simOMPL.Algorithm.CForest
152
+ elseif algorithm == 'EST' then
153
+ alg = simOMPL.Algorithm.EST
154
+ elseif algorithm == 'FMT' then
155
+ alg = simOMPL.Algorithm.FMT
156
+ elseif algorithm == 'KPIECE1' then
157
+ alg = simOMPL.Algorithm.KPIECE1
158
+ elseif algorithm == 'LazyPRM' then
159
+ alg = simOMPL.Algorithm.LazyPRM
160
+ elseif algorithm == 'LazyPRMstar' then
161
+ alg = simOMPL.Algorithm.LazyPRMstar
162
+ elseif algorithm == 'LazyRRT' then
163
+ alg = simOMPL.Algorithm.LazyRRT
164
+ elseif algorithm == 'LBKPIECE1' then
165
+ alg = simOMPL.Algorithm.LBKPIECE1
166
+ elseif algorithm == 'LBTRRT' then
167
+ alg = simOMPL.Algorithm.LBTRRT
168
+ elseif algorithm == 'PDST' then
169
+ alg = simOMPL.Algorithm.PDST
170
+ elseif algorithm == 'PRM' then
171
+ alg = simOMPL.Algorithm.PRM
172
+ elseif algorithm == 'PRMstar' then
173
+ alg = simOMPL.Algorithm.PRMstar
174
+ elseif algorithm == 'pRRT' then
175
+ alg = simOMPL.Algorithm.pRRT
176
+ elseif algorithm == 'pSBL' then
177
+ alg = simOMPL.Algorithm.pSBL
178
+ elseif algorithm == 'RRT' then
179
+ alg = simOMPL.Algorithm.RRT
180
+ elseif algorithm == 'RRTConnect' then
181
+ alg = simOMPL.Algorithm.RRTConnect
182
+ elseif algorithm == 'RRTstar' then
183
+ alg = simOMPL.Algorithm.RRTstar
184
+ elseif algorithm == 'SBL' then
185
+ alg = simOMPL.Algorithm.SBL
186
+ elseif algorithm == 'SPARS' then
187
+ alg = simOMPL.Algorithm.SPARS
188
+ elseif algorithm == 'SPARStwo' then
189
+ alg = simOMPL.Algorithm.SPARStwo
190
+ elseif algorithm == 'STRIDE' then
191
+ alg = simOMPL.Algorithm.STRIDE
192
+ elseif algorithm == 'TRRT' then
193
+ alg = simOMPL.Algorithm.TRRT
194
+ end
195
+ return alg
196
+ end
197
+
198
+ _getPathLength=function(path, jointHandles)
199
+ -- Returns the length of the path in configuration space
200
+ local d=0
201
+ local l=#jointHandles
202
+ local pc=#path/l
203
+ for i=1,pc-1,1 do
204
+ local config1, config2 = _beforeAfterConfigFromPath(path, i, l)
205
+ d=d+_getConfigDistance(jointHandles,config1,config2)
206
+ end
207
+ return d
208
+ end
209
+
210
+ _beforeAfterConfigFromPath=function(path, path_index, num_handles)
211
+ local config1 = {}
212
+ local config2 = {}
213
+ for i=1,num_handles,1 do
214
+ config1[i] = path[(path_index-1)*num_handles+i]
215
+ config2[i] = path[path_index*num_handles+i]
216
+ end
217
+ return config1, config2
218
+ end
219
+
220
+ _getPoseOnPath=function(pathHandle, relativeDistance)
221
+ local pos = sim.getPositionOnPath(pathHandle, relativeDistance)
222
+ local ori = sim.getOrientationOnPath(pathHandle, relativeDistance)
223
+ return pos, ori
224
+ end
225
+
226
+ getNonlinearPath=function(inInts,inFloats,inStrings,inBuffer)
227
+ algorithm = inStrings[1]
228
+ collisionHandle = inInts[1]
229
+ ignoreCollisions = inInts[2]
230
+ searchCntPerGoalConfig = inInts[3]
231
+ jointHandles = _sliceFromOffset(inInts, 3)
232
+ collisionPairs={collisionHandle, sim.handle_all}
233
+ if ignoreCollisions==1 then
234
+ collisionPairs=nil
235
+ end
236
+
237
+ local configCnt = #inFloats/#jointHandles
238
+ goalConfigs = {}
239
+ for i=1,configCnt,1 do
240
+ local config={}
241
+ for j=1,#jointHandles,1 do
242
+ table.insert(config, inFloats[((i-1) * #jointHandles)+j])
243
+ end
244
+ table.insert(goalConfigs, config)
245
+ end
246
+
247
+ -- Search a path from current config to a goal config.
248
+ path = _findPath(goalConfigs, searchCntPerGoalConfig, jointHandles, algorithm, collisionPairs)
249
+ if path == nil then
250
+ path = {}
251
+ end
252
+ return {},path,{},''
253
+ end
254
+
255
+ getPathFromCartesianPath=function(inInts,inFloats,inStrings,inBuffer)
256
+ pathHandle = inInts[1]
257
+ ikGroup = inInts[2]
258
+ ikTarget = inInts[3]
259
+ jointHandles = _sliceFromOffset(inInts, 3)
260
+ collisionPairs = nil--{collisionHandle, sim.handle_all}
261
+ orientationCorrection = inFloats
262
+
263
+ local initIkPos = sim.getObjectPosition(ikTarget, -1)
264
+ local initIkOri = sim.getObjectOrientation(ikTarget, -1)
265
+ local originalConfig = _getConfig(jointHandles)
266
+ local i = 0.05
267
+ local fullPath = {}
268
+ local failed = false
269
+
270
+ while i <= 1.0 do
271
+ pos, ori = _getPoseOnPath(pathHandle, i)
272
+ sim.setObjectPosition(ikTarget, -1, pos)
273
+ sim.setObjectOrientation(ikTarget, -1, ori)
274
+ intermediatePath = sim.generateIkPath(ikGroup,jointHandles,20,collisionPairs)
275
+ if intermediatePath == nil then
276
+ failed = true
277
+ break
278
+ end
279
+ for j=1,#intermediatePath,1 do
280
+ table.insert(fullPath, intermediatePath[j])
281
+ end
282
+ newConfig = {}
283
+ for j=#intermediatePath-#jointHandles+1,#intermediatePath,1 do
284
+ table.insert(newConfig, intermediatePath[j])
285
+ end
286
+ _setConfig(jointHandles, newConfig)
287
+ i = i + 0.05
288
+ end
289
+ _setConfig(jointHandles, originalConfig)
290
+ sim.setObjectPosition(ikTarget, -1, initIkPos)
291
+ sim.setObjectOrientation(ikTarget, -1, initIkOri)
292
+ if failed then
293
+ fullPath = {}
294
+ end
295
+ return {},fullPath,{},''
296
+ end
297
+
298
+ insertPathControlPoint=function(inInts,inFloats,inStrings,inBuffer)
299
+ local handle = inInts[1]
300
+ local ptCnt = inInts[2]
301
+ local floatSkip = 6
302
+ local ptData = {}
303
+ for i=1,ptCnt,1 do
304
+ local offset = (i-1)*floatSkip
305
+ local ctrPos = {inFloats[offset+1], inFloats[offset+2], inFloats[offset+3]}
306
+ local ctrOri = {inFloats[offset+4], inFloats[offset+5], inFloats[offset+6]}
307
+ local vel = 0
308
+ local virDist = 0
309
+ local bezierPointsAtControl = 20
310
+ local bazierInterpolFactor1 = 0.990
311
+ local bazierInterpolFactor2 = 0.990
312
+ local auxFlags = 0
313
+ table.insert(ptData, ctrPos[1])
314
+ table.insert(ptData, ctrPos[2])
315
+ table.insert(ptData, ctrPos[3])
316
+ table.insert(ptData, ctrOri[1])
317
+ table.insert(ptData, ctrOri[2])
318
+ table.insert(ptData, ctrOri[3])
319
+ table.insert(ptData, vel)
320
+ table.insert(ptData, virDist)
321
+ table.insert(ptData, bezierPointsAtControl)
322
+ table.insert(ptData, bazierInterpolFactor1)
323
+ table.insert(ptData, bazierInterpolFactor2)
324
+ end
325
+ res = sim.insertPathCtrlPoints(handle, 0, 0, ptCnt, ptData)
326
+ return {},{},{},''
327
+ end
328
+
329
+ getBoxAdjustedMatrixAndFacingAngle=function(inInts,inFloats,inStrings,inBuffer)
330
+ local baseHandle = inInts[1]
331
+ local targetHandle = inInts[2]
332
+ local p2=sim.getObjectPosition(targetHandle,-1)
333
+ local p1=sim.getObjectPosition(baseHandle,-1)
334
+ local p={p2[1]-p1[1],p2[2]-p1[2],p2[3]-p1[3]}
335
+ local pl=math.sqrt(p[1]*p[1]+p[2]*p[2]+p[3]*p[3])
336
+ p[1]=p[1]/pl
337
+ p[2]=p[2]/pl
338
+ p[3]=p[3]/pl
339
+ local m=sim.getObjectMatrix(targetHandle,-1)
340
+ local matchingScore=0
341
+ for i=1,3,1 do
342
+ v={m[0+i],m[4+i],m[8+i]}
343
+ score=v[1]*p[1]+v[2]*p[2]+v[3]*p[3]
344
+ if (math.abs(score)>matchingScore) then
345
+ s=1
346
+ if (score<0) then s=-1 end
347
+ matchingScore=math.abs(score)
348
+ bestMatch={v[1]*s,v[2]*s,v[3]*s}
349
+ end
350
+ end
351
+ angle=math.atan2(bestMatch[2],bestMatch[1])
352
+ m=sim.buildMatrix(p2,{0,0,angle})
353
+
354
+ table.insert(m,angle-math.pi/2)
355
+
356
+ return {},m,{},''
357
+ end
358
+
359
+ getNonlinearPathMobile=function(inInts,inFloats,inStrings,inBuffer)
360
+ algorithm = inStrings[1]
361
+ robotHandle = inInts[1]
362
+ targetHandle = inInts[2]
363
+ collisionHandle=inInts[3]
364
+ ignoreCollisions=inInts[4]
365
+ bd=inFloats[1]
366
+ path_pts=inInts[5]
367
+
368
+ collisionPairs={collisionHandle,sim.handle_all}
369
+
370
+ if ignoreCollisions==1 then
371
+ collisionPairs=nil
372
+ end
373
+
374
+ t=simOMPL.createTask('t')
375
+ simOMPL.setVerboseLevel(t, 0)
376
+ ss=simOMPL.createStateSpace('2d',simOMPL.StateSpaceType.dubins,robotHandle,{-bd,-bd},{bd,bd},1)
377
+ state_h = simOMPL.setStateSpace(t,{ss})
378
+ simOMPL.setDubinsParams(ss,0.1,true)
379
+ simOMPL.setAlgorithm(t,_getAlgorithm(algorithm))
380
+
381
+ if collisionPairs ~= nil then
382
+ simOMPL.setCollisionPairs(t, collisionPairs)
383
+ end
384
+
385
+ startpos=sim.getObjectPosition(robotHandle,-1)
386
+ startorient=sim.getObjectOrientation(robotHandle,-1)
387
+ startpose={startpos[1],startpos[2],startorient[3]}
388
+
389
+ simOMPL.setStartState(t,startpose)
390
+
391
+ goalpos=sim.getObjectPosition(targetHandle,-1)
392
+ goalorient=sim.getObjectOrientation(targetHandle,-1)
393
+ goalpose={goalpos[1],goalpos[2],goalorient[3]}
394
+
395
+ simOMPL.setGoalState(t,goalpose)
396
+
397
+ r,path=simOMPL.compute(t,4,-1,path_pts)
398
+
399
+ simOMPL.destroyTask(t)
400
+
401
+ return {},path,{},''
402
+ end
403
+
404
+ handleSpherical=function(inInts,inFloats,inStrings,inBuffer)
405
+ local depth_handle=inInts[1]
406
+ local rgb_handle=inInts[2]
407
+ local six_sensor_handles = {inInts[3], inInts[4], inInts[5], inInts[6], inInts[7], inInts[8]}
408
+ simVision.handleSpherical(rgb_handle, six_sensor_handles, 360, 180, depth_handle)
409
+ return {},{},{},''
410
+ end
external/pyrep/pyrep/backend/simConst.py ADDED
@@ -0,0 +1,1726 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is automatically generated by generate_simConst.py from simConst.h
2
+
3
+ SIM_PROGRAM_VERSION_NB = 40100
4
+ SIM_PROGRAM_REVISION_NB = 1
5
+ SIMX_VERSION = 11
6
+ SIMX_HEADER_SIZE = 18
7
+ simx_headeroffset_crc = 0
8
+ simx_headeroffset_version = 2
9
+ simx_headeroffset_message_id = 3
10
+ simx_headeroffset_client_time = 7
11
+ simx_headeroffset_server_time = 11
12
+ simx_headeroffset_scene_id = 15
13
+ simx_headeroffset_server_state = 17
14
+ SIMX_SUBHEADER_SIZE = 26
15
+ simx_cmdheaderoffset_mem_size = 0
16
+ simx_cmdheaderoffset_full_mem_size = 4
17
+ simx_cmdheaderoffset_pdata_offset0 = 8
18
+ simx_cmdheaderoffset_pdata_offset1 = 10
19
+ simx_cmdheaderoffset_cmd = 14
20
+ simx_cmdheaderoffset_delay_or_split = 18
21
+ simx_cmdheaderoffset_sim_time = 20
22
+ simx_cmdheaderoffset_status = 24
23
+ simx_cmdheaderoffset_reserved = 25
24
+ sim_object_shape_type = 0
25
+ sim_object_joint_type = 1
26
+ sim_object_graph_type = 2
27
+ sim_object_camera_type = 3
28
+ sim_object_dummy_type = 4
29
+ sim_object_proximitysensor_type = 5
30
+ sim_object_reserved1 = 6
31
+ sim_object_reserved2 = 7
32
+ sim_object_path_type = 8
33
+ sim_object_visionsensor_type = 9
34
+ sim_object_reserved3 = 10
35
+ sim_object_mill_type = 11
36
+ sim_object_forcesensor_type = 12
37
+ sim_object_light_type = 13
38
+ sim_object_mirror_type = 14
39
+ sim_object_octree_type = 15
40
+ sim_object_pointcloud_type = 16
41
+ sim_object_type_end = 108
42
+
43
+ sim_appobj_object_type = 109
44
+ sim_appobj_collision_type = 110
45
+ sim_appobj_distance_type = 111
46
+ sim_appobj_simulation_type = 112
47
+ sim_appobj_ik_type = 113
48
+ sim_appobj_constraintsolver_type_old = 114
49
+ sim_appobj_collection_type = 115
50
+ sim_appobj_ui_type = 116
51
+ sim_appobj_script_type = 117
52
+ sim_appobj_pathplanning_type = 118
53
+ sim_appobj_RESERVED_type = 119
54
+ sim_appobj_texture_type = 120
55
+ sim_appobj_motionplanning_type_old = 121
56
+
57
+ sim_ik_pseudo_inverse_method = 0
58
+ sim_ik_damped_least_squares_method = 1
59
+ sim_ik_jacobian_transpose_method = 2
60
+
61
+ sim_ik_x_constraint = 1
62
+ sim_ik_y_constraint = 2
63
+ sim_ik_z_constraint = 4
64
+ sim_ik_alpha_beta_constraint = 8
65
+ sim_ik_gamma_constraint = 16
66
+ sim_ik_avoidance_constraint_old = 64
67
+
68
+ sim_ikresult_not_performed = 0
69
+ sim_ikresult_success = 1
70
+ sim_ikresult_fail = 2
71
+
72
+ sim_light_omnidirectional_subtype = 1
73
+ sim_light_spot_subtype = 2
74
+ sim_light_directional_subtype = 3
75
+ sim_joint_revolute_subtype = 10
76
+ sim_joint_prismatic_subtype = 11
77
+ sim_joint_spherical_subtype = 12
78
+ sim_shape_simpleshape_subtype = 20
79
+ sim_shape_multishape_subtype = 21
80
+ sim_proximitysensor_pyramid_subtype = 30
81
+ sim_proximitysensor_cylinder_subtype = 31
82
+ sim_proximitysensor_disc_subtype = 32
83
+ sim_proximitysensor_cone_subtype = 33
84
+ sim_proximitysensor_ray_subtype = 34
85
+ sim_mill_pyramid_subtype = 40
86
+ sim_mill_cylinder_subtype = 41
87
+ sim_mill_disc_subtype = 42
88
+ sim_mill_cone_subtype = 43
89
+ sim_object_no_subtype = 200
90
+
91
+ sim_objectspecialproperty_collidable = 1
92
+ sim_objectspecialproperty_measurable = 2
93
+ sim_objectspecialproperty_detectable_ultrasonic = 16
94
+ sim_objectspecialproperty_detectable_infrared = 32
95
+ sim_objectspecialproperty_detectable_laser = 64
96
+ sim_objectspecialproperty_detectable_inductive = 128
97
+ sim_objectspecialproperty_detectable_capacitive = 256
98
+ sim_objectspecialproperty_renderable = 512
99
+ sim_objectspecialproperty_detectable_all = 496
100
+ sim_objectspecialproperty_cuttable_old = 1024
101
+ sim_objectspecialproperty_pathplanning_ignored = 2048
102
+
103
+ sim_modelproperty_not_collidable = 1
104
+ sim_modelproperty_not_measurable = 2
105
+ sim_modelproperty_not_renderable = 4
106
+ sim_modelproperty_not_detectable = 8
107
+ sim_modelproperty_not_cuttable_old = 16
108
+ sim_modelproperty_not_dynamic = 32
109
+ sim_modelproperty_not_respondable = 64
110
+ sim_modelproperty_not_reset = 128
111
+ sim_modelproperty_not_visible = 256
112
+ sim_modelproperty_scripts_inactive = 512
113
+ sim_modelproperty_not_showasinsidemodel = 1024
114
+ sim_modelproperty_not_model = 61440
115
+
116
+ sim_message_ui_button_state_change = 0
117
+ sim_message_reserved9 = 1
118
+ sim_message_object_selection_changed = 2
119
+ sim_message_reserved10 = 3
120
+ sim_message_model_loaded = 4
121
+ sim_message_reserved11 = 5
122
+ sim_message_keypress = 6
123
+ sim_message_bannerclicked = 7
124
+ sim_message_scene_loaded = 8
125
+ sim_message_prox_sensor_select_down = 9
126
+ sim_message_prox_sensor_select_up = 10
127
+ sim_message_pick_select_down = 11
128
+ sim_message_for_c_api_only_start = 256
129
+ sim_message_reserved1 = 257
130
+ sim_message_reserved2 = 258
131
+ sim_message_reserved3 = 259
132
+ sim_message_eventcallback_scenesave = 260
133
+ sim_message_eventcallback_modelsave = 261
134
+ sim_message_eventcallback_moduleopen = 262
135
+ sim_message_eventcallback_modulehandle = 263
136
+ sim_message_eventcallback_moduleclose = 264
137
+ sim_message_reserved4 = 265
138
+ sim_message_reserved5 = 266
139
+ sim_message_reserved6 = 267
140
+ sim_message_reserved7 = 268
141
+ sim_message_eventcallback_instancepass = 269
142
+ sim_message_eventcallback_broadcast = 270
143
+ sim_message_eventcallback_imagefilter_enumreset = 271
144
+ sim_message_eventcallback_imagefilter_enumerate = 272
145
+ sim_message_eventcallback_imagefilter_adjustparams = 273
146
+ sim_message_eventcallback_imagefilter_reserved = 274
147
+ sim_message_eventcallback_imagefilter_process = 275
148
+ sim_message_eventcallback_reserved1 = 276
149
+ sim_message_eventcallback_reserved2 = 277
150
+ sim_message_eventcallback_reserved3 = 278
151
+ sim_message_eventcallback_reserved4 = 279
152
+ sim_message_eventcallback_abouttoundo = 280
153
+ sim_message_eventcallback_undoperformed = 281
154
+ sim_message_eventcallback_abouttoredo = 282
155
+ sim_message_eventcallback_redoperformed = 283
156
+ sim_message_eventcallback_scripticondblclick = 284
157
+ sim_message_eventcallback_simulationabouttostart = 285
158
+ sim_message_eventcallback_simulationended = 286
159
+ sim_message_eventcallback_reserved5 = 287
160
+ sim_message_eventcallback_keypress = 288
161
+ sim_message_eventcallback_modulehandleinsensingpart = 289
162
+ sim_message_eventcallback_renderingpass = 290
163
+ sim_message_eventcallback_bannerclicked = 291
164
+ sim_message_eventcallback_menuitemselected = 292
165
+ sim_message_eventcallback_refreshdialogs = 293
166
+ sim_message_eventcallback_sceneloaded = 294
167
+ sim_message_eventcallback_modelloaded = 295
168
+ sim_message_eventcallback_instanceswitch = 296
169
+ sim_message_eventcallback_guipass = 297
170
+ sim_message_eventcallback_mainscriptabouttobecalled = 298
171
+ sim_message_eventcallback_rmlposition = 299
172
+ sim_message_eventcallback_rmlvelocity = 300
173
+ sim_message_eventcallback_reserved18 = 301
174
+ sim_message_eventcallback_reserved19 = 302
175
+ sim_message_eventcallback_pathplanningplugin = 303
176
+ sim_message_eventcallback_colladaplugin = 304
177
+ sim_message_eventcallback_opengl = 305
178
+ sim_message_eventcallback_openglframe = 306
179
+ sim_message_eventcallback_openglcameraview = 307
180
+ sim_message_eventcallback_proxsensorselectdown = 308
181
+ sim_message_eventcallback_proxsensorselectup = 309
182
+ sim_message_eventcallback_pickselectdown = 310
183
+ sim_message_eventcallback_rmlpos = 311
184
+ sim_message_eventcallback_rmlvel = 312
185
+ sim_message_eventcallback_rmlstep = 313
186
+ sim_message_eventcallback_rmlremove = 314
187
+ sim_message_eventcallback_rmlinfo = 315
188
+ sim_message_eventcallback_beforerendering = 316
189
+ sim_message_eventcallback_extrenderer_start = 317
190
+ sim_message_eventcallback_extrenderer_light = 318
191
+ sim_message_eventcallback_extrenderer_mesh = 319
192
+ sim_message_eventcallback_extrenderer_stop = 320
193
+ sim_message_eventcallback_reserved6 = 321
194
+ sim_message_eventcallback_reserved7 = 322
195
+ sim_message_eventcallback_reserved8 = 323
196
+ sim_message_eventcallback_reserved9 = 324
197
+ sim_message_eventcallback_reserved10 = 325
198
+ sim_message_eventcallback_reserved11 = 326
199
+ sim_message_eventcallback_reserved12 = 327
200
+ sim_message_eventcallback_reserved13 = 328
201
+ sim_message_eventcallback_reserved14 = 329
202
+ sim_message_eventcallback_reserved15 = 330
203
+ sim_message_eventcallback_reserved16 = 331
204
+ sim_message_eventcallback_reserved17 = 332
205
+ sim_message_eventcallback_extrenderer_triangles = 333
206
+ sim_message_eventcallback_simulationabouttoend = 334
207
+ sim_message_eventcallback_instanceabouttoswitch = 335
208
+ sim_message_eventcallback_lastinstancepass = 336
209
+ sim_message_eventcallback_uipass = 337
210
+ sim_message_simulation_start_resume_request = 4096
211
+ sim_message_simulation_pause_request = 4097
212
+ sim_message_simulation_stop_request = 4098
213
+
214
+ sim_displayattribute_renderpass = 1
215
+ sim_displayattribute_depthpass = 2
216
+ sim_displayattribute_pickpass = 4
217
+ sim_displayattribute_selected = 8
218
+ sim_displayattribute_groupselection_old = 16
219
+ sim_displayattribute_mainselection = 32
220
+ sim_displayattribute_forcewireframe = 64
221
+ sim_displayattribute_forbidwireframe = 128
222
+ sim_displayattribute_forbidedges = 256
223
+ sim_displayattribute_originalcolors = 512
224
+ sim_displayattribute_ignorelayer = 1024
225
+ sim_displayattribute_forvisionsensor = 2048
226
+ sim_displayattribute_colorcodedpickpass = 4096
227
+ sim_displayattribute_colorcoded = 8192
228
+ sim_displayattribute_trianglewireframe = 16384
229
+ sim_displayattribute_inertiaonly = 32768
230
+ sim_displayattribute_thickEdges = 65536
231
+ sim_displayattribute_dynamiccontentonly = 131072
232
+ sim_displayattribute_mirror = 262144
233
+ sim_displayattribute_useauxcomponent = 524288
234
+ sim_displayattribute_ignorerenderableflag = 1048576
235
+ sim_displayattribute_noopenglcallbacks = 2097152
236
+ sim_displayattribute_FREE = 4194304
237
+ sim_displayattribute_noghosts = 8388608
238
+ sim_displayattribute_nopointclouds = 16777216
239
+ sim_displayattribute_nodrawingobjects = 33554432
240
+ sim_displayattribute_noparticles = 67108864
241
+ sim_displayattribute_colorcodedtriangles = 134217728
242
+
243
+ sim_objectproperty_reserved1 = 0
244
+ sim_objectproperty_reserved2 = 1
245
+ sim_objectproperty_reserved3 = 2
246
+ sim_objectproperty_reserved4 = 3
247
+ sim_objectproperty_reserved5 = 4
248
+ sim_objectproperty_reserved6 = 8
249
+ sim_objectproperty_collapsed = 16
250
+ sim_objectproperty_selectable = 32
251
+ sim_objectproperty_reserved7 = 64
252
+ sim_objectproperty_selectmodelbaseinstead = 128
253
+ sim_objectproperty_dontshowasinsidemodel = 256
254
+ sim_objectproperty_canupdatedna = 1024
255
+ sim_objectproperty_selectinvisible = 2048
256
+ sim_objectproperty_depthinvisible = 4096
257
+ sim_objectproperty_cannotdelete = 8192
258
+ sim_objectproperty_cannotdeleteduringsim = 16384
259
+
260
+ sim_lua_arg_nil = 0
261
+ sim_lua_arg_bool = 1
262
+ sim_lua_arg_int = 2
263
+ sim_lua_arg_float = 3
264
+ sim_lua_arg_string = 4
265
+ sim_lua_arg_invalid = 5
266
+ sim_lua_arg_charbuff = 6
267
+ sim_lua_arg_double = 7
268
+ sim_lua_arg_table = 8
269
+
270
+ sim_script_arg_null = 0
271
+ sim_script_arg_bool = 1
272
+ sim_script_arg_int32 = 2
273
+ sim_script_arg_float = 3
274
+ sim_script_arg_string = 4
275
+ sim_script_arg_invalid = 5
276
+ sim_script_arg_charbuff = 6
277
+ sim_script_arg_double = 7
278
+ sim_script_arg_table = 8
279
+
280
+ sim_ui_menu_title = 1
281
+ sim_ui_menu_minimize = 2
282
+ sim_ui_menu_close = 4
283
+ sim_ui_menu_systemblock = 8
284
+
285
+ sim_ui_property_visible = 1
286
+ sim_ui_property_visibleduringsimulationonly = 2
287
+ sim_ui_property_moveable = 4
288
+ sim_ui_property_relativetoleftborder = 8
289
+ sim_ui_property_relativetotopborder = 16
290
+ sim_ui_property_fixedwidthfont = 32
291
+ sim_ui_property_systemblock = 64
292
+ sim_ui_property_settocenter = 128
293
+ sim_ui_property_rolledup = 256
294
+ sim_ui_property_selectassociatedobject = 512
295
+ sim_ui_property_visiblewhenobjectselected = 1024
296
+ sim_ui_property_systemblockcanmovetofront = 2048
297
+ sim_ui_property_pauseactive = 4096
298
+
299
+ sim_buttonproperty_button = 0
300
+ sim_buttonproperty_label = 1
301
+ sim_buttonproperty_slider = 2
302
+ sim_buttonproperty_editbox = 3
303
+ sim_buttonproperty_staydown = 8
304
+ sim_buttonproperty_enabled = 16
305
+ sim_buttonproperty_borderless = 32
306
+ sim_buttonproperty_horizontallycentered = 64
307
+ sim_buttonproperty_ignoremouse = 128
308
+ sim_buttonproperty_isdown = 256
309
+ sim_buttonproperty_transparent = 512
310
+ sim_buttonproperty_nobackgroundcolor = 1024
311
+ sim_buttonproperty_rollupaction = 2048
312
+ sim_buttonproperty_closeaction = 4096
313
+ sim_buttonproperty_verticallycentered = 8192
314
+ sim_buttonproperty_downupevent = 16384
315
+
316
+ sim_simulation_stopped = 0
317
+ sim_simulation_paused = 8
318
+ sim_simulation_advancing = 16
319
+ sim_simulation_advancing_firstafterstop = 16
320
+ sim_simulation_advancing_running = 17
321
+ sim_simulation_advancing_lastbeforepause = 19
322
+ sim_simulation_advancing_firstafterpause = 20
323
+ sim_simulation_advancing_abouttostop = 21
324
+ sim_simulation_advancing_lastbeforestop = 22
325
+
326
+ sim_script_no_error = 0
327
+ sim_script_main_script_nonexistent = 1
328
+ sim_script_main_script_not_called = 2
329
+ sim_script_reentrance_error = 4
330
+ sim_script_lua_error = 8
331
+ sim_script_call_error = 16
332
+
333
+ sim_scripttype_mainscript = 0
334
+ sim_scripttype_childscript = 1
335
+ sim_scripttype_addonscript = 2
336
+ sim_scripttype_addonfunction = 3
337
+ sim_scripttype_jointctrlcallback_old = 4
338
+ sim_scripttype_contactcallback_old = 5
339
+ sim_scripttype_customizationscript = 6
340
+ sim_scripttype_generalcallback_old = 7
341
+ sim_scripttype_sandboxscript = 8
342
+ sim_scripttype_threaded = 240
343
+
344
+ sim_syscb_init = 0
345
+ sim_syscb_cleanup = 1
346
+ sim_syscb_nonsimulation = 2
347
+ sim_syscb_beforesimulation = 3
348
+ sim_syscb_aftersimulation = 4
349
+ sim_syscb_actuation = 5
350
+ sim_syscb_sensing = 6
351
+ sim_syscb_suspended = 7
352
+ sim_syscb_suspend = 8
353
+ sim_syscb_resume = 9
354
+ sim_syscb_beforeinstanceswitch = 10
355
+ sim_syscb_afterinstanceswitch = 11
356
+ sim_syscb_beforecopy = 12
357
+ sim_syscb_aftercopy = 13
358
+ sim_syscb_aos_run = 14
359
+ sim_syscb_aos_suspend = 15
360
+ sim_syscb_aos_resume = 16
361
+ sim_syscb_jointcallback = 17
362
+ sim_syscb_contactcallback = 18
363
+ sim_syscb_customcallback1 = 19
364
+ sim_syscb_customcallback2 = 20
365
+ sim_syscb_customcallback3 = 21
366
+ sim_syscb_customcallback4 = 22
367
+ sim_syscb_beforedelete = 23
368
+ sim_syscb_afterdelete = 24
369
+ sim_syscb_aftercreate = 25
370
+ sim_syscb_threadmain = 26
371
+ sim_syscb_dyncallback = 27
372
+ sim_syscb_beforemainscript = 28
373
+ sim_syscb_vision = 29
374
+ sim_syscb_trigger = 30
375
+ sim_syscb_userconfig = 31
376
+ sim_syscb_xr = 200
377
+ sim_syscb_br = 200
378
+
379
+ sim_customizationscriptattribute_activeduringsimulation = 0
380
+ sim_scriptattribute_executionorder = 1
381
+ sim_scriptattribute_executioncount = 2
382
+ sim_childscriptattribute_automaticcascadingcalls = 3
383
+ sim_scriptattribute_enabled = 4
384
+ sim_childscriptattribute_enabled = 4
385
+ sim_customizationscriptattribute_cleanupbeforesave = 5
386
+ sim_scriptattribute_debuglevel = 6
387
+ sim_scriptattribute_scripttype = 7
388
+
389
+ sim_scriptexecorder_first = 0
390
+ sim_scriptexecorder_normal = 1
391
+ sim_scriptexecorder_last = 2
392
+
393
+ sim_scripttreetraversal_reverse = 0
394
+ sim_scripttreetraversal_forward = 1
395
+ sim_scripttreetraversal_parent = 2
396
+
397
+ sim_scriptdebug_none = 0
398
+ sim_scriptdebug_syscalls = 1
399
+ sim_scriptdebug_vars_interval = 2
400
+ sim_scriptdebug_allcalls = 3
401
+ sim_scriptdebug_vars = 4
402
+ sim_scriptdebug_callsandvars = 5
403
+
404
+ sim_scriptthreadresume_launch = -2
405
+ sim_scriptthreadresume_allnotyetresumed = -1
406
+ sim_scriptthreadresume_default = 0
407
+ sim_scriptthreadresume_actuation_first = 1
408
+ sim_scriptthreadresume_actuation_last = 2
409
+ sim_scriptthreadresume_sensing_first = 3
410
+ sim_scriptthreadresume_sensing_last = 4
411
+ sim_scriptthreadresume_custom = 5
412
+
413
+ sim_callbackid_rossubscriber = 1
414
+ sim_callbackid_dynstep = 2
415
+ sim_callbackid_userdefined = 1000
416
+
417
+ sim_api_error_report = 1
418
+ sim_api_error_output = 2
419
+ sim_api_warning_output = 4
420
+ sim_api_errormessage_ignore = 0
421
+ sim_api_errormessage_report = 1
422
+ sim_api_errormessage_output = 2
423
+
424
+ sim_handle_all = -2
425
+ sim_handle_all_except_explicit = -3
426
+ sim_handle_self = -4
427
+ sim_handle_main_script = -5
428
+ sim_handle_tree = -6
429
+ sim_handle_chain = -7
430
+ sim_handle_single = -8
431
+ sim_handle_default = -9
432
+ sim_handle_all_except_self = -10
433
+ sim_handle_parent = -11
434
+ sim_handle_scene = -12
435
+ sim_handle_app = -13
436
+
437
+ sim_handleflag_assembly = 4194304
438
+ sim_handleflag_togglevisibility = 4194304
439
+ sim_handleflag_extended = 4194304
440
+ sim_handleflag_greyscale = 4194304
441
+ sim_handleflag_codedstring = 4194304
442
+ sim_handleflag_wxyzquaternion = 4194304
443
+ sim_handleflag_reljointbaseframe = 4194304
444
+ sim_handleflag_abscoords = 8388608
445
+ sim_handleflag_depthbuffer = 8388608
446
+ sim_handleflag_depthbuffermeters = 8388608
447
+ sim_handleflag_keeporiginal = 4194304
448
+ sim_handleflag_camera = 4194304
449
+ sim_handleflag_altname = 4194304
450
+ sim_handleflag_axis = 4194304
451
+ sim_handleflag_resetforce = 4194304
452
+ sim_handleflag_resettorque = 8388608
453
+ sim_handleflag_resetforcetorque = 12582912
454
+ sim_handleflag_model = 8388608
455
+ sim_handleflag_rawvalue = 16777216
456
+ sim_handleflag_silenterror = 33554432
457
+
458
+ sim_distcalcmethod_dl = 0
459
+ sim_distcalcmethod_dac = 1
460
+ sim_distcalcmethod_max_dl_dac = 2
461
+ sim_distcalcmethod_dl_and_dac = 3
462
+ sim_distcalcmethod_sqrt_dl2_and_dac2 = 4
463
+ sim_distcalcmethod_dl_if_nonzero = 5
464
+ sim_distcalcmethod_dac_if_nonzero = 6
465
+
466
+ sim_dlgstyle_message = 0
467
+ sim_dlgstyle_input = 1
468
+ sim_dlgstyle_ok = 2
469
+ sim_dlgstyle_ok_cancel = 3
470
+ sim_dlgstyle_yes_no = 4
471
+ sim_dlgstyle_dont_center = 32
472
+
473
+ sim_dlgret_still_open = 0
474
+ sim_dlgret_ok = 1
475
+ sim_dlgret_cancel = 2
476
+ sim_dlgret_yes = 3
477
+ sim_dlgret_no = 4
478
+
479
+ sim_pathproperty_show_line = 1
480
+ sim_pathproperty_show_orientation = 2
481
+ sim_pathproperty_closed_path = 4
482
+ sim_pathproperty_automatic_orientation = 8
483
+ sim_pathproperty_invert_velocity_deprecated = 16
484
+ sim_pathproperty_infinite_acceleration_deprecated = 32
485
+ sim_pathproperty_flat_path = 64
486
+ sim_pathproperty_show_position = 128
487
+ sim_pathproperty_auto_velocity_profile_translation_deprecated = 256
488
+ sim_pathproperty_auto_velocity_profile_rotation_deprecated = 512
489
+ sim_pathproperty_endpoints_at_zero_deprecated = 1024
490
+ sim_pathproperty_keep_x_up = 2048
491
+
492
+ sim_drawing_points = 0
493
+ sim_drawing_lines = 1
494
+ sim_drawing_triangles = 2
495
+ sim_drawing_trianglepoints = 3
496
+ sim_drawing_quadpoints = 4
497
+ sim_drawing_discpoints = 5
498
+ sim_drawing_cubepoints = 6
499
+ sim_drawing_spherepoints = 7
500
+ sim_drawing_itemcolors = 32
501
+ sim_drawing_vertexcolors = 64
502
+ sim_drawing_itemsizes = 128
503
+ sim_drawing_backfaceculling = 256
504
+ sim_drawing_wireframe = 512
505
+ sim_drawing_painttag = 1024
506
+ sim_drawing_followparentvisibility = 2048
507
+ sim_drawing_cyclic = 4096
508
+ sim_drawing_50percenttransparency = 8192
509
+ sim_drawing_25percenttransparency = 16384
510
+ sim_drawing_12percenttransparency = 32768
511
+ sim_drawing_emissioncolor = 65536
512
+ sim_drawing_facingcamera = 131072
513
+ sim_drawing_overlay = 262144
514
+ sim_drawing_itemtransparency = 524288
515
+ sim_drawing_persistent = 1048576
516
+ sim_drawing_auxchannelcolor1 = 2097152
517
+ sim_drawing_auxchannelcolor2 = 4194304
518
+
519
+ sim_banner_left = 1
520
+ sim_banner_right = 2
521
+ sim_banner_nobackground = 4
522
+ sim_banner_overlay = 8
523
+ sim_banner_followparentvisibility = 16
524
+ sim_banner_clickselectsparent = 32
525
+ sim_banner_clicktriggersevent = 64
526
+ sim_banner_facingcamera = 128
527
+ sim_banner_fullyfacingcamera = 256
528
+ sim_banner_backfaceculling = 512
529
+ sim_banner_keepsamesize = 1024
530
+ sim_banner_bitmapfont = 2048
531
+
532
+ sim_particle_points1 = 0
533
+ sim_particle_points2 = 1
534
+ sim_particle_points4 = 2
535
+ sim_particle_roughspheres = 3
536
+ sim_particle_spheres = 4
537
+ sim_particle_respondable1to4 = 32
538
+ sim_particle_respondable5to8 = 64
539
+ sim_particle_particlerespondable = 128
540
+ sim_particle_ignoresgravity = 256
541
+ sim_particle_invisible = 512
542
+ sim_particle_itemsizes = 1024
543
+ sim_particle_itemdensities = 2048
544
+ sim_particle_itemcolors = 4096
545
+ sim_particle_cyclic = 8192
546
+ sim_particle_emissioncolor = 16384
547
+ sim_particle_water = 32768
548
+ sim_particle_painttag = 65536
549
+
550
+ sim_boolparam_hierarchy_visible = 0
551
+ sim_boolparam_console_visible = 1
552
+ sim_boolparam_collision_handling_enabled = 2
553
+ sim_boolparam_distance_handling_enabled = 3
554
+ sim_boolparam_ik_handling_enabled = 4
555
+ sim_boolparam_gcs_handling_enabled = 5
556
+ sim_boolparam_dynamics_handling_enabled = 6
557
+ sim_boolparam_joint_motion_handling_enabled_deprecated = 7
558
+ sim_boolparam_path_motion_handling_enabled_deprecated = 8
559
+ sim_boolparam_proximity_sensor_handling_enabled = 9
560
+ sim_boolparam_vision_sensor_handling_enabled = 10
561
+ sim_boolparam_mill_handling_enabled = 11
562
+ sim_boolparam_browser_visible = 12
563
+ sim_boolparam_scene_and_model_load_messages = 13
564
+ sim_reserved0 = 14
565
+ sim_boolparam_shape_textures_are_visible = 15
566
+ sim_boolparam_display_enabled = 16
567
+ sim_boolparam_infotext_visible = 17
568
+ sim_boolparam_statustext_open = 18
569
+ sim_boolparam_fog_enabled = 19
570
+ sim_boolparam_rml2_available = 20
571
+ sim_boolparam_rml4_available = 21
572
+ sim_boolparam_mirrors_enabled = 22
573
+ sim_boolparam_aux_clip_planes_enabled = 23
574
+ sim_boolparam_reserved3 = 24
575
+ sim_boolparam_realtime_simulation = 25
576
+ sim_boolparam_use_glfinish_cmd = 26
577
+ sim_boolparam_force_show_wireless_emission = 27
578
+ sim_boolparam_force_show_wireless_reception = 28
579
+ sim_boolparam_video_recording_triggered = 29
580
+ sim_boolparam_reserved1 = 30
581
+ sim_boolparam_reserved2 = 31
582
+ sim_boolparam_threaded_rendering_enabled_old = 32
583
+ sim_boolparam_fullscreen = 33
584
+ sim_boolparam_headless = 34
585
+ sim_boolparam_hierarchy_toolbarbutton_enabled = 35
586
+ sim_boolparam_browser_toolbarbutton_enabled = 36
587
+ sim_boolparam_objectshift_toolbarbutton_enabled = 37
588
+ sim_boolparam_objectrotate_toolbarbutton_enabled = 38
589
+ sim_boolparam_force_calcstruct_all_visible = 39
590
+ sim_boolparam_force_calcstruct_all = 40
591
+ sim_boolparam_exit_request = 41
592
+ sim_boolparam_play_toolbarbutton_enabled = 42
593
+ sim_boolparam_pause_toolbarbutton_enabled = 43
594
+ sim_boolparam_stop_toolbarbutton_enabled = 44
595
+ sim_boolparam_waiting_for_trigger = 45
596
+ sim_boolparam_objproperties_toolbarbutton_enabled = 46
597
+ sim_boolparam_calcmodules_toolbarbutton_enabled = 47
598
+ sim_boolparam_rosinterface_donotrunmainscript = 48
599
+ sim_boolparam_online_mode = 49
600
+ sim_boolparam_xr_partrepository = 50
601
+ sim_boolparam_xr_palletrepository = 51
602
+ sim_boolparam_scene_closing = 52
603
+ sim_boolparam_show_w_emitters = 53
604
+ sim_boolparam_show_w_receivers = 54
605
+ sim_boolparam_xr_jobfunc = 55
606
+
607
+ sim_intparam_error_report_mode = 0
608
+ sim_intparam_program_version = 1
609
+ sim_intparam_instance_count = 2
610
+ sim_intparam_custom_cmd_start_id = 3
611
+ sim_intparam_compilation_version = 4
612
+ sim_intparam_current_page = 5
613
+ sim_intparam_flymode_camera_handle = 6
614
+ sim_intparam_dynamic_step_divider = 7
615
+ sim_intparam_dynamic_engine = 8
616
+ sim_intparam_server_port_start = 9
617
+ sim_intparam_server_port_range = 10
618
+ sim_intparam_visible_layers = 11
619
+ sim_intparam_infotext_style = 12
620
+ sim_intparam_settings = 13
621
+ sim_intparam_edit_mode_type = 14
622
+ sim_intparam_server_port_next = 15
623
+ sim_intparam_qt_version = 16
624
+ sim_intparam_event_flags_read_old = 17
625
+ sim_intparam_event_flags_read_clear_old = 18
626
+ sim_intparam_platform = 19
627
+ sim_intparam_scene_unique_id = 20
628
+ sim_intparam_work_thread_count = 21
629
+ sim_intparam_mouse_x = 22
630
+ sim_intparam_mouse_y = 23
631
+ sim_intparam_core_count = 24
632
+ sim_intparam_work_thread_calc_time_ms = 25
633
+ sim_intparam_idle_fps = 26
634
+ sim_intparam_prox_sensor_select_down = 27
635
+ sim_intparam_prox_sensor_select_up = 28
636
+ sim_intparam_stop_request_counter = 29
637
+ sim_intparam_program_revision = 30
638
+ sim_intparam_mouse_buttons = 31
639
+ sim_intparam_dynamic_warning_disabled_mask = 32
640
+ sim_intparam_simulation_warning_disabled_mask = 33
641
+ sim_intparam_scene_index = 34
642
+ sim_intparam_motionplanning_seed = 35
643
+ sim_intparam_speedmodifier = 36
644
+ sim_intparam_dynamic_iteration_count = 37
645
+ sim_intparam_job_count = 38
646
+ sim_intparam_program_full_version = 39
647
+ sim_intparam_verbosity = 40
648
+ sim_intparam_statusbarverbosity = 41
649
+ sim_intparam_dlgverbosity = 42
650
+ sim_intparam_videoencoder_index = 43
651
+
652
+ sim_uint64param_simulation_time_step_ns = 0
653
+ sim_uint64param_simulation_time_ns = 1
654
+
655
+ sim_floatparam_rand = 0
656
+ sim_floatparam_simulation_time_step = 1
657
+ sim_floatparam_stereo_distance = 2
658
+ sim_floatparam_dynamic_step_size = 3
659
+ sim_floatparam_mouse_wheel_zoom_factor = 4
660
+
661
+ sim_stringparam_application_path = 0
662
+ sim_stringparam_video_filename = 1
663
+ sim_stringparam_app_arg1 = 2
664
+ sim_stringparam_app_arg2 = 3
665
+ sim_stringparam_app_arg3 = 4
666
+ sim_stringparam_app_arg4 = 5
667
+ sim_stringparam_app_arg5 = 6
668
+ sim_stringparam_app_arg6 = 7
669
+ sim_stringparam_app_arg7 = 8
670
+ sim_stringparam_app_arg8 = 9
671
+ sim_stringparam_app_arg9 = 10
672
+ sim_stringparam_additional_addonscript1 = 11
673
+ sim_stringparam_additional_addonscript_firstscene = 11
674
+ sim_stringparam_additional_addonscript2 = 12
675
+ sim_stringparam_additional_addonscript = 12
676
+ sim_stringparam_scene_path_and_name = 13
677
+ sim_stringparam_scene_path = 14
678
+ sim_stringparam_scene_name = 15
679
+ sim_stringparam_remoteapi_temp_file_dir = 16
680
+ sim_stringparam_job = 17
681
+ sim_stringparam_job0 = 18
682
+ sim_stringparam_job99 = 117
683
+ sim_stringparam_scene_unique_id = 118
684
+ sim_stringparam_machine_id = 119
685
+ sim_stringparam_machine_id_legacy = 120
686
+ sim_stringparam_verbosity = 121
687
+ sim_stringparam_statusbarverbosity = 122
688
+ sim_stringparam_dlgverbosity = 123
689
+ sim_stringparam_consolelogfilter = 124
690
+ sim_stringparam_startupscriptstring = 125
691
+
692
+ sim_arrayparam_gravity = 0
693
+ sim_arrayparam_fog = 1
694
+ sim_arrayparam_fog_color = 2
695
+ sim_arrayparam_background_color1 = 3
696
+ sim_arrayparam_background_color2 = 4
697
+ sim_arrayparam_ambient_light = 5
698
+ sim_arrayparam_random_euler = 6
699
+
700
+ sim_gui_menubar = 1
701
+ sim_gui_popups = 2
702
+ sim_gui_toolbar1 = 4
703
+ sim_gui_toolbar2 = 8
704
+ sim_gui_hierarchy = 16
705
+ sim_gui_infobar = 32
706
+ sim_gui_statusbar = 64
707
+ sim_gui_scripteditor = 128
708
+ sim_gui_scriptsimulationparameters = 256
709
+ sim_gui_dialogs = 512
710
+ sim_gui_browser = 1024
711
+ sim_gui_all = 65535
712
+ sim_gui_headless = 65536
713
+ sim_autostart = 131072
714
+ sim_autoquit = 262144
715
+
716
+ sim_jointmode_passive = 0
717
+ sim_jointmode_motion_deprecated = 1
718
+ sim_jointmode_ik = 2
719
+ sim_jointmode_reserved_previously_ikdependent = 3
720
+ sim_jointmode_dependent = 4
721
+ sim_jointmode_force = 5
722
+
723
+ sim_verbosity_useglobal = -1
724
+ sim_verbosity_none = 100
725
+ sim_verbosity_errors = 200
726
+ sim_verbosity_warnings = 300
727
+ sim_verbosity_loadinfos = 400
728
+ sim_verbosity_questions = 410
729
+ sim_verbosity_scripterrors = 420
730
+ sim_verbosity_scriptwarnings = 430
731
+ sim_verbosity_scriptinfos = 450
732
+ sim_verbosity_msgs = 450
733
+ sim_verbosity_infos = 500
734
+ sim_verbosity_debug = 600
735
+ sim_verbosity_trace = 700
736
+ sim_verbosity_tracelua = 800
737
+ sim_verbosity_traceall = 900
738
+ sim_verbosity_default = 400
739
+ sim_verbosity_undecorated = 61440
740
+
741
+ sim_moduleinfo_extversionstr = 0
742
+ sim_moduleinfo_builddatestr = 1
743
+ sim_moduleinfo_extversionint = 2
744
+ sim_moduleinfo_verbosity = 3
745
+ sim_moduleinfo_statusbarverbosity = 4
746
+
747
+ sim_navigation_passive = 0
748
+ sim_navigation_camerashift = 1
749
+ sim_navigation_camerarotate = 2
750
+ sim_navigation_camerazoom = 3
751
+ sim_navigation_cameratilt = 4
752
+ sim_navigation_cameraangle = 5
753
+ sim_navigation_camerafly = 6
754
+ sim_navigation_objectshift = 7
755
+ sim_navigation_objectrotate = 8
756
+ sim_navigation_reserved2 = 9
757
+ sim_navigation_reserved3 = 10
758
+ sim_navigation_reserved4 = 11
759
+ sim_navigation_reserved5 = 12
760
+ sim_navigation_reserved6 = 13
761
+ sim_navigation_createpathpoint = 256
762
+ sim_navigation_clickselection = 512
763
+ sim_navigation_ctrlselection = 1024
764
+ sim_navigation_shiftselection = 2048
765
+ sim_navigation_camerazoomwheel = 4096
766
+ sim_navigation_camerarotaterightbutton = 8192
767
+ sim_navigation_camerarotatemiddlebutton = 8192
768
+
769
+ simrml_phase_sync_if_possible = 0
770
+ simrml_only_time_sync = 1
771
+ simrml_only_phase_sync = 2
772
+ simrml_no_sync = 3
773
+ simrml_keep_target_vel = 0
774
+ simrml_recompute_trajectory = 4
775
+ simrml_disable_extremum_motion_states_calc = 8
776
+ simrml_keep_current_vel_if_fallback_strategy = 16
777
+
778
+ sim_filedlg_type_load = 0
779
+ sim_filedlg_type_save = 1
780
+ sim_filedlg_type_load_multiple = 2
781
+ sim_filedlg_type_folder = 3
782
+
783
+ sim_msgbox_type_info = 0
784
+ sim_msgbox_type_question = 1
785
+ sim_msgbox_type_warning = 2
786
+ sim_msgbox_type_critical = 3
787
+
788
+ sim_msgbox_buttons_ok = 0
789
+ sim_msgbox_buttons_yesno = 1
790
+ sim_msgbox_buttons_yesnocancel = 2
791
+ sim_msgbox_buttons_okcancel = 3
792
+
793
+ sim_msgbox_return_cancel = 0
794
+ sim_msgbox_return_no = 1
795
+ sim_msgbox_return_yes = 2
796
+ sim_msgbox_return_ok = 3
797
+ sim_msgbox_return_error = 4
798
+
799
+ sim_physics_bullet = 0
800
+ sim_physics_ode = 1
801
+ sim_physics_vortex = 2
802
+ sim_physics_newton = 3
803
+
804
+ sim_pure_primitive_none = 0
805
+ sim_pure_primitive_plane = 1
806
+ sim_pure_primitive_disc = 2
807
+ sim_pure_primitive_cuboid = 3
808
+ sim_pure_primitive_spheroid = 4
809
+ sim_pure_primitive_cylinder = 5
810
+ sim_pure_primitive_cone = 6
811
+ sim_pure_primitive_heightfield = 7
812
+
813
+ sim_dummy_linktype_dynamics_loop_closure = 0
814
+ sim_dummy_linktype_dynamics_force_constraint = 1
815
+ sim_dummy_linktype_gcs_loop_closure = 2
816
+ sim_dummy_linktype_gcs_tip = 3
817
+ sim_dummy_linktype_gcs_target = 4
818
+ sim_dummy_linktype_ik_tip_target = 5
819
+ sim_dummy_linktype_reserved = 6
820
+
821
+ sim_texturemap_plane = 0
822
+ sim_texturemap_cylinder = 1
823
+ sim_texturemap_sphere = 2
824
+ sim_texturemap_cube = 3
825
+
826
+ sim_pathplanning_holonomic = 0
827
+ sim_pathplanning_reserved = 1
828
+ sim_pathplanning_nonholonomic = 2
829
+
830
+ sim_holonomicpathplanning_xy = 0
831
+ sim_holonomicpathplanning_xg = 1
832
+ sim_holonomicpathplanning_xyz = 2
833
+ sim_holonomicpathplanning_xyg = 3
834
+ sim_holonomicpathplanning_abg = 4
835
+ sim_holonomicpathplanning_xyzg = 5
836
+ sim_holonomicpathplanning_xabg = 6
837
+ sim_holonomicpathplanning_xyabg = 7
838
+ sim_holonomicpathplanning_xyzabg = 8
839
+
840
+ sim_lock_ui_wants_to_read = 0
841
+ sim_lock_ui_wants_to_write = 1
842
+ sim_lock_nonui_wants_to_write = 2
843
+
844
+ sim_colorcomponent_ambient = 0
845
+ sim_colorcomponent_ambient_diffuse = 0
846
+ sim_colorcomponent_diffuse = 1
847
+ sim_colorcomponent_specular = 2
848
+ sim_colorcomponent_emission = 3
849
+ sim_colorcomponent_transparency = 4
850
+ sim_colorcomponent_auxiliary = 5
851
+
852
+ sim_volume_pyramid = 0
853
+ sim_volume_cylinder = 1
854
+ sim_volume_disc = 2
855
+ sim_volume_cone = 3
856
+ sim_volume_ray = 4
857
+ sim_volume_randomizedray = 5
858
+
859
+ sim_pov_pattern_null = 0
860
+ sim_pov_white_marble = 1
861
+ sim_pov_blood_marble = 2
862
+ sim_pov_blue_agate = 3
863
+ sim_pov_sapphire_agate = 4
864
+ sim_pov_brown_agate = 5
865
+ sim_pov_pink_granite = 6
866
+ sim_pov_pink_alabaster = 7
867
+ sim_pov_cherry_wood = 8
868
+ sim_pov_pine_wood = 9
869
+ sim_pov_dark_wood = 10
870
+ sim_pov_tan_wood = 11
871
+ sim_pov_white_wood = 12
872
+ sim_pov_tom_wood = 13
873
+ sim_pov_dmf_wood1 = 14
874
+ sim_pov_dmf_wood2 = 15
875
+ sim_pov_dmf_wood3 = 16
876
+ sim_pov_dmf_wood4 = 17
877
+ sim_pov_dmf_wood5 = 18
878
+ sim_pov_dmf_wood6 = 19
879
+ sim_pov_dmf_light_oak = 20
880
+ sim_pov_dmf_dark_oak = 21
881
+ sim_pov_emb_wood1 = 22
882
+ sim_pov_yellow_pine = 23
883
+ sim_pov_rose_wood = 24
884
+ sim_pov_sandal_wood = 25
885
+ sim_pov_glass = 26
886
+ sim_pov_glass2 = 27
887
+ sim_pov_glass3 = 28
888
+ sim_pov_green_glass = 29
889
+ sim_pov_light_glass = 30
890
+ sim_pov_bold_glass = 31
891
+ sim_pov_wine_bottle = 32
892
+ sim_pov_beer_bottle = 33
893
+ sim_pov_ruby_glass = 34
894
+ sim_pov_blue_glass = 35
895
+ sim_pov_yellow_glass = 36
896
+ sim_pov_orange_glass = 37
897
+ sim_pov_vicks_bottle_glass = 38
898
+ sim_pov_chrome_metal = 39
899
+ sim_pov_brass_metal = 40
900
+ sim_pov_copper_metal = 41
901
+ sim_pov_bronze_metal = 42
902
+ sim_pov_silver_metal = 43
903
+ sim_pov_gold_metal = 44
904
+ sim_pov_polished_chrome = 45
905
+ sim_pov_polished_brass = 46
906
+ sim_pov_new_brass = 47
907
+ sim_pov_spun_brass = 48
908
+ sim_pov_brushed_aluminum = 49
909
+ sim_pov_silver1 = 50
910
+ sim_pov_silver2 = 51
911
+ sim_pov_silver3 = 52
912
+ sim_pov_brass_valley = 53
913
+ sim_pov_rust = 54
914
+ sim_pov_rusty_iron = 55
915
+ sim_pov_soft_silver = 56
916
+ sim_pov_new_penny = 57
917
+ sim_pov_tinny_brass = 58
918
+ sim_pov_gold_nugget = 59
919
+ sim_pov_aluminum = 60
920
+ sim_pov_bright_bronze = 61
921
+ sim_pov_water = 62
922
+ sim_pov_cork = 63
923
+ sim_pov_lightning = 64
924
+ sim_pov_mirror = 65
925
+
926
+ sim_objintparam_visibility_layer = 10
927
+ sim_objfloatparam_abs_x_velocity = 11
928
+ sim_objfloatparam_abs_y_velocity = 12
929
+ sim_objfloatparam_abs_z_velocity = 13
930
+ sim_objfloatparam_abs_rot_velocity = 14
931
+ sim_objfloatparam_objbbox_min_x = 15
932
+ sim_objfloatparam_objbbox_min_y = 16
933
+ sim_objfloatparam_objbbox_min_z = 17
934
+ sim_objfloatparam_objbbox_max_x = 18
935
+ sim_objfloatparam_objbbox_max_y = 19
936
+ sim_objfloatparam_objbbox_max_z = 20
937
+ sim_objfloatparam_modelbbox_min_x = 21
938
+ sim_objfloatparam_modelbbox_min_y = 22
939
+ sim_objfloatparam_modelbbox_min_z = 23
940
+ sim_objfloatparam_modelbbox_max_x = 24
941
+ sim_objfloatparam_modelbbox_max_y = 25
942
+ sim_objfloatparam_modelbbox_max_z = 26
943
+ sim_objintparam_collection_self_collision_indicator = 27
944
+ sim_objfloatparam_transparency_offset = 28
945
+ sim_objintparam_child_role = 29
946
+ sim_objintparam_parent_role = 30
947
+ sim_objintparam_manipulation_permissions = 31
948
+ sim_objintparam_illumination_handle = 32
949
+ sim_objstringparam_dna = 33
950
+ sim_objfloatparam_size_factor = 34
951
+ sim_objstringparam_unique_id = 35
952
+ sim_objintparam_visible = 36
953
+ sim_objparam_end = 999
954
+ sim_visionfloatparam_near_clipping = 1000
955
+ sim_visionfloatparam_far_clipping = 1001
956
+ sim_visionintparam_resolution_x = 1002
957
+ sim_visionintparam_resolution_y = 1003
958
+ sim_visionfloatparam_perspective_angle = 1004
959
+ sim_visionfloatparam_ortho_size = 1005
960
+ sim_visionintparam_disabled_light_components = 1006
961
+ sim_visionintparam_rendering_attributes = 1007
962
+ sim_visionintparam_entity_to_render = 1008
963
+ sim_visionintparam_windowed_size_x = 1009
964
+ sim_visionintparam_windowed_size_y = 1010
965
+ sim_visionintparam_windowed_pos_x = 1011
966
+ sim_visionintparam_windowed_pos_y = 1012
967
+ sim_visionintparam_pov_focal_blur = 1013
968
+ sim_visionfloatparam_pov_blur_distance = 1014
969
+ sim_visionfloatparam_pov_aperture = 1015
970
+ sim_visionintparam_pov_blur_sampled = 1016
971
+ sim_visionintparam_render_mode = 1017
972
+ sim_visionintparam_perspective_operation = 1018
973
+ sim_jointintparam_motor_enabled = 2000
974
+ sim_jointintparam_ctrl_enabled = 2001
975
+ sim_jointfloatparam_pid_p = 2002
976
+ sim_jointfloatparam_pid_i = 2003
977
+ sim_jointfloatparam_pid_d = 2004
978
+ sim_jointfloatparam_intrinsic_x = 2005
979
+ sim_jointfloatparam_intrinsic_y = 2006
980
+ sim_jointfloatparam_intrinsic_z = 2007
981
+ sim_jointfloatparam_intrinsic_qx = 2008
982
+ sim_jointfloatparam_intrinsic_qy = 2009
983
+ sim_jointfloatparam_intrinsic_qz = 2010
984
+ sim_jointfloatparam_intrinsic_qw = 2011
985
+ sim_jointfloatparam_velocity = 2012
986
+ sim_jointfloatparam_spherical_qx = 2013
987
+ sim_jointfloatparam_spherical_qy = 2014
988
+ sim_jointfloatparam_spherical_qz = 2015
989
+ sim_jointfloatparam_spherical_qw = 2016
990
+ sim_jointfloatparam_upper_limit = 2017
991
+ sim_jointfloatparam_kc_k = 2018
992
+ sim_jointfloatparam_kc_c = 2019
993
+ sim_jointfloatparam_ik_weight = 2021
994
+ sim_jointfloatparam_error_x = 2022
995
+ sim_jointfloatparam_error_y = 2023
996
+ sim_jointfloatparam_error_z = 2024
997
+ sim_jointfloatparam_error_a = 2025
998
+ sim_jointfloatparam_error_b = 2026
999
+ sim_jointfloatparam_error_g = 2027
1000
+ sim_jointfloatparam_error_pos = 2028
1001
+ sim_jointfloatparam_error_angle = 2029
1002
+ sim_jointintparam_velocity_lock = 2030
1003
+ sim_jointintparam_vortex_dep_handle = 2031
1004
+ sim_jointfloatparam_vortex_dep_multiplication = 2032
1005
+ sim_jointfloatparam_vortex_dep_offset = 2033
1006
+ sim_shapefloatparam_init_velocity_x = 3000
1007
+ sim_shapefloatparam_init_velocity_y = 3001
1008
+ sim_shapefloatparam_init_velocity_z = 3002
1009
+ sim_shapeintparam_static = 3003
1010
+ sim_shapeintparam_respondable = 3004
1011
+ sim_shapefloatparam_mass = 3005
1012
+ sim_shapefloatparam_texture_x = 3006
1013
+ sim_shapefloatparam_texture_y = 3007
1014
+ sim_shapefloatparam_texture_z = 3008
1015
+ sim_shapefloatparam_texture_a = 3009
1016
+ sim_shapefloatparam_texture_b = 3010
1017
+ sim_shapefloatparam_texture_g = 3011
1018
+ sim_shapefloatparam_texture_scaling_x = 3012
1019
+ sim_shapefloatparam_texture_scaling_y = 3013
1020
+ sim_shapeintparam_culling = 3014
1021
+ sim_shapeintparam_wireframe = 3015
1022
+ sim_shapeintparam_compound = 3016
1023
+ sim_shapeintparam_convex = 3017
1024
+ sim_shapeintparam_convex_check = 3018
1025
+ sim_shapeintparam_respondable_mask = 3019
1026
+ sim_shapefloatparam_init_velocity_a = 3020
1027
+ sim_shapefloatparam_init_ang_velocity_x = 3020
1028
+ sim_shapefloatparam_init_velocity_b = 3021
1029
+ sim_shapefloatparam_init_ang_velocity_y = 3021
1030
+ sim_shapefloatparam_init_velocity_g = 3022
1031
+ sim_shapefloatparam_init_ang_velocity_z = 3022
1032
+ sim_shapestringparam_color_name = 3023
1033
+ sim_shapeintparam_edge_visibility = 3024
1034
+ sim_shapefloatparam_shading_angle = 3025
1035
+ sim_shapefloatparam_edge_angle = 3026
1036
+ sim_shapeintparam_edge_borders_hidden = 3027
1037
+ sim_proxintparam_ray_invisibility = 4000
1038
+ sim_proxintparam_volume_type = 4001
1039
+ sim_proxintparam_entity_to_detect = 4002
1040
+ sim_forcefloatparam_error_x = 5000
1041
+ sim_forcefloatparam_error_y = 5001
1042
+ sim_forcefloatparam_error_z = 5002
1043
+ sim_forcefloatparam_error_a = 5003
1044
+ sim_forcefloatparam_error_b = 5004
1045
+ sim_forcefloatparam_error_g = 5005
1046
+ sim_forcefloatparam_error_pos = 5006
1047
+ sim_forcefloatparam_error_angle = 5007
1048
+ sim_lightintparam_pov_casts_shadows = 8000
1049
+ sim_lightfloatparam_spot_exponent = 8001
1050
+ sim_lightfloatparam_spot_cutoff = 8002
1051
+ sim_lightfloatparam_const_attenuation = 8003
1052
+ sim_lightfloatparam_lin_attenuation = 8004
1053
+ sim_lightfloatparam_quad_attenuation = 8005
1054
+ sim_cameraintparam_disabled_light_components = 9000
1055
+ sim_camerafloatparam_perspective_angle = 9001
1056
+ sim_camerafloatparam_ortho_size = 9002
1057
+ sim_cameraintparam_rendering_attributes = 9003
1058
+ sim_cameraintparam_pov_focal_blur = 9004
1059
+ sim_camerafloatparam_pov_blur_distance = 9005
1060
+ sim_camerafloatparam_pov_aperture = 9006
1061
+ sim_cameraintparam_pov_blur_samples = 9007
1062
+ sim_camerafloatparam_near_clipping = 9008
1063
+ sim_camerafloatparam_far_clipping = 9009
1064
+ sim_dummyintparam_link_type = 10000
1065
+ sim_dummyintparam_follow_path = 10001
1066
+ sim_dummyfloatparam_follow_path_offset = 10002
1067
+ sim_millintparam_volume_type = 11000
1068
+ sim_mirrorfloatparam_width = 12000
1069
+ sim_mirrorfloatparam_height = 12001
1070
+ sim_mirrorfloatparam_reflectance = 12002
1071
+ sim_mirrorintparam_enable = 12003
1072
+ sim_pplanfloatparam_x_min = 20000
1073
+ sim_pplanfloatparam_x_range = 20001
1074
+ sim_pplanfloatparam_y_min = 20002
1075
+ sim_pplanfloatparam_y_range = 20003
1076
+ sim_pplanfloatparam_z_min = 20004
1077
+ sim_pplanfloatparam_z_range = 20005
1078
+ sim_pplanfloatparam_delta_min = 20006
1079
+ sim_pplanfloatparam_delta_range = 20007
1080
+ sim_mplanintparam_nodes_computed_old = 25000
1081
+ sim_mplanintparam_prepare_nodes_old = 25001
1082
+ sim_mplanintparam_clear_nodes_old = 25002
1083
+
1084
+ sim_stack_table_circular_ref = -4
1085
+ sim_stack_table_not_table = -3
1086
+ sim_stack_table_map = -2
1087
+ sim_stack_table_empty = 0
1088
+
1089
+ sim_bullet_global_float_start = 0
1090
+ sim_bullet_global_stepsize = 1
1091
+ sim_bullet_global_internalscalingfactor = 2
1092
+ sim_bullet_global_collisionmarginfactor = 3
1093
+ sim_bullet_global_float_end = 4
1094
+ sim_bullet_global_int_start = 1000
1095
+ sim_bullet_global_constraintsolvingiterations = 1001
1096
+ sim_bullet_global_bitcoded = 1002
1097
+ sim_bullet_global_constraintsolvertype = 1003
1098
+ sim_bullet_global_int_end = 1004
1099
+ sim_bullet_global_bool_start = 2000
1100
+ sim_bullet_global_fullinternalscaling = 2001
1101
+ sim_bullet_global_bool_end = 2002
1102
+ sim_bullet_joint_float_start = 3000
1103
+ sim_bullet_joint_stoperp = 3001
1104
+ sim_bullet_joint_stopcfm = 3002
1105
+ sim_bullet_joint_normalcfm = 3003
1106
+ sim_bullet_joint_float_end = 3004
1107
+ sim_bullet_joint_int_start = 4000
1108
+ sim_bullet_joint_int_end = 4001
1109
+ sim_bullet_joint_bool_start = 5000
1110
+ sim_bullet_joint_bool_end = 5001
1111
+ sim_bullet_body_float_start = 6000
1112
+ sim_bullet_body_restitution = 6001
1113
+ sim_bullet_body_oldfriction = 6002
1114
+ sim_bullet_body_friction = 6003
1115
+ sim_bullet_body_lineardamping = 6004
1116
+ sim_bullet_body_angulardamping = 6005
1117
+ sim_bullet_body_nondefaultcollisionmargingfactor = 6006
1118
+ sim_bullet_body_nondefaultcollisionmargingfactorconvex = 6007
1119
+ sim_bullet_body_float_end = 6008
1120
+ sim_bullet_body_int_start = 7000
1121
+ sim_bullet_body_bitcoded = 7001
1122
+ sim_bullet_body_int_end = 7002
1123
+ sim_bullet_body_bool_start = 8000
1124
+ sim_bullet_body_sticky = 8001
1125
+ sim_bullet_body_usenondefaultcollisionmargin = 8002
1126
+ sim_bullet_body_usenondefaultcollisionmarginconvex = 8003
1127
+ sim_bullet_body_autoshrinkconvex = 8004
1128
+ sim_bullet_body_bool_end = 8005
1129
+ sim_ode_global_float_start = 9000
1130
+ sim_ode_global_stepsize = 9001
1131
+ sim_ode_global_internalscalingfactor = 9002
1132
+ sim_ode_global_cfm = 9003
1133
+ sim_ode_global_erp = 9004
1134
+ sim_ode_global_float_end = 9005
1135
+ sim_ode_global_int_start = 10000
1136
+ sim_ode_global_constraintsolvingiterations = 10001
1137
+ sim_ode_global_bitcoded = 10002
1138
+ sim_ode_global_randomseed = 10003
1139
+ sim_ode_global_int_end = 10004
1140
+ sim_ode_global_bool_start = 11000
1141
+ sim_ode_global_fullinternalscaling = 11001
1142
+ sim_ode_global_quickstep = 11002
1143
+ sim_ode_global_bool_end = 11003
1144
+ sim_ode_joint_float_start = 12000
1145
+ sim_ode_joint_stoperp = 12001
1146
+ sim_ode_joint_stopcfm = 12002
1147
+ sim_ode_joint_bounce = 12003
1148
+ sim_ode_joint_fudgefactor = 12004
1149
+ sim_ode_joint_normalcfm = 12005
1150
+ sim_ode_joint_float_end = 12006
1151
+ sim_ode_joint_int_start = 13000
1152
+ sim_ode_joint_int_end = 13001
1153
+ sim_ode_joint_bool_start = 14000
1154
+ sim_ode_joint_bool_end = 14001
1155
+ sim_ode_body_float_start = 15000
1156
+ sim_ode_body_friction = 15001
1157
+ sim_ode_body_softerp = 15002
1158
+ sim_ode_body_softcfm = 15003
1159
+ sim_ode_body_lineardamping = 15004
1160
+ sim_ode_body_angulardamping = 15005
1161
+ sim_ode_body_float_end = 15006
1162
+ sim_ode_body_int_start = 16000
1163
+ sim_ode_body_maxcontacts = 16001
1164
+ sim_ode_body_int_end = 16002
1165
+ sim_ode_body_bool_start = 17000
1166
+ sim_ode_body_bool_end = 17001
1167
+ sim_vortex_global_float_start = 18000
1168
+ sim_vortex_global_stepsize = 18001
1169
+ sim_vortex_global_internalscalingfactor = 18002
1170
+ sim_vortex_global_contacttolerance = 18003
1171
+ sim_vortex_global_constraintlinearcompliance = 18004
1172
+ sim_vortex_global_constraintlineardamping = 18005
1173
+ sim_vortex_global_constraintlinearkineticloss = 18006
1174
+ sim_vortex_global_constraintangularcompliance = 18007
1175
+ sim_vortex_global_constraintangulardamping = 18008
1176
+ sim_vortex_global_constraintangularkineticloss = 18009
1177
+ sim_vortex_global_float_end = 18010
1178
+ sim_vortex_global_int_start = 19000
1179
+ sim_vortex_global_bitcoded = 19001
1180
+ sim_vortex_global_int_end = 19002
1181
+ sim_vortex_global_bool_start = 20000
1182
+ sim_vortex_global_autosleep = 20001
1183
+ sim_vortex_global_multithreading = 20002
1184
+ sim_vortex_global_bool_end = 20003
1185
+ sim_vortex_joint_float_start = 21000
1186
+ sim_vortex_joint_lowerlimitdamping = 21001
1187
+ sim_vortex_joint_upperlimitdamping = 21002
1188
+ sim_vortex_joint_lowerlimitstiffness = 21003
1189
+ sim_vortex_joint_upperlimitstiffness = 21004
1190
+ sim_vortex_joint_lowerlimitrestitution = 21005
1191
+ sim_vortex_joint_upperlimitrestitution = 21006
1192
+ sim_vortex_joint_lowerlimitmaxforce = 21007
1193
+ sim_vortex_joint_upperlimitmaxforce = 21008
1194
+ sim_vortex_joint_motorconstraintfrictioncoeff = 21009
1195
+ sim_vortex_joint_motorconstraintfrictionmaxforce = 21010
1196
+ sim_vortex_joint_motorconstraintfrictionloss = 21011
1197
+ sim_vortex_joint_p0loss = 21012
1198
+ sim_vortex_joint_p0stiffness = 21013
1199
+ sim_vortex_joint_p0damping = 21014
1200
+ sim_vortex_joint_p0frictioncoeff = 21015
1201
+ sim_vortex_joint_p0frictionmaxforce = 21016
1202
+ sim_vortex_joint_p0frictionloss = 21017
1203
+ sim_vortex_joint_p1loss = 21018
1204
+ sim_vortex_joint_p1stiffness = 21019
1205
+ sim_vortex_joint_p1damping = 21020
1206
+ sim_vortex_joint_p1frictioncoeff = 21021
1207
+ sim_vortex_joint_p1frictionmaxforce = 21022
1208
+ sim_vortex_joint_p1frictionloss = 21023
1209
+ sim_vortex_joint_p2loss = 21024
1210
+ sim_vortex_joint_p2stiffness = 21025
1211
+ sim_vortex_joint_p2damping = 21026
1212
+ sim_vortex_joint_p2frictioncoeff = 21027
1213
+ sim_vortex_joint_p2frictionmaxforce = 21028
1214
+ sim_vortex_joint_p2frictionloss = 21029
1215
+ sim_vortex_joint_a0loss = 21030
1216
+ sim_vortex_joint_a0stiffness = 21031
1217
+ sim_vortex_joint_a0damping = 21032
1218
+ sim_vortex_joint_a0frictioncoeff = 21033
1219
+ sim_vortex_joint_a0frictionmaxforce = 21034
1220
+ sim_vortex_joint_a0frictionloss = 21035
1221
+ sim_vortex_joint_a1loss = 21036
1222
+ sim_vortex_joint_a1stiffness = 21037
1223
+ sim_vortex_joint_a1damping = 21038
1224
+ sim_vortex_joint_a1frictioncoeff = 21039
1225
+ sim_vortex_joint_a1frictionmaxforce = 21040
1226
+ sim_vortex_joint_a1frictionloss = 21041
1227
+ sim_vortex_joint_a2loss = 21042
1228
+ sim_vortex_joint_a2stiffness = 21043
1229
+ sim_vortex_joint_a2damping = 21044
1230
+ sim_vortex_joint_a2frictioncoeff = 21045
1231
+ sim_vortex_joint_a2frictionmaxforce = 21046
1232
+ sim_vortex_joint_a2frictionloss = 21047
1233
+ sim_vortex_joint_dependencyfactor = 21048
1234
+ sim_vortex_joint_dependencyoffset = 21049
1235
+ sim_vortex_joint_float_end = 21050
1236
+ sim_vortex_joint_int_start = 22000
1237
+ sim_vortex_joint_bitcoded = 22001
1238
+ sim_vortex_joint_relaxationenabledbc = 22002
1239
+ sim_vortex_joint_frictionenabledbc = 22003
1240
+ sim_vortex_joint_frictionproportionalbc = 22004
1241
+ sim_vortex_joint_objectid = 22005
1242
+ sim_vortex_joint_dependentobjectid = 22006
1243
+ sim_vortex_joint_int_end = 22007
1244
+ sim_vortex_joint_bool_start = 23000
1245
+ sim_vortex_joint_motorfrictionenabled = 23001
1246
+ sim_vortex_joint_proportionalmotorfriction = 23002
1247
+ sim_vortex_joint_bool_end = 23003
1248
+ sim_vortex_body_float_start = 24000
1249
+ sim_vortex_body_primlinearaxisfriction = 24001
1250
+ sim_vortex_body_seclinearaxisfriction = 24002
1251
+ sim_vortex_body_primangularaxisfriction = 24003
1252
+ sim_vortex_body_secangularaxisfriction = 24004
1253
+ sim_vortex_body_normalangularaxisfriction = 24005
1254
+ sim_vortex_body_primlinearaxisstaticfrictionscale = 24006
1255
+ sim_vortex_body_seclinearaxisstaticfrictionscale = 24007
1256
+ sim_vortex_body_primangularaxisstaticfrictionscale = 24008
1257
+ sim_vortex_body_secangularaxisstaticfrictionscale = 24009
1258
+ sim_vortex_body_normalangularaxisstaticfrictionscale = 24010
1259
+ sim_vortex_body_compliance = 24011
1260
+ sim_vortex_body_damping = 24012
1261
+ sim_vortex_body_restitution = 24013
1262
+ sim_vortex_body_restitutionthreshold = 24014
1263
+ sim_vortex_body_adhesiveforce = 24015
1264
+ sim_vortex_body_linearvelocitydamping = 24016
1265
+ sim_vortex_body_angularvelocitydamping = 24017
1266
+ sim_vortex_body_primlinearaxisslide = 24018
1267
+ sim_vortex_body_seclinearaxisslide = 24019
1268
+ sim_vortex_body_primangularaxisslide = 24020
1269
+ sim_vortex_body_secangularaxisslide = 24021
1270
+ sim_vortex_body_normalangularaxisslide = 24022
1271
+ sim_vortex_body_primlinearaxisslip = 24023
1272
+ sim_vortex_body_seclinearaxisslip = 24024
1273
+ sim_vortex_body_primangularaxisslip = 24025
1274
+ sim_vortex_body_secangularaxisslip = 24026
1275
+ sim_vortex_body_normalangularaxisslip = 24027
1276
+ sim_vortex_body_autosleeplinearspeedthreshold = 24028
1277
+ sim_vortex_body_autosleeplinearaccelthreshold = 24029
1278
+ sim_vortex_body_autosleepangularspeedthreshold = 24030
1279
+ sim_vortex_body_autosleepangularaccelthreshold = 24031
1280
+ sim_vortex_body_skinthickness = 24032
1281
+ sim_vortex_body_autoangulardampingtensionratio = 24033
1282
+ sim_vortex_body_primaxisvectorx = 24034
1283
+ sim_vortex_body_primaxisvectory = 24035
1284
+ sim_vortex_body_primaxisvectorz = 24036
1285
+ sim_vortex_body_float_end = 24037
1286
+ sim_vortex_body_int_start = 25000
1287
+ sim_vortex_body_primlinearaxisfrictionmodel = 25001
1288
+ sim_vortex_body_seclinearaxisfrictionmodel = 25002
1289
+ sim_vortex_body_primangulararaxisfrictionmodel = 25003
1290
+ sim_vortex_body_secmangulararaxisfrictionmodel = 25004
1291
+ sim_vortex_body_normalmangulararaxisfrictionmodel = 25005
1292
+ sim_vortex_body_bitcoded = 25006
1293
+ sim_vortex_body_autosleepsteplivethreshold = 25007
1294
+ sim_vortex_body_materialuniqueid = 25008
1295
+ sim_vortex_body_int_end = 25009
1296
+ sim_vortex_body_bool_start = 26000
1297
+ sim_vortex_body_pureshapesasconvex = 26001
1298
+ sim_vortex_body_convexshapesasrandom = 26002
1299
+ sim_vortex_body_randomshapesasterrain = 26003
1300
+ sim_vortex_body_fastmoving = 26004
1301
+ sim_vortex_body_autoslip = 26005
1302
+ sim_vortex_body_seclinaxissameasprimlinaxis = 26006
1303
+ sim_vortex_body_secangaxissameasprimangaxis = 26007
1304
+ sim_vortex_body_normangaxissameasprimangaxis = 26008
1305
+ sim_vortex_body_autoangulardamping = 26009
1306
+ sim_vortex_body_bool_end = 26010
1307
+ sim_newton_global_float_start = 27000
1308
+ sim_newton_global_stepsize = 27001
1309
+ sim_newton_global_contactmergetolerance = 27002
1310
+ sim_newton_global_float_end = 27003
1311
+ sim_newton_global_int_start = 28000
1312
+ sim_newton_global_constraintsolvingiterations = 28001
1313
+ sim_newton_global_bitcoded = 28002
1314
+ sim_newton_global_int_end = 28003
1315
+ sim_newton_global_bool_start = 29000
1316
+ sim_newton_global_multithreading = 29001
1317
+ sim_newton_global_exactsolver = 29002
1318
+ sim_newton_global_highjointaccuracy = 29003
1319
+ sim_newton_global_bool_end = 29004
1320
+ sim_newton_joint_float_start = 30000
1321
+ sim_newton_joint_dependencyfactor = 30001
1322
+ sim_newton_joint_dependencyoffset = 30002
1323
+ sim_newton_joint_float_end = 30003
1324
+ sim_newton_joint_int_start = 31000
1325
+ sim_newton_joint_objectid = 31001
1326
+ sim_newton_joint_dependentobjectid = 31002
1327
+ sim_newton_joint_int_end = 31003
1328
+ sim_newton_joint_bool_start = 32000
1329
+ sim_newton_joint_bool_end = 32001
1330
+ sim_newton_body_float_start = 33000
1331
+ sim_newton_body_staticfriction = 33001
1332
+ sim_newton_body_kineticfriction = 33002
1333
+ sim_newton_body_restitution = 33003
1334
+ sim_newton_body_lineardrag = 33004
1335
+ sim_newton_body_angulardrag = 33005
1336
+ sim_newton_body_float_end = 33006
1337
+ sim_newton_body_int_start = 34000
1338
+ sim_newton_body_bitcoded = 34001
1339
+ sim_newton_body_int_end = 34002
1340
+ sim_newton_body_bool_start = 35000
1341
+ sim_newton_body_fastmoving = 35001
1342
+ sim_newton_body_bool_end = 35002
1343
+
1344
+ sim_vortex_bodyfrictionmodel_box = 0
1345
+ sim_vortex_bodyfrictionmodel_scaledbox = 1
1346
+ sim_vortex_bodyfrictionmodel_proplow = 2
1347
+ sim_vortex_bodyfrictionmodel_prophigh = 3
1348
+ sim_vortex_bodyfrictionmodel_scaledboxfast = 4
1349
+ sim_vortex_bodyfrictionmodel_neutral = 5
1350
+ sim_vortex_bodyfrictionmodel_none = 6
1351
+
1352
+ sim_bullet_constraintsolvertype_sequentialimpulse = 0
1353
+ sim_bullet_constraintsolvertype_nncg = 1
1354
+ sim_bullet_constraintsolvertype_dantzig = 2
1355
+ sim_bullet_constraintsolvertype_projectedgaussseidel = 3
1356
+
1357
+ sim_objdynprop_dynamic = 1
1358
+ sim_objdynprop_respondable = 2
1359
+
1360
+ sim_announce_pureconenotsupported = 0
1361
+ sim_announce_purespheroidnotsupported = 1
1362
+ sim_announce_containsnonpurenonconvexshapes = 2
1363
+ sim_announce_containsstaticshapesondynamicconstruction = 3
1364
+ sim_announce_purehollowshapenotsupported = 4
1365
+ sim_announce_vortexpluginisdemo = 5
1366
+ sim_announce_newtondynamicrandommeshnotsupported = 6
1367
+
1368
+ sim_dynamicsimicon_none = 0
1369
+ sim_dynamicsimicon_objectisdynamicallysimulated = 1
1370
+ sim_dynamicsimicon_objectisnotdynamicallyenabled = 2
1371
+
1372
+ sim_filtercomponent_originalimage_deprecated = 1
1373
+ sim_filtercomponent_originaldepth_deprecated = 2
1374
+ sim_filtercomponent_uniformimage_deprecated = 3
1375
+ sim_filtercomponent_tooutput_deprecated = 4
1376
+ sim_filtercomponent_tobuffer1_deprecated = 5
1377
+ sim_filtercomponent_tobuffer2_deprecated = 6
1378
+ sim_filtercomponent_frombuffer1_deprecated = 7
1379
+ sim_filtercomponent_frombuffer2_deprecated = 8
1380
+ sim_filtercomponent_swapbuffers_deprecated = 9
1381
+ sim_filtercomponent_addbuffer1_deprecated = 10
1382
+ sim_filtercomponent_subtractbuffer1_deprecated = 11
1383
+ sim_filtercomponent_multiplywithbuffer1_deprecated = 12
1384
+ sim_filtercomponent_horizontalflip_deprecated = 13
1385
+ sim_filtercomponent_verticalflip_deprecated = 14
1386
+ sim_filtercomponent_rotate_deprecated = 15
1387
+ sim_filtercomponent_shift_deprecated = 16
1388
+ sim_filtercomponent_resize_deprecated = 17
1389
+ sim_filtercomponent_3x3filter_deprecated = 18
1390
+ sim_filtercomponent_5x5filter_deprecated = 19
1391
+ sim_filtercomponent_sharpen_deprecated = 20
1392
+ sim_filtercomponent_edge_deprecated = 21
1393
+ sim_filtercomponent_rectangularcut_deprecated = 22
1394
+ sim_filtercomponent_circularcut_deprecated = 23
1395
+ sim_filtercomponent_normalize_deprecated = 24
1396
+ sim_filtercomponent_intensityscale_deprecated = 25
1397
+ sim_filtercomponent_keeporremovecolors_deprecated = 26
1398
+ sim_filtercomponent_scaleandoffsetcolors_deprecated = 27
1399
+ sim_filtercomponent_binary_deprecated = 28
1400
+ sim_filtercomponent_swapwithbuffer1_deprecated = 29
1401
+ sim_filtercomponent_addtobuffer1_deprecated = 30
1402
+ sim_filtercomponent_subtractfrombuffer1_deprecated = 31
1403
+ sim_filtercomponent_correlationwithbuffer1_deprecated = 32
1404
+ sim_filtercomponent_colorsegmentation_deprecated = 33
1405
+ sim_filtercomponent_blobextraction_deprecated = 34
1406
+ sim_filtercomponent_imagetocoord_deprecated = 35
1407
+ sim_filtercomponent_pixelchange_deprecated = 36
1408
+ sim_filtercomponent_velodyne_deprecated = 37
1409
+ sim_filtercomponent_todepthoutput_deprecated = 38
1410
+ sim_filtercomponent_customized_deprecated = 1000
1411
+
1412
+ sim_buffer_uint8 = 0
1413
+ sim_buffer_int8 = 1
1414
+ sim_buffer_uint16 = 2
1415
+ sim_buffer_int16 = 3
1416
+ sim_buffer_uint32 = 4
1417
+ sim_buffer_int32 = 5
1418
+ sim_buffer_float = 6
1419
+ sim_buffer_double = 7
1420
+ sim_buffer_uint8rgb = 8
1421
+ sim_buffer_uint8bgr = 9
1422
+ sim_buffer_uint8rgba = 10
1423
+ sim_buffer_uint8argb = 11
1424
+ sim_buffer_base64 = 12
1425
+ sim_buffer_split = 13
1426
+ sim_buffer_clamp = 256
1427
+
1428
+ sim_imgcomb_vertical = 0
1429
+ sim_imgcomb_horizontal = 1
1430
+
1431
+ sim_dynmat_default = 2310013
1432
+ sim_dynmat_highfriction = 2310014
1433
+ sim_dynmat_lowfriction = 2310015
1434
+ sim_dynmat_nofriction = 2310016
1435
+ sim_dynmat_reststackgrasp = 2310017
1436
+ sim_dynmat_foot = 2310018
1437
+ sim_dynmat_wheel = 2310019
1438
+ sim_dynmat_gripper = 2310020
1439
+ sim_dynmat_floor = 2310021
1440
+
1441
+ sim_rendermode_opengl = 0
1442
+ sim_rendermode_auxchannels = 1
1443
+ sim_rendermode_colorcoded = 2
1444
+ sim_rendermode_povray = 3
1445
+ sim_rendermode_reserved = 4
1446
+ sim_rendermode_extrenderer = 5
1447
+ sim_rendermode_extrendererwindowed = 6
1448
+ sim_rendermode_opengl3 = 7
1449
+ sim_rendermode_opengl3windowed = 8
1450
+
1451
+ sim_syncobj_worldcont = 0
1452
+ sim_syncobj_world = 1
1453
+ sim_syncobj_ikgroup = 2
1454
+ sim_syncobj_ikelement = 3
1455
+ sim_syncobj_collision = 4
1456
+ sim_syncobj_distance = 5
1457
+ sim_syncobj_collection = 6
1458
+ sim_syncobj_collectionelement = 7
1459
+ sim_syncobj_color = 8
1460
+ sim_syncobj_sceneobjectstart = 9
1461
+ sim_syncobj_dummy = 9
1462
+ sim_syncobj_joint = 10
1463
+ sim_syncobj_sceneobjectend = 10
1464
+
1465
+ simx_cmdnull_start = 0
1466
+ simx_cmd_synchronous_enable = 1
1467
+ simx_cmd_synchronous_disable = 2
1468
+ simx_cmd_synchronous_next = 3
1469
+ simx_cmd_get_last_errors = 4
1470
+ simx_cmd_close_scene = 5
1471
+ simx_cmd_get_object_selection = 6
1472
+ simx_cmd_reserved1 = 7
1473
+ simx_cmd_reserved2 = 8
1474
+ simx_cmd_create_dummy = 9
1475
+ simx_cmd_kill_connection = 10
1476
+ simx_cmdnull_custom_start = 2048
1477
+ simx_cmd4bytes_start = 4096
1478
+ simx_cmd_get_joint_position = 4097
1479
+ simx_cmd_set_joint_position = 4098
1480
+ simx_cmd_get_vision_sensor_image_bw = 4099
1481
+ simx_cmd_get_vision_sensor_image_rgb = 4100
1482
+ simx_cmd_set_vision_sensor_image_bw = 4101
1483
+ simx_cmd_set_vision_sensor_image_rgb = 4102
1484
+ simx_cmd_start_pause_stop_simulation = 4103
1485
+ simx_cmd_set_joint_target_velocity = 4104
1486
+ simx_cmd_read_proximity_sensor = 4105
1487
+ simx_cmd_get_joint_matrix = 4106
1488
+ simx_cmd_set_spherical_joint_matrix = 4107
1489
+ simx_cmd_set_joint_target_position = 4108
1490
+ simx_cmd_get_joint_force = 4109
1491
+ simx_cmd_set_joint_force = 4110
1492
+ simx_cmd_read_force_sensor = 4111
1493
+ simx_cmd_break_force_sensor = 4112
1494
+ simx_cmd_read_vision_sensor = 4113
1495
+ simx_cmd_get_object_parent = 4114
1496
+ simx_cmd_spotcanbeused5 = 4115
1497
+ simx_cmd_aux_console_close = 4116
1498
+ simx_cmd_aux_console_print = 4117
1499
+ simx_cmd_aux_console_show = 4118
1500
+ simx_cmd_get_vision_sensor_depth_buffer = 4119
1501
+ simx_cmd_get_object_orientation = 4120
1502
+ simx_cmd_get_object_position = 4121
1503
+ simx_cmd_set_object_orientation = 4122
1504
+ simx_cmd_set_object_position = 4123
1505
+ simx_cmd_set_object_parent = 4124
1506
+ simx_cmd_get_array_parameter = 4125
1507
+ simx_cmd_set_array_parameter = 4126
1508
+ simx_cmd_get_boolean_parameter = 4127
1509
+ simx_cmd_set_boolean_parameter = 4128
1510
+ simx_cmd_get_integer_parameter = 4129
1511
+ simx_cmd_set_integer_parameter = 4130
1512
+ simx_cmd_get_floating_parameter = 4131
1513
+ simx_cmd_set_floating_parameter = 4132
1514
+ simx_cmd_get_string_parameter = 4133
1515
+ simx_cmd_read_collision = 4134
1516
+ simx_cmd_read_distance = 4135
1517
+ simx_cmd_remove_object = 4136
1518
+ simx_cmd_remove_ui = 4137
1519
+ simx_cmd_get_objects = 4138
1520
+ simx_cmd_end_dialog = 4139
1521
+ simx_cmd_get_dialog_input = 4140
1522
+ simx_cmd_get_dialog_result = 4141
1523
+ simx_cmd_copy_paste_objects = 4142
1524
+ simx_cmd_set_object_selection = 4143
1525
+ simx_cmd_spotcanbeused1 = 4144
1526
+ simx_cmd_spotcanbeused2 = 4145
1527
+ simx_cmd_spotcanbeused3 = 4146
1528
+ simx_cmd_spotcanbeused4 = 4147
1529
+ simx_cmd_get_model_property = 4148
1530
+ simx_cmd_set_model_property = 4149
1531
+ simx_cmd_get_object_velocity = 4150
1532
+ simx_cmd_remove_model = 4151
1533
+ simx_cmd_get_joint_max_force = 4152
1534
+ simx_cmd4bytes_custom_start = 6144
1535
+ simx_cmd_set_object_quaternion = 6145
1536
+ simx_cmd8bytes_start = 8192
1537
+ simx_cmd_get_ui_slider = 8193
1538
+ simx_cmd_set_ui_slider = 8194
1539
+ simx_cmd_get_ui_event_button = 8195
1540
+ simx_cmd_get_ui_button_property = 8196
1541
+ simx_cmd_set_ui_button_property = 8197
1542
+ simx_cmd_set_ui_button_label = 8198
1543
+ simx_cmd_get_object_float_parameter = 8199
1544
+ simx_cmd_get_object_int_parameter = 8200
1545
+ simx_cmd_set_object_float_parameter = 8201
1546
+ simx_cmd_set_object_int_parameter = 8202
1547
+ simx_cmd_get_object_child = 8203
1548
+ simx_cmd_get_object_group_data = 8204
1549
+ simx_cmd_get_object_orientation2 = 8205
1550
+ simx_cmd_get_object_position2 = 8206
1551
+ simx_cmd8bytes_custom_start = 10240
1552
+ simx_cmd_get_object_quaternion = 10241
1553
+ simx_cmd1string_start = 12288
1554
+ simx_cmd_get_object_handle = 12289
1555
+ simx_cmd_load_scene = 12290
1556
+ simx_cmd_load_model = 12291
1557
+ simx_cmd_transfer_file = 12292
1558
+ simx_cmd_load_ui = 12293
1559
+ simx_cmd_erase_file = 12294
1560
+ simx_cmd_get_ui_handle = 12295
1561
+ simx_cmd_add_statusbar_message = 12296
1562
+ simx_cmd_aux_console_open = 12297
1563
+ simx_cmd_get_collision_handle = 12298
1564
+ simx_cmd_get_distance_handle = 12299
1565
+ simx_cmd_display_dialog = 12300
1566
+ simx_cmd_clear_float_signal = 12301
1567
+ simx_cmd_clear_integer_signal = 12302
1568
+ simx_cmd_clear_string_signal = 12303
1569
+ simx_cmd_get_float_signal = 12304
1570
+ simx_cmd_get_integer_signal = 12305
1571
+ simx_cmd_get_string_signal = 12306
1572
+ simx_cmd_set_float_signal = 12307
1573
+ simx_cmd_set_integer_signal = 12308
1574
+ simx_cmd_set_string_signal = 12309
1575
+ simx_cmd_append_string_signal = 12310
1576
+ simx_cmd_write_string_stream = 12310
1577
+ simx_cmd_get_and_clear_string_signal = 12311
1578
+ simx_cmd_read_string_stream = 12312
1579
+ simx_cmd_get_collection_handle = 12313
1580
+ simx_cmd4bytes2strings_start = 13312
1581
+ simx_cmd_call_script_function = 13313
1582
+ simx_cmd4bytes2strings_end = 13568
1583
+ simx_cmd1string_custom_start = 14336
1584
+ simx_cmdreserved_start = 16384
1585
+ simx_cmdmask = 65535
1586
+ simx_opmode_oneshot = 0
1587
+ simx_opmode_blocking = 65536
1588
+ simx_opmode_oneshot_wait = 65536
1589
+ simx_opmode_streaming = 131072
1590
+ simx_opmode_continuous = 131072
1591
+ simx_opmode_oneshot_split = 196608
1592
+ simx_opmode_streaming_split = 262144
1593
+ simx_opmode_continuous_split = 262144
1594
+ simx_opmode_discontinue = 327680
1595
+ simx_opmode_buffer = 393216
1596
+ simx_opmode_remove = 458752
1597
+
1598
+ simx_return_ok = 0
1599
+ simx_return_novalue_flag = 1
1600
+ simx_return_timeout_flag = 2
1601
+ simx_return_illegal_opmode_flag = 4
1602
+ simx_return_remote_error_flag = 8
1603
+ simx_return_split_progress_flag = 16
1604
+ simx_return_local_error_flag = 32
1605
+ simx_return_initialize_error_flag = 64
1606
+
1607
+ simx_error_noerror = 0
1608
+ simx_error_novalue_flag = 1
1609
+ simx_error_timeout_flag = 2
1610
+ simx_error_illegal_opmode_flag = 4
1611
+ simx_error_remote_error_flag = 8
1612
+ simx_error_split_progress_flag = 16
1613
+ simx_error_local_error_flag = 32
1614
+ simx_error_initialize_error_flag = 64
1615
+
1616
+ simros_strmcmdnull_start = 0
1617
+ simros_strmcmd_get_object_selection = 1
1618
+ simros_strmcmd_get_info = 2
1619
+ simros_strmcmdnull_subscriber_start = 2048
1620
+ simros_strmcmd_add_status_bar_message = 2049
1621
+ simros_strmcmd_set_object_selection = 2050
1622
+ simros_strmcmd_set_joint_state = 2051
1623
+ simros_strmcmdint_start = 4096
1624
+ simros_strmcmd_get_array_parameter = 4097
1625
+ simros_strmcmd_get_boolean_parameter = 4098
1626
+ simros_strmcmd_get_dialog_result = 4099
1627
+ simros_strmcmd_get_floating_parameter = 4100
1628
+ simros_strmcmd_get_integer_parameter = 4101
1629
+ simros_strmcmd_get_joint_state = 4102
1630
+ simros_strmcmd_get_object_parent = 4103
1631
+ simros_strmcmd_get_objects = 4104
1632
+ simros_strmcmd_get_string_parameter = 4105
1633
+ simros_strmcmd_get_ui_event_button = 4106
1634
+ simros_strmcmd_get_vision_sensor_depth_buffer = 4107
1635
+ simros_strmcmd_get_vision_sensor_image = 4108
1636
+ simros_strmcmd_read_collision = 4109
1637
+ simros_strmcmd_read_distance = 4110
1638
+ simros_strmcmd_read_force_sensor = 4111
1639
+ simros_strmcmd_read_proximity_sensor = 4112
1640
+ simros_strmcmd_read_vision_sensor = 4113
1641
+ simros_strmcmd_get_vision_sensor_info = 4114
1642
+ simros_strmcmd_get_range_finder_data = 4115
1643
+ simros_strmcmd_get_laser_scanner_data = 4116
1644
+ simros_strmcmd_get_odom_data = 4117
1645
+ simros_strmcmd_get_depth_sensor_data = 4118
1646
+ simros_strmcmdint_subscriber_start = 6144
1647
+ simros_strmcmd_auxiliary_console_print = 6145
1648
+ simros_strmcmd_set_array_parameter = 6146
1649
+ simros_strmcmd_set_boolean_parameter = 6147
1650
+ simros_strmcmd_set_floating_parameter = 6148
1651
+ simros_strmcmd_set_integer_parameter = 6149
1652
+ simros_strmcmd_set_joint_force = 6150
1653
+ simros_strmcmd_set_joint_position = 6151
1654
+ simros_strmcmd_set_joint_target_position = 6152
1655
+ simros_strmcmd_set_joint_target_velocity = 6153
1656
+ simros_strmcmd_set_vision_sensor_image = 6154
1657
+ simros_strmcmd_set_joy_sensor = 6155
1658
+ simros_strmcmd_set_twist_command = 6156
1659
+ simros_strmcmdintint_start = 8192
1660
+ simros_strmcmd_get_object_pose = 8193
1661
+ simros_strmcmd_get_object_float_parameter = 8194
1662
+ simros_strmcmd_get_object_int_parameter = 8195
1663
+ simros_strmcmd_get_ui_button_property = 8196
1664
+ simros_strmcmd_get_ui_slider = 8197
1665
+ simros_strmcmd_get_transform = 8198
1666
+ simros_strmcmd_get_object_group_data = 8199
1667
+ simros_strmcmdintint_subscriber_start = 10240
1668
+ simros_strmcmd_set_object_float_parameter = 10241
1669
+ simros_strmcmd_set_object_int_parameter = 10242
1670
+ simros_strmcmd_set_object_pose = 10243
1671
+ simros_strmcmd_set_object_position = 10244
1672
+ simros_strmcmd_set_object_quaternion = 10245
1673
+ simros_strmcmd_set_ui_button_label = 10246
1674
+ simros_strmcmd_set_ui_button_property = 10247
1675
+ simros_strmcmd_set_ui_slider = 10248
1676
+ simros_strmcmdstring_start = 12288
1677
+ simros_strmcmd_get_float_signal = 12289
1678
+ simros_strmcmd_get_integer_signal = 12290
1679
+ simros_strmcmd_get_string_signal = 12291
1680
+ simros_strmcmd_reserved1 = 12292
1681
+ simros_strmcmd_get_and_clear_string_signal = 12293
1682
+ simros_strmcmdstring_subscriber_start = 14336
1683
+ simros_strmcmd_clear_float_signal = 14337
1684
+ simros_strmcmd_clear_integer_signal = 14338
1685
+ simros_strmcmd_clear_string_signal = 14339
1686
+ simros_strmcmd_set_float_signal = 14340
1687
+ simros_strmcmd_set_integer_signal = 14341
1688
+ simros_strmcmd_set_string_signal = 14342
1689
+ simros_strmcmd_reserved2 = 14343
1690
+ simros_strmcmd_append_string_signal = 14344
1691
+ simros_strmcmd_set_joint_trajectory = 14345
1692
+ simros_strmcmdintstring_start = 16384
1693
+ simros_strmcmd_get_twist_status = 16385
1694
+ simros_strmcmd_receive_data_from_script_function = 16386
1695
+ simros_strmcmdintstring_subscriber_start = 18432
1696
+ simros_strmcmd_send_data_to_script_function = 18433
1697
+ simros_strmcmdreserved_start = 20480
1698
+
1699
+ # Followings are copied from official simConst.py (so possibly deprecated in C++ API)
1700
+ sim_appobj_constraintsolver_type = 114
1701
+ sim_boolparam_full_model_copy_from_api = 24
1702
+ sim_boolparam_joint_motion_handling_enabled = 7
1703
+ sim_boolparam_path_motion_handling_enabled = 8
1704
+ sim_boolparam_threaded_rendering_enabled = 32
1705
+ sim_ik_avoidance_constraint = 64
1706
+ sim_intparam_event_flags_read = 17
1707
+ sim_intparam_event_flags_read_clear = 18
1708
+ sim_jointmode_ikdependent = 3
1709
+ sim_jointmode_motion = 1
1710
+ sim_modelproperty_not_cuttable = 16
1711
+ sim_mplanintparam_clear_nodes = 25002
1712
+ sim_mplanintparam_nodes_computed = 25000
1713
+ sim_mplanintparam_prepare_nodes = 25001
1714
+ sim_navigation_ikmanip = 12
1715
+ sim_navigation_jointpathtest = 11
1716
+ sim_navigation_objectmultipleselection = 13
1717
+ sim_object_volume_type = 10
1718
+ sim_objectspecialproperty_cuttable = 1024
1719
+ sim_pathproperty_auto_velocity_profile_rotation = 512
1720
+ sim_pathproperty_auto_velocity_profile_translation = 256
1721
+ sim_pathproperty_endpoints_at_zero = 1024
1722
+ sim_pathproperty_infinite_acceleration = 32
1723
+ sim_pathproperty_invert_velocity = 16
1724
+ sim_scripttype_contactcallback = 5
1725
+ sim_scripttype_generalcallback = 7
1726
+ sim_scripttype_jointctrlcallback = 4
external/pyrep/pyrep/backend/utils.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from threading import Lock
2
+ from typing import List, Tuple
3
+ from pyrep.backend import sim
4
+ from pyrep.objects.object import Object
5
+ from pyrep.objects.shape import Shape
6
+ from pyrep.objects.dummy import Dummy
7
+ from pyrep.objects.cartesian_path import CartesianPath
8
+ from pyrep.objects.joint import Joint
9
+ from pyrep.objects.vision_sensor import VisionSensor
10
+ from pyrep.objects.force_sensor import ForceSensor
11
+ from pyrep.objects.proximity_sensor import ProximitySensor
12
+ from pyrep.objects.camera import Camera
13
+ from pyrep.objects.octree import Octree
14
+
15
+ step_lock = Lock()
16
+
17
+
18
+ def to_type(handle: int) -> Object:
19
+ """Converts an object handle to the correct sub-type.
20
+
21
+ :param handle: The internal handle of an object.
22
+ :return: The sub-type of this object.
23
+ """
24
+ t = sim.simGetObjectType(handle)
25
+ if t == sim.sim_object_shape_type:
26
+ return Shape(handle)
27
+ elif t == sim.sim_object_dummy_type:
28
+ return Dummy(handle)
29
+ elif t == sim.sim_object_path_type:
30
+ return CartesianPath(handle)
31
+ elif t == sim.sim_object_joint_type:
32
+ return Joint(handle)
33
+ elif t == sim.sim_object_visionsensor_type:
34
+ return VisionSensor(handle)
35
+ elif t == sim.sim_object_forcesensor_type:
36
+ return ForceSensor(handle)
37
+ elif t == sim.sim_object_proximitysensor_type:
38
+ return ProximitySensor(handle)
39
+ elif t == sim.sim_object_camera_type:
40
+ return Camera(handle)
41
+ elif t == sim.sim_object_octree_type:
42
+ return Octree(handle)
43
+ raise ValueError
44
+
45
+
46
+ def script_call(function_name_at_script_name: str,
47
+ script_handle_or_type: int,
48
+ ints=(), floats=(), strings=(), bytes='') -> (
49
+ Tuple[List[int], List[float], List[str], str]):
50
+ """Calls a script function (from a plugin, the main client application,
51
+ or from another script). This represents a callback inside of a script.
52
+
53
+ :param function_name_at_script_name: A string representing the function
54
+ name and script name, e.g. myFunctionName@theScriptName. When the
55
+ script is not associated with an object, then just specify the
56
+ function name.
57
+ :param script_handle_or_type: The handle of the script, otherwise the
58
+ type of the script.
59
+ :param ints: The input ints to the script.
60
+ :param floats: The input floats to the script.
61
+ :param strings: The input strings to the script.
62
+ :param bytes: The input bytes to the script (as a string).
63
+ :return: Any number of return values from the called Lua function.
64
+ """
65
+ return sim.simExtCallScriptFunction(
66
+ function_name_at_script_name, script_handle_or_type, list(ints),
67
+ list(floats), list(strings), bytes)
68
+
69
+
70
+ def _is_in_ipython():
71
+ try:
72
+ __IPYTHON__
73
+ return True
74
+ except NameError:
75
+ pass
76
+ return False
external/pyrep/pyrep/misc/__init__.py ADDED
File without changes
external/pyrep/pyrep/misc/distance.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrep.errors import PyRepError
2
+ from pyrep.backend import sim
3
+ from typing import Union
4
+
5
+
6
+ class Distance(object):
7
+ """Allows registering distance objects which are measurable entity-pairs."""
8
+
9
+ def __init__(self, name_or_handle: Union[str, int]):
10
+ raise PyRepError(
11
+ 'Currently there is an error in CoppeliaSim with distance objects. '
12
+ 'As soon as CoppeliaSim resolves this issue, this error will be '
13
+ 'removed.')
14
+ self._handle: int
15
+ if isinstance(name_or_handle, int):
16
+ self._handle = name_or_handle
17
+ else:
18
+ self._handle = sim.simGetDistanceHandle(name_or_handle)
19
+ # The entity needs to be set as explicit handling for reads to work.
20
+ if not sim.simGetExplicitHandling(self._handle):
21
+ sim.simSetExplicitHandling(self._handle, 1)
22
+
23
+ def __eq__(self, other: object):
24
+ if not isinstance(other, Distance):
25
+ raise NotImplementedError
26
+ return self.get_handle() == other.get_handle()
27
+
28
+ def get_handle(self) -> int:
29
+ """Gets the internal handle of this object.
30
+
31
+ :return: The internal handle.
32
+ """
33
+ return self._handle
34
+
35
+ def read(self) -> Union[float, None]:
36
+ """Reads the distance of a registered distance object.
37
+
38
+ :raises: PyRepError if no objects could be measured.
39
+
40
+ :return: The smallest distance between the 2 entities or None if no
41
+ measurement could be made.
42
+ """
43
+ num_measurements = sim.simHandleDistance(self._handle)
44
+ if num_measurements == 0:
45
+ raise PyRepError(
46
+ 'Could not make a measurement. Are both entities associated '
47
+ 'with the distance object marked as measurable?')
48
+ return (None if num_measurements == 0
49
+ else sim.simReadDistance(self._handle))
external/pyrep/pyrep/misc/signals.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrep.errors import PyRepError
2
+ from pyrep.backend import sim
3
+ from typing import Any
4
+
5
+
6
+ class Signal(object):
7
+ """Signals can be seen as global variables.
8
+
9
+ Four types of signals are currently supported:
10
+ integer-, floating-, double-, and string-type signals.
11
+ Signals can be defined, redefined, read and cleared.
12
+ """
13
+
14
+ def __init__(self, name):
15
+ self._name = name
16
+
17
+ def set(self, value) -> None:
18
+ """Sets the value of this signal.
19
+
20
+ :param value: The value of the signal.
21
+ """
22
+ pass
23
+
24
+ def get(self) -> Any:
25
+ """Gets the value of this signal.
26
+
27
+ :raises PyRepError if signal does not exist.
28
+ :return: The value of the signal.
29
+ """
30
+ pass
31
+
32
+ def clear(self) -> int:
33
+ """Clears the value of this signal.
34
+
35
+ :return: The number of signals cleared. Either 0 or 1.
36
+ """
37
+ pass
38
+
39
+ def _check_signal(self, value: int, type_name: str) -> None:
40
+ if value == 0:
41
+ raise PyRepError('Signal %s of type %s does not exist.' % (
42
+ self._name, type_name))
43
+
44
+
45
+ class IntegerSignal(Signal):
46
+ """An integer-type signal."""
47
+
48
+ def set(self, value) -> None:
49
+ sim.simSetIntegerSignal(self._name, value)
50
+
51
+ def get(self) -> int:
52
+ ret, value = sim.simGetIntegerSignal(self._name)
53
+ self._check_signal(ret, 'int')
54
+ return value
55
+
56
+ def clear(self) -> int:
57
+ return sim.simClearIntegerSignal(self._name)
58
+
59
+
60
+ class FloatSignal(Signal):
61
+ """An float-type signal."""
62
+
63
+ def set(self, value) -> None:
64
+ sim.simSetFloatSignal(self._name, value)
65
+
66
+ def get(self) -> float:
67
+ ret, value = sim.simGetFloatSignal(self._name)
68
+ self._check_signal(ret, 'float')
69
+ return value
70
+
71
+ def clear(self) -> int:
72
+ return sim.simClearFloatSignal(self._name)
73
+
74
+
75
+ class DoubleSignal(Signal):
76
+ """An double-type signal."""
77
+
78
+ def set(self, value) -> None:
79
+ sim.simSetDoubleSignal(self._name, value)
80
+
81
+ def get(self) -> float:
82
+ ret, value = sim.simGetDoubleSignal(self._name)
83
+ self._check_signal(ret, 'double')
84
+ return value
85
+
86
+ def clear(self) -> int:
87
+ return sim.simClearDoubleSignal(self._name)
88
+
89
+
90
+ class StringSignal(Signal):
91
+ """An string-type signal."""
92
+
93
+ def set(self, value) -> None:
94
+ sim.simSetStringSignal(self._name, value)
95
+
96
+ def get(self) -> str:
97
+ ret, value = sim.simGetStringSignal(self._name)
98
+ self._check_signal(ret, 'string')
99
+ return value
100
+
101
+ def clear(self) -> int:
102
+ return sim.simClearStringSignal(self._name)
external/pyrep/pyrep/objects/__init__.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrep.objects.object import Object
2
+ from pyrep.objects.cartesian_path import CartesianPath
3
+ from pyrep.objects.dummy import Dummy
4
+ from pyrep.objects.force_sensor import ForceSensor
5
+ from pyrep.objects.joint import Joint
6
+ from pyrep.objects.proximity_sensor import ProximitySensor
7
+ from pyrep.objects.shape import Shape
8
+ from pyrep.objects.vision_sensor import VisionSensor
9
+ from pyrep.objects.octree import Octree
10
+ from pyrep.objects.camera import Camera
external/pyrep/pyrep/objects/camera.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Union
2
+ from pyrep.objects.object import Object, object_type_to_class
3
+ from pyrep.const import ObjectType
4
+
5
+
6
+ class Camera(Object):
7
+ """Cameras can be associated with views.
8
+ """
9
+
10
+ def __init__(self, name_or_handle: Union[str, int]):
11
+ super().__init__(name_or_handle)
12
+
13
+ @staticmethod
14
+ def create():
15
+ raise NotImplementedError("API does not provide simCreateCamera.")
16
+
17
+ def _get_requested_type(self) -> ObjectType:
18
+ return ObjectType.CAMERA
19
+
20
+
21
+ object_type_to_class[ObjectType.CAMERA] = Camera
external/pyrep/pyrep/objects/cartesian_path.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Tuple, List
2
+ from pyrep.backend import sim
3
+ from pyrep.objects.object import Object, object_type_to_class
4
+ from pyrep.const import ObjectType
5
+
6
+
7
+ class CartesianPath(Object):
8
+ """An object that defines a cartesian path or trajectory in space.
9
+ """
10
+
11
+ @staticmethod
12
+ def create(show_line: bool = True, show_orientation: bool = True,
13
+ show_position: bool = True, closed_path: bool = False,
14
+ automatic_orientation: bool = True, flat_path: bool = False,
15
+ keep_x_up: bool = False, line_size: int = 1,
16
+ length_calculation_method: int = sim.sim_distcalcmethod_dl_if_nonzero, control_point_size: float = 0.01,
17
+ ang_to_lin_conv_coeff: float = 1., virt_dist_scale_factor: float = 1.,
18
+ path_color: tuple = (0.1, 0.75, 1.)) -> 'CartesianPath':
19
+ """Creates a cartesian path and inserts in the scene.
20
+
21
+ :param show_line: Shows line in UI.
22
+ :param show_position: Shows line in UI.
23
+ :param show_orientation: Shows orientation in UI.
24
+ :param closed_path: If set, then a path's last control point will be
25
+ linked to its first control point to close the path and make its
26
+ operation cyclic. A minimum of 3 control points are required for
27
+ a path to be closed.
28
+ :param automatic_orientation: If set, then all control points and
29
+ Bezier point's orientation will automatically be calculated in
30
+ order to have a point's z-axis along the path, and its y-axis
31
+ pointing outwards its curvature (if keep x up is enabled, the
32
+ y-axis is not particularly constrained). If disabled, the user
33
+ determines the control point's orientation and the Bezier points'
34
+ orientation will be interpolated from the path's control points'
35
+ orientation.
36
+ :param flat_path: If set, then all control points (and subsequently all
37
+ Bezier points) will be constraint to the z=0 plane of the path
38
+ object's local reference frame.
39
+ :param keep_x_up: If set, then the automatic orientation functionality
40
+ will align each Bezier point's z-axis along the path and keep its
41
+ x-axis pointing along the path object's z-axis.
42
+ :param line_size: Size of the line in pixels.
43
+ :param length_calculation_method: Method for calculating the path length. See
44
+ https://www.coppeliarobotics.com/helpFiles/en/apiConstants.htm#distanceCalculationMethods
45
+ :param control_point_size: Size of the control points in the path.
46
+ :param ang_to_lin_conv_coeff: The angular to linear conversion coefficient.
47
+ :param virt_dist_scale_factor: The virtual distance scaling factor.
48
+ :param path_color: Ambient diffuse rgb color of the path.
49
+
50
+ :return: The newly created cartesian path.
51
+ """
52
+ attributes = 0
53
+ if show_line:
54
+ attributes |= sim.sim_pathproperty_show_line
55
+ if show_orientation:
56
+ attributes |= sim.sim_pathproperty_show_orientation
57
+ if closed_path:
58
+ attributes |= sim.sim_pathproperty_closed_path
59
+ if automatic_orientation:
60
+ attributes |= sim.sim_pathproperty_automatic_orientation
61
+ if flat_path:
62
+ attributes |= sim.sim_pathproperty_flat_path
63
+ if show_position:
64
+ attributes |= sim.sim_pathproperty_show_position
65
+ if keep_x_up:
66
+ attributes |= sim.sim_pathproperty_keep_x_up
67
+
68
+ handle = sim.simCreatePath(attributes, [line_size, length_calculation_method, 0],
69
+ [control_point_size, ang_to_lin_conv_coeff, virt_dist_scale_factor],
70
+ list(path_color))
71
+ return CartesianPath(handle)
72
+
73
+ def _get_requested_type(self) -> ObjectType:
74
+ return ObjectType.PATH
75
+
76
+ def get_pose_on_path(self, relative_distance: float
77
+ ) -> Tuple[List[float], List[float]]:
78
+ """Retrieves the absolute interpolated pose of a point along the path.
79
+
80
+ :param relative_distance: A value between 0 and 1, where 0 is the
81
+ beginning of the path, and 1 the end of the path.
82
+ :return: A tuple containing the x, y, z position, and the x, y, z
83
+ orientation of the point on the path (in radians).
84
+ """
85
+ pos = sim.simGetPositionOnPath(self._handle, relative_distance)
86
+ ori = sim.simGetOrientationOnPath(self._handle, relative_distance)
87
+ return pos, ori
88
+
89
+ def insert_control_points(self, poses: List[List[float]]) -> None:
90
+ """Inserts one or several control points into the path.
91
+
92
+ :param poses: A list of lists containing 6 values representing the pose
93
+ of each of the new control points. Orientation in radians.
94
+ """
95
+ data = []
96
+ for p in poses:
97
+ data.extend(p)
98
+ self._script_call('insertPathControlPoint@PyRep',
99
+ ints=[self._handle, len(poses)], floats=data)
100
+
101
+ def _script_call(self, func: str, ints=(), floats=(), strings=(), bytes=''):
102
+ return sim.simExtCallScriptFunction(
103
+ func, sim.sim_scripttype_addonscript,
104
+ list(ints), list(floats), list(strings), bytes)
105
+
106
+
107
+ object_type_to_class[ObjectType.PATH] = CartesianPath
external/pyrep/pyrep/objects/dummy.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrep.objects.object import Object, object_type_to_class
2
+ from pyrep.const import ObjectType
3
+ from pyrep.backend import sim
4
+
5
+
6
+ class Dummy(Object):
7
+ """A point with orientation.
8
+
9
+ Dummies are multipurpose objects that can have many different applications.
10
+ """
11
+
12
+ @staticmethod
13
+ def create(size=0.01) -> 'Dummy':
14
+ """Creates a dummy object and inserts in the scene.
15
+
16
+ :param size: The size of the dummy object.
17
+ :return: The newly created Dummy.
18
+ """
19
+ handle = sim.simCreateDummy(size, None)
20
+ return Dummy(handle)
21
+
22
+ def _get_requested_type(self) -> ObjectType:
23
+ return ObjectType.DUMMY
24
+
25
+
26
+ object_type_to_class[ObjectType.DUMMY] = Dummy
external/pyrep/pyrep/objects/force_sensor.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Tuple, List
2
+ from pyrep.backend import sim
3
+ from pyrep.objects.object import Object, object_type_to_class
4
+ from pyrep.const import ObjectType
5
+
6
+
7
+ class ForceSensor(Object):
8
+ """An object able to measure forces and torques that are applied to it.
9
+ """
10
+
11
+ def _get_requested_type(self) -> ObjectType:
12
+ return ObjectType.FORCE_SENSOR
13
+
14
+ @classmethod
15
+ def create(cls, sensor_size=0.01) -> 'ForceSensor':
16
+ options = 0 # force and torque threshold are disabled
17
+ intParams = [0, 0, 0, 0, 0]
18
+ floatParams = [sensor_size, 0, 0, 0, 0]
19
+ handle = sim.simCreateForceSensor(options=0, intParams=intParams,
20
+ floatParams=floatParams, color=None)
21
+ return cls(handle)
22
+
23
+ def read(self) -> Tuple[List[float], List[float]]:
24
+ """Reads the force and torque applied to a force sensor.
25
+
26
+ :return: A tuple containing the applied forces along the
27
+ sensor's x, y and z-axes, and the torques along the
28
+ sensor's x, y and z-axes.
29
+ """
30
+ _, forces, torques = sim.simReadForceSensor(self._handle)
31
+ return forces, torques
32
+
33
+
34
+ object_type_to_class[ObjectType.FORCE_SENSOR] = ForceSensor
external/pyrep/pyrep/objects/joint.py ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Tuple, List, Union
2
+ from pyrep.backend import sim, utils
3
+ from pyrep.const import JointType, JointMode
4
+ from pyrep.objects.object import Object, object_type_to_class
5
+ from pyrep.const import ObjectType
6
+
7
+
8
+ class Joint(Object):
9
+ """A joint or actuator.
10
+
11
+ Four types are supported: revolute joints, prismatic joints,
12
+ screws and spherical joints.
13
+ """
14
+
15
+ def __init__(self, name_or_handle: Union[str, int]):
16
+ super().__init__(name_or_handle)
17
+
18
+ def _get_requested_type(self) -> ObjectType:
19
+ return ObjectType.JOINT
20
+
21
+ def get_joint_type(self) -> JointType:
22
+ """Retrieves the type of a joint.
23
+
24
+ :return: The type of the joint.
25
+ """
26
+ return JointType(sim.simGetJointType(self._handle))
27
+
28
+ def get_joint_position(self) -> float:
29
+ """Retrieves the intrinsic position of a joint.
30
+
31
+ This function cannot be used with spherical joints.
32
+
33
+ :return: Intrinsic position of the joint. This is a one-dimensional
34
+ value: if the joint is revolute, the rotation angle is returned,
35
+ if the joint is prismatic, the translation amount is returned, etc.
36
+ """
37
+ return sim.simGetJointPosition(self._handle)
38
+
39
+ def set_joint_position(self, position: float,
40
+ disable_dynamics: bool = False) -> None:
41
+ """Sets the intrinsic position of the joint.
42
+
43
+ :param disable_dynamics: If True, then the position can be set even
44
+ when the joint mode is in Force mode. It will disable dynamics,
45
+ move the joint, and then re-enable dynamics.
46
+
47
+ :param position: Position of a joint (angular or linear
48
+ values depending on the joint type).
49
+ """
50
+ if not disable_dynamics:
51
+ sim.simSetJointPosition(self._handle, position)
52
+ return
53
+
54
+ is_model = self.is_model()
55
+ if not is_model:
56
+ self.set_model(True)
57
+
58
+ prior = sim.simGetModelProperty(self.get_handle())
59
+ p = prior | sim.sim_modelproperty_not_dynamic
60
+ # Disable the dynamics
61
+ sim.simSetModelProperty(self._handle, p)
62
+ with utils.step_lock:
63
+ sim.simExtStep(True) # Have to step for changes to take effect
64
+
65
+ sim.simSetJointPosition(self._handle, position)
66
+ self.set_joint_target_position(position)
67
+
68
+ with utils.step_lock:
69
+ sim.simExtStep(True) # Have to step for changes to take effect
70
+ # Re-enable the dynamics
71
+ sim.simSetModelProperty(self._handle, prior)
72
+ self.set_model(is_model)
73
+
74
+ def get_joint_target_position(self) -> float:
75
+ """Retrieves the target position of a joint.
76
+
77
+ :return: Target position of the joint (angular or linear value
78
+ depending on the joint type).
79
+ """
80
+ return sim.simGetJointTargetPosition(self._handle)
81
+
82
+ def set_joint_target_position(self, position: float) -> None:
83
+ """Sets the target position of a joint.
84
+
85
+ This command makes only sense when the joint is in torque/force mode
86
+ (also make sure that the joint's motor and position control
87
+ are enabled).
88
+
89
+ :param position: Target position of the joint (angular or linear
90
+ value depending on the joint type).
91
+ """
92
+ sim.simSetJointTargetPosition(self._handle, position)
93
+
94
+ def get_joint_target_velocity(self) -> float:
95
+ """Retrieves the intrinsic target velocity of a non-spherical joint.
96
+
97
+ :return: Target velocity of the joint (linear or angular velocity
98
+ depending on the joint-type).
99
+ """
100
+ return sim.simGetJointTargetVelocity(self._handle)
101
+
102
+ def set_joint_target_velocity(self, velocity: float) -> None:
103
+ """Sets the intrinsic target velocity of a non-spherical joint.
104
+
105
+ This command makes only sense when the joint mode is torque/force
106
+ mode: the dynamics functionality and the joint motor have to be
107
+ enabled (position control should however be disabled).
108
+
109
+ :param velocity: Target velocity of the joint (linear or angular
110
+ velocity depending on the joint-type).
111
+ """
112
+ sim.simSetJointTargetVelocity(self._handle, velocity)
113
+
114
+ def get_joint_force(self) -> float:
115
+ """Retrieves the force or torque applied along/about its active axis.
116
+
117
+ This function retrieves meaningful information only if the joint is
118
+ prismatic or revolute, and is dynamically enabled. With the Bullet
119
+ engine, this function returns the force or torque applied to the joint
120
+ motor (torques from joint limits are not taken into account). With the
121
+ ODE and Vortex engine, this function returns the total force or torque
122
+ applied to a joint along/about its z-axis.
123
+
124
+ :return: The force or the torque applied to the joint along/about
125
+ its z-axis.
126
+ """
127
+ return sim.simGetJointForce(self._handle)
128
+
129
+ def set_joint_force(self, force: float) -> None:
130
+ """Sets the maximum force or torque that a joint can exert.
131
+
132
+ The joint will apply that force/torque until the joint target velocity
133
+ has been reached. To apply a negative force/torque, set a negative
134
+ target velocity. This function has no effect when the joint is not
135
+ dynamically enabled, or when it is a spherical joint.
136
+
137
+ :param force: The maximum force or torque that the joint can exert.
138
+ This cannot be a negative value.
139
+ """
140
+ sim.simSetJointMaxForce(self._handle, force)
141
+
142
+ def get_joint_velocity(self) -> float:
143
+ """Get the current joint velocity.
144
+
145
+ :return: Velocity of the joint (linear or angular velocity depending
146
+ on the joint-type).
147
+ """
148
+ return sim.simGetObjectFloatParameter(
149
+ self._handle, sim.sim_jointfloatparam_velocity)
150
+
151
+ def get_joint_interval(self) -> Tuple[bool, List[float]]:
152
+ """Retrieves the interval parameters of a joint.
153
+
154
+ :return: A tuple containing a bool indicates whether the joint is cyclic
155
+ (the joint varies between -pi and +pi in a cyclic manner), and a
156
+ list containing the interval of the joint. interval[0] is the joint
157
+ minimum allowed value, interval[1] is the joint range (the maximum
158
+ allowed value is interval[0]+interval[1]). When the joint is
159
+ "cyclic", then the interval parameters don't have any meaning.
160
+ """
161
+ cyclic, interval = sim.simGetJointInterval(self._handle)
162
+ return cyclic, interval
163
+
164
+ def set_joint_interval(self, cyclic: bool, interval: List[float]) -> None:
165
+ """Sets the interval parameters of a joint (i.e. range values).
166
+
167
+ The attributes or interval parameters might have no effect, depending
168
+ on the joint-type.
169
+
170
+ :param cyclic: Indicates whether the joint is cyclic.
171
+ Only revolute joints with a pitch of 0 can be cyclic.
172
+ :param interval: Interval of the joint. interval[0] is the joint minimum
173
+ allowed value, interval[1] is the joint range (i.e. the maximum
174
+ allowed value is interval[0]+interval[1]).
175
+ """
176
+ sim.simSetJointInterval(self._handle, cyclic, interval)
177
+
178
+ def get_joint_upper_velocity_limit(self) -> float:
179
+ """Gets the joints upper velocity limit.
180
+
181
+ :return: The upper velocity limit.
182
+ """
183
+ return sim.simGetObjectFloatParameter(
184
+ self._handle, sim.sim_jointfloatparam_upper_limit)
185
+
186
+ def is_control_loop_enabled(self) -> bool:
187
+ """Gets whether the control loop is enable.
188
+
189
+ :return: True if the control loop is enabled.
190
+ """
191
+ return sim.simGetObjectInt32Parameter(
192
+ self._handle, sim.sim_jointintparam_ctrl_enabled)
193
+
194
+ def set_control_loop_enabled(self, value: bool) -> None:
195
+ """Sets whether the control loop is enable.
196
+
197
+ :param value: The new value for the control loop state.
198
+ """
199
+ sim.simSetObjectInt32Parameter(
200
+ self._handle, sim.sim_jointintparam_ctrl_enabled, value)
201
+
202
+ def is_motor_enabled(self) -> bool:
203
+ """Gets whether the motor is enable.
204
+
205
+ :return: True if the motor is enabled.
206
+ """
207
+ return sim.simGetObjectInt32Parameter(
208
+ self._handle, sim.sim_jointintparam_motor_enabled)
209
+
210
+ def set_motor_enabled(self, value: bool) -> None:
211
+ """Sets whether the motor is enable.
212
+
213
+ :param value: The new value for the motor state.
214
+ """
215
+ sim.simSetObjectInt32Parameter(
216
+ self._handle, sim.sim_jointintparam_motor_enabled, value)
217
+
218
+ def is_motor_locked_at_zero_velocity(self) -> bool:
219
+ """Gets if the motor is locked when target velocity is zero.
220
+
221
+ When enabled in velocity mode and its target velocity is zero, then the
222
+ joint is locked in place.
223
+
224
+ :return: If the motor will be locked at zero velocity.
225
+ """
226
+ return sim.simGetObjectInt32Parameter(
227
+ self._handle, sim.sim_jointintparam_velocity_lock)
228
+
229
+ def set_motor_locked_at_zero_velocity(self, value: bool) -> None:
230
+ """Set if the motor is locked when target velocity is zero.
231
+
232
+ When enabled in velocity mode and its target velocity is zero, then the
233
+ joint is locked in place.
234
+
235
+ :param value: If the motor should be locked at zero velocity.
236
+ """
237
+ sim.simSetObjectInt32Parameter(
238
+ self._handle, sim.sim_jointintparam_velocity_lock, value)
239
+
240
+ def get_joint_mode(self) -> JointMode:
241
+ """Retrieves the operation mode of the joint.
242
+
243
+ :return: The joint mode.
244
+ """
245
+ return JointMode(sim.simGetJointMode(self._handle))
246
+
247
+ def set_joint_mode(self, value: JointMode) -> None:
248
+ """Sets the operation mode of the joint.
249
+
250
+ :param value: The new joint mode value.
251
+ """
252
+ sim.simSetJointMode(self._handle, value.value)
253
+
254
+
255
+ object_type_to_class[ObjectType.JOINT] = Joint
external/pyrep/pyrep/objects/light.py ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import warnings
2
+ import numpy as np
3
+ from typing import Union
4
+ from pyrep.backend import sim
5
+ from pyrep.const import ObjectType
6
+ from pyrep.objects.object import Object, object_type_to_class
7
+
8
+
9
+ class Light(Object):
10
+ """A light.
11
+ """
12
+
13
+ def __init__(self, name_or_handle: Union[str, int]):
14
+ super().__init__(name_or_handle)
15
+
16
+ def _get_requested_type(self) -> ObjectType:
17
+ return ObjectType.LIGHT
18
+
19
+ # On and Off
20
+
21
+ def turn_on(self):
22
+ """ Turn the light on.
23
+ """
24
+ sim.simSetLightParameters(self._handle, True)
25
+
26
+ def turn_off(self):
27
+ """ Turn the light off.
28
+ """
29
+ sim.simSetLightParameters(self._handle, False)
30
+
31
+ def is_on(self):
32
+ """ Determines whether the light is on.
33
+ return: Boolean
34
+ """
35
+ return sim.simGetLightParameters(self._handle)[0]
36
+
37
+ def is_off(self):
38
+ """ Determines whether the light is off.
39
+ return: Boolean
40
+ """
41
+ return not sim.simGetLightParameters(self._handle)[0]
42
+
43
+ # Get and Set Color
44
+
45
+ def get_diffuse(self):
46
+ """ Get the diffuse colors of the light.
47
+ return: 3-vector np.array of diffuse colors
48
+ """
49
+ return np.asarray(sim.simGetLightParameters(self._handle)[1])
50
+
51
+ def set_diffuse(self, diffuse):
52
+ """ Set the diffuse colors of the light.
53
+ """
54
+ sim.simSetLightParameters(self._handle, self.is_on(), list(diffuse))
55
+
56
+ def get_specular(self):
57
+ """ Get the specular colors of the light.
58
+ return: 3-vector np.array of specular colors
59
+ """
60
+ return np.asarray(sim.simGetLightParameters(self._handle)[2])
61
+
62
+ def set_specular(self, specular):
63
+ """ Set the specular colors of the light.
64
+ """
65
+ sim.simSetLightParameters(self._handle, self.is_on(), specularPart=list(specular))
66
+
67
+ # Intensity Properties
68
+
69
+ def get_intensity_properties(self):
70
+ """ Gets light intensity properties.
71
+
72
+ :return: The light intensity properties cast_shadows, spot_exponent, spot_cutoff, const_atten_factor,
73
+ linear_atten_factor, quad_atten_factor
74
+ """
75
+ cast_shadows = sim.simGetObjectInt32Parameter(self._handle, sim.sim_lightintparam_pov_casts_shadows)
76
+ spot_exponent = sim.simGetObjectFloatParameter(self._handle, sim.sim_lightfloatparam_spot_exponent)
77
+ spot_cutoff = sim.simGetObjectFloatParameter(self._handle, sim.sim_lightfloatparam_spot_cutoff)
78
+ const_atten_factor = sim.simGetObjectFloatParameter(self._handle, sim.sim_lightfloatparam_const_attenuation)
79
+ linear_atten_factor = sim.simGetObjectFloatParameter(self._handle, sim.sim_lightfloatparam_lin_attenuation)
80
+ quad_atten_factor = sim.simGetObjectFloatParameter(self._handle, sim.sim_lightfloatparam_quad_attenuation)
81
+ return bool(cast_shadows), spot_exponent, spot_cutoff, const_atten_factor, linear_atten_factor,\
82
+ quad_atten_factor
83
+
84
+ def set_intensity_properties(self, cast_shadows=None, spot_exponent=None, spot_cutoff=None, const_atten_factor=None,
85
+ linear_atten_factor=None, quad_atten_factor=None):
86
+ """ Set light intensity properties.
87
+
88
+ :param cast_shadows: POV-Ray light casts shadows
89
+ :param spot_exponent: light spot exponent
90
+ :param spot_cutoff: light spot cutoff
91
+ :param const_atten_factor: light constant attenuation factor, currently not supported
92
+ :param linear_atten_factor: light linear attenuation factor, currently not supported
93
+ :param quad_atten_factor: light quadratic attenuation factor, currently not supported
94
+ """
95
+ if cast_shadows is not None:
96
+ sim.simSetObjectInt32Parameter(
97
+ self._handle, sim.sim_lightintparam_pov_casts_shadows, int(cast_shadows))
98
+ if spot_exponent is not None:
99
+ if spot_exponent % 1 != 0:
100
+ warnings.warn('spot exponent must be an integer, rounding input of {} to {}'.format(
101
+ spot_exponent, round(spot_exponent)))
102
+ sim.simSetObjectFloatParameter(
103
+ self._handle, sim.sim_lightfloatparam_spot_exponent, float(round(spot_exponent)))
104
+ if spot_cutoff is not None:
105
+ spot_cutoff = float(spot_cutoff)
106
+ if spot_cutoff > np.pi/2:
107
+ warnings.warn('Tried to set spot_cutoff to {}, but the maximum allowed value is pi/2,'
108
+ 'therefore setting to pi/2'.format(spot_cutoff))
109
+ sim.simSetObjectFloatParameter(
110
+ self._handle, sim.sim_lightfloatparam_spot_cutoff, float(spot_cutoff))
111
+ if const_atten_factor is not None:
112
+ raise Exception('CoppeliaSim currently does not support setting attenuation factors')
113
+ # sim.simSetObjectFloatParameter(
114
+ # self._handle, sim.sim_lightfloatparam_const_attenuation, float(const_atten_factor))
115
+ if linear_atten_factor is not None:
116
+ raise Exception('CoppeliaSim currently does not support setting attenuation factors')
117
+ # sim.simSetObjectFloatParameter(
118
+ # self._handle, sim.sim_lightfloatparam_lin_attenuation, float(linear_atten_factor))
119
+ if quad_atten_factor is not None:
120
+ raise Exception('CoppeliaSim currently does not support setting attenuation factors')
121
+ # sim.simSetObjectFloatParameter(
122
+ # self._handle, sim.sim_lightfloatparam_quad_attenuation, float(quad_atten_factor))
123
+
124
+
125
+ object_type_to_class[ObjectType.LIGHT] = Light
external/pyrep/pyrep/objects/object.py ADDED
@@ -0,0 +1,756 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import warnings
2
+
3
+ from pyrep.backend import sim
4
+ from pyrep.errors import *
5
+ from pyrep.const import ObjectType
6
+ from pyrep.errors import WrongObjectTypeError
7
+ from typing import Any, Dict, List, Tuple, Union
8
+ import numpy as np
9
+
10
+
11
+ object_type_to_class: Dict[ObjectType, Any] = {}
12
+
13
+
14
+ class Object(object):
15
+ """Base class for V-REP scene objects that are used for building a scene.
16
+
17
+ Objects are visible in the scene hierarchy and in the scene view.
18
+ """
19
+
20
+ def __init__(self, name_or_handle: Union[str, int]):
21
+ if isinstance(name_or_handle, int):
22
+ self._handle = name_or_handle
23
+ else:
24
+ self._handle = sim.simGetObjectHandle(name_or_handle)
25
+ assert_type = self._get_requested_type()
26
+ actual = ObjectType(sim.simGetObjectType(self._handle))
27
+ if actual != assert_type:
28
+ raise WrongObjectTypeError(
29
+ 'You requested object of type %s, but the actual type was '
30
+ '%s' % (assert_type.name, actual.name))
31
+
32
+ def __eq__(self, other: object):
33
+ if not isinstance(other, Object):
34
+ raise NotImplementedError
35
+ return self.get_handle() == other.get_handle()
36
+
37
+ @staticmethod
38
+ def exists(name: str) -> bool:
39
+ """Checks if the given object is in the scene.
40
+
41
+ :param id: name/id of object. If the name is appended by a "@alt"
42
+ suffix, then the object handle based on the object's alternative
43
+ name will be retrieved.
44
+ :return: True of the object exists.
45
+ """
46
+ return sim.hasObjectHandle(name)
47
+
48
+
49
+ @staticmethod
50
+ def get_object_type(name: str) -> ObjectType:
51
+ """Gets the type of the object.
52
+
53
+ :return: Type of the object.
54
+ """
55
+ return ObjectType(sim.simGetObjectType(sim.simGetObjectHandle(name)))
56
+
57
+ @staticmethod
58
+ def get_object_name(name_or_handle: Union[str, int]) -> str:
59
+ """Gets object name.
60
+
61
+ :return: Object name.
62
+ """
63
+ if isinstance(name_or_handle, int):
64
+ name = sim.simGetObjectName(name_or_handle)
65
+ else:
66
+ name = name_or_handle
67
+ return name
68
+
69
+ @staticmethod
70
+ def get_object(name_or_handle: str) -> 'Object':
71
+ """Gets object retrieved by name.
72
+
73
+ :return: The object.
74
+ """
75
+ name = Object.get_object_name(name_or_handle)
76
+ object_type = Object.get_object_type(name)
77
+ cls = object_type_to_class[object_type]
78
+ return cls(name)
79
+
80
+ def _get_requested_type(self) -> ObjectType:
81
+ """Used for internally checking assumptions user made about object type.
82
+
83
+ :return: Type of the object.
84
+ """
85
+ raise NotImplementedError('Must be overridden.')
86
+
87
+ def get_type(self) -> ObjectType:
88
+ """Gets the type of the object.
89
+
90
+ :return: Type of the object.
91
+ """
92
+ return ObjectType(sim.simGetObjectType(self._handle))
93
+
94
+ def get_handle(self) -> int:
95
+ """Gets the internal handle of this object.
96
+
97
+ :return: The internal handle.
98
+ """
99
+ return self._handle
100
+
101
+ def still_exists(self) -> bool:
102
+ """Gets whether this object is still in the scene or not.
103
+
104
+ :return: Whether the object exists or not.
105
+ """
106
+ return sim.simGetObjectName(self._handle) != ''
107
+
108
+ def get_name(self) -> str:
109
+ """Gets the objects name in the scene.
110
+
111
+ :return: The objects name.
112
+ """
113
+ return sim.simGetObjectName(self._handle)
114
+
115
+ def set_name(self, name: str) -> None:
116
+ """Sets the objects name in the scene.
117
+ """
118
+ sim.simSetObjectName(self._handle, name)
119
+
120
+ def get_position(self, relative_to=None) -> np.ndarray:
121
+ """Gets the position of this object.
122
+
123
+ :param relative_to: Indicates relative to which reference frame we want
124
+ the position. Specify None to retrieve the absolute position, or an
125
+ Object relative to whose reference frame we want the position.
126
+ :return: An array containing the x, y, z position of the object.
127
+ """
128
+ relto = -1 if relative_to is None else relative_to.get_handle()
129
+ position = sim.simGetObjectPosition(self._handle, relto)
130
+ return np.array(position, dtype=np.float64)
131
+
132
+ def set_position(self, position: Union[list, np.ndarray], relative_to=None,
133
+ reset_dynamics=True) -> None:
134
+ """Sets the position of this object.
135
+
136
+ :param position: A list containing the x, y, z position of the object.
137
+ :param relative_to: Indicates relative to which reference frame the
138
+ the position is specified. Specify None to set the absolute
139
+ position, or an Object relative to whose reference frame the
140
+ position is specified.
141
+ :param reset_dynamics: If we want to reset the dynamics when moving
142
+ an object instantaneously.
143
+ """
144
+ relto = -1 if relative_to is None else relative_to.get_handle()
145
+ if reset_dynamics:
146
+ for ob in self.get_objects_in_tree(exclude_base=False):
147
+ ob.reset_dynamic_object()
148
+
149
+ sim.simSetObjectPosition(self._handle, relto, list(position))
150
+
151
+ def get_orientation(self, relative_to=None) -> np.ndarray:
152
+ """Gets the orientation of this object.
153
+
154
+ :param relative_to: Indicates relative to which reference frame we want
155
+ the orientation. Specify None to retrieve the absolute orientation,
156
+ or an Object relative to whose reference frame we want the
157
+ orientation.
158
+ :return: A list containing the x, y, z orientation of the
159
+ object (in radians).
160
+ """
161
+ relto = -1 if relative_to is None else relative_to.get_handle()
162
+ orientation = sim.simGetObjectOrientation(self._handle, relto)
163
+ return np.array(orientation, dtype=np.float64)
164
+
165
+ def set_orientation(self, orientation: Union[list, np.ndarray],
166
+ relative_to=None, reset_dynamics=True) -> None:
167
+ """Sets the orientation of this object.
168
+
169
+ :param orientation: An array containing the x, y, z orientation of
170
+ the object (in radians).
171
+ :param relative_to: Indicates relative to which reference frame the
172
+ the orientation is specified. Specify None to set the absolute
173
+ orientation, or an Object relative to whose reference frame the
174
+ orientation is specified.
175
+ :param reset_dynamics: If we want to reset the dynamics when rotating
176
+ an object instantaneously.
177
+ """
178
+ relto = -1 if relative_to is None else relative_to.get_handle()
179
+ if reset_dynamics:
180
+ for ob in self.get_objects_in_tree(exclude_base=False):
181
+ ob.reset_dynamic_object()
182
+ sim.simSetObjectOrientation(self._handle, relto, list(orientation))
183
+
184
+ def get_quaternion(self, relative_to=None) -> np.ndarray:
185
+ """Retrieves the quaternion (x,y,z,w) of an object.
186
+
187
+ :param relative_to: Indicates relative to which reference frame we want
188
+ the orientation. Specify None to retrieve the absolute orientation,
189
+ or an Object relative to whose reference frame we want the
190
+ orientation.
191
+ :return: A list containing the quaternion (x,y,z,w).
192
+ """
193
+ relto = -1 if relative_to is None else relative_to.get_handle()
194
+ quaternion = sim.simGetObjectQuaternion(self._handle, relto)
195
+ return np.array(quaternion, dtype=np.float64)
196
+
197
+ def set_quaternion(self, quaternion: Union[list, np.ndarray],
198
+ relative_to=None, reset_dynamics=True) -> None:
199
+ """Sets the orientation of this object.
200
+
201
+ If the quaternion is not normalised, it will be normalised for you.
202
+
203
+ :param quaternion: An array containing the quaternion (x,y,z,w).
204
+ :param relative_to: Indicates relative to which reference frame the
205
+ the orientation is specified. Specify None to set the absolute
206
+ orientation, or an Object relative to whose reference frame the
207
+ orientation is specified.
208
+ :param reset_dynamics: If we want to reset the dynamics when rotating
209
+ an object instantaneously.
210
+ """
211
+ assert len(quaternion) == 4
212
+ quaternion = np.asarray(quaternion)
213
+ norm = np.linalg.norm(quaternion)
214
+ if norm != 1.0:
215
+ quaternion = quaternion / norm
216
+ relto = -1 if relative_to is None else relative_to.get_handle()
217
+ if reset_dynamics:
218
+ for ob in self.get_objects_in_tree(exclude_base=False):
219
+ ob.reset_dynamic_object()
220
+ sim.simSetObjectQuaternion(self._handle, relto, list(quaternion))
221
+
222
+ def get_pose(self, relative_to=None) -> np.ndarray:
223
+ """Retrieves the position and quaternion of an object
224
+
225
+ :param relative_to: Indicates relative to which reference frame we want
226
+ the pose. Specify None to retrieve the absolute pose, or an Object
227
+ relative to whose reference frame we want the pose.
228
+ :return: An array containing the (X,Y,Z,Qx,Qy,Qz,Qw) pose of
229
+ the object.
230
+ """
231
+ position = self.get_position(relative_to)
232
+ quaternion = self.get_quaternion(relative_to)
233
+ return np.r_[position, quaternion]
234
+
235
+ def set_pose(self, pose: Union[list, np.ndarray], relative_to=None,
236
+ reset_dynamics=True) -> None:
237
+ """Sets the position and quaternion of an object.
238
+
239
+ :param pose: An array containing the (X,Y,Z,Qx,Qy,Qz,Qw) pose of
240
+ the object.
241
+ :param relative_to: Indicates relative to which reference frame the
242
+ the pose is specified. Specify None to set the absolute pose, or an
243
+ Object relative to whose reference frame the pose is specified.
244
+ :param reset_dynamics: If we want to reset the dynamics when rotating
245
+ an object instantaneously.
246
+ """
247
+ assert len(pose) == 7
248
+ self.set_position(pose[:3], relative_to, reset_dynamics)
249
+ self.set_quaternion(pose[3:], relative_to, reset_dynamics)
250
+
251
+ def get_velocity(self) -> Tuple[np.ndarray, np.ndarray]:
252
+ """Get the velocity of this object.
253
+
254
+ :return: A pair of linear and angular velocity.
255
+ """
256
+ linear_vel, angular_vel = sim.simGetObjectVelocity(self._handle)
257
+ linear_vel = np.array(linear_vel, dtype=np.float64)
258
+ angular_vel = np.array(angular_vel, dtype=np.float64)
259
+ return linear_vel, angular_vel
260
+
261
+ def get_parent(self) -> Union['Object', None]:
262
+ """Gets the parent of this object in the scene hierarchy.
263
+
264
+ :return: The parent of this object, or None if it doesn't have a parent.
265
+ """
266
+ try:
267
+ handle = sim.simGetObjectParent(self._handle)
268
+ except RuntimeError:
269
+ # Most probably no parent.
270
+ return None
271
+ object_type = ObjectType(sim.simGetObjectType(handle))
272
+ cls = object_type_to_class.get(object_type, Object)
273
+ return cls(handle)
274
+
275
+ def set_parent(self, parent_object: Union['Object', None],
276
+ keep_in_place=True) -> None:
277
+ """Sets this objects parent object in the scene hierarchy.
278
+
279
+ :param parent_object: The object that will become parent, or None if
280
+ the object should become parentless.
281
+ :param keep_in_place: Indicates whether the object's absolute position
282
+ and orientation should stay same
283
+ """
284
+ parent = -1 if parent_object is None else parent_object.get_handle()
285
+ sim.simSetObjectParent(self._handle, parent, keep_in_place)
286
+
287
+ def get_matrix(self, relative_to=None) -> np.ndarray:
288
+ """Retrieves the transformation matrix of this object.
289
+
290
+ :param relative_to: Indicates relative to which reference frame we want
291
+ the matrix. Specify None to retrieve the absolute transformation
292
+ matrix, or an Object relative to whose reference frame we want the
293
+ transformation matrix.
294
+ :return: A 4x4 transformation matrix.
295
+ """
296
+ relto = -1 if relative_to is None else relative_to.get_handle()
297
+ m = sim.simGetObjectMatrix(self._handle, relto)
298
+ m_np = np.array(m).reshape((3, 4))
299
+ return np.concatenate([m_np, [np.array([0, 0, 0, 1])]])
300
+
301
+ def set_matrix(self, matrix: np.ndarray, relative_to=None) -> None:
302
+ """Sets the transformation matrix of this object.
303
+
304
+ :param relative_to: Indicates relative to which reference frame the
305
+ matrix is specified. Specify None to set the absolute transformation
306
+ matrix, or an Object relative to whose reference frame the
307
+ transformation matrix is specified.
308
+ :param matrix: A 4x4 transformation matrix.
309
+ """
310
+ if not isinstance(matrix, np.ndarray):
311
+ raise ValueError('Expected Numpy 4x4 array.')
312
+ relto = -1 if relative_to is None else relative_to.get_handle()
313
+ sim.simSetObjectMatrix(
314
+ self._handle, relto, matrix[:3, :4].reshape((12)).tolist())
315
+
316
+ def is_collidable(self) -> bool:
317
+ """Whether the object is collidable or not.
318
+
319
+ :return: If the object is collidable.
320
+ """
321
+ return self._get_property(sim.sim_objectspecialproperty_collidable)
322
+
323
+ def set_collidable(self, value: bool) -> None:
324
+ """Set whether the object is collidable or not.
325
+
326
+ :param value: The new value of the collidable state.
327
+ """
328
+ self._set_property(sim.sim_objectspecialproperty_collidable, value)
329
+
330
+ def get_contact(self, contact_obj=None, get_contact_normal: bool = True) -> List:
331
+ """Get the contact point and force with other object
332
+
333
+ :param contact_obj: The object want to check contact info with, set to None to get contact with all objects
334
+ :param get_contact_normal: Weather get the force and direction
335
+ :return: a list of all the contact info
336
+ """
337
+ contact_info = sim.simGetContactInfo(self.get_handle(), get_contact_normal)
338
+ if contact_obj is None:
339
+ return contact_info
340
+ else:
341
+ result = []
342
+ check_handle = contact_obj.get_handle()
343
+ for contact in contact_info:
344
+ if check_handle in contact['contact_handles']:
345
+ result.append(contact)
346
+ return result
347
+
348
+ def is_measurable(self) -> bool:
349
+ """Whether the object is measurable or not.
350
+
351
+ :return: If the object is measurable.
352
+ """
353
+ return self._get_property(sim.sim_objectspecialproperty_measurable)
354
+
355
+ def set_measurable(self, value: bool):
356
+ """Set whether the object is measurable or not.
357
+
358
+ :param value: The new value of the measurable state.
359
+ """
360
+ self._set_property(sim.sim_objectspecialproperty_measurable, value)
361
+
362
+ def is_detectable(self) -> bool:
363
+ """Whether the object is detectable or not.
364
+
365
+ :return: If the object is detectable.
366
+ """
367
+ return self._get_property(sim.sim_objectspecialproperty_detectable_all)
368
+
369
+ def set_detectable(self, value: bool):
370
+ """Set whether the object is detectable or not.
371
+
372
+ :param value: The new value of the detectable state.
373
+ """
374
+ self._set_property(sim.sim_objectspecialproperty_detectable_all, value)
375
+
376
+ def is_renderable(self) -> bool:
377
+ """Whether the object is renderable or not.
378
+
379
+ :return: If the object is renderable.
380
+ """
381
+ return self._get_property(sim.sim_objectspecialproperty_renderable)
382
+
383
+ def set_renderable(self, value: bool):
384
+ """Set whether the object is renderable or not.
385
+
386
+ :param value: The new value of the renderable state.
387
+ """
388
+ self._set_property(sim.sim_objectspecialproperty_renderable, value)
389
+
390
+ def is_model(self) -> bool:
391
+ """Whether the object is a model or not.
392
+
393
+ :return: If the object is a model.
394
+ """
395
+ prop = sim.simGetModelProperty(self._handle)
396
+ return not (prop & sim.sim_modelproperty_not_model)
397
+
398
+ def set_model(self, value: bool):
399
+ """Set whether the object is a model or not.
400
+
401
+ :param value: True to set as a model.
402
+ """
403
+ current = sim.simGetModelProperty(self._handle)
404
+ current |= sim.sim_modelproperty_not_model
405
+ if value:
406
+ current -= sim.sim_modelproperty_not_model
407
+ sim.simSetModelProperty(self._handle, current)
408
+
409
+ def remove(self) -> None:
410
+ """Removes this object/model from the scene.
411
+
412
+ :raises: ObjectAlreadyRemoved if the object is no longer on the scene.
413
+ """
414
+ try:
415
+ if self.is_model():
416
+ sim.simRemoveModel(self._handle)
417
+ else:
418
+ sim.simRemoveObject(self._handle)
419
+ except RuntimeError as e:
420
+ raise ObjectAlreadyRemovedError(
421
+ 'The object/model was already deleted.') from e
422
+
423
+ def reset_dynamic_object(self) -> None:
424
+ """Dynamically resets an object that is dynamically simulated.
425
+
426
+ This means that the object representation in the dynamics engine is
427
+ removed, and added again. This can be useful when the set-up of a
428
+ dynamically simulated chain needs to be modified during simulation
429
+ (e.g. joint or shape attachement position/orientation changed).
430
+ It should be noted that calling this on a dynamically simulated object
431
+ might slightly change its position/orientation relative to its parent
432
+ (since the object will be disconnected from the dynamics world in its
433
+ current position/orientation), so the user is in charge of rectifying
434
+ for that.
435
+ """
436
+ sim.simResetDynamicObject(self._handle)
437
+
438
+ def get_bounding_box(self) -> List[float]:
439
+ """Gets the bounding box (relative to the object reference frame).
440
+
441
+ :return: A list containing the min x, max x, min y, max y, min z, max z
442
+ positions.
443
+ """
444
+ params = [sim.sim_objfloatparam_objbbox_min_x,
445
+ sim.sim_objfloatparam_objbbox_max_x,
446
+ sim.sim_objfloatparam_objbbox_min_y,
447
+ sim.sim_objfloatparam_objbbox_max_y,
448
+ sim.sim_objfloatparam_objbbox_min_z,
449
+ sim.sim_objfloatparam_objbbox_max_z]
450
+ return [sim.simGetObjectFloatParameter(
451
+ self._handle, p) for p in params]
452
+
453
+ def get_extension_string(self) -> str:
454
+ """A string that describes additional environment/object properties.
455
+
456
+ :return: The extension string.
457
+ """
458
+ return sim.simGetExtensionString(self._handle, -1, '')
459
+
460
+ def get_configuration_tree(self) -> bytes:
461
+ """Retrieves configuration information for a hierarchy tree.
462
+
463
+ Configuration includes object relative positions/orientations,
464
+ joint/path values. Calling :py:meth:`PyRep.set_configuration_tree` at a
465
+ later time, will restore the object configuration
466
+ (use this function to temporarily save object
467
+ positions/orientations/joint/path values).
468
+
469
+ :return: The configuration tree.
470
+ """
471
+ return sim.simGetConfigurationTree(self._handle)
472
+
473
+ def rotate(self, rotation: List[float]) -> None:
474
+ """Rotates a transformation matrix.
475
+
476
+ :param rotation: The x, y, z rotation to perform (in radians).
477
+ """
478
+ m = sim.simGetObjectMatrix(self._handle, -1)
479
+ x_axis = [m[0], m[4], m[8]]
480
+ y_axis = [m[1], m[5], m[9]]
481
+ z_axis = [m[2], m[6], m[10]]
482
+ axis_pos = sim.simGetObjectPosition(self._handle, -1)
483
+ m = sim.simRotateAroundAxis(m, z_axis, axis_pos, rotation[2])
484
+ m = sim.simRotateAroundAxis(m, y_axis, axis_pos, rotation[1])
485
+ m = sim.simRotateAroundAxis(m, x_axis, axis_pos, rotation[0])
486
+ sim.simSetObjectMatrix(self._handle, -1, m)
487
+
488
+ def check_collision(self, obj: 'Object' = None) -> bool:
489
+ """Checks whether two entities are colliding.
490
+
491
+ :param obj: The other collidable object to check collision against,
492
+ or None to check against all collidable objects. Note that objects
493
+ must be marked as collidable!
494
+ :return: If the object is colliding.
495
+ """
496
+ handle = sim.sim_handle_all if obj is None else obj.get_handle()
497
+ return sim.simCheckCollision(self._handle, handle) == 1
498
+
499
+ # === Model specific methods ===
500
+
501
+ def is_model_collidable(self) -> bool:
502
+ """Whether the model is collidable or not.
503
+
504
+ :raises: ObjectIsNotModel if the object is not a model.
505
+ :return: If the model is collidable.
506
+ """
507
+ return self._get_model_property(
508
+ sim.sim_modelproperty_not_collidable)
509
+
510
+ def set_model_collidable(self, value: bool):
511
+ """Set whether the model is collidable or not.
512
+
513
+ :param value: The new value of the collidable state of the model.
514
+ :raises: ObjectIsNotModel if the object is not a model.
515
+ """
516
+ self._set_model_property(
517
+ sim.sim_modelproperty_not_collidable, value)
518
+
519
+ def is_model_measurable(self) -> bool:
520
+ """Whether the model is measurable or not.
521
+
522
+ :raises: ObjectIsNotModel if the object is not a model.
523
+ :return: If the model is measurable.
524
+ """
525
+ return self._get_model_property(
526
+ sim.sim_modelproperty_not_measurable)
527
+
528
+ def set_model_measurable(self, value: bool):
529
+ """Set whether the model is measurable or not.
530
+
531
+ :param value: The new value of the measurable state of the model.
532
+ :raises: ObjectIsNotModel if the object is not a model.
533
+ """
534
+ self._set_model_property(
535
+ sim.sim_modelproperty_not_measurable, value)
536
+
537
+ def is_model_detectable(self) -> bool:
538
+ """Whether the model is detectable or not.
539
+
540
+ :raises: ObjectIsNotModel if the object is not a model.
541
+ :return: If the model is detectable.
542
+ """
543
+ return self._get_model_property(
544
+ sim.sim_modelproperty_not_detectable)
545
+
546
+ def set_model_detectable(self, value: bool):
547
+ """Set whether the model is detectable or not.
548
+
549
+ :param value: The new value of the detectable state of the model.
550
+ :raises: ObjectIsNotModel if the object is not a model.
551
+ """
552
+ self._set_model_property(
553
+ sim.sim_modelproperty_not_detectable, value)
554
+
555
+ def is_model_renderable(self) -> bool:
556
+ """Whether the model is renderable or not.
557
+
558
+ :raises: ObjectIsNotModel if the object is not a model.
559
+ :return: If the model is renderable.
560
+ """
561
+ return self._get_model_property(
562
+ sim.sim_modelproperty_not_renderable)
563
+
564
+ def set_model_renderable(self, value: bool):
565
+ """Set whether the model is renderable or not.
566
+
567
+ :param value: The new value of the renderable state of the model.
568
+ :raises: ObjectIsNotModel if the object is not a model.
569
+ """
570
+ self._set_model_property(
571
+ sim.sim_modelproperty_not_renderable, value)
572
+
573
+ def is_model_dynamic(self) -> bool:
574
+ """Whether the model is dynamic or not.
575
+
576
+ :raises: ObjectIsNotModel if the object is not a model.
577
+ :return: If the model is dynamic.
578
+ """
579
+ return self._get_model_property(
580
+ sim.sim_modelproperty_not_dynamic)
581
+
582
+ def set_model_dynamic(self, value: bool):
583
+ """Set whether the model is dynamic or not.
584
+
585
+ :param value: The new value of the dynamic state of the model.
586
+ :raises: ObjectIsNotModel if the object is not a model.
587
+ """
588
+ self._set_model_property(
589
+ sim.sim_modelproperty_not_dynamic, value)
590
+
591
+ def is_model_respondable(self) -> bool:
592
+ """Whether the model is respondable or not.
593
+
594
+ :raises: ObjectIsNotModel if the object is not a model.
595
+ :return: If the model is respondable.
596
+ """
597
+ return self._get_model_property(
598
+ sim.sim_modelproperty_not_respondable)
599
+
600
+ def set_model_respondable(self, value: bool):
601
+ """Set whether the model is respondable or not.
602
+
603
+ :param value: The new value of the respondable state of the model.
604
+ :raises: ObjectIsNotModel if the object is not a model.
605
+ """
606
+ self._set_model_property(
607
+ sim.sim_modelproperty_not_respondable, value)
608
+
609
+ def save_model(self, path: str) -> None:
610
+ """Saves a model.
611
+
612
+ Object can be turned to models via :py:meth:`Object.set_model`.
613
+ Any existing file with same name will be overwritten.
614
+
615
+ :param path: model filename. The filename extension is required ("ttm").
616
+ :raises: ObjectIsNotModel if the object is not a model.
617
+ """
618
+ self._check_model()
619
+ sim.simSaveModel(self._handle, path)
620
+
621
+ def get_model_bounding_box(self) -> List[float]:
622
+ """Gets the models bounding box (relative to models reference frame).
623
+
624
+ :raises: ObjectIsNotModel if the object is not a model.
625
+ :return: A list containing the min x, max x, min y, max y, min z, max z
626
+ positions.
627
+ """
628
+ self._check_model()
629
+ params = [sim.sim_objfloatparam_modelbbox_min_x,
630
+ sim.sim_objfloatparam_modelbbox_max_x,
631
+ sim.sim_objfloatparam_modelbbox_min_y,
632
+ sim.sim_objfloatparam_modelbbox_max_y,
633
+ sim.sim_objfloatparam_modelbbox_min_z,
634
+ sim.sim_objfloatparam_modelbbox_max_z]
635
+ return [sim.simGetObjectFloatParameter(
636
+ self._handle, p) for p in params]
637
+
638
+ @staticmethod
639
+ def _get_objects_in_tree(root_object=None, object_type=ObjectType.ALL,
640
+ exclude_base=True, first_generation_only=False
641
+ ) -> List['Object']:
642
+ if root_object is None:
643
+ root_object = sim.sim_handle_scene
644
+ elif isinstance(root_object, Object):
645
+ root_object = root_object.get_handle()
646
+ elif not isinstance(root_object, int):
647
+ raise ValueError('root_object must be None, int or Object')
648
+
649
+ options = 0
650
+ if exclude_base:
651
+ options |= 1
652
+ if first_generation_only:
653
+ options |= 2
654
+ handles = sim.simGetObjectsInTree(
655
+ root_object, object_type.value, options)
656
+ objects = []
657
+ for handle in handles:
658
+ try:
659
+ objects.append(Object.get_object(handle))
660
+ except KeyError:
661
+ name = Object.get_object_name(handle)
662
+ type = Object.get_object_type(name)
663
+ warnings.warn(
664
+ "Object ({}, '{}') has {}, "
665
+ 'which is not supported'.format(handle, name, type))
666
+ return objects
667
+
668
+ def get_objects_in_tree(self, *args, **kwargs) -> List['Object']:
669
+ """Retrieves the objects in a given hierarchy tree.
670
+
671
+ :param object_type: The object type to retrieve.
672
+ One of :py:class:`.ObjectType`.
673
+ :param exclude_base: Exclude the tree base from the returned list.
674
+ :param first_generation_only: Include in the returned list only the
675
+ object's first children. Otherwise, entire hierarchy is returned.
676
+ :return: A list of objects in the hierarchy tree.
677
+ """
678
+ return self._get_objects_in_tree(self._handle, *args, **kwargs)
679
+
680
+ def copy(self) -> 'Object':
681
+ """Copy and pastes object in the scene.
682
+
683
+ The object is copied together with all its associated calculation
684
+ objects and associated scripts.
685
+
686
+ :return: The new pasted object.
687
+ """
688
+ return self.__class__((sim.simCopyPasteObjects([self._handle], 0)[0]))
689
+
690
+ def check_distance(self, other: 'Object') -> float:
691
+ """Checks the minimum distance between two objects.
692
+
693
+ :param other: The other object to check distance against.
694
+ :return: The distance between the objects.
695
+ """
696
+ return sim.simCheckDistance(
697
+ self.get_handle(), other.get_handle(), -1)[6]
698
+
699
+ def get_bullet_friction(self) -> float:
700
+ """Get bullet friction parameter.
701
+
702
+ :return: The friction.
703
+ """
704
+ return sim.simGetEngineFloatParameter(sim.sim_bullet_body_friction,
705
+ self._handle)
706
+
707
+ def set_bullet_friction(self, friction) -> None:
708
+ """Set bullet friction parameter.
709
+
710
+ :param friction: The friction to set.
711
+ """
712
+ sim.simSetEngineFloatParameter(sim.sim_bullet_body_friction,
713
+ self._handle, friction)
714
+
715
+ def get_explicit_handling(self) -> int:
716
+ """Get explicit handling flags.
717
+
718
+ :return: The flag: enabled(1) or disabled(0).
719
+ """
720
+ return sim.simGetExplicitHandling(self._handle)
721
+
722
+ def set_explicit_handling(self, value: int) -> None:
723
+ """Set explicit handling flags.
724
+
725
+ :param value: A flag to enable(1) or disable(0) explicit handling.
726
+ """
727
+ sim.simSetExplicitHandling(self._handle, value)
728
+
729
+ # === Private methods ===
730
+
731
+ def _check_model(self) -> None:
732
+ if not self.is_model():
733
+ raise ObjectIsNotModelError(
734
+ "Object '%s' is not a model. Use 'set_model(True)' to convert.")
735
+
736
+ def _get_model_property(self, prop_type: int) -> bool:
737
+ current = sim.simGetModelProperty(self._handle)
738
+ return (current & prop_type) == 0
739
+
740
+ def _set_model_property(self, prop_type: int, value: bool) -> None:
741
+ current = sim.simGetModelProperty(self._handle)
742
+ current |= prop_type # Makes is not X
743
+ if value:
744
+ current -= prop_type
745
+ sim.simSetModelProperty(self._handle, current)
746
+
747
+ def _get_property(self, prop_type: int) -> bool:
748
+ current = sim.simGetObjectSpecialProperty(self._handle)
749
+ return current & prop_type
750
+
751
+ def _set_property(self, prop_type: int, value: bool) -> None:
752
+ current = sim.simGetObjectSpecialProperty(self._handle)
753
+ current |= prop_type
754
+ if not value:
755
+ current -= prop_type
756
+ sim.simSetObjectSpecialProperty(self._handle, current)
external/pyrep/pyrep/objects/octree.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrep.backend import sim
2
+ from typing import List, Optional, Union
3
+ from pyrep.objects.object import Object, object_type_to_class
4
+ from pyrep.const import ObjectType
5
+
6
+ class Octree(Object):
7
+ """An octree object."""
8
+
9
+ def __init__(self, name_or_handle: Union[str, int]):
10
+ super().__init__(name_or_handle)
11
+
12
+ @staticmethod
13
+ def create(voxel_size: float, point_size: Optional[float] = None,
14
+ options: int = 0) -> 'Octree':
15
+ """Creates an octree object and inserts in the scene.
16
+
17
+ :param voxelSize: The resolution of octree voxels.
18
+ :param options: Octree options.
19
+ :param pointSize: Point representation size of voxels.
20
+ :return: The newly created Octree.
21
+ """
22
+ if point_size is None:
23
+ point_size = voxel_size
24
+ handle = sim.simCreateOctree(voxel_size, options, point_size)
25
+ return Octree(handle)
26
+
27
+ def _get_requested_type(self) -> ObjectType:
28
+ return ObjectType.OCTREE
29
+
30
+ def insert_voxels(self, points: List[float], color: Optional[float] = None,
31
+ options: int = 0) -> None:
32
+ """Inserts voxels into the octree.
33
+
34
+ :param points: A list of x,y,z numbers.
35
+ :param color: A list containing RGB data, or None.
36
+ :param options: Voxel insertion options.
37
+ """
38
+ if not isinstance(points, list):
39
+ raise ValueError(
40
+ 'Octree.insert_voxels: points parameter is not a list.')
41
+ if len(points) % 3 != 0:
42
+ raise ValueError(
43
+ 'Octree.insert_voxels: points parameter length '
44
+ 'not a multiple of 3.')
45
+ if color is not None:
46
+ if not isinstance(color, list):
47
+ raise ValueError(
48
+ 'Octree.insert_voxels: color parameter not a list.')
49
+ elif len(color) != 3:
50
+ raise ValueError(
51
+ 'Octree.insert_voxels: color parameter not an RGB list.')
52
+ sim.simInsertVoxelsIntoOctree(self._handle, options, points, color,None)
53
+ return
54
+
55
+ def remove_voxels(self, points : Optional[List[float]],
56
+ options: int = 0) -> None:
57
+ """Remove voxels from the octree.
58
+
59
+ :param points: A list of x,y,z numbers, or None to clear the octree.
60
+ :param options: Voxel removal options.
61
+ """
62
+ if points is not None:
63
+ if not isinstance(points, list):
64
+ raise ValueError(
65
+ 'Octree.insert_voxels: points parameter is not a list.')
66
+ if len(points) % 3 != 0:
67
+ raise ValueError(
68
+ 'Octree.insert_voxels: points parameter length '
69
+ 'not a multiple of 3.')
70
+ sim.simRemoveVoxelsFromOctree(self._handle, options, points)
71
+
72
+ def get_voxels(self) -> list:
73
+ """Returns voxels from the octree.
74
+
75
+ :return: List of voxel x,y,z coordinates.
76
+ """
77
+ return sim.simGetOctreeVoxels(self._handle)
78
+
79
+ def insert_object(self, obj: Object, color: Optional[float] = None,
80
+ options: int = 0) -> None:
81
+ """Inserts object into the octree.
82
+
83
+ :param obj: Object to insert.
84
+ :param color: A list containing RGB data, or None.
85
+ :param options: Object insertion options.
86
+ """
87
+ if color is not None:
88
+ if not isinstance(color, list):
89
+ raise ValueError(
90
+ 'Octree.insert_object: color parameter not a list.')
91
+ elif len(color) != 3:
92
+ raise ValueError(
93
+ 'Octree.insert_object: color parameter not an RGB list.')
94
+ sim.simInsertObjectIntoOctree(self._handle, obj.get_handle(), options,
95
+ color, 0)
96
+ return
97
+
98
+ def subtract_object(self, obj: Object, options: int = 0) -> None:
99
+ """Subtract object from the octree.
100
+
101
+ :param obj: Object to subtract.
102
+ :param options: Object subtraction options.
103
+ """
104
+ sim.simSubtractObjectFromOctree(self._handle, obj.get_handle(), options)
105
+ return
106
+
107
+ def check_point_occupancy(self, points: List[float],
108
+ options: int = 0) -> bool:
109
+ if not isinstance(points, list):
110
+ raise ValueError(
111
+ 'Octree.check_point_occupancy: points parameter is not a list.')
112
+ if len(points) % 3 != 0:
113
+ raise ValueError(
114
+ 'Octree._check_point_occupancy: points parameter length '
115
+ 'not a multiple of 3.')
116
+ return sim.simCheckOctreePointOccupancy(self._handle, options, points)
117
+
118
+ def clear_voxels(self) -> None:
119
+ """Clears all voxels from the octree.
120
+ """
121
+ sim.simRemoveVoxelsFromOctree(self._handle, 0, None)
122
+
123
+ object_type_to_class[ObjectType.OCTREE] = Octree
external/pyrep/pyrep/objects/proximity_sensor.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from math import sqrt
2
+
3
+ from pyrep.backend import sim
4
+ from pyrep.objects.object import Object, object_type_to_class
5
+ from pyrep.const import ObjectType
6
+
7
+
8
+ class ProximitySensor(Object):
9
+ """Detects objects within a detection volume.
10
+
11
+ V-REP supports pyramid-, cylinder-, disk-, cone- and ray-type proximity
12
+ sensors.
13
+ """
14
+
15
+ def _get_requested_type(self) -> ObjectType:
16
+ return ObjectType.PROXIMITY_SENSOR
17
+
18
+ def read(self) -> float:
19
+ """Read the distance between sensor and first detected object. If
20
+ there is no detected object returns -1.0. It can be considered as
21
+ maximum measurable distance of the sensor.
22
+
23
+ :return: Float distance to the first detected object
24
+ """
25
+ state, _, points, _ = sim.simReadProximitySensor(self._handle)
26
+ if state:
27
+ return sqrt(points[0] ** 2 + points[1] ** 2 + points[2] ** 2)
28
+ return -1.0
29
+
30
+ def is_detected(self, obj: Object) -> bool:
31
+ """Checks whether the proximity sensor detects the indicated object.
32
+
33
+ :param obj: The object to detect.
34
+ :return: Bool indicating if the object was detected.
35
+ """
36
+ state, point = sim.simCheckProximitySensor(
37
+ self._handle, obj.get_handle())
38
+ return state == 1
39
+
40
+
41
+ object_type_to_class[ObjectType.PROXIMITY_SENSOR] = ProximitySensor
external/pyrep/pyrep/objects/shape.py ADDED
@@ -0,0 +1,584 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, Tuple
2
+ import numpy as np
3
+ from pyrep.backend import sim
4
+ from pyrep.objects.object import Object, object_type_to_class
5
+ from pyrep.const import ObjectType, PrimitiveShape, TextureMappingMode
6
+ from pyrep.textures.texture import Texture
7
+ import os
8
+ import collections
9
+
10
+
11
+ SShapeVizInfo = collections.namedtuple(
12
+ 'SShapeVizInfo',
13
+ [
14
+ 'vertices',
15
+ 'indices',
16
+ 'normals',
17
+ 'shading_angle',
18
+ 'colors',
19
+ 'texture',
20
+ 'texture_id',
21
+ 'texture_coords',
22
+ 'texture_apply_mode',
23
+ 'texture_options',
24
+ ],
25
+ )
26
+
27
+
28
+ class Shape(Object):
29
+ """Shapes are rigid mesh objects that are composed of triangular faces.
30
+ """
31
+
32
+ @staticmethod
33
+ def create(type: PrimitiveShape, size: List[float],
34
+ mass=1., backface_culling=False, visible_edges=False,
35
+ smooth=False, respondable=True,
36
+ static=False, renderable=True, position=None,
37
+ orientation=None, color=None) -> 'Shape':
38
+ """Creates a primitive shape in the scene.
39
+
40
+ :param type: The type of primitive to shape. One of:
41
+ PrimitiveShape.CUBOID
42
+ PrimitiveShape.SPHERE
43
+ PrimitiveShape.CYLINDER
44
+ PrimitiveShape.CONE
45
+ :param size: A list of the x, y, z dimensions.
46
+ :param mass: A float representing the mass of the object.
47
+ :param backface_culling: If backface culling is enabled.
48
+ :param visible_edges: If the object will have visible edges.
49
+ :param smooth: If the shape appears smooth.
50
+ :param respondable: Shape is responsible.
51
+ :param static: If the shape is static.
52
+ :param renderable: If the shape is renderable.
53
+ :param position: The x, y, z position.
54
+ :param orientation: The x, y, z orientation (in radians).
55
+ :param color: The r, g, b values of the shape.
56
+ :return: The created Shape object.
57
+ """
58
+ options = 0
59
+ if backface_culling:
60
+ options |= 1
61
+ if visible_edges:
62
+ options |= 2
63
+ if smooth:
64
+ options |= 4
65
+ if respondable:
66
+ options |= 8
67
+ if static:
68
+ options |= 16
69
+
70
+ handle = sim.simCreatePureShape(type.value, options, size, mass, None)
71
+ ob = Shape(handle)
72
+ ob.set_renderable(renderable)
73
+ if position is not None:
74
+ ob.set_position(position)
75
+ if orientation is not None:
76
+ ob.set_orientation(orientation)
77
+ if color is not None:
78
+ ob.set_color(color)
79
+ return ob
80
+
81
+ @classmethod
82
+ def import_shape(cls, filename: str, scaling_factor=1.0,
83
+ keep_identical_vertices=False, ignore_color=False,
84
+ ignore_texture=False, reorient_bounding_box=False,
85
+ ignore_up_vector=False) -> 'Shape':
86
+ """Imports a shape with visuals from a file.
87
+
88
+ :param filename: The location of the file to import.
89
+ :param scaling_factor: The scaling factor to apply to the imported vertices
90
+ :param keep_identical_vertices: Keep identical vertices.
91
+ :param ignore_color: Do not preserve colors.
92
+ :param ignore_texture: Do not preserve texture.
93
+ :param reorient_bounding_box: Reorient the shape's bounding box
94
+ with the world.
95
+ :param ignore_up_vector: Ignore up-vector coded in file.
96
+ :return: The Shape object.
97
+ """
98
+ if not os.path.isfile(filename):
99
+ raise ValueError('Filename does not exist: ' + filename)
100
+
101
+ options = 0
102
+ if keep_identical_vertices:
103
+ options |= 1
104
+ if ignore_color:
105
+ options |= 8
106
+ if not ignore_texture:
107
+ options |= 16
108
+ if reorient_bounding_box:
109
+ options |= 32
110
+ if ignore_up_vector:
111
+ options |= 128
112
+
113
+ handle = sim.simImportShape(0, filename, options, 0, scaling_factor)
114
+ return cls(handle)
115
+
116
+ @staticmethod
117
+ def import_mesh(filename: str, scaling_factor=1.0,
118
+ keep_identical_vertices=False,
119
+ ignore_up_vector=False) -> 'Shape':
120
+ """Imports a mesh from a file.
121
+
122
+ :param filename: The location of the file to import.
123
+ :param scaling_factor: The scaling factor to apply to the imported vertices
124
+ :param keep_identical_vertices: Keep identical vertices.
125
+ :param ignore_up_vector: Ignore up-vector coded in file.
126
+ :return: The grouped Shape object.
127
+ """
128
+
129
+ if not os.path.isfile(filename):
130
+ raise ValueError('Filename does not exist: ' + filename)
131
+
132
+ options = 0
133
+ if keep_identical_vertices:
134
+ options |= 1
135
+ if ignore_up_vector:
136
+ options |= 128
137
+
138
+ # fileformat is 0 as it is automatically detected.
139
+ # identicalVerticeTolerance has no effect. Setting to zero.
140
+ verticies, indices, names = sim.simImportMesh(
141
+ 0, filename, options, 0, scaling_factor)
142
+ mesh_objects = []
143
+ for v, i, n in zip(verticies, indices, names):
144
+ mesh_ob = Shape.create_mesh(v, i)
145
+ mesh_objects.append(mesh_ob)
146
+ grouped = mesh_objects[0]
147
+ if len(mesh_objects) > 1:
148
+ handles = [o.get_handle() for o in mesh_objects]
149
+ handle = sim.simGroupShapes(handles)
150
+ grouped = Shape(handle)
151
+ return grouped
152
+
153
+ @staticmethod
154
+ def create_mesh(vertices: List[float], indices: List[int],
155
+ shading_angle=None, backface_culling=False,
156
+ visible_edges=False) -> 'Shape':
157
+ """Creates a mesh shape.
158
+
159
+ :param vertices: A list of vertices.
160
+ :param indices: A list of indices.
161
+ :param shading_angle: The shading angle (in radians).
162
+ :param backface_culling: To enable backface culling.
163
+ :param visible_edges: To enable visible edges.
164
+ :return: The newly created mesh.
165
+ """
166
+ options = 0
167
+ if backface_culling:
168
+ options |= 1
169
+ if visible_edges:
170
+ options |= 2
171
+ if shading_angle is None:
172
+ shading_angle = 20.0 * 3.1415 / 180.0
173
+ handle = sim.simCreateMeshShape(
174
+ options, shading_angle, vertices, indices)
175
+ return Shape(handle)
176
+
177
+ def _get_requested_type(self) -> ObjectType:
178
+ return ObjectType.SHAPE
179
+
180
+ def is_respondable(self) -> bool:
181
+ """Whether the shape is respondable or not.
182
+
183
+ :return: If the shape is respondable.
184
+ """
185
+ return sim.simGetObjectInt32Parameter(
186
+ self._handle, sim.sim_shapeintparam_respondable)
187
+
188
+ def set_respondable(self, value: bool) -> None:
189
+ """Set whether the shape is respondable or not.
190
+
191
+ :param value: The new value of the respondable state of the shape.
192
+ """
193
+ sim.simSetObjectInt32Parameter(
194
+ self._handle, sim.sim_shapeintparam_respondable, value)
195
+ self.reset_dynamic_object()
196
+
197
+ def is_dynamic(self) -> bool:
198
+ """Whether the shape is dynamic or not.
199
+
200
+ :return: If the shape is dynamic.
201
+ """
202
+ return not sim.simGetObjectInt32Parameter(
203
+ self._handle, sim.sim_shapeintparam_static)
204
+
205
+ def set_dynamic(self, value: bool) -> None:
206
+ """Set whether the shape is dynamic or not.
207
+
208
+ :param value: The new value of the dynamic state of the shape.
209
+ """
210
+ sim.simSetObjectInt32Parameter(
211
+ self._handle, sim.sim_shapeintparam_static, not value)
212
+ self.reset_dynamic_object()
213
+
214
+ def get_color(self) -> List[float]:
215
+ """Gets the shape color.
216
+
217
+ :return: The r, g, b values of the shape.
218
+ """
219
+ return sim.simGetShapeColor(
220
+ self._handle, None, sim.sim_colorcomponent_ambient_diffuse)
221
+
222
+ def set_color(self, color: List[float]) -> None:
223
+ """Sets the color of the shape.
224
+
225
+ :param color: The r, g, b values of the shape.
226
+ """
227
+ sim.simSetShapeColor(
228
+ self._handle, None, sim.sim_colorcomponent_ambient_diffuse, color)
229
+
230
+ def get_transparency(self) -> float:
231
+ """Sets the transparency of the shape.
232
+
233
+ :return: The transparency values of the shape.
234
+ """
235
+ return sim.simGetShapeColor(
236
+ self._handle, None, sim.sim_colorcomponent_transparency)[0]
237
+
238
+ def set_transparency(self, value: float) -> None:
239
+ """Sets the transparency of the shape.
240
+
241
+ :param value: Value between 0 and 1.
242
+ """
243
+ if 0 > value > 1:
244
+ raise ValueError('Value must be between 0 and 1.')
245
+ sim.simSetShapeColor(
246
+ self._handle, None, sim.sim_colorcomponent_transparency, [value])
247
+
248
+ def get_mass(self) -> float:
249
+ """Gets the mass of the shape.
250
+
251
+ :return: A float representing the mass.
252
+ """
253
+ return sim.simGetObjectFloatParameter(self._handle,
254
+ sim.sim_shapefloatparam_mass)
255
+
256
+ def set_mass(self, mass: float) -> None:
257
+ """Sets the mass of the shape.
258
+
259
+ :param mass: The new mass value.
260
+ """
261
+ sim.simSetObjectFloatParameter(
262
+ self._handle, sim.sim_shapefloatparam_mass, mass)
263
+
264
+ def compute_mass_and_inertia(self, density: float) -> None:
265
+ """Computes and applies the mass and inertia properties for a
266
+ convex shape (or convex compound shape), based on a density value.
267
+
268
+ :param density: The density expressed in kg/m^3
269
+ """
270
+ ret = sim.simComputeMassAndInertia(self._handle, density)
271
+ if ret == 0:
272
+ raise ValueError(
273
+ 'The shape must be a convex shape (or convex compound shape)')
274
+
275
+
276
+ def get_mesh_data(self) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
277
+ """Retrieves a shape's mesh information.
278
+
279
+ :param asnumpy: A flag to cast vertices as numpy array with reshape.
280
+ :return: A tuple containing a list of vertices, indices, and normals.
281
+ """
282
+ vertices, indices, normals = sim.simGetShapeMesh(self._handle)
283
+ vertices = np.array(vertices, dtype=np.float64).reshape(-1, 3)
284
+ indices = np.array(indices, dtype=np.int64).reshape(-1, 3)
285
+ normals = np.array(normals, dtype=np.float64).reshape(-1, 3)
286
+ return vertices, indices, normals
287
+
288
+ def decimate_mesh(self, percentage: float) -> 'Shape':
289
+ """Retrieves a shape's mesh information.
290
+
291
+ :param percentage: The percentage of the desired decimation (0.1-0.9).
292
+ :return: A new shape that has a decimated mesh.
293
+ """
294
+ if percentage < 0.1 or percentage > 0.9:
295
+ raise ValueError('percentage param must be between 0.1 and 0.9.')
296
+ # verts, inds, _ = self.get_mesh_data()
297
+ verts, inds, _ = sim.simGetShapeMesh(self._handle)
298
+ new_verts, new_inds = sim.simGetDecimatedMesh(
299
+ # verts.reshape(-1).tolist(), inds.reshape(-1).tolist(), percentage)
300
+ verts, inds, percentage)
301
+ s = Shape.create_mesh(new_verts, new_inds)
302
+ s.set_matrix(self.get_matrix())
303
+ return s
304
+
305
+ def get_convex_decomposition(self, morph=False, same=False, use_vhacd=False,
306
+ individual_meshes=False,
307
+ hacd_extra_points=True, hacd_face_points=True,
308
+ hacd_min_clusters=1, hacd_tri_target=500,
309
+ hacd_max_vertex=200, hacd_max_iter=4,
310
+ hacd_max_concavity=100, hacd_max_dist=30,
311
+ hacd_cluster_thresh=0.25,
312
+ vhacd_pca=False, vhacd_tetrahedron=False,
313
+ vhacd_res=100000, vhacd_depth=20,
314
+ vhacd_plane_downsample=4,
315
+ vhacd_hull_downsample=4,
316
+ vhacd_max_vertex=64, vhacd_concavity=0.0025,
317
+ vhacd_alpha=0.05, vhacd_beta=0.05,
318
+ vhacd_gamma=0.00125, vhacd_min_vol=0.0001
319
+ ) -> 'Shape':
320
+ """
321
+ Compute the convex decomposition of the shape using HACD or V-HACD
322
+ algorithms
323
+ :param morph: The shape will be morphed into its convex decomposition.
324
+ Otherwise a new shape will be created.
325
+ :param same: Use the same parameters as the last call to the function.
326
+ :param use_vhacd: Use V-HACD algorithm.
327
+ :param individual_meshes: Each individual mesh of a compound shape will
328
+ be handled on its own during decomposition, otherwise the
329
+ compound shape is considered as a single mesh.
330
+ :param hacd_extra_points: HACD: Extra points will be added when
331
+ computing the concavity.
332
+ :param hacd_face_points: HACD: Faces points will be added when computing
333
+ the concavity.
334
+ :param hacd_min_clusters: HACD: Minimum number of clusters to generate.
335
+ :param hacd_tri_target: HACD: Targeted number of triangles of the
336
+ decimated mesh.
337
+ :param hacd_max_vertex: HACD: Maximum number of vertices for each
338
+ generated convex hull.
339
+ :param hacd_max_iter: HACD: Maximum number of iterations.
340
+ :param hacd_max_concavity: HACD: The maximum allowed concavity.
341
+ :param hacd_max_dist: HACD: The maximum allowed distance to get convex
342
+ clusters connected.
343
+ :param hacd_cluster_thresh: HACD: The threshold to detect small
344
+ clusters, expressed as a fraction of the total mesh surface.
345
+ :param vhacd_pca: V-HACD: Enable PCA.
346
+ :param vhacd_tetrahedron: V-HACD: Tetrahedron-based approximate convex
347
+ decomposition. Otherwise, voxel-based decomposition is used.
348
+ :param vhacd_res: V-HACD: Resolution (10000-64000000)
349
+ :param vhacd_depth: V-HACD: Depth (1-32)
350
+ :param vhacd_plane_downsample: V-HACD: Plane downsampling (1-16)
351
+ :param vhacd_hull_downsample: V-HACD: Convex hull downsampling (1-16)
352
+ :param vhacd_max_vertex: V-HACD: Maximum number of vertices per convex
353
+ hull (4-1024)
354
+ :param vhacd_concavity: V-HACD: Concavity (0.0-1.0)
355
+ :param vhacd_alpha: V-HACD: Alpha (0.0-1.0)
356
+ :param vhacd_beta: V-HACD: Beta (0.0-1.0)
357
+ :param vhacd_gamma: V-HACD: Gamma (0.0-1.0)
358
+ :param vhacd_min_vol: V-HACD: Minimum volume per convex hull (0.0-0.01)
359
+ :return: Convex Decomposition of the shape.
360
+ """
361
+ options = 0
362
+ if morph:
363
+ options |= 1
364
+ if same:
365
+ options |= 4
366
+ if hacd_extra_points:
367
+ options |= 8
368
+ if hacd_face_points:
369
+ options |= 16
370
+ if individual_meshes:
371
+ options |= 32
372
+ if use_vhacd:
373
+ options |= 128
374
+ if vhacd_pca:
375
+ options |= 256
376
+ if vhacd_tetrahedron:
377
+ options |= 512
378
+
379
+ int_params = [
380
+ hacd_min_clusters, # [0]
381
+ hacd_tri_target, # [1]
382
+ hacd_max_vertex, # [2]
383
+ hacd_max_iter, # [3]
384
+ 0, # [4]
385
+ vhacd_res, # [5]
386
+ vhacd_depth, # [6]
387
+ vhacd_plane_downsample, # [7]
388
+ vhacd_hull_downsample, # [8]
389
+ vhacd_max_vertex # [9]
390
+ ]
391
+
392
+ float_params = [
393
+ hacd_max_concavity, # [0]
394
+ hacd_max_dist, # [1]
395
+ hacd_cluster_thresh, # [2]
396
+ 0.0, # [3]
397
+ 0.0, # [4]
398
+ vhacd_concavity, # [5]
399
+ vhacd_alpha, # [6]
400
+ vhacd_beta, # [7]
401
+ vhacd_gamma, # [8]
402
+ vhacd_min_vol # [9]
403
+ ]
404
+
405
+ return Shape(sim.simConvexDecompose(self.get_handle(), options,
406
+ int_params, float_params))
407
+
408
+ def get_texture(self):
409
+ """Retrieves the texture from the shape.
410
+ :return: The texture associated with this object.
411
+ """
412
+ return Texture(sim.simGetShapeTextureId(self.get_handle()))
413
+
414
+ def remove_texture(self):
415
+ """Removes the texture from the shape.
416
+ """
417
+ sim.simSetShapeTexture(self.get_handle(), -1, 0, 0, [1, 1], None, None)
418
+
419
+ def set_texture(self, texture: Texture, mapping_mode: TextureMappingMode,
420
+ interpolate=True, decal_mode=False, repeat_along_u=False,
421
+ repeat_along_v=False, uv_scaling=[1., 1.],
422
+ position: List[float] = None,
423
+ orientation: List[float] = None):
424
+ """Applies a texture to a shape
425
+
426
+ :param texture: The texture to add.
427
+ :param mapping_mode: The texture mapping mode. One of:
428
+ TextureMappingMode.PLANE
429
+ TextureMappingMode.CYLINDER
430
+ TextureMappingMode.SPHERE
431
+ TextureMappingMode.CUBE
432
+ :param interpolate: Adjacent texture pixels are not interpolated.
433
+ :param decal_mode: Texture is applied as a decal (its appearance
434
+ won't be influenced by light conditions).
435
+ :param repeat_along_u: Texture will be repeated along the U direction.
436
+ :param repeat_along_v: Texture will be repeated along the V direction.
437
+ :param uv_scaling: A list of 2 values containig the texture scaling
438
+ factors along the U and V directions.
439
+ :param position: A list of (x,y,z) values that indicate the texture
440
+ position on the shape. Can be None for default.
441
+ :param orientation: A list of 3 Euler angles that indicate the texture
442
+ orientation on the shape. Can be None for default.
443
+ """
444
+ options = 0
445
+ if not interpolate:
446
+ options |= 1
447
+ if decal_mode:
448
+ options |= 2
449
+ if repeat_along_u:
450
+ options |= 4
451
+ if repeat_along_v:
452
+ options |= 8
453
+ sim.simSetShapeTexture(
454
+ self.get_handle(), texture.get_texture_id(), mapping_mode.value,
455
+ options, list(uv_scaling), position, orientation)
456
+
457
+ def ungroup(self) -> List['Shape']:
458
+ """Ungroups a compound shape into several simple shapes.
459
+
460
+ :return: A list of shapes.
461
+ """
462
+ handles = sim.simUngroupShape(self.get_handle())
463
+ return [Shape(handle) for handle in handles]
464
+
465
+ def apply_texture(self, texture_coords: np.ndarray, texture: np.ndarray,
466
+ interpolate: bool = True, decal_mode: bool = False,
467
+ is_rgba: bool = False, fliph: bool = False,
468
+ flipv: bool = False) -> None:
469
+ """Apply texture to the shape.
470
+
471
+ :param texture_coords: A list of (u, v) values that indicate the
472
+ vertex position on the shape. For each of the shape's triangle,
473
+ there should be exactly 3 UV texture coordinate pairs
474
+ :param texture: The RGB or RGBA texture.
475
+ :param interpolate: A flag to interpolate adjacent texture pixels.
476
+ :param decal_mode: Texture is applied as a decal (its appearance
477
+ won't be influenced by light conditions).
478
+ :param is_rgba: A flag to use RGBA texture.
479
+ :param fliph: A flag to flip texture horizontally.
480
+ :param flipv: A flag to flip texture vertically. Note that CoppeliaSim
481
+ texture coordinates are flipped vertically compared with Pillow
482
+ and OpenCV and this flag must be true in general.
483
+ """
484
+ texture_coords = np.asarray(texture_coords)
485
+ if not isinstance(texture, np.ndarray):
486
+ raise TypeError('texture must be np.ndarray type')
487
+ height, width = texture.shape[:2]
488
+
489
+ options = 0
490
+ if not interpolate:
491
+ options |= 1
492
+ if decal_mode:
493
+ options |= 2
494
+ if is_rgba:
495
+ options |= 16
496
+ if fliph:
497
+ options |= 32
498
+ if flipv:
499
+ options |= 64
500
+
501
+ sim.simApplyTexture(
502
+ self._handle,
503
+ textureCoordinates=texture_coords.flatten().tolist(),
504
+ textCoordSize=texture_coords.size,
505
+ texture=texture.flatten().tolist(),
506
+ textureResolution=(width, height),
507
+ options=options,
508
+ )
509
+
510
+ def get_shape_viz(self, index):
511
+ """Retrieves a shape's visual information.
512
+
513
+ :param index: 0-based index of the shape element to retrieve
514
+ (compound shapes contain more than one shape element)
515
+
516
+ :return: SShapeVizInfo.
517
+ """
518
+ info = sim.simGetShapeViz(shapeHandle=self._handle, index=index)
519
+
520
+ vertices = np.array(info.vertices, dtype=float).reshape(-1, 3)
521
+ indices = np.array(info.indices, dtype=float).reshape(-1, 3)
522
+ normals = np.array(info.normals, dtype=float).reshape(-1, 3)
523
+ colors = np.array(info.colors, dtype=float)
524
+ texture = np.array(info.texture, dtype=np.uint8).reshape(
525
+ info.textureRes[1], info.textureRes[0], 4)
526
+ textureCoords = np.array(info.textureCoords, dtype=float).reshape(
527
+ -1, 2)
528
+
529
+ res = SShapeVizInfo(
530
+ vertices=vertices,
531
+ indices=indices,
532
+ normals=normals,
533
+ shading_angle=info.shadingAngle,
534
+ colors=colors,
535
+ texture=texture,
536
+ texture_id=info.textureId,
537
+ texture_coords=textureCoords,
538
+ texture_apply_mode=info.textureApplyMode,
539
+ texture_options=info.textureOptions,
540
+ )
541
+ return res
542
+
543
+ def reorient_bounding_box(self, relative_to=None) -> None:
544
+ relto = -1 if relative_to is None else relative_to.get_handle()
545
+ sim.simReorientShapeBoundingBox(self._handle, relto)
546
+
547
+ def add_force(self, position: np.ndarray, force: np.ndarray,
548
+ reset_force_torque: bool = False) -> None:
549
+ """
550
+ Adds a non-central force to a shape object that is dynamically enabled.
551
+ Added forces are cumulative.
552
+
553
+ :param position: Relative position where the force should be applied.
554
+ :param force: The force (in relative coordinates) to add.
555
+ :param reset_force_torque: Clears the accumulated force and torque.
556
+ """
557
+ h = (self._handle | sim.sim_handleflag_resetforcetorque
558
+ if reset_force_torque else self._handle)
559
+ sim.simAddForce(h, list(position), list(force))
560
+
561
+ def add_force_and_torque(self, force: np.ndarray, torque: np.ndarray,
562
+ reset_force: bool = False,
563
+ reset_torque: bool = False) -> None:
564
+ """
565
+ Adds a force and/or torque to a shape object that is dynamically
566
+ enabled. Forces are applied at the center of mass.
567
+ Added forces and torques are cumulative.
568
+
569
+ :param force: The force (in absolute coordinates) to add.
570
+ :param torque: The torque (in absolute coordinates) to add.
571
+ :param reset_force: Clears the accumulated force.
572
+ :param reset_torque: Clears the accumulated torque.
573
+ """
574
+ h = self._handle
575
+ if reset_force:
576
+ h |= sim.sim_handleflag_resetforce
577
+ if reset_torque:
578
+ h |= sim.sim_handleflag_resettorque
579
+ sim.simAddForceAndTorque(h,
580
+ None if force is None else list(force),
581
+ None if torque is None else list(torque))
582
+
583
+
584
+ object_type_to_class[ObjectType.SHAPE] = Shape
external/pyrep/pyrep/objects/vision_sensor.py ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ from typing import List, Union, Sequence
3
+ from pyrep.backend import sim
4
+ from pyrep.objects.object import Object, object_type_to_class
5
+ import numpy as np
6
+ from pyrep.const import ObjectType, PerspectiveMode, RenderMode
7
+
8
+
9
+ class VisionSensor(Object):
10
+ """A camera-type sensor, reacting to light, colors and images.
11
+ """
12
+
13
+ def __init__(self, name_or_handle: Union[str, int]):
14
+ super().__init__(name_or_handle)
15
+ self.resolution = sim.simGetVisionSensorResolution(self._handle)
16
+
17
+ @staticmethod
18
+ def create(resolution: List[int], explicit_handling=False,
19
+ perspective_mode=True, show_volume_not_detecting=True,
20
+ show_volume_detecting=True, passive=False,
21
+ use_local_lights=False, show_fog=True,
22
+ near_clipping_plane=1e-2, far_clipping_plane=10.0,
23
+ view_angle=60.0, ortho_size=1.0, sensor_size=None,
24
+ background_color=None,
25
+ render_mode=RenderMode.OPENGL3,
26
+ position=None, orientation=None) -> 'VisionSensor':
27
+ """ Create a Vision Sensor
28
+
29
+ :param resolution: List of the [x, y] resolution.
30
+ :param explicit_handling: Sensor will be explicitly handled.
31
+ :param perspective_mode: Sensor will be operated in Perspective Mode.
32
+ Orthographic mode if False.
33
+ :param show_volume_not_detecting: Sensor volume will be shown when not
34
+ detecting anything.
35
+ :param show_volume_detecting: Sensor will be shown when detecting.
36
+ :param passive: Sensor will be passive (use an external image).
37
+ :param use_local_lights: Sensor will use local lights.
38
+ :param show_fog: Sensor will show fog (if enabled).
39
+ :param near_clipping_plane: Near clipping plane.
40
+ :param far_clipping_plane: Far clipping plane.
41
+ :param view_angle: Perspective angle (in degrees) if in Perspective Mode.
42
+ :param ortho_size: Orthographic projection size [m] if in Orthographic
43
+ Mode.
44
+ :param sensor_size: Size [x, y, z] of the Vision Sensor object.
45
+ :param render_mode: Sensor rendering mode, one of:
46
+ RenderMode.OPENGL
47
+ RenderMode.OPENGL_AUXILIARY
48
+ RenderMode.OPENGL_COLOR_CODED
49
+ RenderMode.POV_RAY
50
+ RenderMode.EXTERNAL
51
+ RenderMode.EXTERNAL_WINDOWED
52
+ RenderMode.OPENGL3
53
+ RenderMode.OPENGL3_WINDOWED
54
+ :param position: The [x, y, z] position, if specified.
55
+ :param orientation: The [x, y, z] orientation in radians, if specified.
56
+ :return: The created Vision Sensor.
57
+ """
58
+ options = 0
59
+ if explicit_handling:
60
+ options |= 1
61
+ if perspective_mode:
62
+ options |= 2
63
+ if not show_volume_not_detecting:
64
+ options |= 4
65
+ if not show_volume_detecting:
66
+ options |= 8
67
+ if passive:
68
+ options |= 16
69
+ if use_local_lights:
70
+ options |= 32
71
+ if not show_fog:
72
+ options |= 64
73
+
74
+ if background_color: #show_default_background_color:
75
+ options |= 128
76
+ else:
77
+ background_color = [0.0, 0.0, 0.0]
78
+
79
+ int_params = [
80
+ resolution[0], # 0
81
+ resolution[1], # 1
82
+ 0, # 2
83
+ 0 # 3
84
+ ]
85
+
86
+ if sensor_size is None:
87
+ sensor_size = [0.01, 0.01, 0.03]
88
+ # sensor_size[1] and sensor_size[2] should be 0 according to the documentation...
89
+
90
+ float_params = [
91
+ near_clipping_plane, # 0
92
+ far_clipping_plane, # 1
93
+ math.radians(view_angle) if perspective_mode else ortho_size, # 2
94
+ sensor_size[0], # 3
95
+ sensor_size[1], # 4
96
+ sensor_size[2], # 5
97
+ background_color[0], # 6
98
+ background_color[1], # 7
99
+ background_color[2], # 8
100
+ 0.0, # 9
101
+ 0.0, # 10
102
+ ]
103
+
104
+
105
+ vs = VisionSensor(
106
+ sim.simCreateVisionSensor(options, int_params, float_params, None)
107
+ )
108
+ vs.set_render_mode(render_mode)
109
+ if position is not None:
110
+ vs.set_position(position)
111
+ if orientation is not None:
112
+ vs.set_orientation(orientation)
113
+ return vs
114
+
115
+ def _get_requested_type(self) -> ObjectType:
116
+ return ObjectType.VISION_SENSOR
117
+
118
+ def handle_explicitly(self) -> None:
119
+ """Handle sensor explicitly.
120
+
121
+ This enables capturing image (e.g., capture_rgb())
122
+ without PyRep.step().
123
+ """
124
+ if not self.get_explicit_handling():
125
+ raise RuntimeError('The explicit_handling is disabled. '
126
+ 'Call set_explicit_handling(value=1) to enable explicit_handling first.')
127
+ sim.simHandleVisionSensor(self._handle)
128
+
129
+ def capture_rgb(self) -> np.ndarray:
130
+ """Retrieves the rgb-image of a vision sensor.
131
+
132
+ :return: A numpy array of size (width, height, 3)
133
+ """
134
+ return sim.simGetVisionSensorImage(self._handle, self.resolution)
135
+
136
+ def capture_depth(self, in_meters=False) -> np.ndarray:
137
+ """Retrieves the depth-image of a vision sensor.
138
+
139
+ :param in_meters: Whether the depth should be returned in meters.
140
+ :return: A numpy array of size (width, height)
141
+ """
142
+ return sim.simGetVisionSensorDepthBuffer(
143
+ self._handle, self.resolution, in_meters)
144
+
145
+ def capture_pointcloud(self) -> np.ndarray:
146
+ """Retrieves point cloud in word frame.
147
+
148
+ :return: A numpy array of size (width, height, 3)
149
+ """
150
+ d = self.capture_depth(in_meters=True)
151
+ return self.pointcloud_from_depth(d)
152
+
153
+ def pointcloud_from_depth(self, depth: np.ndarray) -> np.ndarray:
154
+ """Converts depth (in meters) to point cloud in word frame.
155
+
156
+ :return: A numpy array of size (width, height, 3)
157
+ """
158
+ intrinsics = self.get_intrinsic_matrix()
159
+ return VisionSensor.pointcloud_from_depth_and_camera_params(
160
+ depth, self.get_matrix(), intrinsics)
161
+
162
+ @staticmethod
163
+ def pointcloud_from_depth_and_camera_params(
164
+ depth: np.ndarray, extrinsics: np.ndarray,
165
+ intrinsics: np.ndarray) -> np.ndarray:
166
+ """Converts depth (in meters) to point cloud in word frame.
167
+ :return: A numpy array of size (width, height, 3)
168
+ """
169
+ upc = _create_uniform_pixel_coords_image(depth.shape)
170
+ pc = upc * np.expand_dims(depth, -1)
171
+ C = np.expand_dims(extrinsics[:3, 3], 0).T
172
+ R = extrinsics[:3, :3]
173
+ R_inv = R.T # inverse of rot matrix is transpose
174
+ R_inv_C = np.matmul(R_inv, C)
175
+ extrinsics = np.concatenate((R_inv, -R_inv_C), -1)
176
+ cam_proj_mat = np.matmul(intrinsics, extrinsics)
177
+ cam_proj_mat_homo = np.concatenate(
178
+ [cam_proj_mat, [np.array([0, 0, 0, 1])]])
179
+ cam_proj_mat_inv = np.linalg.inv(cam_proj_mat_homo)[0:3]
180
+ world_coords_homo = np.expand_dims(_pixel_to_world_coords(
181
+ pc, cam_proj_mat_inv), 0)
182
+ world_coords = world_coords_homo[..., :-1][0]
183
+ return world_coords
184
+
185
+ def get_intrinsic_matrix(self):
186
+ res = np.array(self.get_resolution())
187
+ pp_offsets = res / 2
188
+ ratio = res[0] / res[1]
189
+ pa_x = pa_y = math.radians(self.get_perspective_angle())
190
+ if ratio > 1:
191
+ pa_y = 2 * np.arctan(np.tan(pa_y / 2) / ratio)
192
+ elif ratio < 1:
193
+ pa_x = 2 * np.arctan(np.tan(pa_x / 2) * ratio)
194
+ persp_angles = np.array([pa_x, pa_y])
195
+ focal_lengths = -res / (2 * np.tan(persp_angles / 2))
196
+ return np.array(
197
+ [[focal_lengths[0], 0., pp_offsets[0]],
198
+ [0., focal_lengths[1], pp_offsets[1]],
199
+ [0., 0., 1.]])
200
+
201
+ def get_resolution(self) -> List[int]:
202
+ """ Return the Sensor's resolution.
203
+
204
+ :return: Resolution [x, y]
205
+ """
206
+ return sim.simGetVisionSensorResolution(self._handle)
207
+
208
+ def set_resolution(self, resolution: List[int]) -> None:
209
+ """ Set the Sensor's resolution.
210
+
211
+ :param resolution: New resolution [x, y]
212
+ """
213
+ sim.simSetObjectInt32Parameter(
214
+ self._handle, sim.sim_visionintparam_resolution_x, resolution[0]
215
+ )
216
+ sim.simSetObjectInt32Parameter(
217
+ self._handle, sim.sim_visionintparam_resolution_y, resolution[1]
218
+ )
219
+ self.resolution = resolution
220
+
221
+ def get_perspective_mode(self) -> PerspectiveMode:
222
+ """ Retrieve the Sensor's perspective mode.
223
+
224
+ :return: The current PerspectiveMode.
225
+ """
226
+ perspective_mode = sim.simGetObjectInt32Parameter(
227
+ self._handle, sim.sim_visionintparam_perspective_operation,
228
+ )
229
+ return PerspectiveMode(perspective_mode)
230
+
231
+ def set_perspective_mode(self, perspective_mode: PerspectiveMode) -> None:
232
+ """ Set the Sensor's perspective mode.
233
+
234
+ :param perspective_mode: The new perspective mode, one of:
235
+ PerspectiveMode.ORTHOGRAPHIC
236
+ PerspectiveMode.PERSPECTIVE
237
+ """
238
+ sim.simSetObjectInt32Parameter(
239
+ self._handle, sim.sim_visionintparam_perspective_operation,
240
+ perspective_mode.value
241
+ )
242
+
243
+ def get_render_mode(self) -> RenderMode:
244
+ """ Retrieves the Sensor's rendering mode
245
+
246
+ :return: RenderMode for the current rendering mode.
247
+ """
248
+ render_mode = sim.simGetObjectInt32Parameter(
249
+ self._handle, sim.sim_visionintparam_render_mode
250
+ )
251
+ return RenderMode(render_mode)
252
+
253
+ def set_render_mode(self, render_mode: RenderMode) -> None:
254
+ """ Set the Sensor's rendering mode
255
+
256
+ :param render_mode: The new sensor rendering mode, one of:
257
+ RenderMode.OPENGL
258
+ RenderMode.OPENGL_AUXILIARY
259
+ RenderMode.OPENGL_COLOR_CODED
260
+ RenderMode.POV_RAY
261
+ RenderMode.EXTERNAL
262
+ RenderMode.EXTERNAL_WINDOWED
263
+ RenderMode.OPENGL3
264
+ RenderMode.OPENGL3_WINDOWED
265
+ """
266
+ sim.simSetObjectInt32Parameter(
267
+ self._handle, sim.sim_visionintparam_render_mode,
268
+ render_mode.value
269
+ )
270
+
271
+ def get_windowed_size(self) -> Sequence[int]:
272
+ """Get the size of windowed rendering.
273
+
274
+ :return: The (x, y) resolution of the window. 0 for full-screen.
275
+ """
276
+ size_x = sim.simGetObjectInt32Parameter(
277
+ self._handle, sim.sim_visionintparam_windowed_size_x)
278
+ size_y = sim.simGetObjectInt32Parameter(
279
+ self._handle, sim.sim_visionintparam_windowed_size_y)
280
+ return size_x, size_y
281
+
282
+ def set_windowed_size(self, resolution: Sequence[int] = (0, 0)) -> None:
283
+ """Set the size of windowed rendering.
284
+
285
+ :param resolution: The (x, y) resolution of the window.
286
+ 0 for full-screen.
287
+ """
288
+ sim.simSetObjectInt32Parameter(
289
+ self._handle, sim.sim_visionintparam_windowed_size_x,
290
+ resolution[0])
291
+ sim.simSetObjectInt32Parameter(
292
+ self._handle, sim.sim_visionintparam_windowed_size_y,
293
+ resolution[1])
294
+
295
+ def get_perspective_angle(self) -> float:
296
+ """ Get the Sensor's perspective angle.
297
+
298
+ :return: The sensor's perspective angle (in degrees).
299
+ """
300
+ return math.degrees(sim.simGetObjectFloatParameter(
301
+ self._handle, sim.sim_visionfloatparam_perspective_angle
302
+ ))
303
+
304
+ def set_perspective_angle(self, angle: float) -> None:
305
+ """ Set the Sensor's perspective angle.
306
+
307
+ :param angle: New perspective angle (in degrees)
308
+ """
309
+ sim.simSetObjectFloatParameter(
310
+ self._handle, sim.sim_visionfloatparam_perspective_angle,
311
+ math.radians(angle)
312
+ )
313
+
314
+ def get_orthographic_size(self) -> float:
315
+ """ Get the Sensor's orthographic size.
316
+
317
+ :return: The sensor's orthographic size (in metres).
318
+ """
319
+ return sim.simGetObjectFloatParameter(
320
+ self._handle, sim.sim_visionfloatparam_ortho_size
321
+ )
322
+
323
+ def set_orthographic_size(self, ortho_size: float) -> None:
324
+ """ Set the Sensor's orthographic size.
325
+
326
+ :param angle: New orthographic size (in metres)
327
+ """
328
+ sim.simSetObjectFloatParameter(
329
+ self._handle, sim.sim_visionfloatparam_ortho_size, ortho_size
330
+ )
331
+
332
+ def get_near_clipping_plane(self) -> float:
333
+ """ Get the Sensor's near clipping plane.
334
+
335
+ :return: Near clipping plane (metres)
336
+ """
337
+ return sim.simGetObjectFloatParameter(
338
+ self._handle, sim.sim_visionfloatparam_near_clipping
339
+ )
340
+
341
+ def set_near_clipping_plane(self, near_clipping: float) -> None:
342
+ """ Set the Sensor's near clipping plane.
343
+
344
+ :param near_clipping: New near clipping plane (in metres)
345
+ """
346
+ sim.simSetObjectFloatParameter(
347
+ self._handle, sim.sim_visionfloatparam_near_clipping, near_clipping
348
+ )
349
+
350
+ def get_far_clipping_plane(self) -> float:
351
+ """ Get the Sensor's far clipping plane.
352
+
353
+ :return: Near clipping plane (metres)
354
+ """
355
+ return sim.simGetObjectFloatParameter(
356
+ self._handle, sim.sim_visionfloatparam_far_clipping
357
+ )
358
+
359
+ def set_far_clipping_plane(self, far_clipping: float) -> None:
360
+ """ Set the Sensor's far clipping plane.
361
+
362
+ :param far_clipping: New far clipping plane (in metres)
363
+ """
364
+ sim.simSetObjectFloatParameter(
365
+ self._handle, sim.sim_visionfloatparam_far_clipping, far_clipping
366
+ )
367
+
368
+ def set_entity_to_render(self, entity_to_render: int) -> None:
369
+ """ Set the entity to render to the Sensor, this can be an object or more usefully a collection.
370
+ -1 to render all objects in scene.
371
+
372
+ :param entity_to_render: Handle of the entity to render
373
+ """
374
+ sim.simSetObjectInt32Parameter(
375
+ self._handle, sim.sim_visionintparam_entity_to_render, entity_to_render
376
+ )
377
+
378
+ def get_entity_to_render(self) -> None:
379
+ """ Get the entity to render to the Sensor, this can be an object or more usefully a collection.
380
+ -1 if all objects in scene are rendered.
381
+
382
+ :return: Handle of the entity to render
383
+ """
384
+ return sim.simGetObjectInt32Parameter(
385
+ self._handle, sim.sim_visionintparam_entity_to_render
386
+ )
387
+
388
+
389
+ def _create_uniform_pixel_coords_image(resolution: np.ndarray):
390
+ pixel_x_coords = np.reshape(
391
+ np.tile(np.arange(resolution[1]), [resolution[0]]),
392
+ (resolution[0], resolution[1], 1)).astype(np.float32)
393
+ pixel_y_coords = np.reshape(
394
+ np.tile(np.arange(resolution[0]), [resolution[1]]),
395
+ (resolution[1], resolution[0], 1)).astype(np.float32)
396
+ pixel_y_coords = np.transpose(pixel_y_coords, (1, 0, 2))
397
+ uniform_pixel_coords = np.concatenate(
398
+ (pixel_x_coords, pixel_y_coords, np.ones_like(pixel_x_coords)), -1)
399
+ return uniform_pixel_coords
400
+
401
+
402
+ def _transform(coords, trans):
403
+ h, w = coords.shape[:2]
404
+ coords = np.reshape(coords, (h * w, -1))
405
+ coords = np.transpose(coords, (1, 0))
406
+ transformed_coords_vector = np.matmul(trans, coords)
407
+ transformed_coords_vector = np.transpose(
408
+ transformed_coords_vector, (1, 0))
409
+ return np.reshape(transformed_coords_vector,
410
+ (h, w, -1))
411
+
412
+
413
+ def _pixel_to_world_coords(pixel_coords, cam_proj_mat_inv):
414
+ h, w = pixel_coords.shape[:2]
415
+ pixel_coords = np.concatenate(
416
+ [pixel_coords, np.ones((h, w, 1))], -1)
417
+ world_coords = _transform(pixel_coords, cam_proj_mat_inv)
418
+ world_coords_homo = np.concatenate(
419
+ [world_coords, np.ones((h, w, 1))], axis=-1)
420
+ return world_coords_homo
421
+
422
+
423
+ object_type_to_class[ObjectType.VISION_SENSOR] = VisionSensor
external/pyrep/pyrep/robots/arms/__init__.py ADDED
File without changes
external/pyrep/pyrep/robots/arms/arm.py ADDED
@@ -0,0 +1,496 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+
3
+ from ctypes import alignment
4
+ from pyrep.backend import sim, utils
5
+ from pyrep.objects import Object
6
+ from pyrep.objects.dummy import Dummy
7
+ from pyrep.robots.configuration_paths.arm_configuration_path import (
8
+ ArmConfigurationPath)
9
+ from pyrep.robots.robot_component import RobotComponent
10
+ from pyrep.objects.cartesian_path import CartesianPath
11
+ from pyrep.errors import ConfigurationError, ConfigurationPathError, IKError
12
+ from pyrep.const import ConfigurationPathAlgorithms as Algos
13
+ from pyrep.const import PYREP_SCRIPT_TYPE
14
+ from typing import List, Union
15
+ import numpy as np
16
+ import warnings
17
+
18
+
19
+
20
+ class Arm(RobotComponent):
21
+ """Base class representing a robot arm with path planning support.
22
+ """
23
+
24
+ def __init__(self, count: int, name: str, num_joints: int,
25
+ base_name: str = None,
26
+ max_velocity=1.0, max_acceleration=4.0, max_jerk=1000):
27
+ """Count is used for when we have multiple copies of arms"""
28
+ self.name = name
29
+ joint_names = ['%s_joint%d' % (name, i+1) for i in range(num_joints)]
30
+ super().__init__(count, name, joint_names, base_name)
31
+
32
+ # Used for motion planning
33
+ self.max_velocity = max_velocity
34
+ self.max_acceleration = max_acceleration
35
+ self.max_jerk = max_jerk
36
+
37
+ # Motion planning handles
38
+ suffix = '' if count == 0 else '#%d' % (count - 1)
39
+ self._ik_target = Dummy('%s_target%s' % (name, suffix))
40
+ self._ik_tip = Dummy('%s_tip%s' % (name, suffix))
41
+ self._ik_group = sim.simGetIkGroupHandle('%s_ik%s' % (name, suffix))
42
+ self._collision_collection = sim.simGetCollectionHandle(
43
+ '%s_arm%s' % (name, suffix))
44
+
45
+ def set_ik_element_properties(self, constraint_x=True, constraint_y=True,
46
+ constraint_z=True,
47
+ constraint_alpha_beta=True,
48
+ constraint_gamma=True) -> None:
49
+ constraints = 0
50
+ if constraint_x:
51
+ constraints |= sim.sim_ik_x_constraint
52
+ if constraint_y:
53
+ constraints |= sim.sim_ik_y_constraint
54
+ if constraint_z:
55
+ constraints |= sim.sim_ik_z_constraint
56
+ if constraint_alpha_beta:
57
+ constraints |= sim.sim_ik_alpha_beta_constraint
58
+ if constraint_gamma:
59
+ constraints |= sim.sim_ik_gamma_constraint
60
+ sim.simSetIkElementProperties(
61
+ ikGroupHandle=self._ik_group,
62
+ tipDummyHandle=self._ik_tip.get_handle(),
63
+ constraints=constraints,
64
+ precision=None,
65
+ weight=None,
66
+ )
67
+
68
+ def set_ik_group_properties(self, resolution_method='pseudo_inverse', max_iterations=6, dls_damping=0.1) -> None:
69
+ try:
70
+ res_method = {'pseudo_inverse': sim.sim_ik_pseudo_inverse_method,
71
+ 'damped_least_squares': sim.sim_ik_damped_least_squares_method,
72
+ 'jacobian_transpose': sim.sim_ik_jacobian_transpose_method}[resolution_method]
73
+ except KeyError:
74
+ raise Exception('Invalid resolution method,'
75
+ 'Must be one of ["pseudo_inverse" | "damped_least_squares" | "jacobian_transpose"]')
76
+ sim.simSetIkGroupProperties(
77
+ ikGroupHandle=self._ik_group,
78
+ resolutionMethod=res_method,
79
+ maxIterations=max_iterations,
80
+ damping=dls_damping
81
+ )
82
+
83
+ def solve_ik_via_sampling(self,
84
+ position: Union[List[float], np.ndarray],
85
+ euler: Union[List[float], np.ndarray] = None,
86
+ quaternion: Union[List[float], np.ndarray] = None,
87
+ ignore_collisions: bool = False,
88
+ trials: int = 300,
89
+ max_configs: int = 1,
90
+ distance_threshold: float = 0.65,
91
+ max_time_ms: int = 10,
92
+ relative_to: Object = None
93
+ ) -> np.ndarray:
94
+ """Solves an IK group and returns the calculated joint values.
95
+
96
+ This IK method performs a random searches for manipulator configurations
97
+ that matches the given end-effector pose in space. When the tip pose
98
+ is close enough then IK is computed in order to try to bring the
99
+ tip onto the target. This is the method that should be used when
100
+ the start pose is far from the end pose.
101
+
102
+ We generate 'max_configs' number of samples within X number of 'trials',
103
+ before ranking them according to angular distance.
104
+
105
+ Must specify either rotation in euler or quaternions, but not both!
106
+
107
+ :param position: The x, y, z position of the target.
108
+ :param euler: The x, y, z orientation of the target (in radians).
109
+ :param quaternion: A list containing the quaternion (x,y,z,w).
110
+ :param ignore_collisions: If collision checking should be disabled.
111
+ :param trials: The maximum number of attempts to reach max_configs.
112
+ :param max_configs: The maximum number of configurations we want to
113
+ generate before sorting them.
114
+ :param distance_threshold: Distance indicating when IK should be
115
+ computed in order to try to bring the tip onto the target.
116
+ :param max_time_ms: Maximum time in ms spend searching for
117
+ each configuation.
118
+ :param relative_to: Indicates relative to which reference frame we want
119
+ the target pose. Specify None to retrieve the absolute pose,
120
+ or an Object relative to whose reference frame we want the pose.
121
+ :raises: ConfigurationError if no joint configuration could be found.
122
+
123
+ :return: 'max_configs' number of joint configurations, ranked according
124
+ to angular distance.
125
+ """
126
+ if not ((euler is None) ^ (quaternion is None)):
127
+ raise ConfigurationError(
128
+ 'Specify either euler or quaternion values, but not both.')
129
+
130
+ prev_pose = self._ik_target.get_pose()
131
+ self._ik_target.set_position(position, relative_to)
132
+ if euler is not None:
133
+ self._ik_target.set_orientation(euler, relative_to)
134
+ elif quaternion is not None:
135
+ self._ik_target.set_quaternion(quaternion, relative_to)
136
+
137
+ handles = [j.get_handle() for j in self.joints]
138
+ cyclics, intervals = self.get_joint_intervals()
139
+ low_limits, max_limits = list(zip(*intervals))
140
+ # If there are huge intervals, then limit them
141
+ low_limits = np.maximum(low_limits, -np.pi*2).tolist()
142
+ max_limits = np.minimum(max_limits, np.pi*2).tolist()
143
+
144
+ collision_pairs = []
145
+ if not ignore_collisions:
146
+ collision_pairs = [self._collision_collection, sim.sim_handle_all]
147
+
148
+ metric = joint_options = None
149
+ valid_joint_positions = []
150
+ for i in range(trials):
151
+ config = sim.simGetConfigForTipPose(
152
+ self._ik_group, handles, distance_threshold, int(max_time_ms),
153
+ metric, collision_pairs, joint_options, low_limits, max_limits)
154
+ if len(config) > 0:
155
+ valid_joint_positions.append(config)
156
+ if len(valid_joint_positions) >= max_configs:
157
+ break
158
+
159
+ self._ik_target.set_pose(prev_pose)
160
+ if len(valid_joint_positions) == 0:
161
+ raise ConfigurationError(
162
+ 'Could not find a valid joint configuration for desired '
163
+ 'end effector pose.')
164
+
165
+ if len(valid_joint_positions) > 1:
166
+ current_config = np.array(self.get_joint_positions())
167
+ # Sort based on angular distance
168
+ valid_joint_positions.sort(
169
+ key=lambda x: np.linalg.norm(current_config - x))
170
+
171
+ return np.array(valid_joint_positions)
172
+
173
+
174
+ def get_configs_for_tip_pose(self,
175
+ position: Union[List[float], np.ndarray],
176
+ euler: Union[List[float], np.ndarray] = None,
177
+ quaternion: Union[List[float], np.ndarray] = None,
178
+ ignore_collisions=False,
179
+ trials=300, max_configs=60,
180
+ relative_to: Object = None
181
+ ) -> List[List[float]]:
182
+ """Gets a valid joint configuration for a desired end effector pose.
183
+ Must specify either rotation in euler or quaternions, but not both!
184
+ :param position: The x, y, z position of the target.
185
+ :param euler: The x, y, z orientation of the target (in radians).
186
+ :param quaternion: A list containing the quaternion (x,y,z,w).
187
+ :param ignore_collisions: If collision checking should be disabled.
188
+ :param trials: The maximum number of attempts to reach max_configs
189
+ :param max_configs: The maximum number of configurations we want to
190
+ generate before ranking them.
191
+ :param relative_to: Indicates relative to which reference frame we want
192
+ the target pose. Specify None to retrieve the absolute pose,
193
+ or an Object relative to whose reference frame we want the pose.
194
+ :raises: ConfigurationError if no joint configuration could be found.
195
+ :return: A list of valid joint configurations for the desired
196
+ end effector pose.
197
+ """
198
+
199
+ warnings.warn("Please use 'solve_ik_via_sampling' instead.",
200
+ DeprecationWarning)
201
+ return list(self.solve_ik_via_sampling(
202
+ position, euler, quaternion, ignore_collisions, trials,
203
+ max_configs, relative_to=relative_to))
204
+
205
+ def solve_ik_via_jacobian(
206
+ self, position: Union[List[float], np.ndarray],
207
+ euler: Union[List[float], np.ndarray] = None,
208
+ quaternion: Union[List[float], np.ndarray] = None,
209
+ relative_to: Object = None) -> List[float]:
210
+ """Solves an IK group and returns the calculated joint values.
211
+
212
+ This IK method performs a linearisation around the current robot
213
+ configuration via the Jacobian. The linearisation is valid when the
214
+ start and goal pose are not too far away, but after a certain point,
215
+ linearisation will no longer be valid. In that case, the user is better
216
+ off using 'solve_ik_via_sampling'.
217
+
218
+ Must specify either rotation in euler or quaternions, but not both!
219
+
220
+ :param position: The x, y, z position of the target.
221
+ :param euler: The x, y, z orientation of the target (in radians).
222
+ :param quaternion: A list containing the quaternion (x,y,z,w).
223
+ :param relative_to: Indicates relative to which reference frame we want
224
+ the target pose. Specify None to retrieve the absolute pose,
225
+ or an Object relative to whose reference frame we want the pose.
226
+ :return: A list containing the calculated joint values.
227
+ """
228
+ self._ik_target.set_position(position, relative_to)
229
+ if euler is not None:
230
+ self._ik_target.set_orientation(euler, relative_to)
231
+ elif quaternion is not None:
232
+ self._ik_target.set_quaternion(quaternion, relative_to)
233
+
234
+ ik_result, joint_values = sim.simCheckIkGroup(
235
+ self._ik_group, [j.get_handle() for j in self.joints])
236
+ if ik_result == sim.sim_ikresult_fail:
237
+ raise IKError('IK failed. Perhaps the distance was between the tip '
238
+ ' and target was too large.')
239
+ elif ik_result == sim.sim_ikresult_not_performed:
240
+ raise IKError('IK not performed.')
241
+ return joint_values
242
+
243
+ def solve_ik(self, position: Union[List[float], np.ndarray],
244
+ euler: Union[List[float], np.ndarray] = None,
245
+ quaternion: Union[List[float], np.ndarray] = None,
246
+ relative_to: Object = None) -> List[float]:
247
+ """Solves an IK group and returns the calculated joint values.
248
+
249
+ Must specify either rotation in euler or quaternions, but not both!
250
+
251
+ :param position: The x, y, z position of the target.
252
+ :param euler: The x, y, z orientation of the target (in radians).
253
+ :param quaternion: A list containing the quaternion (x,y,z,w).
254
+ :param relative_to: Indicates relative to which reference frame we want
255
+ the target pose. Specify None to retrieve the absolute pose,
256
+ or an Object relative to whose reference frame we want the pose.
257
+ :return: A list containing the calculated joint values.
258
+ """
259
+ warnings.warn("Please use 'solve_ik_via_jacobian' instead.",
260
+ DeprecationWarning)
261
+ return self.solve_ik_via_jacobian(
262
+ position, euler, quaternion, relative_to)
263
+
264
+ def get_path_from_cartesian_path(self, path: CartesianPath
265
+ ) -> ArmConfigurationPath:
266
+ """Translate a path from cartesian space, to arm configuration space.
267
+
268
+ Note: It must be possible to reach the start of the path via a linear
269
+ path, otherwise an error will be raised.
270
+
271
+ :param path: A :py:class:`CartesianPath` instance to be translated to
272
+ a configuration-space path.
273
+ :raises: ConfigurationPathError if no path could be created.
274
+
275
+ :return: A path in the arm configuration space.
276
+ """
277
+ handles = [j.get_handle() for j in self.joints]
278
+ _, ret_floats, _, _ = utils.script_call(
279
+ 'getPathFromCartesianPath@PyRep', PYREP_SCRIPT_TYPE,
280
+ ints=[path.get_handle(), self._ik_group,
281
+ self._ik_target.get_handle()] + handles)
282
+ if len(ret_floats) == 0:
283
+ raise ConfigurationPathError(
284
+ 'Could not create a path from cartesian path.')
285
+ return ArmConfigurationPath(self, ret_floats)
286
+
287
+ def get_linear_path(self, position: Union[List[float], np.ndarray],
288
+ euler: Union[List[float], np.ndarray] = None,
289
+ quaternion: Union[List[float], np.ndarray] = None,
290
+ steps=50, ignore_collisions=False,
291
+ relative_to: Object = None) -> ArmConfigurationPath:
292
+ """Gets a linear configuration path given a target pose.
293
+
294
+ Generates a path that drives a robot from its current configuration
295
+ to its target dummy in a straight line (i.e. shortest path in Cartesian
296
+ space).
297
+
298
+ Must specify either rotation in euler or quaternions, but not both!
299
+
300
+ :param position: The x, y, z position of the target.
301
+ :param euler: The x, y, z orientation of the target (in radians).
302
+ :param quaternion: A list containing the quaternion (x,y,z,w).
303
+ :param steps: The desired number of path points. Each path point
304
+ contains a robot configuration. A minimum of two path points is
305
+ required. If the target pose distance is large, a larger number
306
+ of steps leads to better results for this function.
307
+ :param ignore_collisions: If collision checking should be disabled.
308
+ :param relative_to: Indicates relative to which reference frame we want
309
+ the target pose. Specify None to retrieve the absolute pose,
310
+ or an Object relative to whose reference frame we want the pose.
311
+ :raises: ConfigurationPathError if no path could be created.
312
+
313
+ :return: A linear path in the arm configuration space.
314
+ """
315
+ if not ((euler is None) ^ (quaternion is None)):
316
+ raise ConfigurationPathError(
317
+ 'Specify either euler or quaternion values, but not both.')
318
+
319
+ prev_pose = self._ik_target.get_pose()
320
+ self._ik_target.set_position(position, relative_to)
321
+ if euler is not None:
322
+ self._ik_target.set_orientation(euler, relative_to)
323
+ elif quaternion is not None:
324
+ self._ik_target.set_quaternion(quaternion, relative_to)
325
+ handles = [j.get_handle() for j in self.joints]
326
+
327
+ collision_pairs = []
328
+ if not ignore_collisions:
329
+ collision_pairs = [self._collision_collection, sim.sim_handle_all]
330
+ joint_options = None
331
+ ret_floats = sim.generateIkPath(
332
+ self._ik_group, handles, steps, collision_pairs, joint_options)
333
+ self._ik_target.set_pose(prev_pose)
334
+ if len(ret_floats) == 0:
335
+ raise ConfigurationPathError('Could not create path.')
336
+ return ArmConfigurationPath(self, ret_floats)
337
+
338
+
339
+
340
+ def get_nonlinear_path(self, position: Union[List[float], np.ndarray],
341
+ euler: Union[List[float], np.ndarray] = None,
342
+ quaternion: Union[List[float], np.ndarray] = None,
343
+ ignore_collisions=False,
344
+ trials=300,
345
+ max_configs=1,
346
+ distance_threshold: float = 0.65,
347
+ max_time_ms: int = 10,
348
+ trials_per_goal=1,
349
+ algorithm=Algos.SBL,
350
+ relative_to: Object = None
351
+ ) -> ArmConfigurationPath:
352
+ """Gets a non-linear (planned) configuration path given a target pose.
353
+
354
+ A path is generated by finding several configs for a pose, and ranking
355
+ them according to the distance in configuration space (smaller is
356
+ better).
357
+
358
+ Must specify either rotation in euler or quaternions, but not both!
359
+
360
+ :param position: The x, y, z position of the target.
361
+ :param euler: The x, y, z orientation of the target (in radians).
362
+ :param quaternion: A list containing the quaternion (x,y,z,w).
363
+ :param ignore_collisions: If collision checking should be disabled.
364
+ :param trials: The maximum number of attempts to reach max_configs.
365
+ See 'solve_ik_via_sampling'.
366
+ :param max_configs: The maximum number of configurations we want to
367
+ generate before sorting them. See 'solve_ik_via_sampling'.
368
+ :param distance_threshold: Distance indicating when IK should be
369
+ computed in order to try to bring the tip onto the target.
370
+ See 'solve_ik_via_sampling'.
371
+ :param max_time_ms: Maximum time in ms spend searching for
372
+ each configuation. See 'solve_ik_via_sampling'.
373
+ :param trials_per_goal: The number of paths per config we want to trial.
374
+ :param algorithm: The algorithm for path planning to use.
375
+ :param relative_to: Indicates relative to which reference frame we want
376
+ the target pose. Specify None to retrieve the absolute pose,
377
+ or an Object relative to whose reference frame we want the pose.
378
+ :raises: ConfigurationPathError if no path could be created.
379
+
380
+ :return: A non-linear path in the arm configuration space.
381
+ """
382
+
383
+ logging.debug("planning non linear path")
384
+
385
+ handles = [j.get_handle() for j in self.joints]
386
+
387
+ try:
388
+ configs = self.solve_ik_via_sampling(
389
+ position, euler, quaternion, ignore_collisions, trials,
390
+ max_configs, distance_threshold, max_time_ms, relative_to)
391
+ except ConfigurationError as e:
392
+ raise ConfigurationPathError('Could not create path.') from e
393
+
394
+ logging.debug("calling external script")
395
+
396
+
397
+ _, ret_floats, _, _ = utils.script_call(
398
+ 'getNonlinearPath@PyRep', PYREP_SCRIPT_TYPE,
399
+ ints=[self._collision_collection, int(ignore_collisions),
400
+ trials_per_goal] + handles,
401
+ floats=configs.flatten().tolist(),
402
+ strings=[algorithm.value])
403
+
404
+ logging.debug("Done calling external script")
405
+
406
+ if len(ret_floats) == 0:
407
+ raise ConfigurationPathError('Could not create path.')
408
+ return ArmConfigurationPath(self, ret_floats)
409
+
410
+ def get_path(self, position: Union[List[float], np.ndarray],
411
+ euler: Union[List[float], np.ndarray] = None,
412
+ quaternion: Union[List[float], np.ndarray] = None,
413
+ ignore_collisions=False,
414
+ trials=300,
415
+ max_configs=1,
416
+ distance_threshold: float = 0.65,
417
+ max_time_ms: int = 10,
418
+ trials_per_goal=1,
419
+ algorithm=Algos.SBL,
420
+ relative_to: Object = None
421
+ ) -> ArmConfigurationPath:
422
+ """Tries to get a linear path, failing that tries a non-linear path.
423
+
424
+ Must specify either rotation in euler or quaternions, but not both!
425
+
426
+ :param position: The x, y, z position of the target.
427
+ :param euler: The x, y, z orientation of the target (in radians).
428
+ :param quaternion: A list containing the quaternion (x,y,z,w).
429
+ :param ignore_collisions: If collision checking should be disabled.
430
+ :param trials: The maximum number of attempts to reach max_configs.
431
+ See 'solve_ik_via_sampling'.
432
+ :param max_configs: The maximum number of configurations we want to
433
+ generate before sorting them. See 'solve_ik_via_sampling'.
434
+ :param distance_threshold: Distance indicating when IK should be
435
+ computed in order to try to bring the tip onto the target.
436
+ See 'solve_ik_via_sampling'.
437
+ :param max_time_ms: Maximum time in ms spend searching for
438
+ each configuation. See 'solve_ik_via_sampling'.
439
+ :param trials_per_goal: The number of paths per config we want to trial.
440
+ :param algorithm: The algorithm for path planning to use.
441
+ :param relative_to: Indicates relative to which reference frame we want
442
+ the target pose. Specify None to retrieve the absolute pose,
443
+ or an Object relative to whose reference frame we want the pose.
444
+
445
+ :raises: ConfigurationPathError if neither a linear or non-linear path
446
+ can be created.
447
+ :return: A linear or non-linear path in the arm configuration space.
448
+ """
449
+ logging.debug("planning linear path")
450
+ try:
451
+ p = self.get_linear_path(position, euler, quaternion,
452
+ ignore_collisions=ignore_collisions,
453
+ relative_to=relative_to)
454
+ return p
455
+ except ConfigurationPathError as e:
456
+ #logging.error("configuration error", e)
457
+ pass # Allowed. Try again, but with non-linear.
458
+
459
+ # This time if an exception is thrown, we dont want to catch it.
460
+ p = self.get_nonlinear_path(
461
+ position, euler, quaternion, ignore_collisions, trials, max_configs,
462
+ distance_threshold, max_time_ms, trials_per_goal, algorithm,
463
+ relative_to)
464
+ return p
465
+
466
+ def get_tip(self) -> Dummy:
467
+ """Gets the tip of the arm.
468
+
469
+ Each arm is required to have a tip for path planning.
470
+
471
+ :return: The tip of the arm.
472
+ """
473
+ return self._ik_tip
474
+
475
+ def get_jacobian(self):
476
+ """Calculates the Jacobian.
477
+
478
+ :return: the row-major Jacobian matix.
479
+ """
480
+ self._ik_target.set_matrix(self._ik_tip.get_matrix())
481
+ sim.simCheckIkGroup(self._ik_group,
482
+ [j.get_handle() for j in self.joints])
483
+ jacobian, (rows, cols) = sim.simGetIkGroupMatrix(self._ik_group, 0)
484
+ jacobian = np.array(jacobian).reshape((rows, cols), order='F')
485
+ return jacobian
486
+
487
+ def check_arm_collision(self, obj: 'Object' = None) -> bool:
488
+ """Checks whether two entities are colliding.
489
+
490
+ :param obj: The other collidable object to check collision against,
491
+ or None to check against all collidable objects. Note that objects
492
+ must be marked as collidable!
493
+ :return: If the object is colliding.
494
+ """
495
+ handle = sim.sim_handle_all if obj is None else obj.get_handle()
496
+ return sim.simCheckCollision(self._collision_collection, handle) == 1