Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- external/pyrep/.github/stale.ymlAdded+17
- external/pyrep/.github/workflows/build.ymlAdded+46
- external/pyrep/PyRep.egg-info/PKG-INFOAdded+8
- external/pyrep/PyRep.egg-info/SOURCES.txtAdded+103
- external/pyrep/PyRep.egg-info/dependency_links.txtAdded+1
- external/pyrep/PyRep.egg-info/top_level.txtAdded+1
- external/pyrep/cffi_build/__init__.pyAdded
- external/pyrep/cffi_build/cffi_build.pyAdded+757
- external/pyrep/cffi_build/sim.hAdded+712
- external/pyrep/docs/MakefileAdded+19
- external/pyrep/docs/make.batAdded+35
- external/pyrep/docs/source/conf.pyAdded+62
- external/pyrep/docs/source/index.rstAdded+24
- external/pyrep/docs/source/modules.rstAdded+7
- external/pyrep/docs/source/pyrep.objects.rstAdded+78
- external/pyrep/docs/source/pyrep.robots.arms.rstAdded+46
- external/pyrep/docs/source/pyrep.robots.end_effectors.rstAdded+38
- external/pyrep/docs/source/pyrep.robots.rstAdded+30
- external/pyrep/docs/source/pyrep.rstAdded+47
- external/pyrep/docs/source/pyrep.textures.rstAdded+22
- external/pyrep/examples/example_baxter_pick_and_pass.pyAdded+115
- external/pyrep/examples/example_locobot_stack_cube.pyAdded+96
- external/pyrep/examples/example_panda_end_effector_control.pyAdded+35
- external/pyrep/examples/example_panda_ik.pyAdded+41
- external/pyrep/examples/example_panda_reach_target.pyAdded+59
- external/pyrep/examples/example_reinforcement_learning_env.pyAdded+90
- external/pyrep/examples/example_turtlebot_navigation.pyAdded+53
- external/pyrep/examples/example_youbot_navigation.pyAdded+51
- external/pyrep/pyrep/backend/__init__.pyAdded
- external/pyrep/pyrep/backend/sim.pyAdded+1500
- external/pyrep/pyrep/backend/simAddOnScript_PyRep.luaAdded+410
- external/pyrep/pyrep/backend/simConst.pyAdded+1726
- external/pyrep/pyrep/backend/utils.pyAdded+76
- external/pyrep/pyrep/misc/__init__.pyAdded
- external/pyrep/pyrep/misc/distance.pyAdded+49
- external/pyrep/pyrep/misc/signals.pyAdded+102
- external/pyrep/pyrep/objects/__init__.pyAdded+10
- external/pyrep/pyrep/objects/camera.pyAdded+21
- external/pyrep/pyrep/objects/cartesian_path.pyAdded+107
- external/pyrep/pyrep/objects/dummy.pyAdded+26
- external/pyrep/pyrep/objects/force_sensor.pyAdded+34
- external/pyrep/pyrep/objects/joint.pyAdded+255
- external/pyrep/pyrep/objects/light.pyAdded+125
- external/pyrep/pyrep/objects/object.pyAdded+756
- external/pyrep/pyrep/objects/octree.pyAdded+123
- external/pyrep/pyrep/objects/proximity_sensor.pyAdded+41
- external/pyrep/pyrep/objects/shape.pyAdded+584
- external/pyrep/pyrep/objects/vision_sensor.pyAdded+423
- external/pyrep/pyrep/robots/arms/__init__.pyAdded
- external/pyrep/pyrep/robots/arms/arm.pyAdded+496
1234567891011121314151617# Number of days of inactivity before an issue becomes staledaysUntilStale: 60# Number of days of inactivity before a stale issue is closeddaysUntilClose: 7# Issues with these labels will never be considered staleexemptLabels: - pinned - security# Label to use when marking an issue as stalestaleLabel: stale# Comment to post when marking an issue as stale. Set to `false` to disablemarkComment: > This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.# Comment to post when closing a stale issue. Set to `false` to disablecloseComment: false12345678910111213141516171819202122232425262728293031323334353637383940414243444546name: Build
# Controls when the action will run.# Run this workflow every time a new commit pushed to your repositoryon: # Triggers the workflow on push or pull request events. push: pull_request:
# Allows you to run this workflow manually from the Actions tab workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in paralleljobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on runs-on: ubuntu-20.04 env: DISPLAY: :0
# Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2
# Runs a set of commands using the runners shell - name: Run a multi-line script run: | sudo apt-get update -qq sudo apt-get install -y xvfb qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev qt5-default qttools5-dev-tools # start xvfb in the background sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 & cur=`pwd` wget http://www.coppeliarobotics.com/files/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz tar -xf CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz export COPPELIASIM_ROOT="$cur/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04" echo $COPPELIASIM_ROOT ls -al export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COPPELIASIM_ROOT:$COPPELIASIM_ROOT/platforms export QT_QPA_PLATFORM_PLUGIN_PATH=$COPPELIASIM_ROOT pip3 install -r requirements.txt pip3 install setuptools pip3 install . mv pyrep _pyrep python3 -m unittest discover tests12345678Metadata-Version: 2.1Name: PyRepVersion: 4.1.0.3Summary: Python CoppeliaSim wrapperHome-page: https://www.doc.ic.ac.uk/~slj12Author: Stephen JamesAuthor-email: slj12@ic.ac.ukLicense-File: LICENSE123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103LICENSEREADME.mdsetup.pyPyRep.egg-info/PKG-INFOPyRep.egg-info/SOURCES.txtPyRep.egg-info/dependency_links.txtPyRep.egg-info/top_level.txtpyrep/__init__.pypyrep/const.pypyrep/errors.pypyrep/pyrep.pypyrep/backend/__init__.pypyrep/backend/sim.pypyrep/backend/simConst.pypyrep/backend/utils.pypyrep/misc/__init__.pypyrep/misc/distance.pypyrep/misc/signals.pypyrep/objects/__init__.pypyrep/objects/camera.pypyrep/objects/cartesian_path.pypyrep/objects/dummy.pypyrep/objects/force_sensor.pypyrep/objects/joint.pypyrep/objects/light.pypyrep/objects/object.pypyrep/objects/octree.pypyrep/objects/proximity_sensor.pypyrep/objects/shape.pypyrep/objects/vision_sensor.pypyrep/robots/__init__.pypyrep/robots/robot_component.pypyrep/robots/arms/__init__.pypyrep/robots/arms/arm.pypyrep/robots/arms/baxter.pypyrep/robots/arms/dobot.pypyrep/robots/arms/dual_panda.pypyrep/robots/arms/jaco.pypyrep/robots/arms/lbr_iiwa_14_r820.pypyrep/robots/arms/lbr_iiwa_7_r800.pypyrep/robots/arms/locobot_arm.pypyrep/robots/arms/mico.pypyrep/robots/arms/panda.pypyrep/robots/arms/sawyer.pypyrep/robots/arms/ur10.pypyrep/robots/arms/ur3.pypyrep/robots/arms/ur5.pypyrep/robots/arms/xarm7.pypyrep/robots/arms/youBot.pypyrep/robots/configuration_paths/__init__.pypyrep/robots/configuration_paths/arm_configuration_path.pypyrep/robots/configuration_paths/configuration_path.pypyrep/robots/configuration_paths/holonomic_configuration_path.pypyrep/robots/configuration_paths/mobile_configuration_path.pypyrep/robots/configuration_paths/nonholonomic_configuration_path.pypyrep/robots/end_effectors/__init__.pypyrep/robots/end_effectors/baxter_gripper.pypyrep/robots/end_effectors/baxter_suction_cup.pypyrep/robots/end_effectors/dobot_suction_cup.pypyrep/robots/end_effectors/dual_panda_gripper.pypyrep/robots/end_effectors/gripper.pypyrep/robots/end_effectors/jaco_gripper.pypyrep/robots/end_effectors/locobot_gripper.pypyrep/robots/end_effectors/mico_gripper.pypyrep/robots/end_effectors/panda_gripper.pypyrep/robots/end_effectors/robotiq85_gripper.pypyrep/robots/end_effectors/suction_cup.pypyrep/robots/end_effectors/xarm_gripper.pypyrep/robots/mobiles/holonomic_base.pypyrep/robots/mobiles/line_tracer.pypyrep/robots/mobiles/locobot.pypyrep/robots/mobiles/mobile_base.pypyrep/robots/mobiles/nonholonomic_base.pypyrep/robots/mobiles/turtlebot.pypyrep/robots/mobiles/youbot.pypyrep/sensors/__init__.pypyrep/sensors/accelerometer.pypyrep/sensors/gyroscope.pypyrep/sensors/spherical_vision_sensor.pypyrep/textures/__init__.pypyrep/textures/texture.pytests/test_accelerometer.pytests/test_arms_and_configuration_paths.pytests/test_cameras.pytests/test_cartesian_paths.pytests/test_dummies.pytests/test_force_sensors.pytests/test_grippers.pytests/test_gyroscope.pytests/test_joint_groups.pytests/test_joints.pytests/test_lights.pytests/test_misc.pytests/test_mobiles_and_configuration_paths.pytests/test_mobiles_with_arms.pytests/test_objects.pytests/test_octrees.pytests/test_proximity_sensors.pytests/test_pyrep.pytests/test_shapes.pytests/test_spherical_vision_sensors.pytests/test_suction_cups.pytests/test_vision_sensors.py1
1pyrep123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757from cffi import FFIimport osimport globfrom shutil import copyfile
# Get PYREP root and find the needed files to compile the cffi lib.
if 'COPPELIASIM_ROOT' not in os.environ: raise RuntimeError('COPPELIASIM_ROOT not defined.')
if not os.path.exists(os.environ['COPPELIASIM_ROOT']): raise RuntimeError('COPPELIASIM_ROOT defined, but is not a valid path.')
ffibuilder = FFI()
ffibuilder.cdef("""// ==============// simTypes.h// ==============
// Various types used in the interface functions:typedef unsigned char simBool;typedef char simChar;typedef int simInt;typedef float simFloat;typedef double simDouble;typedef void simVoid;typedef unsigned char simUChar;typedef unsigned int simUInt;typedef unsigned long long int simUInt64;
struct SScriptCallBack{ simInt objectID; simInt scriptID; simInt stackID; simChar waitUntilZero; simChar* raiseErrorWithMessage;};
struct SShapeVizInfo{ simFloat* vertices; simInt verticesSize; simInt* indices; simInt indicesSize; simFloat shadingAngle; simFloat* normals; simFloat colors[9]; simChar* texture; /*rgba*/ simInt textureId; simInt textureRes[2]; simFloat* textureCoords; simInt textureApplyMode; simInt textureOptions; /* not just textures options */};
struct SLuaCallBack{ simInt objectID; simBool* inputBool; simInt* inputInt; simFloat* inputFloat; simChar* inputChar; simInt inputArgCount; simInt* inputArgTypeAndSize; simBool* outputBool; simInt* outputInt; simFloat* outputFloat; simChar* outputChar; simInt outputArgCount; simInt* outputArgTypeAndSize; simChar waitUntilZero; simChar* inputCharBuff; simChar* outputCharBuff; simInt scriptID; simDouble* inputDouble; simDouble* outputDouble;};
struct SSyncMsg{ unsigned char msg; void* data; size_t dataSize;};
struct SSyncRt{ unsigned char objTypes[3]; int objHandles[3];};
typedef int (*contactCallback)(int,int,int,int*,float*);typedef int (*jointCtrlCallback)(int,int,int,const int*,const float*,float*);
// ==============// sim.h// ==============
simInt simRunSimulator(const simChar* applicationName,simInt options,simVoid(*initCallBack)(),simVoid(*loopCallBack)(),simVoid(*deinitCallBack)());simInt simRunSimulatorEx(const simChar* applicationName,simInt options,simVoid(*initCallBack)(),simVoid(*loopCallBack)(),simVoid(*deinitCallBack)(),simInt stopDelay,const simChar* sceneOrModelToLoad);simVoid* simGetMainWindow(simInt type);simChar* simGetLastError();simInt simSetBooleanParameter(simInt parameter,simBool boolState);simInt simGetBooleanParameter(simInt parameter);simInt simSetBoolParameter(simInt parameter,simBool boolState);simInt simGetBoolParameter(simInt parameter);simInt simSetIntegerParameter(simInt parameter,simInt intState);simInt simGetIntegerParameter(simInt parameter,simInt* intState);simInt simSetInt32Parameter(simInt parameter,simInt intState);simInt simGetInt32Parameter(simInt parameter,simInt* intState);simInt simGetUInt64Parameter(simInt parameter,simUInt64* intState);simInt simSetFloatingParameter(simInt parameter,simFloat floatState);simInt simGetFloatingParameter(simInt parameter,simFloat* floatState);simInt simSetFloatParameter(simInt parameter,simFloat floatState);simInt simGetFloatParameter(simInt parameter,simFloat* floatState);simInt simSetStringParameter(simInt parameter,const simChar* str);simChar* simGetStringParameter(simInt parameter);simInt simGetObjectHandle(const simChar* objectName);simInt simRemoveObject(simInt objectHandle);simInt simRemoveModel(simInt objectHandle);simChar* simGetObjectName(simInt objectHandle);simInt simGetObjects(simInt index,simInt objectType);simInt simSetObjectName(simInt objectHandle,const simChar* objectName);simInt simGetCollectionHandle(const simChar* collectionName);simInt simRemoveCollection(simInt collectionHandle);simInt simEmptyCollection(simInt collectionHandle);simChar* simGetCollectionName(simInt collectionHandle);simInt simSetCollectionName(simInt collectionHandle,const simChar* collectionName);simInt simGetObjectMatrix(simInt objectHandle,simInt relativeToObjectHandle,simFloat* matrix);simInt simSetObjectMatrix(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* matrix);simInt simGetObjectPosition(simInt objectHandle,simInt relativeToObjectHandle,simFloat* position);simInt simSetObjectPosition(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* position);simInt simGetObjectOrientation(simInt objectHandle,simInt relativeToObjectHandle,simFloat* eulerAngles);simInt simGetObjectQuaternion(simInt objectHandle,simInt relativeToObjectHandle,simFloat* quaternion);simInt simSetObjectQuaternion(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* quaternion);simInt simSetObjectOrientation(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* eulerAngles);simInt simGetJointPosition(simInt objectHandle,simFloat* position);simInt simSetJointPosition(simInt objectHandle,simFloat position);simInt simSetJointTargetPosition(simInt objectHandle,simFloat targetPosition);simInt simGetJointTargetPosition(simInt objectHandle,simFloat* targetPosition);simInt simSetJointMaxForce(simInt objectHandle,simFloat forceOrTorque);simInt simGetPathPosition(simInt objectHandle,simFloat* position);simInt simSetPathPosition(simInt objectHandle,simFloat position);simInt simGetPathLength(simInt objectHandle,simFloat* length);simInt simGetJointMatrix(simInt objectHandle,simFloat* matrix);simInt simSetSphericalJointMatrix(simInt objectHandle,const simFloat* matrix);simInt simGetJointInterval(simInt objectHandle,simBool* cyclic,simFloat* interval);simInt simSetJointInterval(simInt objectHandle,simBool cyclic,const simFloat* interval);simInt simGetObjectParent(simInt objectHandle);simInt simGetObjectChild(simInt objectHandle,simInt index);simInt simSetObjectParent(simInt objectHandle,simInt parentObjectHandle,simBool keepInPlace);simInt simGetObjectType(simInt objectHandle);simInt simGetJointType(simInt objectHandle);simInt simBuildIdentityMatrix(simFloat* matrix);simInt simCopyMatrix(const simFloat* matrixIn,simFloat* matrixOut);simInt simBuildMatrix(const simFloat* position,const simFloat* eulerAngles,simFloat* matrix);simInt simBuildMatrixQ(const simFloat* position,const simFloat* quaternion,simFloat* matrix);simInt simGetEulerAnglesFromMatrix(const simFloat* matrix,simFloat* eulerAngles);simInt simGetQuaternionFromMatrix(const simFloat* matrix,simFloat* quaternion);simInt simInvertMatrix(simFloat* matrix);simInt simMultiplyMatrices(const simFloat* matrixIn1,const simFloat* matrixIn2,simFloat* matrixOut);simInt simInterpolateMatrices(const simFloat* matrixIn1,const simFloat* matrixIn2,simFloat interpolFactor,simFloat* matrixOut);simInt simTransformVector(const simFloat* matrix,simFloat* vect);simInt simReservedCommand(simInt v,simInt w);simFloat simGetSimulationTime();simInt simGetSimulationState();simFloat simGetSystemTime();simInt simGetSystemTimeInMilliseconds(); // deprecatedsimUInt simGetSystemTimeInMs(simInt previousTime);simInt simLoadScene(const simChar* filename);simInt simCloseScene();simInt simSaveScene(const simChar* filename);simInt simLoadModel(const simChar* filename);simInt simSaveModel(simInt baseOfModelHandle,const simChar* filename);simChar* simGetSimulatorMessage(simInt* messageID,simInt* auxiliaryData,simInt* returnedDataSize);simInt simAddModuleMenuEntry(const simChar* entryLabel,simInt itemCount,simInt* itemHandles);simInt simSetModuleMenuItemState(simInt itemHandle,simInt state,const simChar* label);simInt simDoesFileExist(const simChar* filename);simInt simIsObjectInSelection(simInt objectHandle);simInt simAddObjectToSelection(simInt what,simInt objectHandle);simInt simRemoveObjectFromSelection(simInt what,simInt objectHandle);simInt simGetObjectSelectionSize();simInt simGetObjectLastSelection();simInt simGetObjectSelection(simInt* objectHandles);simInt simHandleCollision(simInt collisionObjectHandle);simInt simReadCollision(simInt collisionObjectHandle);simInt simHandleDistance(simInt distanceObjectHandle,simFloat* smallestDistance);simInt simReadDistance(simInt distanceObjectHandle,simFloat* smallestDistance);simInt simHandleProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);simInt simReadProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);simInt simHandleIkGroup(simInt ikGroupHandle);simInt simCheckIkGroup(simInt ikGroupHandle,simInt jointCnt,const simInt* jointHandles,simFloat* jointValues,const simInt* jointOptions);simInt simHandleDynamics(simFloat deltaTime);simInt simGetScriptHandle(const simChar* scriptName);simInt simSetScriptText(simInt scriptHandle,const simChar* scriptText);const simChar* simGetScriptText(simInt scriptHandle);simInt simGetScriptProperty(simInt scriptHandle,simInt* scriptProperty,simInt* associatedObjectHandle);simInt simAssociateScriptWithObject(simInt scriptHandle,simInt associatedObjectHandle);simInt simGetScript(simInt index);simInt simGetScriptAssociatedWithObject(simInt objectHandle);simInt simGetCustomizationScriptAssociatedWithObject(simInt objectHandle);simInt simGetObjectAssociatedWithScript(simInt scriptHandle);simChar* simGetScriptName(simInt scriptHandle);simInt simHandleMainScript();simInt simResetScript(simInt scriptHandle);simInt simAddScript(simInt scriptProperty);simInt simRemoveScript(simInt scriptHandle);simInt simRefreshDialogs(simInt refreshDegree);simInt simGetCollisionHandle(const simChar* collisionObjectName);simInt simGetDistanceHandle(const simChar* distanceObjectName);simInt simGetIkGroupHandle(const simChar* ikGroupName);simInt simResetCollision(simInt collisionObjectHandle);simInt simResetDistance(simInt distanceObjectHandle);simInt simResetProximitySensor(simInt sensorHandle);simInt simCheckProximitySensor(simInt sensorHandle,simInt entityHandle,simFloat* detectedPoint);simInt simCheckProximitySensorEx(simInt sensorHandle,simInt entityHandle,simInt detectionMode,simFloat detectionThreshold,simFloat maxAngle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);simInt simCheckProximitySensorEx2(simInt sensorHandle,simFloat* vertexPointer,simInt itemType,simInt itemCount,simInt detectionMode,simFloat detectionThreshold,simFloat maxAngle,simFloat* detectedPoint,simFloat* normalVector);simChar* simCreateBuffer(simInt size);simInt simReleaseBuffer(const simChar* buffer);simInt simCheckCollision(simInt entity1Handle,simInt entity2Handle);simInt simCheckCollisionEx(simInt entity1Handle,simInt entity2Handle,simFloat** intersectionSegments);simInt simCheckDistance(simInt entity1Handle,simInt entity2Handle,simFloat threshold,simFloat* distanceData);simChar* simGetObjectConfiguration(simInt objectHandle);simInt simSetObjectConfiguration(const simChar* data);simChar* simGetConfigurationTree(simInt objectHandle);simInt simSetConfigurationTree(const simChar* data);simInt simSetSimulationTimeStep(simFloat timeStep);simFloat simGetSimulationTimeStep();simInt simGetRealTimeSimulation();simInt simIsRealTimeSimulationStepNeeded();simInt simAdjustRealTimeTimer(simInt instanceIndex,simFloat deltaTime);simInt simGetSimulationPassesPerRenderingPass();simInt simAdvanceSimulationByOneStep();simInt simStartSimulation();simInt simStopSimulation();simInt simPauseSimulation();simInt simLoadModule(const simChar* filenameAndPath,const simChar* pluginName);simInt simUnloadModule(simInt pluginhandle);simVoid* simSendModuleMessage(simInt message,simInt* auxiliaryData,simVoid* customData,simInt* replyData);simVoid* simBroadcastMessage(simInt* auxiliaryData,simVoid* customData,simInt* replyData);simChar* simGetModuleName(simInt index,simUChar* moduleVersion);simInt simFloatingViewAdd(simFloat posX,simFloat posY,simFloat sizeX,simFloat sizeY,simInt options);simInt simFloatingViewRemove(simInt floatingViewHandle);simInt simAdjustView(simInt viewHandleOrIndex,simInt associatedViewableObjectHandle,simInt options,const simChar* viewLabel);simInt simSetLastError(const simChar* funcName,const simChar* errorMessage);simInt simHandleGraph(simInt graphHandle,simFloat simulationTime);simInt simResetGraph(simInt graphHandle);simInt simSetNavigationMode(simInt navigationMode);simInt simGetNavigationMode();simInt simSetPage(simInt index);simInt simGetPage();simInt simDisplayDialog(const simChar* titleText,const simChar* mainText,simInt dialogType,const simChar* initialText,const simFloat* titleColors,const simFloat* dialogColors,simInt* elementHandle);simInt simGetDialogResult(simInt genericDialogHandle);simChar* simGetDialogInput(simInt genericDialogHandle);simInt simEndDialog(simInt genericDialogHandle);simInt simRegisterScriptCallbackFunction(const simChar* funcNameAtPluginName,const simChar* callTips,simVoid(*callBack)(struct SScriptCallBack* cb));simInt simRegisterScriptVariable(const simChar* varNameAtPluginName,const simChar* varValue,simInt stackHandle);simInt simSetJointTargetVelocity(simInt objectHandle,simFloat targetVelocity);simInt simGetJointTargetVelocity(simInt objectHandle,simFloat* targetVelocity);simInt simSetPathTargetNominalVelocity(simInt objectHandle,simFloat targetNominalVelocity);simInt simCopyPasteObjects(simInt* objectHandles,simInt objectCount,simInt options);simInt simScaleSelectedObjects(simFloat scalingFactor,simBool scalePositionsToo);simInt simScaleObjects(const simInt* objectHandles,simInt objectCount,simFloat scalingFactor,simBool scalePositionsToo);simInt simDeleteSelectedObjects();simInt simGetObjectUniqueIdentifier(simInt objectHandle,simInt* uniqueIdentifier);simInt simSendData(simInt targetID,simInt dataHeader,const simChar* dataName,const simChar* data,simInt dataLength,simInt antennaHandle,simFloat actionRadius,simFloat emissionAngle1,simFloat emissionAngle2,simFloat persistence);simChar* simReceiveData(simInt dataHeader,const simChar* dataName,simInt antennaHandle,simInt index,simInt* dataLength,simInt* senderID,simInt* dataHeaderR,simChar** dataNameR);simInt simSetGraphUserData(simInt graphHandle,const simChar* dataStreamName,simFloat data);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);simInt simRemoveDrawingObject(simInt objectHandle);simInt simAddDrawingObjectItem(simInt objectHandle,const simFloat* itemData);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);simInt simRemoveParticleObject(simInt objectHandle);simInt simAddParticleObjectItem(simInt objectHandle,const simFloat* itemData);simFloat simGetObjectSizeFactor(simInt objectHandle);simInt simAnnounceSceneContentChange();simInt simSetIntegerSignal(const simChar* signalName,simInt signalValue);simInt simGetIntegerSignal(const simChar* signalName,simInt* signalValue);simInt simClearIntegerSignal(const simChar* signalName);simInt simSetFloatSignal(const simChar* signalName,simFloat signalValue);simInt simGetFloatSignal(const simChar* signalName,simFloat* signalValue);simInt simClearFloatSignal(const simChar* signalName);simInt simSetDoubleSignal(const simChar* signalName,simDouble signalValue);simInt simGetDoubleSignal(const simChar* signalName,simDouble* signalValue);simInt simClearDoubleSignal(const simChar* signalName);simInt simSetStringSignal(const simChar* signalName,const simChar* signalValue,simInt stringLength);simChar* simGetStringSignal(const simChar* signalName,simInt* stringLength);simInt simClearStringSignal(const simChar* signalName);simChar* simGetSignalName(simInt signalIndex,simInt signalType);simInt simSetObjectProperty(simInt objectHandle,simInt prop);simInt simGetObjectProperty(simInt objectHandle);simInt simSetObjectSpecialProperty(simInt objectHandle,simInt prop);simInt simGetObjectSpecialProperty(simInt objectHandle);simInt simGetPositionOnPath(simInt pathHandle,simFloat relativeDistance,simFloat* position);simInt simGetDataOnPath(simInt pathHandle,simFloat relativeDistance,simInt dataType,simInt* intData,simFloat* floatData);simInt simGetOrientationOnPath(simInt pathHandle,simFloat relativeDistance,simFloat* eulerAngles);simInt simGetClosestPositionOnPath(simInt pathHandle,simFloat* absolutePosition,simFloat* pathPosition);simInt simReadForceSensor(simInt objectHandle,simFloat* forceVector,simFloat* torqueVector);simInt simBreakForceSensor(simInt objectHandle);simInt simGetShapeVertex(simInt shapeHandle,simInt groupElementIndex,simInt vertexIndex,simFloat* relativePosition);simInt simGetShapeTriangle(simInt shapeHandle,simInt groupElementIndex,simInt triangleIndex,simInt* vertexIndices,simFloat* triangleNormals);simInt simSetLightParameters(simInt objectHandle,simInt state,const simFloat* setToNULL,const simFloat* diffusePart,const simFloat* specularPart);simInt simGetLightParameters(simInt objectHandle,simFloat* setToNULL,simFloat* diffusePart,simFloat* specularPart);simInt simGetVelocity(simInt shapeHandle,simFloat* linearVelocity,simFloat* angularVelocity);simInt simGetObjectVelocity(simInt objectHandle,simFloat* linearVelocity,simFloat* angularVelocity);simInt simAddForceAndTorque(simInt shapeHandle,const simFloat* force,const simFloat* torque);simInt simAddForce(simInt shapeHandle,const simFloat* position,const simFloat* force);simInt simSetExplicitHandling(simInt generalObjectHandle,int explicitFlags);simInt simGetExplicitHandling(simInt generalObjectHandle);simInt simGetLinkDummy(simInt dummyHandle);simInt simSetLinkDummy(simInt dummyHandle,simInt linkedDummyHandle);simInt simSetModelProperty(simInt objectHandle,simInt modelProperty);simInt simGetModelProperty(simInt objectHandle);simInt simSetShapeColor(simInt shapeHandle,const simChar* colorName,simInt colorComponent,const simFloat* rgbData);simInt simGetShapeColor(simInt shapeHandle,const simChar* colorName,simInt colorComponent,simFloat* rgbData);simInt simResetDynamicObject(simInt objectHandle);simInt simSetJointMode(simInt jointHandle,simInt jointMode,simInt options);simInt simGetJointMode(simInt jointHandle,simInt* options);simInt simSerialOpen(const simChar* portString,simInt baudRate,simVoid* reserved1,simVoid* reserved2);simInt simSerialClose(simInt portHandle);simInt simSerialSend(simInt portHandle,const simChar* data,simInt dataLength);simInt simSerialRead(simInt portHandle,simChar* buffer,simInt dataLengthToRead);simInt simSerialCheck(simInt portHandle);simInt simGetContactInfo(simInt dynamicPass,simInt objectHandle,simInt index,simInt* objectHandles,simFloat* contactInfo);simInt simSetThreadIsFree(simBool freeMode);simInt simTubeOpen(simInt dataHeader,const simChar* dataName,simInt readBufferSize,simBool notUsedButKeepZero);simInt simTubeClose(simInt tubeHandle);simInt simTubeWrite(simInt tubeHandle,const simChar* data,simInt dataLength);simChar* simTubeRead(simInt tubeHandle,simInt* dataLength);simInt simTubeStatus(simInt tubeHandle,simInt* readPacketsCount,simInt* writePacketsCount);simInt simAuxiliaryConsoleOpen(const simChar* title,simInt maxLines,simInt mode,const simInt* position,const simInt* size,const simFloat* textColor,const simFloat* backgroundColor);simInt simAuxiliaryConsoleClose(simInt consoleHandle);simInt simAuxiliaryConsoleShow(simInt consoleHandle,simBool showState);simInt simAuxiliaryConsolePrint(simInt consoleHandle,const simChar* text);simInt simImportShape(simInt fileformat,const simChar* pathAndFilename,simInt options,simFloat identicalVerticeTolerance,simFloat scalingFactor);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);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);simInt simCreateMeshShape(simInt options,simFloat shadingAngle,const simFloat* vertices,simInt verticesSize,const simInt* indices,simInt indicesSize,simFloat* reserved);simInt simCreatePureShape(simInt primitiveType,simInt options,const simFloat* sizes,simFloat mass,const simInt* precision);simInt simCreateHeightfieldShape(simInt options,simFloat shadingAngle,simInt xPointCount,simInt yPointCount,simFloat xSize,const simFloat* heights);simInt simGetShapeMesh(simInt shapeHandle,simFloat** vertices,simInt* verticesSize,simInt** indices,simInt* indicesSize,simFloat** normals);simInt simAddBanner(const simChar* label,simFloat size,simInt options,const simFloat* positionAndEulerAngles,simInt parentObjectHandle,const simFloat* labelColors,const simFloat* backgroundColors);simInt simRemoveBanner(simInt bannerID);simInt simCreateJoint(simInt jointType,simInt jointMode,simInt options,const simFloat* sizes,const simFloat* colorA,const simFloat* colorB);simInt simGetObjectIntParameter(simInt objectHandle,simInt parameterID,simInt* parameter);simInt simSetObjectIntParameter(simInt objectHandle,simInt parameterID,simInt parameter);simInt simGetObjectInt32Parameter(simInt objectHandle,simInt parameterID,simInt* parameter);simInt simSetObjectInt32Parameter(simInt objectHandle,simInt parameterID,simInt parameter);simInt simGetObjectFloatParameter(simInt objectHandle,simInt parameterID,simFloat* parameter);simInt simSetObjectFloatParameter(simInt objectHandle,simInt parameterID,simFloat parameter);simChar* simGetObjectStringParameter(simInt objectHandle,simInt parameterID,simInt* parameterLength);simInt simSetObjectStringParameter(simInt objectHandle,simInt parameterID,simChar* parameter,simInt parameterLength);simInt simSetSimulationPassesPerRenderingPass(simInt p);simInt simGetRotationAxis(const simFloat* matrixStart,const simFloat* matrixGoal,simFloat* axis,simFloat* angle);simInt simRotateAroundAxis(const simFloat* matrixIn,const simFloat* axis,const simFloat* axisPos,simFloat angle,simFloat* matrixOut);simInt simGetJointForce(simInt jointHandle,simFloat* forceOrTorque);simInt simGetJointMaxForce(simInt jointHandle,simFloat* forceOrTorque);simInt simSetArrayParameter(simInt parameter,const simVoid* arrayOfValues);simInt simGetArrayParameter(simInt parameter,simVoid* arrayOfValues);simInt simSetIkGroupProperties(simInt ikGroupHandle,simInt resolutionMethod,simInt maxIterations,simFloat damping,void* reserved);simInt simSetIkElementProperties(simInt ikGroupHandle,simInt tipDummyHandle,simInt constraints,const simFloat* precision,const simFloat* weight,void* reserved);simInt simCameraFitToView(simInt viewHandleOrIndex,simInt objectCount,const simInt* objectHandles,simInt options,simFloat scaling);simInt simPersistentDataWrite(const simChar* dataName,const simChar* dataValue,simInt dataLength,simInt options);simChar* simPersistentDataRead(const simChar* dataName,simInt* dataLength);simInt simIsHandleValid(simInt generalObjectHandle,simInt generalObjectType);simInt simHandleVisionSensor(simInt visionSensorHandle,simFloat** auxValues,simInt** auxValuesCount);simInt simReadVisionSensor(simInt visionSensorHandle,simFloat** auxValues,simInt** auxValuesCount);simInt simResetVisionSensor(simInt visionSensorHandle);simInt simCheckVisionSensor(simInt visionSensorHandle,simInt entityHandle,simFloat** auxValues,simInt** auxValuesCount);simFloat* simCheckVisionSensorEx(simInt visionSensorHandle,simInt entityHandle,simBool returnImage);simInt simGetVisionSensorResolution(simInt visionSensorHandle,simInt* resolution);simFloat* simGetVisionSensorImage(simInt visionSensorHandle);simUChar* simGetVisionSensorCharImage(simInt visionSensorHandle,simInt* resolutionX,simInt* resolutionY);simFloat* simGetVisionSensorDepthBuffer(simInt visionSensorHandle);simInt simSetVisionSensorImage(simInt visionSensorHandle,const simFloat* image);simInt simSetVisionSensorCharImage(simInt visionSensorHandle,const simUChar* image);simInt simRMLPosition(simInt dofs,simDouble timeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxVelAccelJerk,const simBool* selection,const simDouble* targetPosVel,simDouble* newPosVelAccel,simVoid* auxData);simInt simRMLVelocity(simInt dofs,simDouble timeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxAccelJerk,const simBool* selection,const simDouble* targetVel,simDouble* newPosVelAccel,simVoid* auxData);simInt simRMLPos(simInt dofs,simDouble smallestTimeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxVelAccelJerk,const simBool* selection,const simDouble* targetPosVel,simVoid* auxData);simInt simRMLVel(simInt dofs,simDouble smallestTimeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxAccelJerk,const simBool* selection,const simDouble* targetVel,simVoid* auxData);simInt simRMLStep(simInt handle,simDouble timeStep,simDouble* newPosVelAccel,simVoid* auxData,simVoid* reserved);simInt simRMLRemove(simInt handle);simChar* simFileDialog(simInt mode,const simChar* title,const simChar* startPath,const simChar* initName,const simChar* extName,const simChar* ext);simInt simMsgBox(simInt dlgType,simInt buttons,const simChar* title,const simChar* message);simInt simCreateDummy(simFloat size,const simFloat* color);simInt simSetShapeMassAndInertia(simInt shapeHandle,simFloat mass,const simFloat* inertiaMatrix,const simFloat* centerOfMass,const simFloat* transformation);simInt simGetShapeMassAndInertia(simInt shapeHandle,simFloat* mass,simFloat* inertiaMatrix,simFloat* centerOfMass,const simFloat* transformation);simInt simGroupShapes(const simInt* shapeHandles,simInt shapeCount);simInt* simUngroupShape(simInt shapeHandle,simInt* shapeCount);simInt simCreateProximitySensor(simInt sensorType,simInt subType,simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);simInt simCreateForceSensor(simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);simInt simCreateVisionSensor(simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);simInt simConvexDecompose(simInt shapeHandle,simInt options,const simInt* intParams,const simFloat* floatParams);simInt simCreatePath(simInt attributes,const simInt* intParams,const simFloat* floatParams,const simFloat* color);simInt simInsertPathCtrlPoints(simInt pathHandle,simInt options,simInt startIndex,simInt ptCnt,const simVoid* ptData);simInt simCutPathCtrlPoints(simInt pathHandle,simInt startIndex,simInt ptCnt);simFloat* simGetIkGroupMatrix(simInt ikGroupHandle,simInt options,simInt* matrixSize);simInt simAddGhost(simInt ghostGroup,simInt objectHandle,simInt options,simFloat startTime,simFloat endTime,const simFloat* color);simInt simModifyGhost(simInt ghostGroup,simInt ghostId,simInt operation,simFloat floatValue,simInt options,simInt optionsMask,const simFloat* colorOrTransformation);simVoid simQuitSimulator(simBool ignoredArgument);simInt simGetThreadId();simInt simLockResources(simInt lockType,simInt reserved);simInt simUnlockResources(simInt lockHandle);simInt simEnableEventCallback(simInt eventCallbackType,const simChar* plugin,simInt reserved);simInt simSetShapeMaterial(simInt shapeHandle,simInt materialIdOrShapeHandle);simInt simGetTextureId(const simChar* textureName,simInt* resolution);simChar* simReadTexture(simInt textureId,simInt options,simInt posX,simInt posY,simInt sizeX,simInt sizeY);simInt simWriteTexture(simInt textureId,simInt options,const simChar* data,simInt posX,simInt posY,simInt sizeX,simInt sizeY,simFloat interpol);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);simInt simWriteCustomDataBlock(simInt objectHandle,const simChar* tagName,const simChar* data,simInt dataSize);simChar* simReadCustomDataBlock(simInt objectHandle,const simChar* tagName,simInt* dataSize);simChar* simReadCustomDataBlockTags(simInt objectHandle,simInt* tagCount);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);simInt simModifyPointCloud(simInt pointCloudHandle,simInt operation,const simInt* intParam,const simFloat* floatParam);simInt simGetShapeGeomInfo(simInt shapeHandle,simInt* intData,simFloat* floatData,simVoid* reserved);simInt* simGetObjectsInTree(simInt treeBaseHandle,simInt objectType,simInt options,simInt* objectCount);simInt simSetObjectSizeValues(simInt objectHandle,const simFloat* sizeValues);simInt simGetObjectSizeValues(simInt objectHandle,simFloat* sizeValues);simInt simScaleObject(simInt objectHandle,simFloat xScale,simFloat yScale,simFloat zScale,simInt options);simInt simSetShapeTexture(simInt shapeHandle,simInt textureId,simInt mappingMode,simInt options,const simFloat* uvScaling,const simFloat* position,const simFloat* orientation);simInt simGetShapeTextureId(simInt shapeHandle);simInt* simGetCollectionObjects(simInt collectionHandle,simInt* objectCount);simInt simSetScriptAttribute(simInt scriptHandle,simInt attributeID,simFloat floatVal,simInt intOrBoolVal);simInt simGetScriptAttribute(simInt scriptHandle,simInt attributeID,simFloat* floatVal,simInt* intOrBoolVal);simInt simReorientShapeBoundingBox(simInt shapeHandle,simInt relativeToHandle,simInt reservedSetToZero);simInt simSwitchThread();simInt simCreateIkGroup(simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);simInt simRemoveIkGroup(simInt ikGroupHandle);simInt simCreateIkElement(simInt ikGroupHandle,simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);simInt simCreateCollection(const simChar* collectionName,simInt options);simInt simAddObjectToCollection(simInt collectionHandle,simInt objectHandle,simInt what,simInt options);simInt simSaveImage(const simUChar* image,const simInt* resolution,simInt options,const simChar* filename,simInt quality,simVoid* reserved);simUChar* simLoadImage(simInt* resolution,simInt options,const simChar* filename,simVoid* reserved);simUChar* simGetScaledImage(const simUChar* imageIn,const simInt* resolutionIn,simInt* resolutionOut,simInt options,simVoid* reserved);simInt simTransformImage(simUChar* image,const simInt* resolution,simInt options,const simFloat* floatParams,const simInt* intParams,simVoid* reserved);simInt simGetQHull(const simFloat* inVertices,simInt inVerticesL,simFloat** verticesOut,simInt* verticesOutL,simInt** indicesOut,simInt* indicesOutL,simInt reserved1,const simFloat* reserved2);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);simInt simExportIk(const simChar* pathAndFilename,simInt reserved1,simVoid* reserved2);simInt simCallScriptFunctionEx(simInt scriptHandleOrType,const simChar* functionNameAtScriptName,simInt stackId);simInt simComputeJacobian(simInt ikGroupHandle,simInt options,simVoid* reserved);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);simFloat* simGenerateIkPath(simInt ikGroupHandle,simInt jointCnt,const simInt* jointHandles,simInt ptCnt,simInt collisionPairCnt,const simInt* collisionPairs,const simInt* jointOptions,simVoid* reserved);simChar* simGetExtensionString(simInt objectHandle,simInt index,const char* key);simInt simComputeMassAndInertia(simInt shapeHandle,simFloat density);simInt simCreateStack();simInt simReleaseStack(simInt stackHandle);simInt simCopyStack(simInt stackHandle);simInt simPushNullOntoStack(simInt stackHandle);simInt simPushBoolOntoStack(simInt stackHandle,simBool value);simInt simPushInt32OntoStack(simInt stackHandle,simInt value);simInt simPushFloatOntoStack(simInt stackHandle,simFloat value);simInt simPushDoubleOntoStack(simInt stackHandle,simDouble value);simInt simPushStringOntoStack(simInt stackHandle,const simChar* value,simInt stringSize);simInt simPushUInt8TableOntoStack(simInt stackHandle,const simUChar* values,simInt valueCnt);simInt simPushInt32TableOntoStack(simInt stackHandle,const simInt* values,simInt valueCnt);simInt simPushFloatTableOntoStack(simInt stackHandle,const simFloat* values,simInt valueCnt);simInt simPushDoubleTableOntoStack(simInt stackHandle,const simDouble* values,simInt valueCnt);simInt simPushTableOntoStack(simInt stackHandle);simInt simInsertDataIntoStackTable(simInt stackHandle);simInt simGetStackSize(simInt stackHandle);simInt simPopStackItem(simInt stackHandle,simInt count);simInt simMoveStackItemToTop(simInt stackHandle,simInt cIndex);simInt simIsStackValueNull(simInt stackHandle);simInt simGetStackBoolValue(simInt stackHandle,simBool* boolValue);simInt simGetStackInt32Value(simInt stackHandle,simInt* numberValue);simInt simGetStackFloatValue(simInt stackHandle,simFloat* numberValue);simInt simGetStackDoubleValue(simInt stackHandle,simDouble* numberValue);simChar* simGetStackStringValue(simInt stackHandle,simInt* stringSize);simInt simGetStackTableInfo(simInt stackHandle,simInt infoType);simInt simGetStackUInt8Table(simInt stackHandle,simUChar* array,simInt count);simInt simGetStackInt32Table(simInt stackHandle,simInt* array,simInt count);simInt simGetStackFloatTable(simInt stackHandle,simFloat* array,simInt count);simInt simGetStackDoubleTable(simInt stackHandle,simDouble* array,simInt count);simInt simUnfoldStackTable(simInt stackHandle);simInt simDebugStack(simInt stackHandle,simInt cIndex);simInt simSetScriptVariable(simInt scriptHandleOrType,const simChar* variableNameAtScriptName,simInt stackHandle);simFloat simGetEngineFloatParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);simInt simGetEngineInt32Parameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);simBool simGetEngineBoolParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);simInt simSetEngineFloatParameter(simInt paramId,simInt objectHandle,const simVoid* object,simFloat val);simInt simSetEngineInt32Parameter(simInt paramId,simInt objectHandle,const simVoid* object,simInt val);simInt simSetEngineBoolParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool val);simInt simCreateOctree(simFloat voxelSize,simInt options,simFloat pointSize,simVoid* reserved);simInt simCreatePointCloud(simFloat maxVoxelSize,simInt maxPtCntPerVoxel,simInt options,simFloat pointSize,simVoid* reserved);simInt simSetPointCloudOptions(simInt pointCloudHandle,simFloat maxVoxelSize,simInt maxPtCntPerVoxel,simInt options,simFloat pointSize,simVoid* reserved);simInt simGetPointCloudOptions(simInt pointCloudHandle,simFloat* maxVoxelSize,simInt* maxPtCntPerVoxel,simInt* options,simFloat* pointSize,simVoid* reserved);simInt simInsertVoxelsIntoOctree(simInt octreeHandle,simInt options,const simFloat* pts,simInt ptCnt,const simUChar* color,const simUInt* tag,simVoid* reserved);simInt simRemoveVoxelsFromOctree(simInt octreeHandle,simInt options,const simFloat* pts,simInt ptCnt,simVoid* reserved);simInt simInsertPointsIntoPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,const simUChar* color,simVoid* optionalValues);simInt simRemovePointsFromPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,simFloat tolerance,simVoid* reserved);simInt simIntersectPointsWithPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,simFloat tolerance,simVoid* reserved);const float* simGetOctreeVoxels(simInt octreeHandle,simInt* ptCnt,simVoid* reserved);const float* simGetPointCloudPoints(simInt pointCloudHandle,simInt* ptCnt,simVoid* reserved);simInt simInsertObjectIntoOctree(simInt octreeHandle,simInt objectHandle,simInt options,const simUChar* color,simUInt tag,simVoid* reserved);simInt simSubtractObjectFromOctree(simInt octreeHandle,simInt objectHandle,simInt options,simVoid* reserved);simInt simInsertObjectIntoPointCloud(simInt pointCloudHandle,simInt objectHandle,simInt options,simFloat gridSize,const simUChar* color,simVoid* optionalValues);simInt simSubtractObjectFromPointCloud(simInt pointCloudHandle,simInt objectHandle,simInt options,simFloat tolerance,simVoid* reserved);simInt simCheckOctreePointOccupancy(simInt octreeHandle,simInt options,const simFloat* points,simInt ptCnt,simUInt* tag,simUInt64* location,simVoid* reserved);simChar* simOpenTextEditor(const simChar* initText,const simChar* xml,simInt* various);simChar* simPackTable(simInt stackHandle,simInt* bufferSize);simInt simUnpackTable(simInt stackHandle,const simChar* buffer,simInt bufferSize);simInt simSetReferencedHandles(simInt objectHandle,simInt count,const simInt* referencedHandles,const simInt* reserved1,const simInt* reserved2);simInt simGetReferencedHandles(simInt objectHandle,simInt** referencedHandles,simInt** reserved1,simInt** reserved2);simInt simGetShapeViz(simInt shapeHandle,simInt index,struct SShapeVizInfo* info);simInt simExecuteScriptString(simInt scriptHandleOrType,const simChar* stringAtScriptName,simInt stackHandle);simChar* simGetApiFunc(simInt scriptHandleOrType,const simChar* apiWord);simChar* simGetApiInfo(simInt scriptHandleOrType,const simChar* apiWord);simInt simSetModuleInfo(const simChar* moduleName,simInt infoType,const simChar* stringInfo,simInt intInfo);simInt simGetModuleInfo(const simChar* moduleName,simInt infoType,simChar** stringInfo,simInt* intInfo);simInt simIsDeprecated(const simChar* funcOrConst);simChar* simGetPersistentDataTags(simInt* tagCount);simInt simEventNotification(const simChar* event);simInt simApplyTexture(simInt shapeHandle,const simFloat* textureCoordinates,simInt textCoordSize,const simUChar* texture,const simInt* textureResolution,simInt options);simInt simSetJointDependency(simInt jointHandle,simInt masterJointHandle,simFloat offset,simFloat coeff);simInt simSetStringNamedParam(const simChar* paramName,const simChar* stringParam,simInt paramLength);simChar* simGetStringNamedParam(const simChar* paramName,simInt* paramLength);simChar* simGetUserParameter(simInt objectHandle,const simChar* parameterName,simInt* parameterLength);simInt simSetUserParameter(simInt objectHandle,const simChar* parameterName,const simChar* parameterValue,simInt parameterLength);simInt simAddLog(const simChar* pluginName,simInt verbosityLevel,const simChar* logMsg);
simInt _simGetContactCallbackCount();const void* _simGetContactCallback(simInt index);simVoid _simSetDynamicSimulationIconCode(simVoid* object,simInt code);simVoid _simSetDynamicObjectFlagForVisualization(simVoid* object,simInt flag);simInt _simGetObjectListSize(simInt objType);const simVoid* _simGetObjectFromIndex(simInt objType,simInt index);simInt _simGetObjectID(const simVoid* object);simInt _simGetObjectType(const simVoid* object);const simVoid** _simGetObjectChildren(const simVoid* object,simInt* count);const simVoid* _simGetGeomProxyFromShape(const simVoid* shape);const simVoid* _simGetParentObject(const simVoid* object);const simVoid* _simGetObject(int objID);simVoid _simGetObjectLocalTransformation(const simVoid* object,simFloat* pos,simFloat* quat,simBool excludeFirstJointTransformation);simVoid _simSetObjectLocalTransformation(simVoid* object,const simFloat* pos,const simFloat* quat);simVoid _simSetObjectCumulativeTransformation(simVoid* object,const simFloat* pos,const simFloat* quat,simBool keepChildrenInPlace);simVoid _simGetObjectCumulativeTransformation(const simVoid* object,simFloat* pos,simFloat* quat,simBool excludeFirstJointTransformation);simBool _simIsShapeDynamicallyStatic(const simVoid* shape);simInt _simGetTreeDynamicProperty(const simVoid* object);simInt _simGetDummyLinkType(const simVoid* dummy,simInt* linkedDummyID);simInt _simGetJointMode(const simVoid* joint);simBool _simIsJointInHybridOperation(const simVoid* joint);simVoid _simDisableDynamicTreeForManipulation(const simVoid* object,simBool disableFlag);simBool _simIsShapeDynamicallyRespondable(const simVoid* shape);simInt _simGetDynamicCollisionMask(const simVoid* shape);const simVoid* _simGetLastParentForLocalGlobalCollidable(const simVoid* shape);simVoid _simSetShapeIsStaticAndNotRespondableButDynamicTag(const simVoid* shape,simBool tag);simBool _simGetShapeIsStaticAndNotRespondableButDynamicTag(const simVoid* shape);simVoid _simSetJointPosition(const simVoid* joint,simFloat pos);simFloat _simGetJointPosition(const simVoid* joint);simVoid _simSetDynamicMotorPositionControlTargetPosition(const simVoid* joint,simFloat pos);simVoid _simGetInitialDynamicVelocity(const simVoid* shape,simFloat* vel);simVoid _simSetInitialDynamicVelocity(simVoid* shape,const simFloat* vel);simVoid _simGetInitialDynamicAngVelocity(const simVoid* shape,simFloat* angularVel);simVoid _simSetInitialDynamicAngVelocity(simVoid* shape,const simFloat* angularVel);simBool _simGetStartSleeping(const simVoid* shape);simBool _simGetWasPutToSleepOnce(const simVoid* shape);simBool _simGetDynamicsFullRefreshFlag(const simVoid* object);simVoid _simSetDynamicsFullRefreshFlag(const simVoid* object,simBool flag);simVoid _simSetGeomProxyDynamicsFullRefreshFlag(simVoid* geomData,simBool flag);simBool _simGetGeomProxyDynamicsFullRefreshFlag(const simVoid* geomData);simVoid _simSetShapeDynamicVelocity(simVoid* shape,const simFloat* linear,const simFloat* angular);simVoid _simGetAdditionalForceAndTorque(const simVoid* shape,simFloat* force,simFloat* torque);simVoid _simClearAdditionalForceAndTorque(const simVoid* shape);simBool _simGetJointPositionInterval(const simVoid* joint,simFloat* minValue,simFloat* rangeValue);simInt _simGetJointType(const simVoid* joint);simBool _simIsForceSensorBroken(const simVoid* forceSensor);simVoid _simGetDynamicForceSensorLocalTransformationPart2(const simVoid* forceSensor,simFloat* pos,simFloat* quat);simBool _simIsDynamicMotorEnabled(const simVoid* joint);simBool _simIsDynamicMotorPositionCtrlEnabled(const simVoid* joint);simBool _simIsDynamicMotorTorqueModulationEnabled(const simVoid* joint);simVoid _simGetMotorPid(const simVoid* joint,simFloat* pParam,simFloat* iParam,simFloat* dParam);simFloat _simGetDynamicMotorTargetPosition(const simVoid* joint);simFloat _simGetDynamicMotorTargetVelocity(const simVoid* joint);simFloat _simGetDynamicMotorMaxForce(const simVoid* joint);simFloat _simGetDynamicMotorUpperLimitVelocity(const simVoid* joint);simVoid _simSetDynamicMotorReflectedPositionFromDynamicEngine(simVoid* joint,simFloat pos);simVoid _simSetJointSphericalTransformation(simVoid* joint,const simFloat* quat);simVoid _simAddForceSensorCumulativeForcesAndTorques(simVoid* forceSensor,const simFloat* force,const simFloat* torque,int totalPassesCount);simVoid _simAddJointCumulativeForcesOrTorques(simVoid* joint,simFloat forceOrTorque,int totalPassesCount);simVoid _simSetDynamicJointLocalTransformationPart2(simVoid* joint,const simFloat* pos,const simFloat* quat);simVoid _simSetDynamicForceSensorLocalTransformationPart2(simVoid* forceSensor,const simFloat* pos,const simFloat* quat);simVoid _simSetDynamicJointLocalTransformationPart2IsValid(simVoid* joint,simBool valid);simVoid _simSetDynamicForceSensorLocalTransformationPart2IsValid(simVoid* forceSensor,simBool valid);const simVoid* _simGetGeomWrapFromGeomProxy(const simVoid* geomData);simVoid _simGetLocalInertiaFrame(const simVoid* geomInfo,simFloat* pos,simFloat* quat);simInt _simGetPurePrimitiveType(const simVoid* geomInfo);simBool _simIsGeomWrapGeometric(const simVoid* geomInfo);simBool _simIsGeomWrapConvex(const simVoid* geomInfo);simInt _simGetGeometricCount(const simVoid* geomInfo);simVoid _simGetAllGeometrics(const simVoid* geomInfo,simVoid** allGeometrics);simVoid _simGetPurePrimitiveSizes(const simVoid* geometric,simFloat* sizes);simVoid _simMakeDynamicAnnouncement(int announceType);simVoid _simGetVerticesLocalFrame(const simVoid* geometric,simFloat* pos,simFloat* quat);const simFloat* _simGetHeightfieldData(const simVoid* geometric,simInt* xCount,simInt* yCount,simFloat* minHeight,simFloat* maxHeight);simVoid _simGetCumulativeMeshes(const simVoid* geomInfo,simFloat** vertices,simInt* verticesSize,simInt** indices,simInt* indicesSize);simFloat _simGetMass(const simVoid* geomInfo);simVoid _simGetPrincipalMomentOfInertia(const simVoid* geomInfo,simFloat* inertia);simVoid _simGetGravity(simFloat* gravity);simInt _simGetTimeDiffInMs(simInt previousTime);simBool _simDoEntitiesCollide(simInt entity1ID,simInt entity2ID,simInt* cacheBuffer,simBool overrideCollidableFlagIfShape1,simBool overrideCollidableFlagIfShape2,simBool pathOrMotionPlanningRoutineCalling);simBool _simGetDistanceBetweenEntitiesIfSmaller(simInt entity1ID,simInt entity2ID,simFloat* distance,simFloat* ray,simInt* cacheBuffer,simBool overrideMeasurableFlagIfNonCollection1,simBool overrideMeasurableFlagIfNonCollection2,simBool pathPlanningRoutineCalling);simInt _simHandleJointControl(const simVoid* joint,simInt auxV,const simInt* inputValuesInt,const simFloat* inputValuesFloat,simFloat* outputValues);simInt _simHandleCustomContact(simInt objHandle1,simInt objHandle2,simInt engine,simInt* dataInt,simFloat* dataFloat);const simVoid* _simGetIkGroupObject(int ikGroupID);simInt _simMpHandleIkGroupObject(const simVoid* ikGroup);simFloat _simGetPureHollowScaling(const simVoid* geometric);simInt _simGetJointCallbackCallOrder(const simVoid* joint);simVoid _simDynCallback(const simInt* intData,const simFloat* floatData);
// Following courtesy of Stephen James:simInt simExtLaunchUIThread(const simChar* applicationName,simInt options,const simChar* sceneOrModelOrUiToLoad,const simChar* applicationDir_);simInt simExtCanInitSimThread();simInt simExtSimThreadInit();simInt simExtSimThreadDestroy();simInt simExtPostExitRequest();simInt simExtGetExitRequest();simInt simExtStep(simBool stepIfRunning);simInt simExtCallScriptFunction(simInt scriptHandleOrType, const simChar* functionNameAtScriptName, const simInt* inIntData, simInt inIntCnt, const simFloat* inFloatData, simInt inFloatCnt, const simChar** inStringData, simInt inStringCnt, const simChar* inBufferData, simInt inBufferCnt, simInt** outIntData, simInt* outIntCnt, simFloat** outFloatData, simInt* outFloatCnt, simChar*** outStringData, simInt* outStringCnt, simChar** outBufferData, simInt* outBufferSize);
// Deprecated beginsimInt simGetMaterialId(const simChar* materialName);simInt simGetShapeMaterial(simInt shapeHandle);simInt simHandleVarious();simInt simSerialPortOpen(simInt portNumber,simInt baudRate,simVoid* reserved1,simVoid* reserved2);simInt simSerialPortClose(simInt portNumber);simInt simSerialPortSend(simInt portNumber,const simChar* data,simInt dataLength);simInt simSerialPortRead(simInt portNumber,simChar* buffer,simInt dataLengthToRead);simInt simJointGetForce(simInt jointHandle,simFloat* forceOrTorque);simInt simGetPathPlanningHandle(const simChar* pathPlanningObjectName);simInt simGetMotionPlanningHandle(const simChar* motionPlanningObjectName);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);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);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);simFloat* simFindIkPath(simInt motionPlanningObjectHandle,const simFloat* startConfig,const simFloat* goalPose,simInt options,simFloat stepSize,simInt* outputConfigsCnt,simFloat* reserved,const simInt* auxIntParams,const simFloat* auxFloatParams);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);simInt simCreateMotionPlanning(simInt jointCnt,const simInt* jointHandles,const simInt* jointRangeSubdivisions,const simFloat* jointMetricWeights,simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);simInt simRemoveMotionPlanning(simInt motionPlanningHandle);simInt simSearchPath(simInt pathPlanningObjectHandle,simFloat maximumSearchTime);simInt simInitializePathSearch(simInt pathPlanningObjectHandle,simFloat maximumSearchTime,simFloat searchTimeStep);simInt simPerformPathSearchStep(simInt temporaryPathSearchObject,simBool abortSearch);simInt simLockInterface(simBool locked);simInt simCopyPasteSelectedObjects();simInt simResetPath(simInt pathHandle);simInt simHandlePath(simInt pathHandle,simFloat deltaTime);simInt simResetJoint(simInt jointHandle);simInt simHandleJoint(simInt jointHandle,simFloat deltaTime);simInt simAppendScriptArrayEntry(const simChar* reservedSetToNull,simInt scriptHandleOrType,const simChar* arrayNameAtScriptName,const simChar* keyName,const simChar* data,const simInt* what);simInt simClearScriptVariable(const simChar* reservedSetToNull,simInt scriptHandleOrType,const simChar* variableNameAtScriptName);simVoid _simGetJointOdeParameters(const simVoid* joint,simFloat* stopERP,simFloat* stopCFM,simFloat* bounce,simFloat* fudge,simFloat* normalCFM);simVoid _simGetJointBulletParameters(const simVoid* joint,simFloat* stopERP,simFloat* stopCFM,simFloat* normalCFM);simVoid _simGetOdeMaxContactFrictionCFMandERP(const simVoid* geomInfo,simInt* maxContacts,simFloat* friction,simFloat* cfm,simFloat* erp);simBool _simGetBulletCollisionMargin(const simVoid* geomInfo,simFloat* margin,simInt* otherProp);simBool _simGetBulletStickyContact(const simVoid* geomInfo);simFloat _simGetBulletRestitution(const simVoid* geomInfo);simVoid _simGetVortexParameters(const simVoid* object,simInt version,simFloat* floatParams,simInt* intParams);simVoid _simGetNewtonParameters(const simVoid* object,simInt* version,simFloat* floatParams,simInt* intParams);simVoid _simGetDamping(const simVoid* geomInfo,simFloat* linDamping,simFloat* angDamping);simFloat _simGetFriction(const simVoid* geomInfo);simInt simAddSceneCustomData(simInt header,const simChar* data,simInt dataLength);simInt simGetSceneCustomDataLength(simInt header);simInt simGetSceneCustomData(simInt header,simChar* data);simInt simAddObjectCustomData(simInt objectHandle,simInt header,const simChar* data,simInt dataLength);simInt simGetObjectCustomDataLength(simInt objectHandle,simInt header);simInt simGetObjectCustomData(simInt objectHandle,simInt header,simChar* data);simInt simCreateUI(const simChar* uiName,simInt menuAttributes,const simInt* clientSize,const simInt* cellSize,simInt* buttonHandles);simInt simCreateUIButton(simInt uiHandle,const simInt* position,const simInt* size,simInt buttonProperty);simInt simGetUIHandle(const simChar* uiName);simInt simGetUIProperty(simInt uiHandle);simInt simGetUIEventButton(simInt uiHandle,simInt* auxiliaryValues);simInt simSetUIProperty(simInt uiHandle,simInt elementProperty);simInt simGetUIButtonProperty(simInt uiHandle,simInt buttonHandle);simInt simSetUIButtonProperty(simInt uiHandle,simInt buttonHandle,simInt buttonProperty);simInt simGetUIButtonSize(simInt uiHandle,simInt buttonHandle,simInt* size);simInt simSetUIButtonLabel(simInt uiHandle,simInt buttonHandle,const simChar* upStateLabel,const simChar* downStateLabel);simChar* simGetUIButtonLabel(simInt uiHandle,simInt buttonHandle);simInt simSetUISlider(simInt uiHandle,simInt buttonHandle,simInt position);simInt simGetUISlider(simInt uiHandle,simInt buttonHandle);simInt simSetUIButtonColor(simInt uiHandle,simInt buttonHandle,const simFloat* upStateColor,const simFloat* downStateColor,const simFloat* labelColor);simInt simSetUIButtonTexture(simInt uiHandle,simInt buttonHandle,const simInt* size,const simChar* textureData);simInt simCreateUIButtonArray(simInt uiHandle,simInt buttonHandle);simInt simSetUIButtonArrayColor(simInt uiHandle,simInt buttonHandle,const simInt* position,const simFloat* color);simInt simDeleteUIButtonArray(simInt uiHandle,simInt buttonHandle);simInt simRemoveUI(simInt uiHandle);simInt simSetUIPosition(simInt uiHandle,const simInt* position);simInt simGetUIPosition(simInt uiHandle,simInt* position);simInt simLoadUI(const simChar* filename,simInt maxCount,simInt* uiHandles);simInt simSaveUI(simInt count,const simInt* uiHandles,const simChar* filename);simInt simHandleGeneralCallbackScript(simInt callbackId,simInt callbackTag,simVoid* additionalData);simInt simRegisterCustomLuaFunction(const simChar* funcName,const simChar* callTips,const simInt* inputArgumentTypes,simVoid(*callBack)(struct SLuaCallBack* p));simInt simRegisterCustomLuaVariable(const simChar* varName,const simChar* varValue);simInt simRegisterContactCallback(simInt(*callBack)(simInt,simInt,simInt,simInt*,simFloat*));simInt simRegisterJointCtrlCallback(simInt(*callBack)(simInt,simInt,simInt,const simInt*,const simFloat*,simFloat*));simInt simGetMechanismHandle(const simChar* mechanismName);simInt simHandleMechanism(simInt mechanismHandle);simInt simHandleCustomizationScripts(simInt callType);simInt simSetVisionSensorFilter(simInt visionSensorHandle,simInt filterIndex,simInt options,const simInt* pSizes,const simUChar* bytes,const simInt* ints,const simFloat* floats,const simUChar* custom);simInt simGetVisionSensorFilter(simInt visionSensorHandle,simInt filterIndex,simInt* options,simInt* pSizes,simUChar** bytes,simInt** ints,simFloat** floats,simUChar** custom);simChar* simGetScriptSimulationParameter(simInt scriptHandle,const simChar* parameterName,simInt* parameterLength);simInt simSetScriptSimulationParameter(simInt scriptHandle,const simChar* parameterName,const simChar* parameterValue,simInt parameterLength);simInt simSetJointForce(simInt objectHandle,simFloat forceOrTorque);simInt simHandleMill(simInt millHandle,simFloat* removedSurfaceAndVolume);simInt simResetMill(simInt millHandle);simInt simResetMilling(simInt objectHandle);simInt simApplyMilling(simInt objectHandle);simBool _simGetParentFollowsDynamic(const simVoid* shape);simInt simGetNameSuffix(const simChar* name);simInt simSetNameSuffix(simInt nameSuffixNumber);simInt simAddStatusbarMessage(const simChar* message);simChar* simGetScriptRawBuffer(simInt scriptHandle,simInt bufferHandle);simInt simSetScriptRawBuffer(simInt scriptHandle,const simChar* buffer,simInt bufferSize);simInt simReleaseScriptRawBuffer(simInt scriptHandle,simInt bufferHandle);
""")
cwd = os.getcwd()cffi_path = os.path.join(cwd, 'cffi_build')
ffibuilder.set_source( "pyrep.backend._sim_cffi", """ #include "sim.h" // the C header of the library """, libraries=['coppeliaSim'], library_dirs=[os.environ['COPPELIASIM_ROOT']], include_dirs=[cffi_path])
# For some reason, cffi makes it such that it looks for libv_rep.so.1# rather than libv_rep.so. So we add a symlink.path = os.path.join(os.environ['COPPELIASIM_ROOT'], 'libcoppeliaSim.so')if not os.path.exists(path + '.1'): print('creating symlink: %s -> %s' % (path + '.1', path)) os.symlink(path, path + '.1')
# Copy lua functions to the VREP_ROOTprint('copying lua file: %s -> %s' % ('pyrep/backend', os.environ['COPPELIASIM_ROOT']))lua_script_fname = 'simAddOnScript_PyRep.lua'copyfile(os.path.join('pyrep/backend', lua_script_fname), os.path.join(os.environ['COPPELIASIM_ROOT'], lua_script_fname))
if __name__ == "__main__": ffibuilder.compile(verbose=True)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
// ==============// simTypes.h// ==============
// Various types used in the interface functions:typedef unsigned char simBool;typedef char simChar;typedef int simInt;typedef float simFloat;typedef double simDouble;typedef void simVoid;typedef unsigned char simUChar;typedef unsigned int simUInt;typedef unsigned long long int simUInt64;
struct SScriptCallBack{ simInt objectID; simInt scriptID; simInt stackID; simChar waitUntilZero; simChar* raiseErrorWithMessage;};
struct SShapeVizInfo{ simFloat* vertices; simInt verticesSize; simInt* indices; simInt indicesSize; simFloat shadingAngle; simFloat* normals; simFloat colors[9]; simChar* texture; /*rgba*/ simInt textureId; simInt textureRes[2]; simFloat* textureCoords; simInt textureApplyMode; simInt textureOptions; /* not just textures options */};
struct SLuaCallBack{ simInt objectID; simBool* inputBool; simInt* inputInt; simFloat* inputFloat; simChar* inputChar; simInt inputArgCount; simInt* inputArgTypeAndSize; simBool* outputBool; simInt* outputInt; simFloat* outputFloat; simChar* outputChar; simInt outputArgCount; simInt* outputArgTypeAndSize; simChar waitUntilZero; simChar* inputCharBuff; simChar* outputCharBuff; simInt scriptID; simDouble* inputDouble; simDouble* outputDouble;};
struct SSyncMsg{ unsigned char msg; void* data; size_t dataSize;};
struct SSyncRt{ unsigned char objTypes[3]; int objHandles[3];};
typedef int (*contactCallback)(int,int,int,int*,float*);typedef int (*jointCtrlCallback)(int,int,int,const int*,const float*,float*);
// ==============// sim.h// ==============
simInt simRunSimulator(const simChar* applicationName,simInt options,simVoid(*initCallBack)(),simVoid(*loopCallBack)(),simVoid(*deinitCallBack)());simInt simRunSimulatorEx(const simChar* applicationName,simInt options,simVoid(*initCallBack)(),simVoid(*loopCallBack)(),simVoid(*deinitCallBack)(),simInt stopDelay,const simChar* sceneOrModelToLoad);simVoid* simGetMainWindow(simInt type);simChar* simGetLastError();simInt simSetBooleanParameter(simInt parameter,simBool boolState);simInt simGetBooleanParameter(simInt parameter);simInt simSetBoolParameter(simInt parameter,simBool boolState);simInt simGetBoolParameter(simInt parameter);simInt simSetIntegerParameter(simInt parameter,simInt intState);simInt simGetIntegerParameter(simInt parameter,simInt* intState);simInt simSetInt32Parameter(simInt parameter,simInt intState);simInt simGetInt32Parameter(simInt parameter,simInt* intState);simInt simGetUInt64Parameter(simInt parameter,simUInt64* intState);simInt simSetFloatingParameter(simInt parameter,simFloat floatState);simInt simGetFloatingParameter(simInt parameter,simFloat* floatState);simInt simSetFloatParameter(simInt parameter,simFloat floatState);simInt simGetFloatParameter(simInt parameter,simFloat* floatState);simInt simSetStringParameter(simInt parameter,const simChar* str);simChar* simGetStringParameter(simInt parameter);simInt simGetObjectHandle(const simChar* objectName);simInt simRemoveObject(simInt objectHandle);simInt simRemoveModel(simInt objectHandle);simChar* simGetObjectName(simInt objectHandle);simInt simGetObjects(simInt index,simInt objectType);simInt simSetObjectName(simInt objectHandle,const simChar* objectName);simInt simGetCollectionHandle(const simChar* collectionName);simInt simRemoveCollection(simInt collectionHandle);simInt simEmptyCollection(simInt collectionHandle);simChar* simGetCollectionName(simInt collectionHandle);simInt simSetCollectionName(simInt collectionHandle,const simChar* collectionName);simInt simGetObjectMatrix(simInt objectHandle,simInt relativeToObjectHandle,simFloat* matrix);simInt simSetObjectMatrix(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* matrix);simInt simGetObjectPosition(simInt objectHandle,simInt relativeToObjectHandle,simFloat* position);simInt simSetObjectPosition(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* position);simInt simGetObjectOrientation(simInt objectHandle,simInt relativeToObjectHandle,simFloat* eulerAngles);simInt simGetObjectQuaternion(simInt objectHandle,simInt relativeToObjectHandle,simFloat* quaternion);simInt simSetObjectQuaternion(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* quaternion);simInt simSetObjectOrientation(simInt objectHandle,simInt relativeToObjectHandle,const simFloat* eulerAngles);simInt simGetJointPosition(simInt objectHandle,simFloat* position);simInt simSetJointPosition(simInt objectHandle,simFloat position);simInt simSetJointTargetPosition(simInt objectHandle,simFloat targetPosition);simInt simGetJointTargetPosition(simInt objectHandle,simFloat* targetPosition);simInt simSetJointMaxForce(simInt objectHandle,simFloat forceOrTorque);simInt simGetPathPosition(simInt objectHandle,simFloat* position);simInt simSetPathPosition(simInt objectHandle,simFloat position);simInt simGetPathLength(simInt objectHandle,simFloat* length);simInt simGetJointMatrix(simInt objectHandle,simFloat* matrix);simInt simSetSphericalJointMatrix(simInt objectHandle,const simFloat* matrix);simInt simGetJointInterval(simInt objectHandle,simBool* cyclic,simFloat* interval);simInt simSetJointInterval(simInt objectHandle,simBool cyclic,const simFloat* interval);simInt simGetObjectParent(simInt objectHandle);simInt simGetObjectChild(simInt objectHandle,simInt index);simInt simSetObjectParent(simInt objectHandle,simInt parentObjectHandle,simBool keepInPlace);simInt simGetObjectType(simInt objectHandle);simInt simGetJointType(simInt objectHandle);simInt simBuildIdentityMatrix(simFloat* matrix);simInt simCopyMatrix(const simFloat* matrixIn,simFloat* matrixOut);simInt simBuildMatrix(const simFloat* position,const simFloat* eulerAngles,simFloat* matrix);simInt simBuildMatrixQ(const simFloat* position,const simFloat* quaternion,simFloat* matrix);simInt simGetEulerAnglesFromMatrix(const simFloat* matrix,simFloat* eulerAngles);simInt simGetQuaternionFromMatrix(const simFloat* matrix,simFloat* quaternion);simInt simInvertMatrix(simFloat* matrix);simInt simMultiplyMatrices(const simFloat* matrixIn1,const simFloat* matrixIn2,simFloat* matrixOut);simInt simInterpolateMatrices(const simFloat* matrixIn1,const simFloat* matrixIn2,simFloat interpolFactor,simFloat* matrixOut);simInt simTransformVector(const simFloat* matrix,simFloat* vect);simInt simReservedCommand(simInt v,simInt w);simFloat simGetSimulationTime();simInt simGetSimulationState();simFloat simGetSystemTime();simInt simGetSystemTimeInMilliseconds(); // deprecatedsimUInt simGetSystemTimeInMs(simInt previousTime);simInt simLoadScene(const simChar* filename);simInt simCloseScene();simInt simSaveScene(const simChar* filename);simInt simLoadModel(const simChar* filename);simInt simSaveModel(simInt baseOfModelHandle,const simChar* filename);simChar* simGetSimulatorMessage(simInt* messageID,simInt* auxiliaryData,simInt* returnedDataSize);simInt simAddModuleMenuEntry(const simChar* entryLabel,simInt itemCount,simInt* itemHandles);simInt simSetModuleMenuItemState(simInt itemHandle,simInt state,const simChar* label);simInt simDoesFileExist(const simChar* filename);simInt simIsObjectInSelection(simInt objectHandle);simInt simAddObjectToSelection(simInt what,simInt objectHandle);simInt simRemoveObjectFromSelection(simInt what,simInt objectHandle);simInt simGetObjectSelectionSize();simInt simGetObjectLastSelection();simInt simGetObjectSelection(simInt* objectHandles);simInt simHandleCollision(simInt collisionObjectHandle);simInt simReadCollision(simInt collisionObjectHandle);simInt simHandleDistance(simInt distanceObjectHandle,simFloat* smallestDistance);simInt simReadDistance(simInt distanceObjectHandle,simFloat* smallestDistance);simInt simHandleProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);simInt simReadProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);simInt simHandleIkGroup(simInt ikGroupHandle);simInt simCheckIkGroup(simInt ikGroupHandle,simInt jointCnt,const simInt* jointHandles,simFloat* jointValues,const simInt* jointOptions);simInt simHandleDynamics(simFloat deltaTime);simInt simGetScriptHandle(const simChar* scriptName);simInt simSetScriptText(simInt scriptHandle,const simChar* scriptText);const simChar* simGetScriptText(simInt scriptHandle);simInt simGetScriptProperty(simInt scriptHandle,simInt* scriptProperty,simInt* associatedObjectHandle);simInt simAssociateScriptWithObject(simInt scriptHandle,simInt associatedObjectHandle);simInt simGetScript(simInt index);simInt simGetScriptAssociatedWithObject(simInt objectHandle);simInt simGetCustomizationScriptAssociatedWithObject(simInt objectHandle);simInt simGetObjectAssociatedWithScript(simInt scriptHandle);simChar* simGetScriptName(simInt scriptHandle);simInt simHandleMainScript();simInt simResetScript(simInt scriptHandle);simInt simAddScript(simInt scriptProperty);simInt simRemoveScript(simInt scriptHandle);simInt simRefreshDialogs(simInt refreshDegree);simInt simGetCollisionHandle(const simChar* collisionObjectName);simInt simGetDistanceHandle(const simChar* distanceObjectName);simInt simGetIkGroupHandle(const simChar* ikGroupName);simInt simResetCollision(simInt collisionObjectHandle);simInt simResetDistance(simInt distanceObjectHandle);simInt simResetProximitySensor(simInt sensorHandle);simInt simCheckProximitySensor(simInt sensorHandle,simInt entityHandle,simFloat* detectedPoint);simInt simCheckProximitySensorEx(simInt sensorHandle,simInt entityHandle,simInt detectionMode,simFloat detectionThreshold,simFloat maxAngle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* normalVector);simInt simCheckProximitySensorEx2(simInt sensorHandle,simFloat* vertexPointer,simInt itemType,simInt itemCount,simInt detectionMode,simFloat detectionThreshold,simFloat maxAngle,simFloat* detectedPoint,simFloat* normalVector);simChar* simCreateBuffer(simInt size);simInt simReleaseBuffer(const simChar* buffer);simInt simCheckCollision(simInt entity1Handle,simInt entity2Handle);simInt simCheckCollisionEx(simInt entity1Handle,simInt entity2Handle,simFloat** intersectionSegments);simInt simCheckDistance(simInt entity1Handle,simInt entity2Handle,simFloat threshold,simFloat* distanceData);simChar* simGetObjectConfiguration(simInt objectHandle);simInt simSetObjectConfiguration(const simChar* data);simChar* simGetConfigurationTree(simInt objectHandle);simInt simSetConfigurationTree(const simChar* data);simInt simSetSimulationTimeStep(simFloat timeStep);simFloat simGetSimulationTimeStep();simInt simGetRealTimeSimulation();simInt simIsRealTimeSimulationStepNeeded();simInt simAdjustRealTimeTimer(simInt instanceIndex,simFloat deltaTime);simInt simGetSimulationPassesPerRenderingPass();simInt simAdvanceSimulationByOneStep();simInt simStartSimulation();simInt simStopSimulation();simInt simPauseSimulation();simInt simLoadModule(const simChar* filenameAndPath,const simChar* pluginName);simInt simUnloadModule(simInt pluginhandle);simVoid* simSendModuleMessage(simInt message,simInt* auxiliaryData,simVoid* customData,simInt* replyData);simVoid* simBroadcastMessage(simInt* auxiliaryData,simVoid* customData,simInt* replyData);simChar* simGetModuleName(simInt index,simUChar* moduleVersion);simInt simFloatingViewAdd(simFloat posX,simFloat posY,simFloat sizeX,simFloat sizeY,simInt options);simInt simFloatingViewRemove(simInt floatingViewHandle);simInt simAdjustView(simInt viewHandleOrIndex,simInt associatedViewableObjectHandle,simInt options,const simChar* viewLabel);simInt simSetLastError(const simChar* funcName,const simChar* errorMessage);simInt simHandleGraph(simInt graphHandle,simFloat simulationTime);simInt simResetGraph(simInt graphHandle);simInt simSetNavigationMode(simInt navigationMode);simInt simGetNavigationMode();simInt simSetPage(simInt index);simInt simGetPage();simInt simDisplayDialog(const simChar* titleText,const simChar* mainText,simInt dialogType,const simChar* initialText,const simFloat* titleColors,const simFloat* dialogColors,simInt* elementHandle);simInt simGetDialogResult(simInt genericDialogHandle);simChar* simGetDialogInput(simInt genericDialogHandle);simInt simEndDialog(simInt genericDialogHandle);simInt simRegisterScriptCallbackFunction(const simChar* funcNameAtPluginName,const simChar* callTips,simVoid(*callBack)(struct SScriptCallBack* cb));simInt simRegisterScriptVariable(const simChar* varNameAtPluginName,const simChar* varValue,simInt stackHandle);simInt simSetJointTargetVelocity(simInt objectHandle,simFloat targetVelocity);simInt simGetJointTargetVelocity(simInt objectHandle,simFloat* targetVelocity);simInt simSetPathTargetNominalVelocity(simInt objectHandle,simFloat targetNominalVelocity);simInt simCopyPasteObjects(simInt* objectHandles,simInt objectCount,simInt options);simInt simScaleSelectedObjects(simFloat scalingFactor,simBool scalePositionsToo);simInt simScaleObjects(const simInt* objectHandles,simInt objectCount,simFloat scalingFactor,simBool scalePositionsToo);simInt simDeleteSelectedObjects();simInt simGetObjectUniqueIdentifier(simInt objectHandle,simInt* uniqueIdentifier);simInt simSendData(simInt targetID,simInt dataHeader,const simChar* dataName,const simChar* data,simInt dataLength,simInt antennaHandle,simFloat actionRadius,simFloat emissionAngle1,simFloat emissionAngle2,simFloat persistence);simChar* simReceiveData(simInt dataHeader,const simChar* dataName,simInt antennaHandle,simInt index,simInt* dataLength,simInt* senderID,simInt* dataHeaderR,simChar** dataNameR);simInt simSetGraphUserData(simInt graphHandle,const simChar* dataStreamName,simFloat data);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);simInt simRemoveDrawingObject(simInt objectHandle);simInt simAddDrawingObjectItem(simInt objectHandle,const simFloat* itemData);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);simInt simRemoveParticleObject(simInt objectHandle);simInt simAddParticleObjectItem(simInt objectHandle,const simFloat* itemData);simFloat simGetObjectSizeFactor(simInt objectHandle);simInt simAnnounceSceneContentChange();simInt simSetIntegerSignal(const simChar* signalName,simInt signalValue);simInt simGetIntegerSignal(const simChar* signalName,simInt* signalValue);simInt simClearIntegerSignal(const simChar* signalName);simInt simSetFloatSignal(const simChar* signalName,simFloat signalValue);simInt simGetFloatSignal(const simChar* signalName,simFloat* signalValue);simInt simClearFloatSignal(const simChar* signalName);simInt simSetDoubleSignal(const simChar* signalName,simDouble signalValue);simInt simGetDoubleSignal(const simChar* signalName,simDouble* signalValue);simInt simClearDoubleSignal(const simChar* signalName);simInt simSetStringSignal(const simChar* signalName,const simChar* signalValue,simInt stringLength);simChar* simGetStringSignal(const simChar* signalName,simInt* stringLength);simInt simClearStringSignal(const simChar* signalName);simChar* simGetSignalName(simInt signalIndex,simInt signalType);simInt simSetObjectProperty(simInt objectHandle,simInt prop);simInt simGetObjectProperty(simInt objectHandle);simInt simSetObjectSpecialProperty(simInt objectHandle,simInt prop);simInt simGetObjectSpecialProperty(simInt objectHandle);simInt simGetPositionOnPath(simInt pathHandle,simFloat relativeDistance,simFloat* position);simInt simGetDataOnPath(simInt pathHandle,simFloat relativeDistance,simInt dataType,simInt* intData,simFloat* floatData);simInt simGetOrientationOnPath(simInt pathHandle,simFloat relativeDistance,simFloat* eulerAngles);simInt simGetClosestPositionOnPath(simInt pathHandle,simFloat* absolutePosition,simFloat* pathPosition);simInt simReadForceSensor(simInt objectHandle,simFloat* forceVector,simFloat* torqueVector);simInt simBreakForceSensor(simInt objectHandle);simInt simGetShapeVertex(simInt shapeHandle,simInt groupElementIndex,simInt vertexIndex,simFloat* relativePosition);simInt simGetShapeTriangle(simInt shapeHandle,simInt groupElementIndex,simInt triangleIndex,simInt* vertexIndices,simFloat* triangleNormals);simInt simSetLightParameters(simInt objectHandle,simInt state,const simFloat* setToNULL,const simFloat* diffusePart,const simFloat* specularPart);simInt simGetLightParameters(simInt objectHandle,simFloat* setToNULL,simFloat* diffusePart,simFloat* specularPart);simInt simGetVelocity(simInt shapeHandle,simFloat* linearVelocity,simFloat* angularVelocity);simInt simGetObjectVelocity(simInt objectHandle,simFloat* linearVelocity,simFloat* angularVelocity);simInt simAddForceAndTorque(simInt shapeHandle,const simFloat* force,const simFloat* torque);simInt simAddForce(simInt shapeHandle,const simFloat* position,const simFloat* force);simInt simSetExplicitHandling(simInt generalObjectHandle,int explicitFlags);simInt simGetExplicitHandling(simInt generalObjectHandle);simInt simGetLinkDummy(simInt dummyHandle);simInt simSetLinkDummy(simInt dummyHandle,simInt linkedDummyHandle);simInt simSetModelProperty(simInt objectHandle,simInt modelProperty);simInt simGetModelProperty(simInt objectHandle);simInt simSetShapeColor(simInt shapeHandle,const simChar* colorName,simInt colorComponent,const simFloat* rgbData);simInt simGetShapeColor(simInt shapeHandle,const simChar* colorName,simInt colorComponent,simFloat* rgbData);simInt simResetDynamicObject(simInt objectHandle);simInt simSetJointMode(simInt jointHandle,simInt jointMode,simInt options);simInt simGetJointMode(simInt jointHandle,simInt* options);simInt simSerialOpen(const simChar* portString,simInt baudRate,simVoid* reserved1,simVoid* reserved2);simInt simSerialClose(simInt portHandle);simInt simSerialSend(simInt portHandle,const simChar* data,simInt dataLength);simInt simSerialRead(simInt portHandle,simChar* buffer,simInt dataLengthToRead);simInt simSerialCheck(simInt portHandle);simInt simGetContactInfo(simInt dynamicPass,simInt objectHandle,simInt index,simInt* objectHandles,simFloat* contactInfo);simInt simSetThreadIsFree(simBool freeMode);simInt simTubeOpen(simInt dataHeader,const simChar* dataName,simInt readBufferSize,simBool notUsedButKeepZero);simInt simTubeClose(simInt tubeHandle);simInt simTubeWrite(simInt tubeHandle,const simChar* data,simInt dataLength);simChar* simTubeRead(simInt tubeHandle,simInt* dataLength);simInt simTubeStatus(simInt tubeHandle,simInt* readPacketsCount,simInt* writePacketsCount);simInt simAuxiliaryConsoleOpen(const simChar* title,simInt maxLines,simInt mode,const simInt* position,const simInt* size,const simFloat* textColor,const simFloat* backgroundColor);simInt simAuxiliaryConsoleClose(simInt consoleHandle);simInt simAuxiliaryConsoleShow(simInt consoleHandle,simBool showState);simInt simAuxiliaryConsolePrint(simInt consoleHandle,const simChar* text);simInt simImportShape(simInt fileformat,const simChar* pathAndFilename,simInt options,simFloat identicalVerticeTolerance,simFloat scalingFactor);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);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);simInt simCreateMeshShape(simInt options,simFloat shadingAngle,const simFloat* vertices,simInt verticesSize,const simInt* indices,simInt indicesSize,simFloat* reserved);simInt simCreatePureShape(simInt primitiveType,simInt options,const simFloat* sizes,simFloat mass,const simInt* precision);simInt simCreateHeightfieldShape(simInt options,simFloat shadingAngle,simInt xPointCount,simInt yPointCount,simFloat xSize,const simFloat* heights);simInt simGetShapeMesh(simInt shapeHandle,simFloat** vertices,simInt* verticesSize,simInt** indices,simInt* indicesSize,simFloat** normals);simInt simAddBanner(const simChar* label,simFloat size,simInt options,const simFloat* positionAndEulerAngles,simInt parentObjectHandle,const simFloat* labelColors,const simFloat* backgroundColors);simInt simRemoveBanner(simInt bannerID);simInt simCreateJoint(simInt jointType,simInt jointMode,simInt options,const simFloat* sizes,const simFloat* colorA,const simFloat* colorB);simInt simGetObjectIntParameter(simInt objectHandle,simInt parameterID,simInt* parameter);simInt simSetObjectIntParameter(simInt objectHandle,simInt parameterID,simInt parameter);simInt simGetObjectInt32Parameter(simInt objectHandle,simInt parameterID,simInt* parameter);simInt simSetObjectInt32Parameter(simInt objectHandle,simInt parameterID,simInt parameter);simInt simGetObjectFloatParameter(simInt objectHandle,simInt parameterID,simFloat* parameter);simInt simSetObjectFloatParameter(simInt objectHandle,simInt parameterID,simFloat parameter);simChar* simGetObjectStringParameter(simInt objectHandle,simInt parameterID,simInt* parameterLength);simInt simSetObjectStringParameter(simInt objectHandle,simInt parameterID,simChar* parameter,simInt parameterLength);simInt simSetSimulationPassesPerRenderingPass(simInt p);simInt simGetRotationAxis(const simFloat* matrixStart,const simFloat* matrixGoal,simFloat* axis,simFloat* angle);simInt simRotateAroundAxis(const simFloat* matrixIn,const simFloat* axis,const simFloat* axisPos,simFloat angle,simFloat* matrixOut);simInt simGetJointForce(simInt jointHandle,simFloat* forceOrTorque);simInt simGetJointMaxForce(simInt jointHandle,simFloat* forceOrTorque);simInt simSetArrayParameter(simInt parameter,const simVoid* arrayOfValues);simInt simGetArrayParameter(simInt parameter,simVoid* arrayOfValues);simInt simSetIkGroupProperties(simInt ikGroupHandle,simInt resolutionMethod,simInt maxIterations,simFloat damping,void* reserved);simInt simSetIkElementProperties(simInt ikGroupHandle,simInt tipDummyHandle,simInt constraints,const simFloat* precision,const simFloat* weight,void* reserved);simInt simCameraFitToView(simInt viewHandleOrIndex,simInt objectCount,const simInt* objectHandles,simInt options,simFloat scaling);simInt simPersistentDataWrite(const simChar* dataName,const simChar* dataValue,simInt dataLength,simInt options);simChar* simPersistentDataRead(const simChar* dataName,simInt* dataLength);simInt simIsHandleValid(simInt generalObjectHandle,simInt generalObjectType);simInt simHandleVisionSensor(simInt visionSensorHandle,simFloat** auxValues,simInt** auxValuesCount);simInt simReadVisionSensor(simInt visionSensorHandle,simFloat** auxValues,simInt** auxValuesCount);simInt simResetVisionSensor(simInt visionSensorHandle);simInt simCheckVisionSensor(simInt visionSensorHandle,simInt entityHandle,simFloat** auxValues,simInt** auxValuesCount);simFloat* simCheckVisionSensorEx(simInt visionSensorHandle,simInt entityHandle,simBool returnImage);simInt simGetVisionSensorResolution(simInt visionSensorHandle,simInt* resolution);simFloat* simGetVisionSensorImage(simInt visionSensorHandle);simUChar* simGetVisionSensorCharImage(simInt visionSensorHandle,simInt* resolutionX,simInt* resolutionY);simFloat* simGetVisionSensorDepthBuffer(simInt visionSensorHandle);simInt simSetVisionSensorImage(simInt visionSensorHandle,const simFloat* image);simInt simSetVisionSensorCharImage(simInt visionSensorHandle,const simUChar* image);simInt simRMLPosition(simInt dofs,simDouble timeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxVelAccelJerk,const simBool* selection,const simDouble* targetPosVel,simDouble* newPosVelAccel,simVoid* auxData);simInt simRMLVelocity(simInt dofs,simDouble timeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxAccelJerk,const simBool* selection,const simDouble* targetVel,simDouble* newPosVelAccel,simVoid* auxData);simInt simRMLPos(simInt dofs,simDouble smallestTimeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxVelAccelJerk,const simBool* selection,const simDouble* targetPosVel,simVoid* auxData);simInt simRMLVel(simInt dofs,simDouble smallestTimeStep,simInt flags,const simDouble* currentPosVelAccel,const simDouble* maxAccelJerk,const simBool* selection,const simDouble* targetVel,simVoid* auxData);simInt simRMLStep(simInt handle,simDouble timeStep,simDouble* newPosVelAccel,simVoid* auxData,simVoid* reserved);simInt simRMLRemove(simInt handle);simChar* simFileDialog(simInt mode,const simChar* title,const simChar* startPath,const simChar* initName,const simChar* extName,const simChar* ext);simInt simMsgBox(simInt dlgType,simInt buttons,const simChar* title,const simChar* message);simInt simCreateDummy(simFloat size,const simFloat* color);simInt simSetShapeMassAndInertia(simInt shapeHandle,simFloat mass,const simFloat* inertiaMatrix,const simFloat* centerOfMass,const simFloat* transformation);simInt simGetShapeMassAndInertia(simInt shapeHandle,simFloat* mass,simFloat* inertiaMatrix,simFloat* centerOfMass,const simFloat* transformation);simInt simGroupShapes(const simInt* shapeHandles,simInt shapeCount);simInt* simUngroupShape(simInt shapeHandle,simInt* shapeCount);simInt simCreateProximitySensor(simInt sensorType,simInt subType,simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);simInt simCreateForceSensor(simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);simInt simCreateVisionSensor(simInt options,const simInt* intParams,const simFloat* floatParams,const simFloat* color);simInt simConvexDecompose(simInt shapeHandle,simInt options,const simInt* intParams,const simFloat* floatParams);simInt simCreatePath(simInt attributes,const simInt* intParams,const simFloat* floatParams,const simFloat* color);simInt simInsertPathCtrlPoints(simInt pathHandle,simInt options,simInt startIndex,simInt ptCnt,const simVoid* ptData);simInt simCutPathCtrlPoints(simInt pathHandle,simInt startIndex,simInt ptCnt);simFloat* simGetIkGroupMatrix(simInt ikGroupHandle,simInt options,simInt* matrixSize);simInt simAddGhost(simInt ghostGroup,simInt objectHandle,simInt options,simFloat startTime,simFloat endTime,const simFloat* color);simInt simModifyGhost(simInt ghostGroup,simInt ghostId,simInt operation,simFloat floatValue,simInt options,simInt optionsMask,const simFloat* colorOrTransformation);simVoid simQuitSimulator(simBool ignoredArgument);simInt simGetThreadId();simInt simLockResources(simInt lockType,simInt reserved);simInt simUnlockResources(simInt lockHandle);simInt simEnableEventCallback(simInt eventCallbackType,const simChar* plugin,simInt reserved);simInt simSetShapeMaterial(simInt shapeHandle,simInt materialIdOrShapeHandle);simInt simGetTextureId(const simChar* textureName,simInt* resolution);simChar* simReadTexture(simInt textureId,simInt options,simInt posX,simInt posY,simInt sizeX,simInt sizeY);simInt simWriteTexture(simInt textureId,simInt options,const simChar* data,simInt posX,simInt posY,simInt sizeX,simInt sizeY,simFloat interpol);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);simInt simWriteCustomDataBlock(simInt objectHandle,const simChar* tagName,const simChar* data,simInt dataSize);simChar* simReadCustomDataBlock(simInt objectHandle,const simChar* tagName,simInt* dataSize);simChar* simReadCustomDataBlockTags(simInt objectHandle,simInt* tagCount);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);simInt simModifyPointCloud(simInt pointCloudHandle,simInt operation,const simInt* intParam,const simFloat* floatParam);simInt simGetShapeGeomInfo(simInt shapeHandle,simInt* intData,simFloat* floatData,simVoid* reserved);simInt* simGetObjectsInTree(simInt treeBaseHandle,simInt objectType,simInt options,simInt* objectCount);simInt simSetObjectSizeValues(simInt objectHandle,const simFloat* sizeValues);simInt simGetObjectSizeValues(simInt objectHandle,simFloat* sizeValues);simInt simScaleObject(simInt objectHandle,simFloat xScale,simFloat yScale,simFloat zScale,simInt options);simInt simSetShapeTexture(simInt shapeHandle,simInt textureId,simInt mappingMode,simInt options,const simFloat* uvScaling,const simFloat* position,const simFloat* orientation);simInt simGetShapeTextureId(simInt shapeHandle);simInt* simGetCollectionObjects(simInt collectionHandle,simInt* objectCount);simInt simSetScriptAttribute(simInt scriptHandle,simInt attributeID,simFloat floatVal,simInt intOrBoolVal);simInt simGetScriptAttribute(simInt scriptHandle,simInt attributeID,simFloat* floatVal,simInt* intOrBoolVal);simInt simReorientShapeBoundingBox(simInt shapeHandle,simInt relativeToHandle,simInt reservedSetToZero);simInt simSwitchThread();simInt simCreateIkGroup(simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);simInt simRemoveIkGroup(simInt ikGroupHandle);simInt simCreateIkElement(simInt ikGroupHandle,simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);simInt simCreateCollection(const simChar* collectionName,simInt options);simInt simAddObjectToCollection(simInt collectionHandle,simInt objectHandle,simInt what,simInt options);simInt simSaveImage(const simUChar* image,const simInt* resolution,simInt options,const simChar* filename,simInt quality,simVoid* reserved);simUChar* simLoadImage(simInt* resolution,simInt options,const simChar* filename,simVoid* reserved);simUChar* simGetScaledImage(const simUChar* imageIn,const simInt* resolutionIn,simInt* resolutionOut,simInt options,simVoid* reserved);simInt simTransformImage(simUChar* image,const simInt* resolution,simInt options,const simFloat* floatParams,const simInt* intParams,simVoid* reserved);simInt simGetQHull(const simFloat* inVertices,simInt inVerticesL,simFloat** verticesOut,simInt* verticesOutL,simInt** indicesOut,simInt* indicesOutL,simInt reserved1,const simFloat* reserved2);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);simInt simExportIk(const simChar* pathAndFilename,simInt reserved1,simVoid* reserved2);simInt simCallScriptFunctionEx(simInt scriptHandleOrType,const simChar* functionNameAtScriptName,simInt stackId);simInt simComputeJacobian(simInt ikGroupHandle,simInt options,simVoid* reserved);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);simFloat* simGenerateIkPath(simInt ikGroupHandle,simInt jointCnt,const simInt* jointHandles,simInt ptCnt,simInt collisionPairCnt,const simInt* collisionPairs,const simInt* jointOptions,simVoid* reserved);simChar* simGetExtensionString(simInt objectHandle,simInt index,const char* key);simInt simComputeMassAndInertia(simInt shapeHandle,simFloat density);simInt simCreateStack();simInt simReleaseStack(simInt stackHandle);simInt simCopyStack(simInt stackHandle);simInt simPushNullOntoStack(simInt stackHandle);simInt simPushBoolOntoStack(simInt stackHandle,simBool value);simInt simPushInt32OntoStack(simInt stackHandle,simInt value);simInt simPushFloatOntoStack(simInt stackHandle,simFloat value);simInt simPushDoubleOntoStack(simInt stackHandle,simDouble value);simInt simPushStringOntoStack(simInt stackHandle,const simChar* value,simInt stringSize);simInt simPushUInt8TableOntoStack(simInt stackHandle,const simUChar* values,simInt valueCnt);simInt simPushInt32TableOntoStack(simInt stackHandle,const simInt* values,simInt valueCnt);simInt simPushFloatTableOntoStack(simInt stackHandle,const simFloat* values,simInt valueCnt);simInt simPushDoubleTableOntoStack(simInt stackHandle,const simDouble* values,simInt valueCnt);simInt simPushTableOntoStack(simInt stackHandle);simInt simInsertDataIntoStackTable(simInt stackHandle);simInt simGetStackSize(simInt stackHandle);simInt simPopStackItem(simInt stackHandle,simInt count);simInt simMoveStackItemToTop(simInt stackHandle,simInt cIndex);simInt simIsStackValueNull(simInt stackHandle);simInt simGetStackBoolValue(simInt stackHandle,simBool* boolValue);simInt simGetStackInt32Value(simInt stackHandle,simInt* numberValue);simInt simGetStackFloatValue(simInt stackHandle,simFloat* numberValue);simInt simGetStackDoubleValue(simInt stackHandle,simDouble* numberValue);simChar* simGetStackStringValue(simInt stackHandle,simInt* stringSize);simInt simGetStackTableInfo(simInt stackHandle,simInt infoType);simInt simGetStackUInt8Table(simInt stackHandle,simUChar* array,simInt count);simInt simGetStackInt32Table(simInt stackHandle,simInt* array,simInt count);simInt simGetStackFloatTable(simInt stackHandle,simFloat* array,simInt count);simInt simGetStackDoubleTable(simInt stackHandle,simDouble* array,simInt count);simInt simUnfoldStackTable(simInt stackHandle);simInt simDebugStack(simInt stackHandle,simInt cIndex);simInt simSetScriptVariable(simInt scriptHandleOrType,const simChar* variableNameAtScriptName,simInt stackHandle);simFloat simGetEngineFloatParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);simInt simGetEngineInt32Parameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);simBool simGetEngineBoolParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool* ok);simInt simSetEngineFloatParameter(simInt paramId,simInt objectHandle,const simVoid* object,simFloat val);simInt simSetEngineInt32Parameter(simInt paramId,simInt objectHandle,const simVoid* object,simInt val);simInt simSetEngineBoolParameter(simInt paramId,simInt objectHandle,const simVoid* object,simBool val);simInt simCreateOctree(simFloat voxelSize,simInt options,simFloat pointSize,simVoid* reserved);simInt simCreatePointCloud(simFloat maxVoxelSize,simInt maxPtCntPerVoxel,simInt options,simFloat pointSize,simVoid* reserved);simInt simSetPointCloudOptions(simInt pointCloudHandle,simFloat maxVoxelSize,simInt maxPtCntPerVoxel,simInt options,simFloat pointSize,simVoid* reserved);simInt simGetPointCloudOptions(simInt pointCloudHandle,simFloat* maxVoxelSize,simInt* maxPtCntPerVoxel,simInt* options,simFloat* pointSize,simVoid* reserved);simInt simInsertVoxelsIntoOctree(simInt octreeHandle,simInt options,const simFloat* pts,simInt ptCnt,const simUChar* color,const simUInt* tag,simVoid* reserved);simInt simRemoveVoxelsFromOctree(simInt octreeHandle,simInt options,const simFloat* pts,simInt ptCnt,simVoid* reserved);simInt simInsertPointsIntoPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,const simUChar* color,simVoid* optionalValues);simInt simRemovePointsFromPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,simFloat tolerance,simVoid* reserved);simInt simIntersectPointsWithPointCloud(simInt pointCloudHandle,simInt options,const simFloat* pts,simInt ptCnt,simFloat tolerance,simVoid* reserved);const float* simGetOctreeVoxels(simInt octreeHandle,simInt* ptCnt,simVoid* reserved);const float* simGetPointCloudPoints(simInt pointCloudHandle,simInt* ptCnt,simVoid* reserved);simInt simInsertObjectIntoOctree(simInt octreeHandle,simInt objectHandle,simInt options,const simUChar* color,simUInt tag,simVoid* reserved);simInt simSubtractObjectFromOctree(simInt octreeHandle,simInt objectHandle,simInt options,simVoid* reserved);simInt simInsertObjectIntoPointCloud(simInt pointCloudHandle,simInt objectHandle,simInt options,simFloat gridSize,const simUChar* color,simVoid* optionalValues);simInt simSubtractObjectFromPointCloud(simInt pointCloudHandle,simInt objectHandle,simInt options,simFloat tolerance,simVoid* reserved);simInt simCheckOctreePointOccupancy(simInt octreeHandle,simInt options,const simFloat* points,simInt ptCnt,simUInt* tag,simUInt64* location,simVoid* reserved);simChar* simOpenTextEditor(const simChar* initText,const simChar* xml,simInt* various);simChar* simPackTable(simInt stackHandle,simInt* bufferSize);simInt simUnpackTable(simInt stackHandle,const simChar* buffer,simInt bufferSize);simInt simSetReferencedHandles(simInt objectHandle,simInt count,const simInt* referencedHandles,const simInt* reserved1,const simInt* reserved2);simInt simGetReferencedHandles(simInt objectHandle,simInt** referencedHandles,simInt** reserved1,simInt** reserved2);simInt simGetShapeViz(simInt shapeHandle,simInt index,struct SShapeVizInfo* info);simInt simExecuteScriptString(simInt scriptHandleOrType,const simChar* stringAtScriptName,simInt stackHandle);simChar* simGetApiFunc(simInt scriptHandleOrType,const simChar* apiWord);simChar* simGetApiInfo(simInt scriptHandleOrType,const simChar* apiWord);simInt simSetModuleInfo(const simChar* moduleName,simInt infoType,const simChar* stringInfo,simInt intInfo);simInt simGetModuleInfo(const simChar* moduleName,simInt infoType,simChar** stringInfo,simInt* intInfo);simInt simIsDeprecated(const simChar* funcOrConst);simChar* simGetPersistentDataTags(simInt* tagCount);simInt simEventNotification(const simChar* event);simInt simApplyTexture(simInt shapeHandle,const simFloat* textureCoordinates,simInt textCoordSize,const simUChar* texture,const simInt* textureResolution,simInt options);simInt simSetJointDependency(simInt jointHandle,simInt masterJointHandle,simFloat offset,simFloat coeff);simInt simSetStringNamedParam(const simChar* paramName,const simChar* stringParam,simInt paramLength);simChar* simGetStringNamedParam(const simChar* paramName,simInt* paramLength);simChar* simGetUserParameter(simInt objectHandle,const simChar* parameterName,simInt* parameterLength);simInt simSetUserParameter(simInt objectHandle,const simChar* parameterName,const simChar* parameterValue,simInt parameterLength);simInt simAddLog(const simChar* pluginName,simInt verbosityLevel,const simChar* logMsg);
simInt _simGetContactCallbackCount();const void* _simGetContactCallback(simInt index);simVoid _simSetDynamicSimulationIconCode(simVoid* object,simInt code);simVoid _simSetDynamicObjectFlagForVisualization(simVoid* object,simInt flag);simInt _simGetObjectListSize(simInt objType);const simVoid* _simGetObjectFromIndex(simInt objType,simInt index);simInt _simGetObjectID(const simVoid* object);simInt _simGetObjectType(const simVoid* object);const simVoid** _simGetObjectChildren(const simVoid* object,simInt* count);const simVoid* _simGetGeomProxyFromShape(const simVoid* shape);const simVoid* _simGetParentObject(const simVoid* object);const simVoid* _simGetObject(int objID);simVoid _simGetObjectLocalTransformation(const simVoid* object,simFloat* pos,simFloat* quat,simBool excludeFirstJointTransformation);simVoid _simSetObjectLocalTransformation(simVoid* object,const simFloat* pos,const simFloat* quat);simVoid _simSetObjectCumulativeTransformation(simVoid* object,const simFloat* pos,const simFloat* quat,simBool keepChildrenInPlace);simVoid _simGetObjectCumulativeTransformation(const simVoid* object,simFloat* pos,simFloat* quat,simBool excludeFirstJointTransformation);simBool _simIsShapeDynamicallyStatic(const simVoid* shape);simInt _simGetTreeDynamicProperty(const simVoid* object);simInt _simGetDummyLinkType(const simVoid* dummy,simInt* linkedDummyID);simInt _simGetJointMode(const simVoid* joint);simBool _simIsJointInHybridOperation(const simVoid* joint);simVoid _simDisableDynamicTreeForManipulation(const simVoid* object,simBool disableFlag);simBool _simIsShapeDynamicallyRespondable(const simVoid* shape);simInt _simGetDynamicCollisionMask(const simVoid* shape);const simVoid* _simGetLastParentForLocalGlobalCollidable(const simVoid* shape);simVoid _simSetShapeIsStaticAndNotRespondableButDynamicTag(const simVoid* shape,simBool tag);simBool _simGetShapeIsStaticAndNotRespondableButDynamicTag(const simVoid* shape);simVoid _simSetJointPosition(const simVoid* joint,simFloat pos);simFloat _simGetJointPosition(const simVoid* joint);simVoid _simSetDynamicMotorPositionControlTargetPosition(const simVoid* joint,simFloat pos);simVoid _simGetInitialDynamicVelocity(const simVoid* shape,simFloat* vel);simVoid _simSetInitialDynamicVelocity(simVoid* shape,const simFloat* vel);simVoid _simGetInitialDynamicAngVelocity(const simVoid* shape,simFloat* angularVel);simVoid _simSetInitialDynamicAngVelocity(simVoid* shape,const simFloat* angularVel);simBool _simGetStartSleeping(const simVoid* shape);simBool _simGetWasPutToSleepOnce(const simVoid* shape);simBool _simGetDynamicsFullRefreshFlag(const simVoid* object);simVoid _simSetDynamicsFullRefreshFlag(const simVoid* object,simBool flag);simVoid _simSetGeomProxyDynamicsFullRefreshFlag(simVoid* geomData,simBool flag);simBool _simGetGeomProxyDynamicsFullRefreshFlag(const simVoid* geomData);simVoid _simSetShapeDynamicVelocity(simVoid* shape,const simFloat* linear,const simFloat* angular);simVoid _simGetAdditionalForceAndTorque(const simVoid* shape,simFloat* force,simFloat* torque);simVoid _simClearAdditionalForceAndTorque(const simVoid* shape);simBool _simGetJointPositionInterval(const simVoid* joint,simFloat* minValue,simFloat* rangeValue);simInt _simGetJointType(const simVoid* joint);simBool _simIsForceSensorBroken(const simVoid* forceSensor);simVoid _simGetDynamicForceSensorLocalTransformationPart2(const simVoid* forceSensor,simFloat* pos,simFloat* quat);simBool _simIsDynamicMotorEnabled(const simVoid* joint);simBool _simIsDynamicMotorPositionCtrlEnabled(const simVoid* joint);simBool _simIsDynamicMotorTorqueModulationEnabled(const simVoid* joint);simVoid _simGetMotorPid(const simVoid* joint,simFloat* pParam,simFloat* iParam,simFloat* dParam);simFloat _simGetDynamicMotorTargetPosition(const simVoid* joint);simFloat _simGetDynamicMotorTargetVelocity(const simVoid* joint);simFloat _simGetDynamicMotorMaxForce(const simVoid* joint);simFloat _simGetDynamicMotorUpperLimitVelocity(const simVoid* joint);simVoid _simSetDynamicMotorReflectedPositionFromDynamicEngine(simVoid* joint,simFloat pos);simVoid _simSetJointSphericalTransformation(simVoid* joint,const simFloat* quat);simVoid _simAddForceSensorCumulativeForcesAndTorques(simVoid* forceSensor,const simFloat* force,const simFloat* torque,int totalPassesCount);simVoid _simAddJointCumulativeForcesOrTorques(simVoid* joint,simFloat forceOrTorque,int totalPassesCount);simVoid _simSetDynamicJointLocalTransformationPart2(simVoid* joint,const simFloat* pos,const simFloat* quat);simVoid _simSetDynamicForceSensorLocalTransformationPart2(simVoid* forceSensor,const simFloat* pos,const simFloat* quat);simVoid _simSetDynamicJointLocalTransformationPart2IsValid(simVoid* joint,simBool valid);simVoid _simSetDynamicForceSensorLocalTransformationPart2IsValid(simVoid* forceSensor,simBool valid);const simVoid* _simGetGeomWrapFromGeomProxy(const simVoid* geomData);simVoid _simGetLocalInertiaFrame(const simVoid* geomInfo,simFloat* pos,simFloat* quat);simInt _simGetPurePrimitiveType(const simVoid* geomInfo);simBool _simIsGeomWrapGeometric(const simVoid* geomInfo);simBool _simIsGeomWrapConvex(const simVoid* geomInfo);simInt _simGetGeometricCount(const simVoid* geomInfo);simVoid _simGetAllGeometrics(const simVoid* geomInfo,simVoid** allGeometrics);simVoid _simGetPurePrimitiveSizes(const simVoid* geometric,simFloat* sizes);simVoid _simMakeDynamicAnnouncement(int announceType);simVoid _simGetVerticesLocalFrame(const simVoid* geometric,simFloat* pos,simFloat* quat);const simFloat* _simGetHeightfieldData(const simVoid* geometric,simInt* xCount,simInt* yCount,simFloat* minHeight,simFloat* maxHeight);simVoid _simGetCumulativeMeshes(const simVoid* geomInfo,simFloat** vertices,simInt* verticesSize,simInt** indices,simInt* indicesSize);simFloat _simGetMass(const simVoid* geomInfo);simVoid _simGetPrincipalMomentOfInertia(const simVoid* geomInfo,simFloat* inertia);simVoid _simGetGravity(simFloat* gravity);simInt _simGetTimeDiffInMs(simInt previousTime);simBool _simDoEntitiesCollide(simInt entity1ID,simInt entity2ID,simInt* cacheBuffer,simBool overrideCollidableFlagIfShape1,simBool overrideCollidableFlagIfShape2,simBool pathOrMotionPlanningRoutineCalling);simBool _simGetDistanceBetweenEntitiesIfSmaller(simInt entity1ID,simInt entity2ID,simFloat* distance,simFloat* ray,simInt* cacheBuffer,simBool overrideMeasurableFlagIfNonCollection1,simBool overrideMeasurableFlagIfNonCollection2,simBool pathPlanningRoutineCalling);simInt _simHandleJointControl(const simVoid* joint,simInt auxV,const simInt* inputValuesInt,const simFloat* inputValuesFloat,simFloat* outputValues);simInt _simHandleCustomContact(simInt objHandle1,simInt objHandle2,simInt engine,simInt* dataInt,simFloat* dataFloat);const simVoid* _simGetIkGroupObject(int ikGroupID);simInt _simMpHandleIkGroupObject(const simVoid* ikGroup);simFloat _simGetPureHollowScaling(const simVoid* geometric);simInt _simGetJointCallbackCallOrder(const simVoid* joint);simVoid _simDynCallback(const simInt* intData,const simFloat* floatData);
// Following courtesy of Stephen James:simInt simExtLaunchUIThread(const simChar* applicationName,simInt options,const simChar* sceneOrModelOrUiToLoad,const simChar* applicationDir_);simInt simExtCanInitSimThread();simInt simExtSimThreadInit();simInt simExtSimThreadDestroy();simInt simExtPostExitRequest();simInt simExtGetExitRequest();simInt simExtStep(simBool stepIfRunning);simInt simExtCallScriptFunction(simInt scriptHandleOrType, const simChar* functionNameAtScriptName, const simInt* inIntData, simInt inIntCnt, const simFloat* inFloatData, simInt inFloatCnt, const simChar** inStringData, simInt inStringCnt, const simChar* inBufferData, simInt inBufferCnt, simInt** outIntData, simInt* outIntCnt, simFloat** outFloatData, simInt* outFloatCnt, simChar*** outStringData, simInt* outStringCnt, simChar** outBufferData, simInt* outBufferSize);
// Deprecated beginsimInt simGetMaterialId(const simChar* materialName);simInt simGetShapeMaterial(simInt shapeHandle);simInt simHandleVarious();simInt simSerialPortOpen(simInt portNumber,simInt baudRate,simVoid* reserved1,simVoid* reserved2);simInt simSerialPortClose(simInt portNumber);simInt simSerialPortSend(simInt portNumber,const simChar* data,simInt dataLength);simInt simSerialPortRead(simInt portNumber,simChar* buffer,simInt dataLengthToRead);simInt simJointGetForce(simInt jointHandle,simFloat* forceOrTorque);simInt simGetPathPlanningHandle(const simChar* pathPlanningObjectName);simInt simGetMotionPlanningHandle(const simChar* motionPlanningObjectName);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);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);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);simFloat* simFindIkPath(simInt motionPlanningObjectHandle,const simFloat* startConfig,const simFloat* goalPose,simInt options,simFloat stepSize,simInt* outputConfigsCnt,simFloat* reserved,const simInt* auxIntParams,const simFloat* auxFloatParams);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);simInt simCreateMotionPlanning(simInt jointCnt,const simInt* jointHandles,const simInt* jointRangeSubdivisions,const simFloat* jointMetricWeights,simInt options,const simInt* intParams,const simFloat* floatParams,const simVoid* reserved);simInt simRemoveMotionPlanning(simInt motionPlanningHandle);simInt simSearchPath(simInt pathPlanningObjectHandle,simFloat maximumSearchTime);simInt simInitializePathSearch(simInt pathPlanningObjectHandle,simFloat maximumSearchTime,simFloat searchTimeStep);simInt simPerformPathSearchStep(simInt temporaryPathSearchObject,simBool abortSearch);simInt simLockInterface(simBool locked);simInt simCopyPasteSelectedObjects();simInt simResetPath(simInt pathHandle);simInt simHandlePath(simInt pathHandle,simFloat deltaTime);simInt simResetJoint(simInt jointHandle);simInt simHandleJoint(simInt jointHandle,simFloat deltaTime);simInt simAppendScriptArrayEntry(const simChar* reservedSetToNull,simInt scriptHandleOrType,const simChar* arrayNameAtScriptName,const simChar* keyName,const simChar* data,const simInt* what);simInt simClearScriptVariable(const simChar* reservedSetToNull,simInt scriptHandleOrType,const simChar* variableNameAtScriptName);simVoid _simGetJointOdeParameters(const simVoid* joint,simFloat* stopERP,simFloat* stopCFM,simFloat* bounce,simFloat* fudge,simFloat* normalCFM);simVoid _simGetJointBulletParameters(const simVoid* joint,simFloat* stopERP,simFloat* stopCFM,simFloat* normalCFM);simVoid _simGetOdeMaxContactFrictionCFMandERP(const simVoid* geomInfo,simInt* maxContacts,simFloat* friction,simFloat* cfm,simFloat* erp);simBool _simGetBulletCollisionMargin(const simVoid* geomInfo,simFloat* margin,simInt* otherProp);simBool _simGetBulletStickyContact(const simVoid* geomInfo);simFloat _simGetBulletRestitution(const simVoid* geomInfo);simVoid _simGetVortexParameters(const simVoid* object,simInt version,simFloat* floatParams,simInt* intParams);simVoid _simGetNewtonParameters(const simVoid* object,simInt* version,simFloat* floatParams,simInt* intParams);simVoid _simGetDamping(const simVoid* geomInfo,simFloat* linDamping,simFloat* angDamping);simFloat _simGetFriction(const simVoid* geomInfo);simInt simAddSceneCustomData(simInt header,const simChar* data,simInt dataLength);simInt simGetSceneCustomDataLength(simInt header);simInt simGetSceneCustomData(simInt header,simChar* data);simInt simAddObjectCustomData(simInt objectHandle,simInt header,const simChar* data,simInt dataLength);simInt simGetObjectCustomDataLength(simInt objectHandle,simInt header);simInt simGetObjectCustomData(simInt objectHandle,simInt header,simChar* data);simInt simCreateUI(const simChar* uiName,simInt menuAttributes,const simInt* clientSize,const simInt* cellSize,simInt* buttonHandles);simInt simCreateUIButton(simInt uiHandle,const simInt* position,const simInt* size,simInt buttonProperty);simInt simGetUIHandle(const simChar* uiName);simInt simGetUIProperty(simInt uiHandle);simInt simGetUIEventButton(simInt uiHandle,simInt* auxiliaryValues);simInt simSetUIProperty(simInt uiHandle,simInt elementProperty);simInt simGetUIButtonProperty(simInt uiHandle,simInt buttonHandle);simInt simSetUIButtonProperty(simInt uiHandle,simInt buttonHandle,simInt buttonProperty);simInt simGetUIButtonSize(simInt uiHandle,simInt buttonHandle,simInt* size);simInt simSetUIButtonLabel(simInt uiHandle,simInt buttonHandle,const simChar* upStateLabel,const simChar* downStateLabel);simChar* simGetUIButtonLabel(simInt uiHandle,simInt buttonHandle);simInt simSetUISlider(simInt uiHandle,simInt buttonHandle,simInt position);simInt simGetUISlider(simInt uiHandle,simInt buttonHandle);simInt simSetUIButtonColor(simInt uiHandle,simInt buttonHandle,const simFloat* upStateColor,const simFloat* downStateColor,const simFloat* labelColor);simInt simSetUIButtonTexture(simInt uiHandle,simInt buttonHandle,const simInt* size,const simChar* textureData);simInt simCreateUIButtonArray(simInt uiHandle,simInt buttonHandle);simInt simSetUIButtonArrayColor(simInt uiHandle,simInt buttonHandle,const simInt* position,const simFloat* color);simInt simDeleteUIButtonArray(simInt uiHandle,simInt buttonHandle);simInt simRemoveUI(simInt uiHandle);simInt simSetUIPosition(simInt uiHandle,const simInt* position);simInt simGetUIPosition(simInt uiHandle,simInt* position);simInt simLoadUI(const simChar* filename,simInt maxCount,simInt* uiHandles);simInt simSaveUI(simInt count,const simInt* uiHandles,const simChar* filename);simInt simHandleGeneralCallbackScript(simInt callbackId,simInt callbackTag,simVoid* additionalData);simInt simRegisterCustomLuaFunction(const simChar* funcName,const simChar* callTips,const simInt* inputArgumentTypes,simVoid(*callBack)(struct SLuaCallBack* p));simInt simRegisterCustomLuaVariable(const simChar* varName,const simChar* varValue);simInt simRegisterContactCallback(simInt(*callBack)(simInt,simInt,simInt,simInt*,simFloat*));simInt simRegisterJointCtrlCallback(simInt(*callBack)(simInt,simInt,simInt,const simInt*,const simFloat*,simFloat*));simInt simGetMechanismHandle(const simChar* mechanismName);simInt simHandleMechanism(simInt mechanismHandle);simInt simHandleCustomizationScripts(simInt callType);simInt simSetVisionSensorFilter(simInt visionSensorHandle,simInt filterIndex,simInt options,const simInt* pSizes,const simUChar* bytes,const simInt* ints,const simFloat* floats,const simUChar* custom);simInt simGetVisionSensorFilter(simInt visionSensorHandle,simInt filterIndex,simInt* options,simInt* pSizes,simUChar** bytes,simInt** ints,simFloat** floats,simUChar** custom);simChar* simGetScriptSimulationParameter(simInt scriptHandle,const simChar* parameterName,simInt* parameterLength);simInt simSetScriptSimulationParameter(simInt scriptHandle,const simChar* parameterName,const simChar* parameterValue,simInt parameterLength);simInt simSetJointForce(simInt objectHandle,simFloat forceOrTorque);simInt simHandleMill(simInt millHandle,simFloat* removedSurfaceAndVolume);simInt simResetMill(simInt millHandle);simInt simResetMilling(simInt objectHandle);simInt simApplyMilling(simInt objectHandle);simBool _simGetParentFollowsDynamic(const simVoid* shape);simInt simGetNameSuffix(const simChar* name);simInt simSetNameSuffix(simInt nameSuffixNumber);simInt simAddStatusbarMessage(const simChar* message);simChar* simGetScriptRawBuffer(simInt scriptHandle,simInt bufferHandle);simInt simSetScriptRawBuffer(simInt scriptHandle,const simChar* buffer,simInt bufferSize);simInt simReleaseScriptRawBuffer(simInt scriptHandle,simInt bufferHandle);// Deprecated end12345678910111213141516171819# Minimal makefile for Sphinx documentation#
# You can set these variables from the command line.SPHINXOPTS =SPHINXBUILD = sphinx-buildSOURCEDIR = sourceBUILDDIR = _build
# Put it first so that "make" without argument is like "make help".help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).%: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)1234567891011121314151617181920212223242526272829303132333435@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162# Configuration file for the Sphinx documentation builder.## This file only contains a selection of the most common options. For a full# list see the documentation:# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,# add these directories to sys.path here. If the directory is relative to the# documentation root, use os.path.abspath to make it absolute, like shown here.#import osimport syssys.path.insert(0, os.path.abspath('../../'))
# -- Project information -----------------------------------------------------
project = 'PyRep'copyright = '2019, Stephen James'author = 'Stephen James'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom# ones.extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.napoleon']
autodoc_mock_imports = ["pyrep.backend._sim_cffi"]
# Add any paths that contain templates here, relative to this directory.templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and# directories to ignore when looking for source files.# This pattern also affects html_static_path and html_extra_path.exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for# a list of builtin themes.#html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,# relative to this directory. They are copied after the builtin static files,# so a file named "default.css" will overwrite the builtin "default.css".html_static_path = ['_static']
master_doc = 'index'
# -- Extension configuration -------------------------------------------------123456789101112131415161718192021222324.. PyRep documentation master file, created by sphinx-quickstart on Sun May 12 18:33:59 2019. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive.
Welcome to PyRep's documentation!=================================
PyRep is a toolkit for robot learning research, built on top of the virtual robotics experimentation platform (V-REP).
See the `Github page <https://github.com/stepjam/PyRep/>`_ for install instructions and examples.
.. toctree:: :maxdepth: 4 :caption: Contents:
pyrep
Indices and tables==================
* :ref:`genindex`* :ref:`modindex`* :ref:`search`1234567pyrep=====
.. toctree:: :maxdepth: 4
pyrep123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778pyrep.objects package=====================
Submodules----------
pyrep.objects.cartesian\_path module------------------------------------
.. automodule:: pyrep.objects.cartesian_path :members: :undoc-members: :show-inheritance:
pyrep.objects.dummy module--------------------------
.. automodule:: pyrep.objects.dummy :members: :undoc-members: :show-inheritance:
pyrep.objects.force\_sensor module----------------------------------
.. automodule:: pyrep.objects.force_sensor :members: :undoc-members: :show-inheritance:
pyrep.objects.joint module--------------------------
.. automodule:: pyrep.objects.joint :members: :undoc-members: :show-inheritance:
pyrep.objects.object module---------------------------
.. automodule:: pyrep.objects.object :members: :undoc-members: :show-inheritance:
pyrep.objects.proximity\_sensor module--------------------------------------
.. automodule:: pyrep.objects.proximity_sensor :members: :undoc-members: :show-inheritance:
pyrep.objects.shape module--------------------------
.. automodule:: pyrep.objects.shape :members: :undoc-members: :show-inheritance:
pyrep.objects.vision\_sensor module-----------------------------------
.. automodule:: pyrep.objects.vision_sensor :members: :undoc-members: :show-inheritance:
Module contents---------------
.. automodule:: pyrep.objects :members: :undoc-members: :show-inheritance:12345678910111213141516171819202122232425262728293031323334353637383940414243444546pyrep.robots.arms package=========================
Submodules----------
pyrep.robots.arms.arm module----------------------------
.. automodule:: pyrep.robots.arms.arm :members: :undoc-members: :show-inheritance:
pyrep.robots.arms.configuration\_path module--------------------------------------------
.. automodule:: pyrep.robots.arms.configuration_path :members: :undoc-members: :show-inheritance:
pyrep.robots.arms.mico module-----------------------------
.. automodule:: pyrep.robots.arms.mico :members: :undoc-members: :show-inheritance:
pyrep.robots.arms.panda module------------------------------
.. automodule:: pyrep.robots.arms.panda :members: :undoc-members: :show-inheritance:
Module contents---------------
.. automodule:: pyrep.robots.arms :members: :undoc-members: :show-inheritance:1234567891011121314151617181920212223242526272829303132333435363738pyrep.robots.end\_effectors package===================================
Submodules----------
pyrep.robots.end\_effectors.gripper module------------------------------------------
.. automodule:: pyrep.robots.end_effectors.gripper :members: :undoc-members: :show-inheritance:
pyrep.robots.end\_effectors.mico\_gripper module------------------------------------------------
.. automodule:: pyrep.robots.end_effectors.mico_gripper :members: :undoc-members: :show-inheritance:
pyrep.robots.end\_effectors.panda\_gripper module-------------------------------------------------
.. automodule:: pyrep.robots.end_effectors.panda_gripper :members: :undoc-members: :show-inheritance:
Module contents---------------
.. automodule:: pyrep.robots.end_effectors :members: :undoc-members: :show-inheritance:123456789101112131415161718192021222324252627282930pyrep.robots package====================
Subpackages-----------
.. toctree::
pyrep.robots.arms pyrep.robots.end_effectors
Submodules----------
pyrep.robots.robot\_component module------------------------------------
.. automodule:: pyrep.robots.robot_component :members: :undoc-members: :show-inheritance:
Module contents---------------
.. automodule:: pyrep.robots :members: :undoc-members: :show-inheritance:1234567891011121314151617181920212223242526272829303132333435363738394041424344454647pyrep package=============
Subpackages-----------
.. toctree::
pyrep.backend pyrep.objects pyrep.robots
Submodules----------
pyrep.const module------------------
.. automodule:: pyrep.const :members: :undoc-members: :show-inheritance:
pyrep.errors module-------------------
.. automodule:: pyrep.errors :members: :undoc-members: :show-inheritance:
pyrep.pyrep module------------------
.. automodule:: pyrep.pyrep :members: :undoc-members: :show-inheritance:
Module contents---------------
.. automodule:: pyrep :members: :undoc-members: :show-inheritance:12345678910111213141516171819202122pyrep.objects package=====================
Submodules----------
pyrep.textures.texture module------------------------------------
.. automodule:: pyrep.textures.texture :members: :undoc-members: :show-inheritance:
Module contents---------------
.. automodule:: pyrep.textures :members: :undoc-members: :show-inheritance:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115"""A baxter picks up a cup with its left arm and then passes it to its right arm.This script contains examples of: - Path planning (linear and non-linear). - Using multiple arms. - Using a gripper."""from os.path import dirname, join, abspathfrom pyrep import PyRepfrom pyrep.robots.arms.baxter import BaxterLeft, BaxterRightfrom pyrep.robots.end_effectors.baxter_gripper import BaxterGripperfrom pyrep.objects.dummy import Dummyfrom pyrep.objects.shape import Shape
SCENE_FILE = join(dirname(abspath(__file__)), 'scene_baxter_pick_and_pass.ttt')pr = PyRep()
pr.launch(SCENE_FILE, headless=False)pr.start()
baxter_left = BaxterLeft()baxter_right = BaxterRight()baxter_gripper_left = BaxterGripper(0)baxter_gripper_right = BaxterGripper(1)
cup = Shape('Cup')waypoints = [Dummy('waypoint%d' % i) for i in range(7)]
print('Planning path for left arm to cup ...')path = baxter_left.get_path(position=waypoints[0].get_position(), quaternion=waypoints[0].get_quaternion())path.visualize() # Let's see what the path looks likeprint('Executing plan ...')done = Falsewhile not done: done = path.step() pr.step()path.clear_visualization()
print('Planning path closer to cup ...')path = baxter_left.get_path(position=waypoints[1].get_position(), quaternion=waypoints[1].get_quaternion())print('Executing plan ...')done = Falsewhile not done: done = path.step() pr.step()
print('Closing left gripper ...')while not baxter_gripper_left.actuate(0.0, 0.4): pr.step()baxter_gripper_left.grasp(cup)
print('Planning path to lift cup ...')path = baxter_left.get_path(position=waypoints[2].get_position(), quaternion=waypoints[2].get_quaternion(), ignore_collisions=True)print('Executing plan ...')done = Falsewhile not done: done = path.step() pr.step()
print('Planning path for right arm to cup ...')path = baxter_right.get_path(position=waypoints[3].get_position(), quaternion=waypoints[3].get_quaternion())print('Executing Plan ...')done = Falsewhile not done: done = path.step() pr.step()
print('Planning path closer to cup ...')path = baxter_right.get_path(position=waypoints[4].get_position(), quaternion=waypoints[4].get_quaternion())print('Executing plan ...')done = Falsewhile not done: done = path.step() pr.step()
print('Closing right gripper ...')while not baxter_gripper_right.actuate(0.0, 0.4): pr.step()
print('Opening left gripper ...')while not baxter_gripper_left.actuate(1.0, 0.4): pr.step()
# Left gripper releases, right gripper grasps.baxter_gripper_left.release()baxter_gripper_right.grasp(cup)pr.step()
print('Planning path for left arm to home position ...')path_l = baxter_left.get_path(position=waypoints[5].get_position(), quaternion=waypoints[5].get_quaternion())
print('Planning path for right arm to home position ...')path_r = baxter_right.get_path(position=waypoints[6].get_position(), quaternion=waypoints[6].get_quaternion())
print('Executing plan on both arms ...')done_l = done_r = Falsewhile not done_l or not done_r: if not done_l: done_l = path_l.step() if not done_r: done_r = path_r.step() pr.step()
print('Done ...')input('Press enter to finish ...')pr.stop()pr.shutdown()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596"""Facebook/CMU LoCoBot drives to a cube, picks it up, and takes it to a target.This script contains examples of: - Linear mobile paths on a non-holonomic platform - How to use the combination of a mobile base, manipulator, and gripper."""from os.path import dirname, join, abspathfrom pyrep import PyRepfrom pyrep.robots.mobiles.locobot import LoCoBotfrom pyrep.robots.arms.locobot_arm import LoCoBotArmfrom pyrep.robots.end_effectors.locobot_gripper import LoCoBotGripperfrom pyrep.objects.shape import Shapefrom pyrep.objects.dummy import Dummy
SCENE_FILE = join(dirname(abspath(__file__)), 'scene_locobot_stack_cube.ttt')pr = PyRep()pr.launch(SCENE_FILE, headless=False)pr.start()
base = LoCoBot()arm = LoCoBotArm()gripper = LoCoBotGripper()
base.set_motor_locked_at_zero_velocity(True)
def drive_to_position(position, orientation): base_path = base.get_linear_path(position, orientation) base_path.visualize() done = False while not done: done = base_path.step() pr.step() pr.step()
def move_arm(position, quaternion, ignore_collisions=False): arm_path = arm.get_path(position, quaternion=quaternion, ignore_collisions=ignore_collisions) arm_path.visualize() done = False while not done: done = arm_path.step() pr.step() arm_path.clear_visualization()
cuboid = Shape('cuboid')goal = Shape('goal')grasp_point = Dummy('grasp_point')
drive_pos = cuboid.get_position()drive_pos[1] -= 0.3
print('Driving to cube ...')drive_to_position(drive_pos, 0)
grasp_point_raised = grasp_point.get_position()grasp_point_raised[2] += 0.075
print('Move arm above cube ...')move_arm(grasp_point_raised, grasp_point.get_quaternion())
print('Arm approach cube ...')move_arm(grasp_point.get_position(), grasp_point.get_quaternion(), True)
print('Closing gripper ...')while not gripper.actuate(0.0, 0.4): pr.step()gripper.grasp(cuboid)
print('Lift cube ...')move_arm(grasp_point_raised, grasp_point.get_quaternion(), True)
drive_pos = goal.get_position()drive_pos[1] -= 0.35
print('Driving to goal ...')drive_to_position(drive_pos, 0)
goal_point_raised = goal.get_position()goal_point_raised[2] += 0.05
print('Move arm above goal ...')move_arm(goal_point_raised, grasp_point.get_quaternion())
print('Drop cube ...')gripper.release()while not gripper.actuate(1.0, 0.4): pr.step()
print('Done!')
pr.stop()pr.shutdown()1234567891011121314151617181920212223242526272829303132333435"""A Franka Panda moves using delta end effector pose control.This script contains examples of: - IK calculations. - Joint movement by setting joint target positions."""from os.path import dirname, join, abspathfrom pyrep import PyRepfrom pyrep.robots.arms.panda import Panda
SCENE_FILE = join(dirname(abspath(__file__)), 'scene_panda_reach_target.ttt')DELTA = 0.01pr = PyRep()pr.launch(SCENE_FILE, headless=False)pr.start()agent = Panda()
starting_joint_positions = agent.get_joint_positions()pos, quat = agent.get_tip().get_position(), agent.get_tip().get_quaternion()
def move(index, delta): pos[index] += delta new_joint_angles = agent.solve_ik_via_jacobian(pos, quaternion=quat) agent.set_joint_target_positions(new_joint_angles) pr.step()
[move(2, -DELTA) for _ in range(20)][move(1, -DELTA) for _ in range(20)][move(2, DELTA) for _ in range(10)][move(1, DELTA) for _ in range(20)]
pr.stop()pr.shutdown()1234567891011121314151617181920212223242526272829303132333435363738394041"""A Franka Panda inverse kinematics exampleThis script contains examples of: - IK calculations."""from os.path import dirname, join, abspathfrom pyrep import PyRepfrom pyrep.errors import IKErrorfrom pyrep.robots.arms.panda import Panda
SCENE_FILE = join(dirname(abspath(__file__)), 'scene_panda_reach_target.ttt')pr = PyRep()pr.launch(SCENE_FILE, headless=False, responsive_ui=True)pr.start()agent = Panda()
starting_joint_positions = agent.get_joint_positions()(x, y, z), q = agent.get_tip().get_position(), agent.get_tip().get_quaternion()
# Try solving via linearisationnew_joint_pos = agent.solve_ik_via_jacobian([x, y, z - 0.01], quaternion=q)new_joint_pos = agent.solve_ik_via_jacobian([x, y, z - 0.05], quaternion=q)new_joint_pos = agent.solve_ik_via_jacobian([x, y, z - 0.1], quaternion=q)new_joint_pos = agent.solve_ik_via_jacobian([x, y, z - 0.2], quaternion=q)
# This will fail because the distance between start and goal is too fartry: new_joint_pos = agent.solve_ik_via_jacobian([x, y, z - 0.4], quaternion=q)except IKError: # So let's swap to an alternative IK method... # This returns 'max_configs' number of joint positions input('Press key to run solve_ik_via_sampling...') new_joint_pos = agent.solve_ik_via_sampling([x, y, z - 0.4], quaternion=q)[0]
# Because the arm is in Forxe/Torque mode, we need to temporarily disable# dynamics in order to instantaneously move joints.agent.set_joint_positions(new_joint_pos, disable_dynamics=True)input('Press any key to finish...')
pr.stop()pr.shutdown()1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859"""A Franka Panda reaches for 10 randomly places targets.This script contains examples of: - Linear (IK) paths. - Scene manipulation (creating an object and moving it)."""from os.path import dirname, join, abspathfrom pyrep import PyRepfrom pyrep.robots.arms.panda import Pandafrom pyrep.objects.shape import Shapefrom pyrep.const import PrimitiveShapefrom pyrep.errors import ConfigurationPathErrorimport numpy as npimport math
LOOPS = 10SCENE_FILE = join(dirname(abspath(__file__)), 'scene_panda_reach_target.ttt')pr = PyRep()pr.launch(SCENE_FILE, headless=False)pr.start()agent = Panda()
# We could have made this target in the scene, but lets create one dynamicallytarget = Shape.create(type=PrimitiveShape.SPHERE, size=[0.05, 0.05, 0.05], color=[1.0, 0.1, 0.1], static=True, respondable=False)
position_min, position_max = [0.8, -0.2, 1.0], [1.0, 0.2, 1.4]
starting_joint_positions = agent.get_joint_positions()
for i in range(LOOPS):
# Reset the arm at the start of each 'episode' agent.set_joint_positions(starting_joint_positions)
# Get a random position within a cuboid and set the target position pos = list(np.random.uniform(position_min, position_max)) target.set_position(pos)
# Get a path to the target (rotate so z points down) try: path = agent.get_path( position=pos, euler=[0, math.radians(180), 0]) except ConfigurationPathError as e: print('Could not find path') continue
# Step the simulation and advance the agent along the path done = False while not done: done = path.step() pr.step()
print('Reached target %d!' % i)
pr.stop()pr.shutdown()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990"""An example of how one might use PyRep to create their RL environments.In this case, the Franka Panda must reach a randomly placed target.This script contains examples of: - RL environment example. - Scene manipulation. - Environment resets. - Setting joint properties (control loop disabled, motor locked at 0 vel)"""from os.path import dirname, join, abspathfrom pyrep import PyRepfrom pyrep.robots.arms.panda import Pandafrom pyrep.objects.shape import Shapeimport numpy as np
SCENE_FILE = join(dirname(abspath(__file__)), 'scene_reinforcement_learning_env.ttt')POS_MIN, POS_MAX = [0.8, -0.2, 1.0], [1.0, 0.2, 1.4]EPISODES = 5EPISODE_LENGTH = 200
class ReacherEnv(object):
def __init__(self): self.pr = PyRep() self.pr.launch(SCENE_FILE, headless=False) self.pr.start() self.agent = Panda() self.agent.set_control_loop_enabled(False) self.agent.set_motor_locked_at_zero_velocity(True) self.target = Shape('target') self.agent_ee_tip = self.agent.get_tip() self.initial_joint_positions = self.agent.get_joint_positions()
def _get_state(self): # Return state containing arm joint angles/velocities & target position return np.concatenate([self.agent.get_joint_positions(), self.agent.get_joint_velocities(), self.target.get_position()])
def reset(self): # Get a random position within a cuboid and set the target position pos = list(np.random.uniform(POS_MIN, POS_MAX)) self.target.set_position(pos) self.agent.set_joint_positions(self.initial_joint_positions) return self._get_state()
def step(self, action): self.agent.set_joint_target_velocities(action) # Execute action on arm self.pr.step() # Step the physics simulation ax, ay, az = self.agent_ee_tip.get_position() tx, ty, tz = self.target.get_position() # Reward is negative distance to target reward = -np.sqrt((ax - tx) ** 2 + (ay - ty) ** 2 + (az - tz) ** 2) return reward, self._get_state()
def shutdown(self): self.pr.stop() self.pr.shutdown()
class Agent(object):
def act(self, state): del state return list(np.random.uniform(-1.0, 1.0, size=(7,)))
def learn(self, replay_buffer): del replay_buffer pass
env = ReacherEnv()agent = Agent()replay_buffer = []
for e in range(EPISODES):
print('Starting episode %d' % e) state = env.reset() for i in range(EPISODE_LENGTH): action = agent.act(state) reward, next_state = env.step(action) replay_buffer.append((state, action, reward, next_state)) state = next_state agent.learn(replay_buffer)
print('Done!')env.shutdown()1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253"""A turtlebot reaches for 4 randomly places targets.This script contains examples of: - Non-linear mobile paths to reach a target with collision avoidance"""from os.path import dirname, join, abspathfrom pyrep import PyRepfrom pyrep.robots.mobiles.turtlebot import TurtleBotfrom pyrep.objects.shape import Shapefrom pyrep.const import PrimitiveShapeimport numpy as np
LOOPS = 4SCENE_FILE = join(dirname(abspath(__file__)), 'scene_turtlebot_navigation.ttt')pr = PyRep()pr.launch(SCENE_FILE, headless=False)pr.start()agent = TurtleBot()
# We could have made this target in the scene, but lets create one dynamicallytarget = Shape.create(type=PrimitiveShape.SPHERE, size=[0.05, 0.05, 0.05], color=[1.0, 0.1, 0.1], static=True, respondable=False)
position_min, position_max = [-0.5, 1, 0.1], [0.5, 1.5, 0.1]
starting_pose = agent.get_2d_pose()
agent.set_motor_locked_at_zero_velocity(True)
for i in range(LOOPS): agent.set_2d_pose(starting_pose)
# Get a random position within a cuboid and set the target position pos = list(np.random.uniform(position_min, position_max)) target.set_position(pos)
path = agent.get_nonlinear_path(position=pos, angle=0)
path.visualize() done = False
while not done: done = path.step() pr.step()
path.clear_visualization()
print('Reached target %d!' % i)
pr.stop()pr.shutdown()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051"""A Kuka youBot reaches for 4 randomly places targets.This script contains examples of: - Linear mobile paths with an omnidirectional robot to reach a target."""from os.path import dirname, join, abspathfrom pyrep import PyRepfrom pyrep.robots.mobiles.youbot import YouBotfrom pyrep.objects.shape import Shapefrom pyrep.const import PrimitiveShapeimport numpy as np
LOOPS = 4SCENE_FILE = join(dirname(abspath(__file__)), 'scene_youbot_navigation.ttt')pr = PyRep()pr.launch(SCENE_FILE, headless=False)pr.start()agent = YouBot()
# We could have made this target in the scene, but lets create one dynamicallytarget = Shape.create(type=PrimitiveShape.SPHERE, size=[0.05, 0.05, 0.05], color=[1.0, 0.1, 0.1], static=True, respondable=False)
position_min, position_max = [-0.5, 1.4, 0.1], [1.0, 0.5, 0.1]
starting_pose = agent.get_2d_pose()
for i in range(LOOPS): agent.set_2d_pose(starting_pose)
# Get a random position within a cuboid and set the target position pos = list(np.random.uniform(position_min, position_max)) target.set_position(pos)
path = agent.get_linear_path(position=pos, angle=0)
path.visualize()
done = False while not done: done = path.step() pr.step()
path.clear_visualization()
print('Reached target %d!' % i)
pr.stop()pr.shutdown()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500from .simConst import *from ._sim_cffi import ffi, libimport numpy as npimport collections
SShapeVizInfo = collections.namedtuple( 'SShapeVizInfo', [ 'vertices', 'indices', 'normals', 'shadingAngle', 'colors', 'texture', 'textureId', 'textureRes', 'textureCoords', 'textureApplyMode', 'textureOptions', ],)
def _check_return(ret): if ret < 0: raise RuntimeError( 'The call failed on the V-REP side. Return value: %d' % ret)
def _check_null_return(val): if val == ffi.NULL: raise RuntimeError( 'The call failed on the V-REP side by returning null.')
def _check_set_object_parameter(ret): if ret == 0: raise RuntimeError( 'Parameter could not be set (e.g. because the parameterID doesn\'t ' 'exist, or because the specified object doesn\'t correspond to the ' 'correct type)')
def simExtLaunchUIThread(options, scene, pyrep_root): lib.simExtLaunchUIThread( 'PyRep'.encode('ascii'), options, scene.encode('ascii'), pyrep_root.encode('ascii'))
def simExtSimThreadInit(): lib.simExtSimThreadInit()
def simExtCanInitSimThread(): return bool(lib.simExtCanInitSimThread())
def simExtSimThreadDestroy(): lib.simExtSimThreadDestroy()
def simExtPostExitRequest(): lib.simExtPostExitRequest()
def simExtGetExitRequest(): return bool(lib.simExtGetExitRequest())
def simExtStep(stepIfRunning=True): lib.simExtStep(stepIfRunning)
def simStartSimulation(): lib.simStartSimulation()
def simStopSimulation(): lib.simStopSimulation()
def simPauseSimulation(): return lib.simPauseSimulation()
def simQuitSimulator(doNotDisplayMessages): lib.simQuitSimulator(doNotDisplayMessages)
def hasObjectHandle(objectName): handle = lib.simGetObjectHandle(objectName.encode('ascii')) if handle: return handle >= 0 return False
def simGetObjectHandle(objectName): handle = lib.simGetObjectHandle(objectName.encode('ascii')) if handle < 0: raise RuntimeError('Handle %s does not exist.' % objectName) return handle
def simGetIkGroupHandle(ikGroupName): handle = lib.simGetIkGroupHandle(ikGroupName.encode('ascii')) if handle <= 0: raise RuntimeError('Ik group does not exist.') return handle
def simSetIkElementProperties(ikGroupHandle, tipDummyHandle, constraints, precision=None, weight=None): if precision is None: precision = ffi.NULL if weight is None: weight = ffi.NULL reserved = ffi.NULL ret = lib.simSetIkElementProperties( ikGroupHandle, tipDummyHandle, constraints, precision, weight, reserved) _check_return(ret) return ret
def simSetIkGroupProperties(ikGroupHandle, resolutionMethod, maxIterations, damping): reserved = ffi.NULL ret = lib.simSetIkGroupProperties( ikGroupHandle, resolutionMethod, maxIterations, damping, reserved) _check_return(ret) return ret
def simGetObjectPosition(objectHandle, relativeToObjectHandle): position = ffi.new('float[3]') lib.simGetObjectPosition(objectHandle, relativeToObjectHandle, position) return list(position)
def simGetJointPosition(jointHandle): position = ffi.new('float *') lib.simGetJointPosition(jointHandle, position) return position[0]
def simSetJointPosition(jointHandle, position): lib.simSetJointPosition(jointHandle, position)
def simGetJointMatrix(jointHandle): matrix = ffi.new('float[12]') lib.simGetJointMatrix(jointHandle, matrix) return list(matrix)
def simSetSphericalJointMatrix(jointHandle, matrix): lib.simSetSphericalJointMatrix(jointHandle, matrix)
def simGetJointTargetVelocity(jointHandle): vel = ffi.new('float *') lib.simGetJointTargetVelocity(jointHandle, vel) return vel[0]
def simSetJointTargetVelocity(jointHandle, targetVelocity): lib.simSetJointTargetVelocity(jointHandle, targetVelocity)
def simGetJointTargetPosition(jointHandle): position = ffi.new('float *') lib.simGetJointTargetPosition(jointHandle, position) return position[0]
def simSetJointTargetPosition(jointHandle, targetPosition): lib.simSetJointTargetPosition(jointHandle, targetPosition)
def simGetJointForce(jointHandle): force = ffi.new('float *') ret = lib.simGetJointForce(jointHandle, force) _check_return(ret) if ret == 0: raise RuntimeError('No value available yet.') return force[0]
def simSetJointForce(jointHandle, force): lib.simSetJointForce(jointHandle, force)
def simGetJointMaxForce(jointHandle): force = ffi.new('float *') ret = lib.simGetJointMaxForce(jointHandle, force) _check_return(ret) if ret == 0: raise RuntimeError('No value available yet.') return force[0]
def simSetJointMaxForce(jointHandle, force): lib.simSetJointMaxForce(jointHandle, force)
def simGetJointInterval(jointHandle): cyclic = ffi.new('char *') interval = ffi.new('float [2]') ret = lib.simGetJointInterval(jointHandle, cyclic, interval) _check_return(ret) return ffi.string(cyclic).decode('utf-8') != '', list(interval)
def simSetJointInterval(jointHandle, cyclic, interval): ret = lib.simSetJointInterval(jointHandle, cyclic, interval) _check_return(ret)
def simCreateForceSensor(options, intParams, floatParams, color): if color is None: color = ffi.NULL handle = lib.simCreateForceSensor(options, intParams, floatParams, color) _check_return(handle) return handle
def simBreakForceSensor(forceSensorHandle): lib.simBreakForceSensor(forceSensorHandle)
def simReadForceSensor(forceSensorHandle): forceVector = ffi.new('float[3]') torqueVector = ffi.new('float[3]') state = lib.simReadForceSensor(forceSensorHandle, forceVector, torqueVector) return state, list(forceVector), list(torqueVector)
def simReleaseBuffer(pointer): lib.simReleaseBuffer(pointer)
def simCreateVisionSensor(options, intParams, floatParams, color): if color is None: color = ffi.NULL ret = lib.simCreateVisionSensor(options, intParams, floatParams, color) _check_return(ret) return ret
def simHandleVisionSensor(sensorHandle): auxValues = ffi.new('float **') auxValuesCount = ffi.new('int **') ret = lib.simHandleVisionSensor( sensorHandle, auxValues, auxValuesCount) _check_return(ret)
k1 = 0 outAuxValues = [] for i in range(auxValuesCount[0][0]): k2 = k1 + auxValuesCount[0][i + 1] outAuxValues.extend([x for x in auxValues[0][k1:k2]])
simReleaseBuffer(ffi.cast('char *', auxValues[0])) simReleaseBuffer(ffi.cast('char *', auxValuesCount[0])) return ret, outAuxValues
def simReadVisionSensor(sensorHandle): auxValues = ffi.new('float **') auxValuesCount = ffi.new('int **') state = lib.simReadVisionSensor(sensorHandle, auxValues, auxValuesCount) auxValues2 = [] if state == 0: s = 0 for i in range(auxValuesCount[0]): auxValues2.append(auxValues[s:s+auxValuesCount[i+1]]) s += auxValuesCount[i+1] #free C buffers simReleaseBuffer(auxValues) simReleaseBuffer(auxValuesCount) return state, auxValues2
def simGetVisionSensorImage(sensorHandle, resolution): img_buffer = lib.simGetVisionSensorImage(sensorHandle) T = ffi.getctype(ffi.typeof(img_buffer).item) # Buffer data type s = ffi.sizeof(T) # datatype size np_T = np.dtype('f{:d}'.format(s)) # Numpy equivalent, e.g. float is 'f4' # Wrap the buffer with numpy. img = np.frombuffer(ffi.buffer(img_buffer, resolution[0]*resolution[1]*3*s), np_T) img = img.reshape(resolution[1], resolution[0], 3) img = np.flip(img, 0).copy() # Image is upside-down simReleaseBuffer(ffi.cast('char *', img_buffer)) return img
def simGetVisionSensorDepthBuffer(sensorHandle, resolution, in_meters): if in_meters: sensorHandle += sim_handleflag_depthbuffermeters img_buffer = lib.simGetVisionSensorDepthBuffer(sensorHandle) T = ffi.getctype(ffi.typeof(img_buffer).item) # Buffer data type s = ffi.sizeof(T) # datatype size np_T = np.dtype('f{:d}'.format(s)) # Numpy equivalent, e.g. float is 'f4' # Wrap the buffer with numpy. img = np.frombuffer(ffi.buffer(img_buffer, resolution[0]*resolution[1]*s), np_T) img = img.reshape(resolution[1], resolution[0]) img = np.flip(img, 0).copy() # Image is upside-down simReleaseBuffer(ffi.cast('char *', img_buffer)) return img
def simGetVisionSensorResolution(sensorHandle): resolution = ffi.new('int[2]') ret = lib.simGetVisionSensorResolution(sensorHandle, resolution) _check_return(ret) return list(resolution)
def simGetObjectChild(parentObjectHandle, childIndex): val = lib.simGetObjectChild(parentObjectHandle, childIndex) _check_return(val) return val
def simGetObjectParent(childObjectHandle): val = lib.simGetObjectParent(childObjectHandle) _check_return(val) return val
def simReadProximitySensor(sensorHandle): detectedPoint = ffi.new('float[3]') detectedObjectHandle = ffi.new('int *') detectedSurfaceNormalVector = ffi.new('float[3]') state = lib.simReadProximitySensor( sensorHandle, detectedPoint, detectedObjectHandle, detectedSurfaceNormalVector) _check_return(state) return (state, detectedObjectHandle, list(detectedPoint), list(detectedSurfaceNormalVector))
def simCheckProximitySensor(sensorHandle, entityHandle): detectedPoint = ffi.new('float[3]') state = lib.simCheckProximitySensor( sensorHandle, entityHandle, detectedPoint) _check_return(state) return state, list(detectedPoint)
def simLoadModel(modelPathAndName): val = lib.simLoadModel(modelPathAndName.encode('ascii')) _check_return(val) return val
def simLoadScene(scenePathAndName): val = lib.simLoadScene(scenePathAndName.encode('ascii')) _check_return(val) return val
def simSaveModel(modelHandle, modelPathAndName): val = lib.simSaveModel(modelHandle, modelPathAndName.encode('ascii')) _check_return(val) return val
def simSaveScene(filename): val = lib.simSaveScene(filename.encode('ascii')) _check_return(val) return val
def simGetObjectName(objectHandle): name_raw = lib.simGetObjectName(objectHandle) if name_raw == ffi.NULL: return '' name = ffi.string(name_raw).decode('utf-8') simReleaseBuffer(name_raw) return name
def simSetObjectName(objectHandle, name): ret = lib.simSetObjectName(objectHandle, name.encode('ascii')) _check_return(ret)
def simAddStatusbarMessage(message): return lib.simAddStatusbarMessage(message.encode('ascii'))
def simGetObjectOrientation(objectHandle, relativeToObjectHandle): eulerAngles = ffi.new('float[3]') ret = lib.simGetObjectOrientation( objectHandle, relativeToObjectHandle, eulerAngles) _check_return(ret) return list(eulerAngles)
def simGetObjectQuaternion(objectHandle, relativeToObjectHandle): quaternion = ffi.new('float[4]') ret = lib.simGetObjectQuaternion( objectHandle, relativeToObjectHandle, quaternion) _check_return(ret) return list(quaternion)
def simSetObjectOrientation(objectHandle, relativeToObjectHandle, eulerAngles): ret = lib.simSetObjectOrientation( objectHandle, relativeToObjectHandle, eulerAngles) _check_return(ret)
def simSetObjectQuaternion(objectHandle, relativeToObjectHandle, quaternion): ret = lib.simSetObjectQuaternion( objectHandle, relativeToObjectHandle, quaternion) _check_return(ret)
def simSetObjectPosition(objectHandle, relativeToObjectHandle, position): ret = lib.simSetObjectPosition( objectHandle, relativeToObjectHandle, position) _check_return(ret)
def simSetObjectParent(objectHandle, parentObject, keepInPlace): ret = lib.simSetObjectParent(objectHandle, parentObject, keepInPlace) _check_return(ret)
def simGetArrayParameter(paramIdentifier): paramValues = ffi.new('float[3]') ret = lib.simGetArrayParameter(paramIdentifier, paramValues) _check_return(ret) return list(paramValues)
def simSetArrayParameter(paramIdentifier, paramValues): ret = lib.simSetArrayParameter(paramIdentifier, paramValues) _check_return(ret)
def simGetBoolParameter(parameter): ret = lib.simGetBoolParameter(parameter) _check_return(ret) return ret
def simSetBoolParameter(parameter, value): ret = lib.simSetBoolParameter(parameter, value) _check_return(ret)
def simGetInt32Parameter(parameter): ret = lib.simGetInt32Parameter(parameter) _check_return(ret) return ret
def simSetInt32Parameter(parameter, value): ret = lib.simSetInt32Parameter(parameter, value) _check_return(ret)
def simGetFloatParameter(parameter): ret = lib.simGetFloatParameter(parameter) _check_return(ret) return ret
def simSetFloatParameter(parameter, value): ret = lib.simSetFloatParameter(parameter, value) _check_return(ret)
def simSetStringParameter(parameter, value): ret = lib.simSetStringParameter(parameter, value.encode('ascii')) _check_return(ret)
def simGetStringParameter(parameter): val = lib.simGetStringParameter(parameter) _check_null_return(val) sval = ffi.string(val).decode('utf-8') simReleaseBuffer(val) return sval
def simGetEngineFloatParameter(parameter, objectHandle): ok = ffi.new('unsigned char *') ret = lib.simGetEngineFloatParameter(parameter, objectHandle, ffi.NULL, ok) _check_return(ret) return ret
def simSetEngineFloatParameter(parameter, objectHandle, val): ret = lib.simSetEngineFloatParameter(parameter, objectHandle, ffi.NULL, val) _check_return(ret) return ret
def simGetCollisionHandle(collisionObjectName): ret = lib.simGetCollisionHandle(collisionObjectName.encode('ascii')) _check_return(ret) return ret
def simGetCollectionHandle(collectionName): ret = lib.simGetCollectionHandle(collectionName.encode('ascii')) _check_return(ret) return ret
def simGetDistanceHandle(distanceObjectName): ret = lib.simGetDistanceHandle(distanceObjectName.encode('ascii')) _check_return(ret) return ret
def simReadCollision(collisionObjectHandle): ret = lib.simReadCollision(collisionObjectHandle) _check_return(ret) return ret
def simReadDistance(distanceObjectHandle): minimumDistance = ffi.new('float *') ret = lib.simReadDistance(distanceObjectHandle, minimumDistance) _check_return(ret) return minimumDistance[0]
def simHandleDistance(distanceObjectHandle): minimumDistance = ffi.new('float *') ret = lib.simHandleDistance(distanceObjectHandle, minimumDistance) _check_return(ret) return ret
def simRemoveObject(objectHandle): ret = lib.simRemoveObject(objectHandle) _check_return(ret)
def simRemoveModel(objectHandle): ret = lib.simRemoveModel(objectHandle) _check_return(ret)
def simCloseScene(): ret = lib.simCloseScene() _check_return(ret)
def simGetObjects(objectType): prev_handle = 0 i = 0 handles = [] while prev_handle != -1: prev_handle = lib.simGetObjects(i, objectType) i += 1 if prev_handle > -1: handles.append(prev_handle) return handles
def simSetObjectInt32Parameter(objectHandle, parameter, value): ret = lib.simSetObjectInt32Parameter(objectHandle, parameter, value) _check_set_object_parameter(ret) _check_return(ret)
def simGetObjectInt32Parameter(objectHandle, parameter): value = ffi.new('int *') ret = lib.simGetObjectInt32Parameter(objectHandle, parameter, value) _check_set_object_parameter(ret) _check_return(ret) return value[0]
def simSetObjectFloatParameter(objectHandle, parameter, value): ret = lib.simSetObjectFloatParameter(objectHandle, parameter, value) _check_set_object_parameter(ret) _check_return(ret)
def simGetObjectFloatParameter(objectHandle, parameter): value = ffi.new('float *') ret = lib.simGetObjectFloatParameter(objectHandle, parameter, value) _check_set_object_parameter(ret) _check_return(ret) return value[0]
def simGetModelProperty(objectHandle): ret = lib.simGetModelProperty(objectHandle) _check_return(ret) return ret
def simSetModelProperty(objectHandle, prop): ret = lib.simSetModelProperty(objectHandle, prop) _check_return(ret)
def simGetObjectSpecialProperty(objectHandle): ret = lib.simGetObjectSpecialProperty(objectHandle) _check_return(ret) return ret
def simSetObjectSpecialProperty(objectHandle, prop): ret = lib.simSetObjectSpecialProperty(objectHandle, prop) _check_return(ret)
def simCreateDummy(size, color): if color is None: color = ffi.NULL ret = lib.simCreateDummy(size, color) _check_return(ret) return ret
def simGetObjectVelocity(objectHandle): linearVel = ffi.new('float[3]') angularVel = ffi.new('float[3]') ret = lib.simGetObjectVelocity(objectHandle, linearVel, angularVel) _check_return(ret) return list(linearVel), list(angularVel)
def simCreateStack(): ret = lib.simCreateStack() _check_return(ret) return ret
def simReleaseStack(stackHandle): ret = lib.simReleaseStack(stackHandle) _check_return(ret)
def simPushInt32OntoStack(stackHandle, value): ret = lib.simPushInt32OntoStack(stackHandle, value) _check_return(ret)
def simGetStackInt32Value(stackHandle): value = ffi.new('int *') ret = lib.simGetStackInt32Value(stackHandle, value) _check_return(ret) return value[0]
def simPushFloatOntoStack(stackHandle, value): ret = lib.simPushFloatOntoStack(stackHandle, value) _check_return(ret)
def simGetStackFloatValue(stackHandle): value = ffi.new('float *') ret = lib.simGetStackFloatValue(stackHandle, value) _check_return(ret) return value[0]
def simPushStringOntoStack(stackHandle, value): ret = lib.simPushStringOntoStack(stackHandle, value.encode('ascii'), 0) _check_return(ret)
def simGetStackStringValue(stackHandle): val = lib.simGetStackFloatValue(stackHandle, ffi.NULL) _check_null_return(val) sval = ffi.string(val).decode('utf-8') simReleaseBuffer(val) return sval
def simExtCallScriptFunction(functionNameAtScriptName, scriptHandleOrType, inputInts, inputFloats, inputStrings, inputBuffer): char_pointers = [] for s in inputStrings: char_pointers.append(ffi.new('char[]', s.encode('ascii'))) strIn = ffi.new('char *[]', char_pointers) outInt = ffi.new('int **') outIntCnt = ffi.new('int *') outFloat = ffi.new('float **') outFloatCnt = ffi.new('int *') outString = ffi.new('char ***') outStringCnt = ffi.new('int *') outBuffer = ffi.new('char **') outBufferSize = ffi.new('int *')
ret = lib.simExtCallScriptFunction( scriptHandleOrType, functionNameAtScriptName.encode('ascii'), inputInts, len(inputInts), inputFloats, len(inputFloats), strIn, len(inputStrings), str(inputBuffer).encode('ascii'), len(str(inputBuffer)), outInt, outIntCnt, outFloat, outFloatCnt, outString, outStringCnt, outBuffer, outBufferSize) _check_return(ret)
ret_ints = [outInt[0][i] for i in range(outIntCnt[0])] ret_floats = [outFloat[0][i] for i in range(outFloatCnt[0])] ret_strings = [ffi.string(outString[0][i]).decode('utf-8') for i in range(outStringCnt[0])] ret_buffer = '' if outBufferSize[0] > 0: ret_buffer = ffi.string(outBuffer[0]).decode('utf-8')
simReleaseBuffer(ffi.cast('char *', outInt[0])) simReleaseBuffer(ffi.cast('char *', outFloat[0])) [simReleaseBuffer(outString[0][i]) for i in range(outStringCnt[0])] simReleaseBuffer(outBuffer[0])
return ret_ints, ret_floats, ret_strings, ret_buffer
def simCreatePureShape(primitiveType, options, sizes, mass, precision): if precision is None: precision = ffi.NULL handle = lib.simCreatePureShape( primitiveType, options, sizes, mass, precision) _check_return(handle) return handle
def simGroupShapes(shapeHandles, merge=False): l = len(shapeHandles) handle = lib.simGroupShapes(shapeHandles, -l if merge else l) _check_return(handle) return handle
def simGetShapeColor(shapeHandle, colorName, colorComponent): rgbData = ffi.new('float[3]') if colorName is None or len(colorName) == 0: colorName = ffi.NULL res = lib.simGetShapeColor(shapeHandle, colorName, colorComponent, rgbData) _check_return(res) return list(rgbData)
def simSetShapeColor(shapeHandle, colorName, colorComponent, rgbData): if colorName is None or len(colorName) == 0: colorName = ffi.NULL res = lib.simSetShapeColor(shapeHandle, colorName, colorComponent, rgbData) _check_return(res)
def simReorientShapeBoundingBox(shapeHandle, relativeToHandle): ret = lib.simReorientShapeBoundingBox(shapeHandle, relativeToHandle, 0) _check_return(ret)
def simGetObjectMatrix(objectHandle, relativeToObjectHandle): matrix = ffi.new('float[12]') ret = lib.simGetObjectMatrix(objectHandle, relativeToObjectHandle, matrix) _check_return(ret) return list(matrix)
def simGetObjectsInTree(treeBaseHandle, objectType, options): objectCount = ffi.new('int *') handles = lib.simGetObjectsInTree(treeBaseHandle, objectType, options, objectCount) _check_null_return(handles) ret = [handles[i] for i in range(objectCount[0])] simReleaseBuffer(ffi.cast('char *', handles)) return ret
def simGetExtensionString(objectHandle, index, key): ext = lib.simGetExtensionString(objectHandle, index, key.encode('ascii')) if ext == ffi.NULL: return '' exts = ffi.string(ext).decode('utf-8') simReleaseBuffer(ext) return exts
def simGetObjectType(objectHandle): ret = lib.simGetObjectType(objectHandle) _check_return(ret) return ret
def simGetConfigurationTree(objectHandle): config = lib.simGetConfigurationTree(objectHandle) _check_null_return(config) # TODO: Not use what to do about the encoding here # configs = ffi.string(config) # simReleaseBuffer(config) return config
def simSetConfigurationTree(data): ret = lib.simSetConfigurationTree(data) _check_return(ret)
def simRotateAroundAxis(matrix, axis, axisPos, angle): matrixOut = ffi.new('float[12]') ret = lib.simRotateAroundAxis(matrix, axis, axisPos, angle, matrixOut) _check_return(ret) return list(matrixOut)
def simSetObjectMatrix(objectHandle, relativeToObjectHandle, matrix): ret = lib.simSetObjectMatrix(objectHandle, relativeToObjectHandle, matrix) _check_return(ret)
def simCheckCollision(entity1Handle, entity2Handle): state = lib.simCheckCollision(entity1Handle, entity2Handle) _check_return(state) return state
def simGetPositionOnPath(pathHandle, relativeDistance): position = ffi.new('float[3]') ret = lib.simGetPositionOnPath(pathHandle, relativeDistance, position) _check_return(ret) return list(position)
def simGetOrientationOnPath(pathHandle, relativeDistance): orientation = ffi.new('float[3]') ret = lib.simGetOrientationOnPath(pathHandle, relativeDistance, orientation) _check_return(ret) return list(orientation)
def simAddDrawingObject(objectType, size, duplicateTolerance, parentObjectHandle, maxItemCount, ambient_diffuse=None, specular=None, emission=None): """
:param objectType: A drawing object type. e.g. sim_drawing_points. :param size: Size of the item. Width of lines or size of points are in pixels, other sizes are in meters. :param duplicateTolerance: If different from 0.0, then will only add the item if there is no other item within duplicateTolerance distance. :param parentObjectHandle: Handle of the scene object where the drawing items should keep attached to. :param maxItemCount: Maximum number of items this object can hold. :param ambient_diffuse: Ambient/diffuse color. :param specular: Default specular color. :param emission: Default emissive color. :return: Handle of the drawing object. """ if ambient_diffuse is None: ambient_diffuse = ffi.NULL if specular is None: specular = ffi.NULL if emission is None: emission = ffi.NULL handle = lib.simAddDrawingObject( objectType, size, duplicateTolerance, parentObjectHandle, maxItemCount, ambient_diffuse, ffi.NULL, specular, emission) _check_return(handle) return handle
def simRemoveDrawingObject(objectHandle): ret = lib.simRemoveDrawingObject(objectHandle) _check_return(ret)
def simAddDrawingObjectItem(objectHandle, itemData): """
:param objectHandle: Handle of a drawing object. :param itemData: If the item is a point item, 3 values are required (x;y;z). If the item is a line item, 6 values are required, and if the item is a triangle item, 9 values are required. If None, then the drawing object is emptied of all its items. :return: """ if itemData is None: itemData = ffi.NULL ret = lib.simAddDrawingObjectItem(objectHandle, itemData) _check_return(ret)
def simGetSimulationTimeStep(): step = lib.simGetSimulationTimeStep() _check_return(step) return step
def simResetDynamicObject(objectHandle): ret = lib.simResetDynamicObject(objectHandle) _check_return(ret)
def simGetJointType(objectHandle): type = lib.simGetJointType(objectHandle) _check_return(type) return type
def simRMLPos(dofs, smallestTimeStep, flags, currentPosVelAccel, maxVelAccelJerk, selection, targetPosVel): smallestTimeStep = ffi.cast('double', smallestTimeStep) handle = lib.simRMLPos(dofs, smallestTimeStep, flags, currentPosVelAccel, maxVelAccelJerk, selection, targetPosVel, ffi.NULL) _check_return(handle) return handle
def simRMLVel(dofs, smallestTimeStep, flags, currentPosVelAccel, maxAccelJerk, selection, targetVel): handle = lib.simRMLVel(dofs, smallestTimeStep, flags, currentPosVelAccel, maxAccelJerk, selection, targetVel, ffi.NULL) _check_return(handle) return handle
def simRMLStep(handle, timeStep, dofs): newPosVelAccel = ffi.new('double[%d]' % (dofs * 3)) # timeStep = ffi.cast('double', timeStep) state = lib.simRMLStep(handle, timeStep, newPosVelAccel, ffi.NULL, ffi.NULL) _check_return(state) return state, list(newPosVelAccel)
def simRMLRemove(handle): ret = lib.simRMLRemove(handle) _check_return(ret)
def simImportMesh(fileformat, pathAndFilename, options, identicalVerticeTolerance, scalingFactor): outVerticies = ffi.new('float ***') outVerticiesCount = ffi.new('int **') outIndices = ffi.new('int ***') outIndicesCount = ffi.new('int **') outNames = ffi.new('char ***') count = lib.simImportMesh( fileformat, pathAndFilename.encode('ascii'), options, identicalVerticeTolerance, scalingFactor, outVerticies, outVerticiesCount, outIndices, outIndicesCount, ffi.NULL, outNames) _check_return(count) retVerticies = [[outVerticies[0][i][j] for j in range(outVerticiesCount[0][i])] for i in range(count)] retIndices = [[outIndices[0][i][j] for j in range(outIndicesCount[0][i])] for i in range(count)] retNames = [ffi.string(outNames[0][i]).decode('utf-8') for i in range(count)] for i in range(count): simReleaseBuffer(ffi.cast('char *', outVerticies[0][i])) simReleaseBuffer(ffi.cast('char *', outIndices[0][i])) simReleaseBuffer(outNames[0][i]) simReleaseBuffer(ffi.cast('char *', outVerticies[0])) simReleaseBuffer(ffi.cast('char *', outVerticiesCount[0])) simReleaseBuffer(ffi.cast('char *', outIndices[0])) simReleaseBuffer(ffi.cast('char *', outIndicesCount[0])) simReleaseBuffer(ffi.cast('char *', outNames[0])) return retVerticies, retIndices, retNames
def simImportShape(fileformat, pathAndFilename, options, identicalVerticeTolerance, scalingFactor): handle = lib.simImportShape( fileformat, pathAndFilename.encode('ascii'), options, identicalVerticeTolerance, scalingFactor) _check_return(handle) return handle
def simCreateMeshShape(options, shadingAngle, vertices, indices): ret = lib.simCreateMeshShape(options, shadingAngle, vertices, len(vertices), indices, len(indices), ffi.NULL) return ret
def simGetShapeMesh(shapeHandle): outVerticies = ffi.new('float **') outVerticiesCount = ffi.new('int *') outIndices = ffi.new('int **') outIndicesCount = ffi.new('int *') # outNormals is 3 times the size of outIndicesCount outNormals = ffi.new('float **')
ret = lib.simGetShapeMesh(shapeHandle, outVerticies, outVerticiesCount, outIndices, outIndicesCount, outNormals) _check_return(ret) retVerticies = [outVerticies[0][i] for i in range(outVerticiesCount[0])] retIndices = [outIndices[0][i] for i in range(outIndicesCount[0])] outNormals = [outIndices[0][i] for i in range(outIndicesCount[0] * 3)]
simReleaseBuffer(ffi.cast('char *', outVerticies[0])) simReleaseBuffer(ffi.cast('char *', outIndices[0])) simReleaseBuffer(ffi.cast('char *', outNormals[0]))
return retVerticies, retIndices, outNormals
def simGetShapeViz(shapeHandle, index): info = ffi.new('struct SShapeVizInfo *') ret = lib.simGetShapeViz(shapeHandle, index, info) _check_return(ret)
vertices = [info.vertices[i] for i in range(info.verticesSize)] indices = [info.indices[i] for i in range(info.indicesSize)] normals = [info.normals[i] for i in range(info.indicesSize * 3)] colors = list(info.colors) textureSize = info.textureRes[0] * info.textureRes[1] * 4 if textureSize == 0: texture = [] textureCoords = [] else: texture = np.frombuffer( ffi.buffer(info.texture, textureSize), np.uint8) texture = texture.tolist() textureCoords = [info.textureCoords[i] for i in range(info.indicesSize * 2)]
return SShapeVizInfo( vertices=vertices, indices=indices, normals=normals, shadingAngle=info.shadingAngle, colors=colors, texture=texture, textureId=info.textureId, textureRes=info.textureRes, textureCoords=textureCoords, textureApplyMode=info.textureApplyMode, textureOptions=info.textureOptions, )
def simConvexDecompose(shapeHandle, options, intParams, floatParams): return lib.simConvexDecompose(shapeHandle, options, intParams, floatParams)
def simGetJointMode(shapeHandle): options = ffi.new('int*') mode = lib.simGetJointMode(shapeHandle, options) _check_return(mode) return mode
def simSetJointMode(shapeHandle, mode): options = 0 ret = lib.simSetJointMode(shapeHandle, mode, options) _check_return(ret)
def simCreatePath(attributes, intParams, floatParams, color): handle = lib.simCreatePath(attributes, intParams, floatParams, color + [0.]*3 + [0.25]*3 + [0.]*3) _check_return(handle) return handle
def simAddScript(type): handle = lib.simAddScript(type) _check_return(handle) return handle
def simAssociateScriptWithObject(scriptHandle, objectHandle): ret = lib.simAssociateScriptWithObject(scriptHandle, objectHandle) _check_return(ret)
def simSetScriptText(scriptHandle, scriptText): ret = lib.simSetScriptText(scriptHandle, scriptText.encode('ascii')) _check_return(ret)
def simGetScriptText(scriptHandle): ret = lib.simGetScriptText(scriptHandle) ret = ffi.string(ret).decode('utf-8') return ret
def simGetScriptAssociatedWithObject(objectHandle): ret = lib.simGetScriptAssociatedWithObject(objectHandle) return ret
def simApplyTexture(shapeHandle, textureCoordinates, textCoordSize, texture, textureResolution, options): ret = lib.simApplyTexture(shapeHandle, textureCoordinates, textCoordSize, texture, textureResolution, options) _check_return(ret) return ret
def simCreateTexture(fileName, options): # The textureID param that is returned from simCreateTexture seems # to be incorrect (in regards to calling simGetShapeTextureId on the # generated plane). handle = lib.simCreateTexture(fileName.encode('ascii'), options, ffi.NULL, ffi.NULL, ffi.NULL, 0, ffi.NULL, ffi.NULL, ffi.NULL) _check_return(handle) return handle
def simSetShapeTexture(shapeHandle, textureId, mappingMode, options, uvScaling, position, orientation): if position is None: position = ffi.NULL if orientation is None: orientation = ffi.NULL
handle = lib.simSetShapeTexture(shapeHandle, textureId, mappingMode, options, uvScaling, position, orientation) _check_return(handle)
def simGetShapeTextureId(objectHandle): ret = lib.simGetShapeTextureId(objectHandle) _check_return(ret) return ret
def simCopyPasteObjects(objectHandles, options): handles = ffi.new('int[]', objectHandles) ret = lib.simCopyPasteObjects(handles, len(objectHandles), options) _check_return(ret) return list(handles)
def simHandleIkGroup(ikGroupHandle): ret = lib.simHandleIkGroup(ikGroupHandle) _check_return(ret) return ret
def simCheckIkGroup(ikGroupHandle, jointHandles): jointValues = ffi.new('float[%d]' % len(jointHandles)) ret = lib.simCheckIkGroup( ikGroupHandle, len(jointHandles), jointHandles, jointValues, ffi.NULL) _check_return(ret) return ret, list(jointValues)
def simComputeJacobian(ikGroupHandle, options): # Only works when joints that are in IK or hybrid mode ret = lib.simComputeJacobian(ikGroupHandle, options, ffi.NULL) _check_return(ret)
def simGetIkGroupMatrix(ikGroupHandle, options): matrixSize = ffi.new('int[2]') ret = lib.simGetIkGroupMatrix(ikGroupHandle, options, matrixSize) flatJacobian = [ret[i] for i in range(matrixSize[0] * matrixSize[1])] # matrixSize[0] represents the row count of the Jacobian. # matrixSize[0] represents the column count of the Jacobian. return flatJacobian, list(matrixSize)
def simCheckDistance(entity1Handle, entity2Handle, threshold): distanceData = ffi.new('float [7]') ret = lib.simCheckDistance( entity1Handle, entity2Handle, threshold, distanceData) _check_return(ret) return list(distanceData)
def simSetExplicitHandling(generalObjectHandle, explicitFlags): ret = lib.simSetExplicitHandling(generalObjectHandle, explicitFlags) _check_return(ret)
def simGetExplicitHandling(generalObjectHandle): flag = lib.simGetExplicitHandling(generalObjectHandle) _check_return(flag) return flag
def simUngroupShape(shapeHandle): count = ffi.new('int*') shapes = lib.simUngroupShape(shapeHandle, count) _check_null_return(shapes) handles = [shapes[i] for i in range(count[0])] # simReleaseBuffer(shapes) return handles
def simInvertMatrix(matrix): c_matrix = ffi.new('float []', matrix) ret = lib.simInvertMatrix(c_matrix) _check_return(ret) return list(c_matrix)
def simMultiplyMatrices(inMatrix1, inMatrix2): outMatrix = ffi.new('float []', len(inMatrix1)) ret = lib.simMultiplyMatrices(inMatrix1, inMatrix2, outMatrix) _check_return(ret) _check_null_return(outMatrix) return list(outMatrix)
def simGetEulerAnglesFromMatrix(rotationMatrix): eulerAngles = ffi.new('float [3]') ret = lib.simGetEulerAnglesFromMatrix(rotationMatrix, eulerAngles) _check_return(ret) _check_null_return(eulerAngles) return list(eulerAngles)
def simGetSimulationTime(): time = lib.simGetSimulationTime() _check_return(time) return time
def simSetIntegerSignal(signalName, signalValue): ret = lib.simSetIntegerSignal(signalName.encode('ascii'), signalValue) _check_return(ret)
def simGetIntegerSignal(signalName): val = ffi.new('int*') ret = lib.simGetIntegerSignal(signalName.encode('ascii'), val) _check_return(ret) return ret, val[0]
def simClearIntegerSignal(signalName): ret = lib.simClearIntegerSignal(signalName.encode('ascii')) _check_return(ret) return ret
def simSetFloatSignal(signalName, signalValue): ret = lib.simSetFloatSignal(signalName.encode('ascii'), signalValue) _check_return(ret)
def simGetFloatSignal(signalName): val = ffi.new('float*') ret = lib.simGetFloatSignal(signalName.encode('ascii'), val) _check_return(ret) return ret, val[0]
def simClearFloatSignal(signalName): ret = lib.simClearFloatSignal(signalName.encode('ascii')) _check_return(ret) return ret
def simSetDoubleSignal(signalName, signalValue): ret = lib.simSetDoubleSignal(signalName.encode('ascii'), signalValue) _check_return(ret)
def simGetDoubleSignal(signalName): val = ffi.new('double*') ret = lib.simGetDoubleSignal(signalName.encode('ascii'), val) _check_return(ret) return ret, val[0]
def simClearDoubleSignal(signalName): ret = lib.simClearDoubleSignal(signalName.encode('ascii')) _check_return(ret) return ret
def simSetStringSignal(signalName, signalValue): ret = lib.simSetStringSignal( signalName.encode('ascii'), signalValue.encode('ascii'), len(signalValue)) _check_return(ret)
def simGetStringSignal(signalName): valLen = ffi.new('int*') str_ret = lib.simGetStringSignal(signalName.encode('ascii'), valLen) if str_ret == ffi.NULL: # No value. return 0, None val = ffi.string(str_ret[0:valLen[0]]).decode('utf-8') simReleaseBuffer(ffi.cast('char *', str_ret)) return 1, val
def simClearStringSignal(signalName): ret = lib.simClearStringSignal(signalName.encode('ascii')) _check_return(ret) return ret
def simSetUserParameter(objectHandle, parameterName, parameterValue): # TODO: currently not used by PyRep. # User params functionality missing in CoppeliaSim. parameterLength = len(parameterValue) ret = lib.simSetUserParameter( objectHandle, parameterName.encode('ascii'), parameterValue.encode('ascii'), parameterLength) _check_return(ret)
def simGetUserParameter(objectHandle, parameterName): # TODO: currently not used by PyRep. # User params functionality missing in CoppeliaSim. parameterLength = ffi.new('int*') parameterValue = lib.simGetUserParameter( objectHandle, parameterName.encode('ascii'), parameterLength) _check_null_return(parameterValue) val = ffi.string((parameterValue[0][:parameterLength[0]])).decode('utf-8') simReleaseBuffer(ffi.cast('char *', parameterValue)) return val
def simCreateOctree(voxelSize, options, pointSize): ret = lib.simCreateOctree(voxelSize, options, pointSize, ffi.NULL) _check_return(ret) return ret
def simInsertVoxelsIntoOctree(octreeHandle, options, points, color, tag): if color is None: color = ffi.NULL if tag is None: tag = ffi.NULL ret = lib.simInsertVoxelsIntoOctree(octreeHandle, options, points, len(points)//3, color, tag, ffi.NULL) _check_return(ret) return ret
def simRemoveVoxelsFromOctree(octreeHandle, options, points): if points is None: points = ffi.NULL if points is ffi.NULL: pointCount = 0 else: pointCount = len(points)//3 ret = lib.simRemoveVoxelsFromOctree(octreeHandle, options, points, pointCount, ffi.NULL) _check_return(ret) return ret
def simGetOctreeVoxels(octreeHandle): pointCountPointer = ffi.new('int *') ret = lib.simGetOctreeVoxels(octreeHandle, pointCountPointer, ffi.NULL) if ret == ffi.NULL: return [] pointCount = pointCountPointer[0] return list(ret[0:pointCount*3])
def simInsertObjectIntoOctree(octreeHandle, objectHandle, options, color, tag): if color is None: color = ffi.NULL ret = lib.simInsertObjectIntoOctree(octreeHandle, objectHandle, options, color, tag, ffi.NULL) _check_return(ret) return ret
def simSubtractObjectFromOctree(octreeHandle, objectHandle, options): ret = lib.simSubtractObjectFromOctree(octreeHandle, objectHandle, options, ffi.NULL) _check_return(ret) return ret
def simCheckOctreePointOccupancy(octreeHandle, options, points): ret = lib.simCheckOctreePointOccupancy(octreeHandle, options, points, len(points)//3, ffi.NULL, ffi.NULL, ffi.NULL) _check_return(ret) if ret == 1: return True else: return False
def simGetContactInfo(contact_obj_handle, get_contact_normal): index = 0 contact_list = [] result = 1
while result > 0: if get_contact_normal: contact = ffi.new('float[9]') ext = sim_handleflag_extended else: contact = ffi.new('float[6]') ext = 0
object_handles = ffi.new('int[2]') result = lib.simGetContactInfo(sim_handle_all, contact_obj_handle, index + ext, object_handles, contact) contact_info = { "contact": list(contact), "contact_handles": list(object_handles) } contact_list.append(contact_info) index += 1 contact_list.pop(-1) # remove the all zero value return contact_list
def simGetConfigForTipPose(ikGroupHandle, jointHandles, thresholdDist, maxTimeInMs, metric, collisionPairs, jointOptions, lowLimits, ranges): jointCnt = len(jointHandles) collisionPairCnt = len(collisionPairs) // 2 collisionPairs = ffi.NULL if len(collisionPairs) == 0 else collisionPairs retConfigm = ffi.new('float[%d]' % jointCnt) reserved = ffi.NULL metric = ffi.NULL if metric is None else metric jointOptions = ffi.NULL if jointOptions is None else jointOptions ret = lib.simGetConfigForTipPose( ikGroupHandle, jointCnt, jointHandles, thresholdDist, maxTimeInMs, retConfigm, metric, collisionPairCnt, collisionPairs, jointOptions, lowLimits, ranges, reserved) _check_return(ret) _check_null_return(retConfigm) return list(retConfigm) if ret == 1 else []
def generateIkPath(ikGroupHandle, jointHandles, ptCnt, collisionPairs, jointOptions): jointCnt = len(jointHandles) collisionPairCnt = len(collisionPairs) // 2 collisionPairs = ffi.NULL if len(collisionPairs) == 0 else collisionPairs reserved = ffi.NULL jointOptions = ffi.NULL if jointOptions is None else jointOptions ret = lib.simGenerateIkPath( ikGroupHandle, jointCnt, jointHandles, ptCnt, collisionPairCnt, collisionPairs, jointOptions, reserved) return [] if ret == ffi.NULL else [ret[i] for i in range(ptCnt * jointCnt)]
def simGetDecimatedMesh(inVertices, inIndices, decimationPercent): outVerticies = ffi.new('float **') outVerticiesCount = ffi.new('int *') outIndices = ffi.new('int **') outIndicesCount = ffi.new('int *') # outNormals is 3 times the size of outIndicesCount # outNormals = ffi.new('float **')
ret = lib.simGetDecimatedMesh(inVertices, len(inVertices), inIndices, len(inIndices), outVerticies, outVerticiesCount, outIndices, outIndicesCount, decimationPercent, 0, ffi.NULL) _check_return(ret) retVerticies = [outVerticies[0][i] for i in range(outVerticiesCount[0])] retIndices = [outIndices[0][i] for i in range(outIndicesCount[0])]
simReleaseBuffer(ffi.cast('char *', outVerticies[0])) simReleaseBuffer(ffi.cast('char *', outIndices[0]))
return retVerticies, retIndices
def simComputeMassAndInertia(shapeHandle, density): ret = lib.simComputeMassAndInertia(shapeHandle, density) _check_return(ret) return ret
def simAddForce(shapeHandle, position, force): ret = lib.simAddForce(shapeHandle, position, force) _check_return(ret)
def simAddForceAndTorque(shapeHandle, force, torque): ret = lib.simAddForceAndTorque(shapeHandle, ffi.NULL if force is None else force, ffi.NULL if torque is None else torque) _check_return(ret)
def simSetLightParameters(shapeHandle, state, diffusePart=None, specularPart=None): ret = lib.simSetLightParameters(shapeHandle, state, ffi.NULL, ffi.NULL if diffusePart is None else diffusePart, ffi.NULL if specularPart is None else specularPart) _check_return(ret)
def simGetLightParameters(shapeHandle): diffusePart = ffi.new('float[3]') specularPart = ffi.new('float[3]') ret = lib.simGetLightParameters(shapeHandle, ffi.NULL, diffusePart, specularPart) _check_return(ret) return ret, list(diffusePart), list(specularPart)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410-- Additional PyRep functionality. To be placed in the CoppeliaSim root directory.
function sysCall_init()
end
function sysCall_cleanup()
end
function sysCall_addOnScriptSuspend()
end
function sysCall_addOnScriptResume()
end
function sysCall_nonSimulation()
end
function sysCall_beforeMainScript()
end
function sysCall_beforeInstanceSwitch()
end
function sysCall_afterInstanceSwitch()
end
function sysCall_beforeSimulation()
end
function sysCall_afterSimulation()
end
_getConfig=function(jh)
-- Returns the current robot configuration
local config={}
for i=1,#jh,1 do
config[i]=sim.getJointPosition(jh[i])
end
return config
end
_setConfig=function(jh, config)
-- Applies the specified configuration to the robot
if config then
for i=1,#jh,1 do
sim.setJointPosition(jh[i],config[i])
end
end
end
_getConfigDistance=function(jointHandles,config1,config2)
-- Returns the distance (in configuration space) between two configurations
local d=0
for i=1,#jointHandles,1 do
-- TODO *metric[i] should be here to give a weight to each joint.
local dx=(config1[i]-config2[i])*1.0
d=d+dx*dx
end
return math.sqrt(d)
end
_sliceFromOffset=function(array, offset)
sliced = {}
for i=1,#array-offset,1 do
sliced[i] = array[i+offset]
end
return sliced
end
_findPath=function(goalConfigs,cnt,jointHandles,algorithm,collisionPairs)
-- Here we do path planning between the specified start and goal configurations. We run the search cnt times,
-- and return the shortest path, and its length
local startConfig = _getConfig(jointHandles)
local task=simOMPL.createTask('task')
simOMPL.setVerboseLevel(task, 0)
alg = _getAlgorithm(algorithm)
simOMPL.setAlgorithm(task,alg)
local jSpaces={}
for i=1,#jointHandles,1 do
jh = jointHandles[i]
cyclic, interval = sim.getJointInterval(jh)
-- If there are huge intervals, then limit them
if interval[1] < -6.28 and interval[2] > 6.28 then
pos=sim.getJointPosition(jh)
interval[1] = -6.28
interval[2] = 6.28
end
local proj=i
if i>3 then proj=0 end
jSpaces[i]=simOMPL.createStateSpace('j_space'..i,simOMPL.StateSpaceType.joint_position,jh,{interval[1]},{interval[2]},proj)
end
simOMPL.setStateSpace(task, jSpaces)
if collisionPairs ~= nil then
simOMPL.setCollisionPairs(task, collisionPairs)
end
simOMPL.setStartState(task, startConfig)
simOMPL.setGoalState(task, goalConfigs[1])
for i=2,#goalConfigs,1 do
simOMPL.addGoalState(task,goalConfigs[i])
end
local path=nil
local l=999999999999
for i=1,cnt,1 do
search_time = 4
local res,_path=simOMPL.compute(task,search_time,-1,300)
-- Path can sometimes touch on invalid state during simplifying
if res and _path then
local is_valid=true
local jhl=#jointHandles
local pc=#_path/jhl
for i=1,pc-1,1 do
local config={}
for j=1,jhl,1 do
config[j]=_path[(i-1)*jhl+j]
end
is_valid=simOMPL.isStateValid(task, config)
if not is_valid then
break
end
end
if is_valid then
local _l=_getPathLength(_path, jointHandles)
if _l<l then
l=_l
path=_path
end
end
end
end
simOMPL.destroyTask(task)
return path,l
end
_getAlgorithm=function(algorithm)
-- Returns correct algorithm functions from user string
alg = nil
if algorithm == 'BiTRRT' then
alg = simOMPL.Algorithm.BiTRRT
elseif algorithm == 'BITstar' then
alg = simOMPL.Algorithm.BITstar
elseif algorithm == 'BKPIECE1' then
alg = simOMPL.Algorithm.BKPIECE1
elseif algorithm == 'CForest' then
alg = simOMPL.Algorithm.CForest
elseif algorithm == 'EST' then
alg = simOMPL.Algorithm.EST
elseif algorithm == 'FMT' then
alg = simOMPL.Algorithm.FMT
elseif algorithm == 'KPIECE1' then
alg = simOMPL.Algorithm.KPIECE1
elseif algorithm == 'LazyPRM' then
alg = simOMPL.Algorithm.LazyPRM
elseif algorithm == 'LazyPRMstar' then
alg = simOMPL.Algorithm.LazyPRMstar
elseif algorithm == 'LazyRRT' then
alg = simOMPL.Algorithm.LazyRRT
elseif algorithm == 'LBKPIECE1' then
alg = simOMPL.Algorithm.LBKPIECE1
elseif algorithm == 'LBTRRT' then
alg = simOMPL.Algorithm.LBTRRT
elseif algorithm == 'PDST' then
alg = simOMPL.Algorithm.PDST
elseif algorithm == 'PRM' then
alg = simOMPL.Algorithm.PRM
elseif algorithm == 'PRMstar' then
alg = simOMPL.Algorithm.PRMstar
elseif algorithm == 'pRRT' then
alg = simOMPL.Algorithm.pRRT
elseif algorithm == 'pSBL' then
alg = simOMPL.Algorithm.pSBL
elseif algorithm == 'RRT' then
alg = simOMPL.Algorithm.RRT
elseif algorithm == 'RRTConnect' then
alg = simOMPL.Algorithm.RRTConnect
elseif algorithm == 'RRTstar' then
alg = simOMPL.Algorithm.RRTstar
elseif algorithm == 'SBL' then
alg = simOMPL.Algorithm.SBL
elseif algorithm == 'SPARS' then
alg = simOMPL.Algorithm.SPARS
elseif algorithm == 'SPARStwo' then
alg = simOMPL.Algorithm.SPARStwo
elseif algorithm == 'STRIDE' then
alg = simOMPL.Algorithm.STRIDE
elseif algorithm == 'TRRT' then
alg = simOMPL.Algorithm.TRRT
end
return alg
end
_getPathLength=function(path, jointHandles)
-- Returns the length of the path in configuration space
local d=0
local l=#jointHandles
local pc=#path/l
for i=1,pc-1,1 do
local config1, config2 = _beforeAfterConfigFromPath(path, i, l)
d=d+_getConfigDistance(jointHandles,config1,config2)
end
return d
end
_beforeAfterConfigFromPath=function(path, path_index, num_handles)
local config1 = {}
local config2 = {}
for i=1,num_handles,1 do
config1[i] = path[(path_index-1)*num_handles+i]
config2[i] = path[path_index*num_handles+i]
end
return config1, config2
end
_getPoseOnPath=function(pathHandle, relativeDistance)
local pos = sim.getPositionOnPath(pathHandle, relativeDistance)
local ori = sim.getOrientationOnPath(pathHandle, relativeDistance)
return pos, ori
end
getNonlinearPath=function(inInts,inFloats,inStrings,inBuffer)
algorithm = inStrings[1]
collisionHandle = inInts[1]
ignoreCollisions = inInts[2]
searchCntPerGoalConfig = inInts[3]
jointHandles = _sliceFromOffset(inInts, 3)
collisionPairs={collisionHandle, sim.handle_all}
if ignoreCollisions==1 then
collisionPairs=nil
end
local configCnt = #inFloats/#jointHandles
goalConfigs = {}
for i=1,configCnt,1 do
local config={}
for j=1,#jointHandles,1 do
table.insert(config, inFloats[((i-1) * #jointHandles)+j])
end
table.insert(goalConfigs, config)
end
-- Search a path from current config to a goal config.
path = _findPath(goalConfigs, searchCntPerGoalConfig, jointHandles, algorithm, collisionPairs)
if path == nil then
path = {}
end
return {},path,{},''
end
getPathFromCartesianPath=function(inInts,inFloats,inStrings,inBuffer)
pathHandle = inInts[1]
ikGroup = inInts[2]
ikTarget = inInts[3]
jointHandles = _sliceFromOffset(inInts, 3)
collisionPairs = nil--{collisionHandle, sim.handle_all}
orientationCorrection = inFloats
local initIkPos = sim.getObjectPosition(ikTarget, -1)
local initIkOri = sim.getObjectOrientation(ikTarget, -1)
local originalConfig = _getConfig(jointHandles)
local i = 0.05
local fullPath = {}
local failed = false
while i <= 1.0 do
pos, ori = _getPoseOnPath(pathHandle, i)
sim.setObjectPosition(ikTarget, -1, pos)
sim.setObjectOrientation(ikTarget, -1, ori)
intermediatePath = sim.generateIkPath(ikGroup,jointHandles,20,collisionPairs)
if intermediatePath == nil then
failed = true
break
end
for j=1,#intermediatePath,1 do
table.insert(fullPath, intermediatePath[j])
end
newConfig = {}
for j=#intermediatePath-#jointHandles+1,#intermediatePath,1 do
table.insert(newConfig, intermediatePath[j])
end
_setConfig(jointHandles, newConfig)
i = i + 0.05
end
_setConfig(jointHandles, originalConfig)
sim.setObjectPosition(ikTarget, -1, initIkPos)
sim.setObjectOrientation(ikTarget, -1, initIkOri)
if failed then
fullPath = {}
end
return {},fullPath,{},''
end
insertPathControlPoint=function(inInts,inFloats,inStrings,inBuffer)
local handle = inInts[1]
local ptCnt = inInts[2]
local floatSkip = 6
local ptData = {}
for i=1,ptCnt,1 do
local offset = (i-1)*floatSkip
local ctrPos = {inFloats[offset+1], inFloats[offset+2], inFloats[offset+3]}
local ctrOri = {inFloats[offset+4], inFloats[offset+5], inFloats[offset+6]}
local vel = 0
local virDist = 0
local bezierPointsAtControl = 20
local bazierInterpolFactor1 = 0.990
local bazierInterpolFactor2 = 0.990
local auxFlags = 0
table.insert(ptData, ctrPos[1])
table.insert(ptData, ctrPos[2])
table.insert(ptData, ctrPos[3])
table.insert(ptData, ctrOri[1])
table.insert(ptData, ctrOri[2])
table.insert(ptData, ctrOri[3])
table.insert(ptData, vel)
table.insert(ptData, virDist)
table.insert(ptData, bezierPointsAtControl)
table.insert(ptData, bazierInterpolFactor1)
table.insert(ptData, bazierInterpolFactor2)
end
res = sim.insertPathCtrlPoints(handle, 0, 0, ptCnt, ptData)
return {},{},{},''
end
getBoxAdjustedMatrixAndFacingAngle=function(inInts,inFloats,inStrings,inBuffer)
local baseHandle = inInts[1]
local targetHandle = inInts[2]
local p2=sim.getObjectPosition(targetHandle,-1)
local p1=sim.getObjectPosition(baseHandle,-1)
local p={p2[1]-p1[1],p2[2]-p1[2],p2[3]-p1[3]}
local pl=math.sqrt(p[1]*p[1]+p[2]*p[2]+p[3]*p[3])
p[1]=p[1]/pl
p[2]=p[2]/pl
p[3]=p[3]/pl
local m=sim.getObjectMatrix(targetHandle,-1)
local matchingScore=0
for i=1,3,1 do
v={m[0+i],m[4+i],m[8+i]}
score=v[1]*p[1]+v[2]*p[2]+v[3]*p[3]
if (math.abs(score)>matchingScore) then
s=1
if (score<0) then s=-1 end
matchingScore=math.abs(score)
bestMatch={v[1]*s,v[2]*s,v[3]*s}
end
end
angle=math.atan2(bestMatch[2],bestMatch[1])
m=sim.buildMatrix(p2,{0,0,angle})
table.insert(m,angle-math.pi/2)
return {},m,{},''
end
getNonlinearPathMobile=function(inInts,inFloats,inStrings,inBuffer)
algorithm = inStrings[1]
robotHandle = inInts[1]
targetHandle = inInts[2]
collisionHandle=inInts[3]
ignoreCollisions=inInts[4]
bd=inFloats[1]
path_pts=inInts[5]
collisionPairs={collisionHandle,sim.handle_all}
if ignoreCollisions==1 then
collisionPairs=nil
end
t=simOMPL.createTask('t')
simOMPL.setVerboseLevel(t, 0)
ss=simOMPL.createStateSpace('2d',simOMPL.StateSpaceType.dubins,robotHandle,{-bd,-bd},{bd,bd},1)
state_h = simOMPL.setStateSpace(t,{ss})
simOMPL.setDubinsParams(ss,0.1,true)
simOMPL.setAlgorithm(t,_getAlgorithm(algorithm))
if collisionPairs ~= nil then
simOMPL.setCollisionPairs(t, collisionPairs)
end
startpos=sim.getObjectPosition(robotHandle,-1)
startorient=sim.getObjectOrientation(robotHandle,-1)
startpose={startpos[1],startpos[2],startorient[3]}
simOMPL.setStartState(t,startpose)
goalpos=sim.getObjectPosition(targetHandle,-1)
goalorient=sim.getObjectOrientation(targetHandle,-1)
goalpose={goalpos[1],goalpos[2],goalorient[3]}
simOMPL.setGoalState(t,goalpose)
r,path=simOMPL.compute(t,4,-1,path_pts)
simOMPL.destroyTask(t)
return {},path,{},''
end
handleSpherical=function(inInts,inFloats,inStrings,inBuffer)
local depth_handle=inInts[1]
local rgb_handle=inInts[2]
local six_sensor_handles = {inInts[3], inInts[4], inInts[5], inInts[6], inInts[7], inInts[8]}
simVision.handleSpherical(rgb_handle, six_sensor_handles, 360, 180, depth_handle)
return {},{},{},''
end1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726# This file is automatically generated by generate_simConst.py from simConst.h
SIM_PROGRAM_VERSION_NB = 40100SIM_PROGRAM_REVISION_NB = 1SIMX_VERSION = 11SIMX_HEADER_SIZE = 18simx_headeroffset_crc = 0simx_headeroffset_version = 2simx_headeroffset_message_id = 3simx_headeroffset_client_time = 7simx_headeroffset_server_time = 11simx_headeroffset_scene_id = 15simx_headeroffset_server_state = 17SIMX_SUBHEADER_SIZE = 26simx_cmdheaderoffset_mem_size = 0simx_cmdheaderoffset_full_mem_size = 4simx_cmdheaderoffset_pdata_offset0 = 8simx_cmdheaderoffset_pdata_offset1 = 10simx_cmdheaderoffset_cmd = 14simx_cmdheaderoffset_delay_or_split = 18simx_cmdheaderoffset_sim_time = 20simx_cmdheaderoffset_status = 24simx_cmdheaderoffset_reserved = 25sim_object_shape_type = 0sim_object_joint_type = 1sim_object_graph_type = 2sim_object_camera_type = 3sim_object_dummy_type = 4sim_object_proximitysensor_type = 5sim_object_reserved1 = 6sim_object_reserved2 = 7sim_object_path_type = 8sim_object_visionsensor_type = 9sim_object_reserved3 = 10sim_object_mill_type = 11sim_object_forcesensor_type = 12sim_object_light_type = 13sim_object_mirror_type = 14sim_object_octree_type = 15sim_object_pointcloud_type = 16sim_object_type_end = 108
sim_appobj_object_type = 109sim_appobj_collision_type = 110sim_appobj_distance_type = 111sim_appobj_simulation_type = 112sim_appobj_ik_type = 113sim_appobj_constraintsolver_type_old = 114sim_appobj_collection_type = 115sim_appobj_ui_type = 116sim_appobj_script_type = 117sim_appobj_pathplanning_type = 118sim_appobj_RESERVED_type = 119sim_appobj_texture_type = 120sim_appobj_motionplanning_type_old = 121
sim_ik_pseudo_inverse_method = 0sim_ik_damped_least_squares_method = 1sim_ik_jacobian_transpose_method = 2
sim_ik_x_constraint = 1sim_ik_y_constraint = 2sim_ik_z_constraint = 4sim_ik_alpha_beta_constraint = 8sim_ik_gamma_constraint = 16sim_ik_avoidance_constraint_old = 64
sim_ikresult_not_performed = 0sim_ikresult_success = 1sim_ikresult_fail = 2
sim_light_omnidirectional_subtype = 1sim_light_spot_subtype = 2sim_light_directional_subtype = 3sim_joint_revolute_subtype = 10sim_joint_prismatic_subtype = 11sim_joint_spherical_subtype = 12sim_shape_simpleshape_subtype = 20sim_shape_multishape_subtype = 21sim_proximitysensor_pyramid_subtype = 30sim_proximitysensor_cylinder_subtype = 31sim_proximitysensor_disc_subtype = 32sim_proximitysensor_cone_subtype = 33sim_proximitysensor_ray_subtype = 34sim_mill_pyramid_subtype = 40sim_mill_cylinder_subtype = 41sim_mill_disc_subtype = 42sim_mill_cone_subtype = 43sim_object_no_subtype = 200
sim_objectspecialproperty_collidable = 1sim_objectspecialproperty_measurable = 2sim_objectspecialproperty_detectable_ultrasonic = 16sim_objectspecialproperty_detectable_infrared = 32sim_objectspecialproperty_detectable_laser = 64sim_objectspecialproperty_detectable_inductive = 128sim_objectspecialproperty_detectable_capacitive = 256sim_objectspecialproperty_renderable = 512sim_objectspecialproperty_detectable_all = 496sim_objectspecialproperty_cuttable_old = 1024sim_objectspecialproperty_pathplanning_ignored = 2048
sim_modelproperty_not_collidable = 1sim_modelproperty_not_measurable = 2sim_modelproperty_not_renderable = 4sim_modelproperty_not_detectable = 8sim_modelproperty_not_cuttable_old = 16sim_modelproperty_not_dynamic = 32sim_modelproperty_not_respondable = 64sim_modelproperty_not_reset = 128sim_modelproperty_not_visible = 256sim_modelproperty_scripts_inactive = 512sim_modelproperty_not_showasinsidemodel = 1024sim_modelproperty_not_model = 61440
sim_message_ui_button_state_change = 0sim_message_reserved9 = 1sim_message_object_selection_changed = 2sim_message_reserved10 = 3sim_message_model_loaded = 4sim_message_reserved11 = 5sim_message_keypress = 6sim_message_bannerclicked = 7sim_message_scene_loaded = 8sim_message_prox_sensor_select_down = 9sim_message_prox_sensor_select_up = 10sim_message_pick_select_down = 11sim_message_for_c_api_only_start = 256sim_message_reserved1 = 257sim_message_reserved2 = 258sim_message_reserved3 = 259sim_message_eventcallback_scenesave = 260sim_message_eventcallback_modelsave = 261sim_message_eventcallback_moduleopen = 262sim_message_eventcallback_modulehandle = 263sim_message_eventcallback_moduleclose = 264sim_message_reserved4 = 265sim_message_reserved5 = 266sim_message_reserved6 = 267sim_message_reserved7 = 268sim_message_eventcallback_instancepass = 269sim_message_eventcallback_broadcast = 270sim_message_eventcallback_imagefilter_enumreset = 271sim_message_eventcallback_imagefilter_enumerate = 272sim_message_eventcallback_imagefilter_adjustparams = 273sim_message_eventcallback_imagefilter_reserved = 274sim_message_eventcallback_imagefilter_process = 275sim_message_eventcallback_reserved1 = 276sim_message_eventcallback_reserved2 = 277sim_message_eventcallback_reserved3 = 278sim_message_eventcallback_reserved4 = 279sim_message_eventcallback_abouttoundo = 280sim_message_eventcallback_undoperformed = 281sim_message_eventcallback_abouttoredo = 282sim_message_eventcallback_redoperformed = 283sim_message_eventcallback_scripticondblclick = 284sim_message_eventcallback_simulationabouttostart = 285sim_message_eventcallback_simulationended = 286sim_message_eventcallback_reserved5 = 287sim_message_eventcallback_keypress = 288sim_message_eventcallback_modulehandleinsensingpart = 289sim_message_eventcallback_renderingpass = 290sim_message_eventcallback_bannerclicked = 291sim_message_eventcallback_menuitemselected = 292sim_message_eventcallback_refreshdialogs = 293sim_message_eventcallback_sceneloaded = 294sim_message_eventcallback_modelloaded = 295sim_message_eventcallback_instanceswitch = 296sim_message_eventcallback_guipass = 297sim_message_eventcallback_mainscriptabouttobecalled = 298sim_message_eventcallback_rmlposition = 299sim_message_eventcallback_rmlvelocity = 300sim_message_eventcallback_reserved18 = 301sim_message_eventcallback_reserved19 = 302sim_message_eventcallback_pathplanningplugin = 303sim_message_eventcallback_colladaplugin = 304sim_message_eventcallback_opengl = 305sim_message_eventcallback_openglframe = 306sim_message_eventcallback_openglcameraview = 307sim_message_eventcallback_proxsensorselectdown = 308sim_message_eventcallback_proxsensorselectup = 309sim_message_eventcallback_pickselectdown = 310sim_message_eventcallback_rmlpos = 311sim_message_eventcallback_rmlvel = 312sim_message_eventcallback_rmlstep = 313sim_message_eventcallback_rmlremove = 314sim_message_eventcallback_rmlinfo = 315sim_message_eventcallback_beforerendering = 316sim_message_eventcallback_extrenderer_start = 317sim_message_eventcallback_extrenderer_light = 318sim_message_eventcallback_extrenderer_mesh = 319sim_message_eventcallback_extrenderer_stop = 320sim_message_eventcallback_reserved6 = 321sim_message_eventcallback_reserved7 = 322sim_message_eventcallback_reserved8 = 323sim_message_eventcallback_reserved9 = 324sim_message_eventcallback_reserved10 = 325sim_message_eventcallback_reserved11 = 326sim_message_eventcallback_reserved12 = 327sim_message_eventcallback_reserved13 = 328sim_message_eventcallback_reserved14 = 329sim_message_eventcallback_reserved15 = 330sim_message_eventcallback_reserved16 = 331sim_message_eventcallback_reserved17 = 332sim_message_eventcallback_extrenderer_triangles = 333sim_message_eventcallback_simulationabouttoend = 334sim_message_eventcallback_instanceabouttoswitch = 335sim_message_eventcallback_lastinstancepass = 336sim_message_eventcallback_uipass = 337sim_message_simulation_start_resume_request = 4096sim_message_simulation_pause_request = 4097sim_message_simulation_stop_request = 4098
sim_displayattribute_renderpass = 1sim_displayattribute_depthpass = 2sim_displayattribute_pickpass = 4sim_displayattribute_selected = 8sim_displayattribute_groupselection_old = 16sim_displayattribute_mainselection = 32sim_displayattribute_forcewireframe = 64sim_displayattribute_forbidwireframe = 128sim_displayattribute_forbidedges = 256sim_displayattribute_originalcolors = 512sim_displayattribute_ignorelayer = 1024sim_displayattribute_forvisionsensor = 2048sim_displayattribute_colorcodedpickpass = 4096sim_displayattribute_colorcoded = 8192sim_displayattribute_trianglewireframe = 16384sim_displayattribute_inertiaonly = 32768sim_displayattribute_thickEdges = 65536sim_displayattribute_dynamiccontentonly = 131072sim_displayattribute_mirror = 262144sim_displayattribute_useauxcomponent = 524288sim_displayattribute_ignorerenderableflag = 1048576sim_displayattribute_noopenglcallbacks = 2097152sim_displayattribute_FREE = 4194304sim_displayattribute_noghosts = 8388608sim_displayattribute_nopointclouds = 16777216sim_displayattribute_nodrawingobjects = 33554432sim_displayattribute_noparticles = 67108864sim_displayattribute_colorcodedtriangles = 134217728
sim_objectproperty_reserved1 = 0sim_objectproperty_reserved2 = 1sim_objectproperty_reserved3 = 2sim_objectproperty_reserved4 = 3sim_objectproperty_reserved5 = 4sim_objectproperty_reserved6 = 8sim_objectproperty_collapsed = 16sim_objectproperty_selectable = 32sim_objectproperty_reserved7 = 64sim_objectproperty_selectmodelbaseinstead = 128sim_objectproperty_dontshowasinsidemodel = 256sim_objectproperty_canupdatedna = 1024sim_objectproperty_selectinvisible = 2048sim_objectproperty_depthinvisible = 4096sim_objectproperty_cannotdelete = 8192sim_objectproperty_cannotdeleteduringsim = 16384
sim_lua_arg_nil = 0sim_lua_arg_bool = 1sim_lua_arg_int = 2sim_lua_arg_float = 3sim_lua_arg_string = 4sim_lua_arg_invalid = 5sim_lua_arg_charbuff = 6sim_lua_arg_double = 7sim_lua_arg_table = 8
sim_script_arg_null = 0sim_script_arg_bool = 1sim_script_arg_int32 = 2sim_script_arg_float = 3sim_script_arg_string = 4sim_script_arg_invalid = 5sim_script_arg_charbuff = 6sim_script_arg_double = 7sim_script_arg_table = 8
sim_ui_menu_title = 1sim_ui_menu_minimize = 2sim_ui_menu_close = 4sim_ui_menu_systemblock = 8
sim_ui_property_visible = 1sim_ui_property_visibleduringsimulationonly = 2sim_ui_property_moveable = 4sim_ui_property_relativetoleftborder = 8sim_ui_property_relativetotopborder = 16sim_ui_property_fixedwidthfont = 32sim_ui_property_systemblock = 64sim_ui_property_settocenter = 128sim_ui_property_rolledup = 256sim_ui_property_selectassociatedobject = 512sim_ui_property_visiblewhenobjectselected = 1024sim_ui_property_systemblockcanmovetofront = 2048sim_ui_property_pauseactive = 4096
sim_buttonproperty_button = 0sim_buttonproperty_label = 1sim_buttonproperty_slider = 2sim_buttonproperty_editbox = 3sim_buttonproperty_staydown = 8sim_buttonproperty_enabled = 16sim_buttonproperty_borderless = 32sim_buttonproperty_horizontallycentered = 64sim_buttonproperty_ignoremouse = 128sim_buttonproperty_isdown = 256sim_buttonproperty_transparent = 512sim_buttonproperty_nobackgroundcolor = 1024sim_buttonproperty_rollupaction = 2048sim_buttonproperty_closeaction = 4096sim_buttonproperty_verticallycentered = 8192sim_buttonproperty_downupevent = 16384
sim_simulation_stopped = 0sim_simulation_paused = 8sim_simulation_advancing = 16sim_simulation_advancing_firstafterstop = 16sim_simulation_advancing_running = 17sim_simulation_advancing_lastbeforepause = 19sim_simulation_advancing_firstafterpause = 20sim_simulation_advancing_abouttostop = 21sim_simulation_advancing_lastbeforestop = 22
sim_script_no_error = 0sim_script_main_script_nonexistent = 1sim_script_main_script_not_called = 2sim_script_reentrance_error = 4sim_script_lua_error = 8sim_script_call_error = 16
sim_scripttype_mainscript = 0sim_scripttype_childscript = 1sim_scripttype_addonscript = 2sim_scripttype_addonfunction = 3sim_scripttype_jointctrlcallback_old = 4sim_scripttype_contactcallback_old = 5sim_scripttype_customizationscript = 6sim_scripttype_generalcallback_old = 7sim_scripttype_sandboxscript = 8sim_scripttype_threaded = 240
sim_syscb_init = 0sim_syscb_cleanup = 1sim_syscb_nonsimulation = 2sim_syscb_beforesimulation = 3sim_syscb_aftersimulation = 4sim_syscb_actuation = 5sim_syscb_sensing = 6sim_syscb_suspended = 7sim_syscb_suspend = 8sim_syscb_resume = 9sim_syscb_beforeinstanceswitch = 10sim_syscb_afterinstanceswitch = 11sim_syscb_beforecopy = 12sim_syscb_aftercopy = 13sim_syscb_aos_run = 14sim_syscb_aos_suspend = 15sim_syscb_aos_resume = 16sim_syscb_jointcallback = 17sim_syscb_contactcallback = 18sim_syscb_customcallback1 = 19sim_syscb_customcallback2 = 20sim_syscb_customcallback3 = 21sim_syscb_customcallback4 = 22sim_syscb_beforedelete = 23sim_syscb_afterdelete = 24sim_syscb_aftercreate = 25sim_syscb_threadmain = 26sim_syscb_dyncallback = 27sim_syscb_beforemainscript = 28sim_syscb_vision = 29sim_syscb_trigger = 30sim_syscb_userconfig = 31sim_syscb_xr = 200sim_syscb_br = 200
sim_customizationscriptattribute_activeduringsimulation = 0sim_scriptattribute_executionorder = 1sim_scriptattribute_executioncount = 2sim_childscriptattribute_automaticcascadingcalls = 3sim_scriptattribute_enabled = 4sim_childscriptattribute_enabled = 4sim_customizationscriptattribute_cleanupbeforesave = 5sim_scriptattribute_debuglevel = 6sim_scriptattribute_scripttype = 7
sim_scriptexecorder_first = 0sim_scriptexecorder_normal = 1sim_scriptexecorder_last = 2
sim_scripttreetraversal_reverse = 0sim_scripttreetraversal_forward = 1sim_scripttreetraversal_parent = 2
sim_scriptdebug_none = 0sim_scriptdebug_syscalls = 1sim_scriptdebug_vars_interval = 2sim_scriptdebug_allcalls = 3sim_scriptdebug_vars = 4sim_scriptdebug_callsandvars = 5
sim_scriptthreadresume_launch = -2sim_scriptthreadresume_allnotyetresumed = -1sim_scriptthreadresume_default = 0sim_scriptthreadresume_actuation_first = 1sim_scriptthreadresume_actuation_last = 2sim_scriptthreadresume_sensing_first = 3sim_scriptthreadresume_sensing_last = 4sim_scriptthreadresume_custom = 5
sim_callbackid_rossubscriber = 1sim_callbackid_dynstep = 2sim_callbackid_userdefined = 1000
sim_api_error_report = 1sim_api_error_output = 2sim_api_warning_output = 4sim_api_errormessage_ignore = 0sim_api_errormessage_report = 1sim_api_errormessage_output = 2
sim_handle_all = -2sim_handle_all_except_explicit = -3sim_handle_self = -4sim_handle_main_script = -5sim_handle_tree = -6sim_handle_chain = -7sim_handle_single = -8sim_handle_default = -9sim_handle_all_except_self = -10sim_handle_parent = -11sim_handle_scene = -12sim_handle_app = -13
sim_handleflag_assembly = 4194304sim_handleflag_togglevisibility = 4194304sim_handleflag_extended = 4194304sim_handleflag_greyscale = 4194304sim_handleflag_codedstring = 4194304sim_handleflag_wxyzquaternion = 4194304sim_handleflag_reljointbaseframe = 4194304sim_handleflag_abscoords = 8388608sim_handleflag_depthbuffer = 8388608sim_handleflag_depthbuffermeters = 8388608sim_handleflag_keeporiginal = 4194304sim_handleflag_camera = 4194304sim_handleflag_altname = 4194304sim_handleflag_axis = 4194304sim_handleflag_resetforce = 4194304sim_handleflag_resettorque = 8388608sim_handleflag_resetforcetorque = 12582912sim_handleflag_model = 8388608sim_handleflag_rawvalue = 16777216sim_handleflag_silenterror = 33554432
sim_distcalcmethod_dl = 0sim_distcalcmethod_dac = 1sim_distcalcmethod_max_dl_dac = 2sim_distcalcmethod_dl_and_dac = 3sim_distcalcmethod_sqrt_dl2_and_dac2 = 4sim_distcalcmethod_dl_if_nonzero = 5sim_distcalcmethod_dac_if_nonzero = 6
sim_dlgstyle_message = 0sim_dlgstyle_input = 1sim_dlgstyle_ok = 2sim_dlgstyle_ok_cancel = 3sim_dlgstyle_yes_no = 4sim_dlgstyle_dont_center = 32
sim_dlgret_still_open = 0sim_dlgret_ok = 1sim_dlgret_cancel = 2sim_dlgret_yes = 3sim_dlgret_no = 4
sim_pathproperty_show_line = 1sim_pathproperty_show_orientation = 2sim_pathproperty_closed_path = 4sim_pathproperty_automatic_orientation = 8sim_pathproperty_invert_velocity_deprecated = 16sim_pathproperty_infinite_acceleration_deprecated = 32sim_pathproperty_flat_path = 64sim_pathproperty_show_position = 128sim_pathproperty_auto_velocity_profile_translation_deprecated = 256sim_pathproperty_auto_velocity_profile_rotation_deprecated = 512sim_pathproperty_endpoints_at_zero_deprecated = 1024sim_pathproperty_keep_x_up = 2048
sim_drawing_points = 0sim_drawing_lines = 1sim_drawing_triangles = 2sim_drawing_trianglepoints = 3sim_drawing_quadpoints = 4sim_drawing_discpoints = 5sim_drawing_cubepoints = 6sim_drawing_spherepoints = 7sim_drawing_itemcolors = 32sim_drawing_vertexcolors = 64sim_drawing_itemsizes = 128sim_drawing_backfaceculling = 256sim_drawing_wireframe = 512sim_drawing_painttag = 1024sim_drawing_followparentvisibility = 2048sim_drawing_cyclic = 4096sim_drawing_50percenttransparency = 8192sim_drawing_25percenttransparency = 16384sim_drawing_12percenttransparency = 32768sim_drawing_emissioncolor = 65536sim_drawing_facingcamera = 131072sim_drawing_overlay = 262144sim_drawing_itemtransparency = 524288sim_drawing_persistent = 1048576sim_drawing_auxchannelcolor1 = 2097152sim_drawing_auxchannelcolor2 = 4194304
sim_banner_left = 1sim_banner_right = 2sim_banner_nobackground = 4sim_banner_overlay = 8sim_banner_followparentvisibility = 16sim_banner_clickselectsparent = 32sim_banner_clicktriggersevent = 64sim_banner_facingcamera = 128sim_banner_fullyfacingcamera = 256sim_banner_backfaceculling = 512sim_banner_keepsamesize = 1024sim_banner_bitmapfont = 2048
sim_particle_points1 = 0sim_particle_points2 = 1sim_particle_points4 = 2sim_particle_roughspheres = 3sim_particle_spheres = 4sim_particle_respondable1to4 = 32sim_particle_respondable5to8 = 64sim_particle_particlerespondable = 128sim_particle_ignoresgravity = 256sim_particle_invisible = 512sim_particle_itemsizes = 1024sim_particle_itemdensities = 2048sim_particle_itemcolors = 4096sim_particle_cyclic = 8192sim_particle_emissioncolor = 16384sim_particle_water = 32768sim_particle_painttag = 65536
sim_boolparam_hierarchy_visible = 0sim_boolparam_console_visible = 1sim_boolparam_collision_handling_enabled = 2sim_boolparam_distance_handling_enabled = 3sim_boolparam_ik_handling_enabled = 4sim_boolparam_gcs_handling_enabled = 5sim_boolparam_dynamics_handling_enabled = 6sim_boolparam_joint_motion_handling_enabled_deprecated = 7sim_boolparam_path_motion_handling_enabled_deprecated = 8sim_boolparam_proximity_sensor_handling_enabled = 9sim_boolparam_vision_sensor_handling_enabled = 10sim_boolparam_mill_handling_enabled = 11sim_boolparam_browser_visible = 12sim_boolparam_scene_and_model_load_messages = 13sim_reserved0 = 14sim_boolparam_shape_textures_are_visible = 15sim_boolparam_display_enabled = 16sim_boolparam_infotext_visible = 17sim_boolparam_statustext_open = 18sim_boolparam_fog_enabled = 19sim_boolparam_rml2_available = 20sim_boolparam_rml4_available = 21sim_boolparam_mirrors_enabled = 22sim_boolparam_aux_clip_planes_enabled = 23sim_boolparam_reserved3 = 24sim_boolparam_realtime_simulation = 25sim_boolparam_use_glfinish_cmd = 26sim_boolparam_force_show_wireless_emission = 27sim_boolparam_force_show_wireless_reception = 28sim_boolparam_video_recording_triggered = 29sim_boolparam_reserved1 = 30sim_boolparam_reserved2 = 31sim_boolparam_threaded_rendering_enabled_old = 32sim_boolparam_fullscreen = 33sim_boolparam_headless = 34sim_boolparam_hierarchy_toolbarbutton_enabled = 35sim_boolparam_browser_toolbarbutton_enabled = 36sim_boolparam_objectshift_toolbarbutton_enabled = 37sim_boolparam_objectrotate_toolbarbutton_enabled = 38sim_boolparam_force_calcstruct_all_visible = 39sim_boolparam_force_calcstruct_all = 40sim_boolparam_exit_request = 41sim_boolparam_play_toolbarbutton_enabled = 42sim_boolparam_pause_toolbarbutton_enabled = 43sim_boolparam_stop_toolbarbutton_enabled = 44sim_boolparam_waiting_for_trigger = 45sim_boolparam_objproperties_toolbarbutton_enabled = 46sim_boolparam_calcmodules_toolbarbutton_enabled = 47sim_boolparam_rosinterface_donotrunmainscript = 48sim_boolparam_online_mode = 49sim_boolparam_xr_partrepository = 50sim_boolparam_xr_palletrepository = 51sim_boolparam_scene_closing = 52sim_boolparam_show_w_emitters = 53sim_boolparam_show_w_receivers = 54sim_boolparam_xr_jobfunc = 55
sim_intparam_error_report_mode = 0sim_intparam_program_version = 1sim_intparam_instance_count = 2sim_intparam_custom_cmd_start_id = 3sim_intparam_compilation_version = 4sim_intparam_current_page = 5sim_intparam_flymode_camera_handle = 6sim_intparam_dynamic_step_divider = 7sim_intparam_dynamic_engine = 8sim_intparam_server_port_start = 9sim_intparam_server_port_range = 10sim_intparam_visible_layers = 11sim_intparam_infotext_style = 12sim_intparam_settings = 13sim_intparam_edit_mode_type = 14sim_intparam_server_port_next = 15sim_intparam_qt_version = 16sim_intparam_event_flags_read_old = 17sim_intparam_event_flags_read_clear_old = 18sim_intparam_platform = 19sim_intparam_scene_unique_id = 20sim_intparam_work_thread_count = 21sim_intparam_mouse_x = 22sim_intparam_mouse_y = 23sim_intparam_core_count = 24sim_intparam_work_thread_calc_time_ms = 25sim_intparam_idle_fps = 26sim_intparam_prox_sensor_select_down = 27sim_intparam_prox_sensor_select_up = 28sim_intparam_stop_request_counter = 29sim_intparam_program_revision = 30sim_intparam_mouse_buttons = 31sim_intparam_dynamic_warning_disabled_mask = 32sim_intparam_simulation_warning_disabled_mask = 33sim_intparam_scene_index = 34sim_intparam_motionplanning_seed = 35sim_intparam_speedmodifier = 36sim_intparam_dynamic_iteration_count = 37sim_intparam_job_count = 38sim_intparam_program_full_version = 39sim_intparam_verbosity = 40sim_intparam_statusbarverbosity = 41sim_intparam_dlgverbosity = 42sim_intparam_videoencoder_index = 43
sim_uint64param_simulation_time_step_ns = 0sim_uint64param_simulation_time_ns = 1
sim_floatparam_rand = 0sim_floatparam_simulation_time_step = 1sim_floatparam_stereo_distance = 2sim_floatparam_dynamic_step_size = 3sim_floatparam_mouse_wheel_zoom_factor = 4
sim_stringparam_application_path = 0sim_stringparam_video_filename = 1sim_stringparam_app_arg1 = 2sim_stringparam_app_arg2 = 3sim_stringparam_app_arg3 = 4sim_stringparam_app_arg4 = 5sim_stringparam_app_arg5 = 6sim_stringparam_app_arg6 = 7sim_stringparam_app_arg7 = 8sim_stringparam_app_arg8 = 9sim_stringparam_app_arg9 = 10sim_stringparam_additional_addonscript1 = 11sim_stringparam_additional_addonscript_firstscene = 11sim_stringparam_additional_addonscript2 = 12sim_stringparam_additional_addonscript = 12sim_stringparam_scene_path_and_name = 13sim_stringparam_scene_path = 14sim_stringparam_scene_name = 15sim_stringparam_remoteapi_temp_file_dir = 16sim_stringparam_job = 17sim_stringparam_job0 = 18sim_stringparam_job99 = 117sim_stringparam_scene_unique_id = 118sim_stringparam_machine_id = 119sim_stringparam_machine_id_legacy = 120sim_stringparam_verbosity = 121sim_stringparam_statusbarverbosity = 122sim_stringparam_dlgverbosity = 123sim_stringparam_consolelogfilter = 124sim_stringparam_startupscriptstring = 125
sim_arrayparam_gravity = 0sim_arrayparam_fog = 1sim_arrayparam_fog_color = 2sim_arrayparam_background_color1 = 3sim_arrayparam_background_color2 = 4sim_arrayparam_ambient_light = 5sim_arrayparam_random_euler = 6
sim_gui_menubar = 1sim_gui_popups = 2sim_gui_toolbar1 = 4sim_gui_toolbar2 = 8sim_gui_hierarchy = 16sim_gui_infobar = 32sim_gui_statusbar = 64sim_gui_scripteditor = 128sim_gui_scriptsimulationparameters = 256sim_gui_dialogs = 512sim_gui_browser = 1024sim_gui_all = 65535sim_gui_headless = 65536sim_autostart = 131072sim_autoquit = 262144
sim_jointmode_passive = 0sim_jointmode_motion_deprecated = 1sim_jointmode_ik = 2sim_jointmode_reserved_previously_ikdependent = 3sim_jointmode_dependent = 4sim_jointmode_force = 5
sim_verbosity_useglobal = -1sim_verbosity_none = 100sim_verbosity_errors = 200sim_verbosity_warnings = 300sim_verbosity_loadinfos = 400sim_verbosity_questions = 410sim_verbosity_scripterrors = 420sim_verbosity_scriptwarnings = 430sim_verbosity_scriptinfos = 450sim_verbosity_msgs = 450sim_verbosity_infos = 500sim_verbosity_debug = 600sim_verbosity_trace = 700sim_verbosity_tracelua = 800sim_verbosity_traceall = 900sim_verbosity_default = 400sim_verbosity_undecorated = 61440
sim_moduleinfo_extversionstr = 0sim_moduleinfo_builddatestr = 1sim_moduleinfo_extversionint = 2sim_moduleinfo_verbosity = 3sim_moduleinfo_statusbarverbosity = 4
sim_navigation_passive = 0sim_navigation_camerashift = 1sim_navigation_camerarotate = 2sim_navigation_camerazoom = 3sim_navigation_cameratilt = 4sim_navigation_cameraangle = 5sim_navigation_camerafly = 6sim_navigation_objectshift = 7sim_navigation_objectrotate = 8sim_navigation_reserved2 = 9sim_navigation_reserved3 = 10sim_navigation_reserved4 = 11sim_navigation_reserved5 = 12sim_navigation_reserved6 = 13sim_navigation_createpathpoint = 256sim_navigation_clickselection = 512sim_navigation_ctrlselection = 1024sim_navigation_shiftselection = 2048sim_navigation_camerazoomwheel = 4096sim_navigation_camerarotaterightbutton = 8192sim_navigation_camerarotatemiddlebutton = 8192
simrml_phase_sync_if_possible = 0simrml_only_time_sync = 1simrml_only_phase_sync = 2simrml_no_sync = 3simrml_keep_target_vel = 0simrml_recompute_trajectory = 4simrml_disable_extremum_motion_states_calc = 8simrml_keep_current_vel_if_fallback_strategy = 16
sim_filedlg_type_load = 0sim_filedlg_type_save = 1sim_filedlg_type_load_multiple = 2sim_filedlg_type_folder = 3
sim_msgbox_type_info = 0sim_msgbox_type_question = 1sim_msgbox_type_warning = 2sim_msgbox_type_critical = 3
sim_msgbox_buttons_ok = 0sim_msgbox_buttons_yesno = 1sim_msgbox_buttons_yesnocancel = 2sim_msgbox_buttons_okcancel = 3
sim_msgbox_return_cancel = 0sim_msgbox_return_no = 1sim_msgbox_return_yes = 2sim_msgbox_return_ok = 3sim_msgbox_return_error = 4
sim_physics_bullet = 0sim_physics_ode = 1sim_physics_vortex = 2sim_physics_newton = 3
sim_pure_primitive_none = 0sim_pure_primitive_plane = 1sim_pure_primitive_disc = 2sim_pure_primitive_cuboid = 3sim_pure_primitive_spheroid = 4sim_pure_primitive_cylinder = 5sim_pure_primitive_cone = 6sim_pure_primitive_heightfield = 7
sim_dummy_linktype_dynamics_loop_closure = 0sim_dummy_linktype_dynamics_force_constraint = 1sim_dummy_linktype_gcs_loop_closure = 2sim_dummy_linktype_gcs_tip = 3sim_dummy_linktype_gcs_target = 4sim_dummy_linktype_ik_tip_target = 5sim_dummy_linktype_reserved = 6
sim_texturemap_plane = 0sim_texturemap_cylinder = 1sim_texturemap_sphere = 2sim_texturemap_cube = 3
sim_pathplanning_holonomic = 0sim_pathplanning_reserved = 1sim_pathplanning_nonholonomic = 2
sim_holonomicpathplanning_xy = 0sim_holonomicpathplanning_xg = 1sim_holonomicpathplanning_xyz = 2sim_holonomicpathplanning_xyg = 3sim_holonomicpathplanning_abg = 4sim_holonomicpathplanning_xyzg = 5sim_holonomicpathplanning_xabg = 6sim_holonomicpathplanning_xyabg = 7sim_holonomicpathplanning_xyzabg = 8
sim_lock_ui_wants_to_read = 0sim_lock_ui_wants_to_write = 1sim_lock_nonui_wants_to_write = 2
sim_colorcomponent_ambient = 0sim_colorcomponent_ambient_diffuse = 0sim_colorcomponent_diffuse = 1sim_colorcomponent_specular = 2sim_colorcomponent_emission = 3sim_colorcomponent_transparency = 4sim_colorcomponent_auxiliary = 5
sim_volume_pyramid = 0sim_volume_cylinder = 1sim_volume_disc = 2sim_volume_cone = 3sim_volume_ray = 4sim_volume_randomizedray = 5
sim_pov_pattern_null = 0sim_pov_white_marble = 1sim_pov_blood_marble = 2sim_pov_blue_agate = 3sim_pov_sapphire_agate = 4sim_pov_brown_agate = 5sim_pov_pink_granite = 6sim_pov_pink_alabaster = 7sim_pov_cherry_wood = 8sim_pov_pine_wood = 9sim_pov_dark_wood = 10sim_pov_tan_wood = 11sim_pov_white_wood = 12sim_pov_tom_wood = 13sim_pov_dmf_wood1 = 14sim_pov_dmf_wood2 = 15sim_pov_dmf_wood3 = 16sim_pov_dmf_wood4 = 17sim_pov_dmf_wood5 = 18sim_pov_dmf_wood6 = 19sim_pov_dmf_light_oak = 20sim_pov_dmf_dark_oak = 21sim_pov_emb_wood1 = 22sim_pov_yellow_pine = 23sim_pov_rose_wood = 24sim_pov_sandal_wood = 25sim_pov_glass = 26sim_pov_glass2 = 27sim_pov_glass3 = 28sim_pov_green_glass = 29sim_pov_light_glass = 30sim_pov_bold_glass = 31sim_pov_wine_bottle = 32sim_pov_beer_bottle = 33sim_pov_ruby_glass = 34sim_pov_blue_glass = 35sim_pov_yellow_glass = 36sim_pov_orange_glass = 37sim_pov_vicks_bottle_glass = 38sim_pov_chrome_metal = 39sim_pov_brass_metal = 40sim_pov_copper_metal = 41sim_pov_bronze_metal = 42sim_pov_silver_metal = 43sim_pov_gold_metal = 44sim_pov_polished_chrome = 45sim_pov_polished_brass = 46sim_pov_new_brass = 47sim_pov_spun_brass = 48sim_pov_brushed_aluminum = 49sim_pov_silver1 = 50sim_pov_silver2 = 51sim_pov_silver3 = 52sim_pov_brass_valley = 53sim_pov_rust = 54sim_pov_rusty_iron = 55sim_pov_soft_silver = 56sim_pov_new_penny = 57sim_pov_tinny_brass = 58sim_pov_gold_nugget = 59sim_pov_aluminum = 60sim_pov_bright_bronze = 61sim_pov_water = 62sim_pov_cork = 63sim_pov_lightning = 64sim_pov_mirror = 65
sim_objintparam_visibility_layer = 10sim_objfloatparam_abs_x_velocity = 11sim_objfloatparam_abs_y_velocity = 12sim_objfloatparam_abs_z_velocity = 13sim_objfloatparam_abs_rot_velocity = 14sim_objfloatparam_objbbox_min_x = 15sim_objfloatparam_objbbox_min_y = 16sim_objfloatparam_objbbox_min_z = 17sim_objfloatparam_objbbox_max_x = 18sim_objfloatparam_objbbox_max_y = 19sim_objfloatparam_objbbox_max_z = 20sim_objfloatparam_modelbbox_min_x = 21sim_objfloatparam_modelbbox_min_y = 22sim_objfloatparam_modelbbox_min_z = 23sim_objfloatparam_modelbbox_max_x = 24sim_objfloatparam_modelbbox_max_y = 25sim_objfloatparam_modelbbox_max_z = 26sim_objintparam_collection_self_collision_indicator = 27sim_objfloatparam_transparency_offset = 28sim_objintparam_child_role = 29sim_objintparam_parent_role = 30sim_objintparam_manipulation_permissions = 31sim_objintparam_illumination_handle = 32sim_objstringparam_dna = 33sim_objfloatparam_size_factor = 34sim_objstringparam_unique_id = 35sim_objintparam_visible = 36sim_objparam_end = 999sim_visionfloatparam_near_clipping = 1000sim_visionfloatparam_far_clipping = 1001sim_visionintparam_resolution_x = 1002sim_visionintparam_resolution_y = 1003sim_visionfloatparam_perspective_angle = 1004sim_visionfloatparam_ortho_size = 1005sim_visionintparam_disabled_light_components = 1006sim_visionintparam_rendering_attributes = 1007sim_visionintparam_entity_to_render = 1008sim_visionintparam_windowed_size_x = 1009sim_visionintparam_windowed_size_y = 1010sim_visionintparam_windowed_pos_x = 1011sim_visionintparam_windowed_pos_y = 1012sim_visionintparam_pov_focal_blur = 1013sim_visionfloatparam_pov_blur_distance = 1014sim_visionfloatparam_pov_aperture = 1015sim_visionintparam_pov_blur_sampled = 1016sim_visionintparam_render_mode = 1017sim_visionintparam_perspective_operation = 1018sim_jointintparam_motor_enabled = 2000sim_jointintparam_ctrl_enabled = 2001sim_jointfloatparam_pid_p = 2002sim_jointfloatparam_pid_i = 2003sim_jointfloatparam_pid_d = 2004sim_jointfloatparam_intrinsic_x = 2005sim_jointfloatparam_intrinsic_y = 2006sim_jointfloatparam_intrinsic_z = 2007sim_jointfloatparam_intrinsic_qx = 2008sim_jointfloatparam_intrinsic_qy = 2009sim_jointfloatparam_intrinsic_qz = 2010sim_jointfloatparam_intrinsic_qw = 2011sim_jointfloatparam_velocity = 2012sim_jointfloatparam_spherical_qx = 2013sim_jointfloatparam_spherical_qy = 2014sim_jointfloatparam_spherical_qz = 2015sim_jointfloatparam_spherical_qw = 2016sim_jointfloatparam_upper_limit = 2017sim_jointfloatparam_kc_k = 2018sim_jointfloatparam_kc_c = 2019sim_jointfloatparam_ik_weight = 2021sim_jointfloatparam_error_x = 2022sim_jointfloatparam_error_y = 2023sim_jointfloatparam_error_z = 2024sim_jointfloatparam_error_a = 2025sim_jointfloatparam_error_b = 2026sim_jointfloatparam_error_g = 2027sim_jointfloatparam_error_pos = 2028sim_jointfloatparam_error_angle = 2029sim_jointintparam_velocity_lock = 2030sim_jointintparam_vortex_dep_handle = 2031sim_jointfloatparam_vortex_dep_multiplication = 2032sim_jointfloatparam_vortex_dep_offset = 2033sim_shapefloatparam_init_velocity_x = 3000sim_shapefloatparam_init_velocity_y = 3001sim_shapefloatparam_init_velocity_z = 3002sim_shapeintparam_static = 3003sim_shapeintparam_respondable = 3004sim_shapefloatparam_mass = 3005sim_shapefloatparam_texture_x = 3006sim_shapefloatparam_texture_y = 3007sim_shapefloatparam_texture_z = 3008sim_shapefloatparam_texture_a = 3009sim_shapefloatparam_texture_b = 3010sim_shapefloatparam_texture_g = 3011sim_shapefloatparam_texture_scaling_x = 3012sim_shapefloatparam_texture_scaling_y = 3013sim_shapeintparam_culling = 3014sim_shapeintparam_wireframe = 3015sim_shapeintparam_compound = 3016sim_shapeintparam_convex = 3017sim_shapeintparam_convex_check = 3018sim_shapeintparam_respondable_mask = 3019sim_shapefloatparam_init_velocity_a = 3020sim_shapefloatparam_init_ang_velocity_x = 3020sim_shapefloatparam_init_velocity_b = 3021sim_shapefloatparam_init_ang_velocity_y = 3021sim_shapefloatparam_init_velocity_g = 3022sim_shapefloatparam_init_ang_velocity_z = 3022sim_shapestringparam_color_name = 3023sim_shapeintparam_edge_visibility = 3024sim_shapefloatparam_shading_angle = 3025sim_shapefloatparam_edge_angle = 3026sim_shapeintparam_edge_borders_hidden = 3027sim_proxintparam_ray_invisibility = 4000sim_proxintparam_volume_type = 4001sim_proxintparam_entity_to_detect = 4002sim_forcefloatparam_error_x = 5000sim_forcefloatparam_error_y = 5001sim_forcefloatparam_error_z = 5002sim_forcefloatparam_error_a = 5003sim_forcefloatparam_error_b = 5004sim_forcefloatparam_error_g = 5005sim_forcefloatparam_error_pos = 5006sim_forcefloatparam_error_angle = 5007sim_lightintparam_pov_casts_shadows = 8000sim_lightfloatparam_spot_exponent = 8001sim_lightfloatparam_spot_cutoff = 8002sim_lightfloatparam_const_attenuation = 8003sim_lightfloatparam_lin_attenuation = 8004sim_lightfloatparam_quad_attenuation = 8005sim_cameraintparam_disabled_light_components = 9000sim_camerafloatparam_perspective_angle = 9001sim_camerafloatparam_ortho_size = 9002sim_cameraintparam_rendering_attributes = 9003sim_cameraintparam_pov_focal_blur = 9004sim_camerafloatparam_pov_blur_distance = 9005sim_camerafloatparam_pov_aperture = 9006sim_cameraintparam_pov_blur_samples = 9007sim_camerafloatparam_near_clipping = 9008sim_camerafloatparam_far_clipping = 9009sim_dummyintparam_link_type = 10000sim_dummyintparam_follow_path = 10001sim_dummyfloatparam_follow_path_offset = 10002sim_millintparam_volume_type = 11000sim_mirrorfloatparam_width = 12000sim_mirrorfloatparam_height = 12001sim_mirrorfloatparam_reflectance = 12002sim_mirrorintparam_enable = 12003sim_pplanfloatparam_x_min = 20000sim_pplanfloatparam_x_range = 20001sim_pplanfloatparam_y_min = 20002sim_pplanfloatparam_y_range = 20003sim_pplanfloatparam_z_min = 20004sim_pplanfloatparam_z_range = 20005sim_pplanfloatparam_delta_min = 20006sim_pplanfloatparam_delta_range = 20007sim_mplanintparam_nodes_computed_old = 25000sim_mplanintparam_prepare_nodes_old = 25001sim_mplanintparam_clear_nodes_old = 25002
sim_stack_table_circular_ref = -4sim_stack_table_not_table = -3sim_stack_table_map = -2sim_stack_table_empty = 0
sim_bullet_global_float_start = 0sim_bullet_global_stepsize = 1sim_bullet_global_internalscalingfactor = 2sim_bullet_global_collisionmarginfactor = 3sim_bullet_global_float_end = 4sim_bullet_global_int_start = 1000sim_bullet_global_constraintsolvingiterations = 1001sim_bullet_global_bitcoded = 1002sim_bullet_global_constraintsolvertype = 1003sim_bullet_global_int_end = 1004sim_bullet_global_bool_start = 2000sim_bullet_global_fullinternalscaling = 2001sim_bullet_global_bool_end = 2002sim_bullet_joint_float_start = 3000sim_bullet_joint_stoperp = 3001sim_bullet_joint_stopcfm = 3002sim_bullet_joint_normalcfm = 3003sim_bullet_joint_float_end = 3004sim_bullet_joint_int_start = 4000sim_bullet_joint_int_end = 4001sim_bullet_joint_bool_start = 5000sim_bullet_joint_bool_end = 5001sim_bullet_body_float_start = 6000sim_bullet_body_restitution = 6001sim_bullet_body_oldfriction = 6002sim_bullet_body_friction = 6003sim_bullet_body_lineardamping = 6004sim_bullet_body_angulardamping = 6005sim_bullet_body_nondefaultcollisionmargingfactor = 6006sim_bullet_body_nondefaultcollisionmargingfactorconvex = 6007sim_bullet_body_float_end = 6008sim_bullet_body_int_start = 7000sim_bullet_body_bitcoded = 7001sim_bullet_body_int_end = 7002sim_bullet_body_bool_start = 8000sim_bullet_body_sticky = 8001sim_bullet_body_usenondefaultcollisionmargin = 8002sim_bullet_body_usenondefaultcollisionmarginconvex = 8003sim_bullet_body_autoshrinkconvex = 8004sim_bullet_body_bool_end = 8005sim_ode_global_float_start = 9000sim_ode_global_stepsize = 9001sim_ode_global_internalscalingfactor = 9002sim_ode_global_cfm = 9003sim_ode_global_erp = 9004sim_ode_global_float_end = 9005sim_ode_global_int_start = 10000sim_ode_global_constraintsolvingiterations = 10001sim_ode_global_bitcoded = 10002sim_ode_global_randomseed = 10003sim_ode_global_int_end = 10004sim_ode_global_bool_start = 11000sim_ode_global_fullinternalscaling = 11001sim_ode_global_quickstep = 11002sim_ode_global_bool_end = 11003sim_ode_joint_float_start = 12000sim_ode_joint_stoperp = 12001sim_ode_joint_stopcfm = 12002sim_ode_joint_bounce = 12003sim_ode_joint_fudgefactor = 12004sim_ode_joint_normalcfm = 12005sim_ode_joint_float_end = 12006sim_ode_joint_int_start = 13000sim_ode_joint_int_end = 13001sim_ode_joint_bool_start = 14000sim_ode_joint_bool_end = 14001sim_ode_body_float_start = 15000sim_ode_body_friction = 15001sim_ode_body_softerp = 15002sim_ode_body_softcfm = 15003sim_ode_body_lineardamping = 15004sim_ode_body_angulardamping = 15005sim_ode_body_float_end = 15006sim_ode_body_int_start = 16000sim_ode_body_maxcontacts = 16001sim_ode_body_int_end = 16002sim_ode_body_bool_start = 17000sim_ode_body_bool_end = 17001sim_vortex_global_float_start = 18000sim_vortex_global_stepsize = 18001sim_vortex_global_internalscalingfactor = 18002sim_vortex_global_contacttolerance = 18003sim_vortex_global_constraintlinearcompliance = 18004sim_vortex_global_constraintlineardamping = 18005sim_vortex_global_constraintlinearkineticloss = 18006sim_vortex_global_constraintangularcompliance = 18007sim_vortex_global_constraintangulardamping = 18008sim_vortex_global_constraintangularkineticloss = 18009sim_vortex_global_float_end = 18010sim_vortex_global_int_start = 19000sim_vortex_global_bitcoded = 19001sim_vortex_global_int_end = 19002sim_vortex_global_bool_start = 20000sim_vortex_global_autosleep = 20001sim_vortex_global_multithreading = 20002sim_vortex_global_bool_end = 20003sim_vortex_joint_float_start = 21000sim_vortex_joint_lowerlimitdamping = 21001sim_vortex_joint_upperlimitdamping = 21002sim_vortex_joint_lowerlimitstiffness = 21003sim_vortex_joint_upperlimitstiffness = 21004sim_vortex_joint_lowerlimitrestitution = 21005sim_vortex_joint_upperlimitrestitution = 21006sim_vortex_joint_lowerlimitmaxforce = 21007sim_vortex_joint_upperlimitmaxforce = 21008sim_vortex_joint_motorconstraintfrictioncoeff = 21009sim_vortex_joint_motorconstraintfrictionmaxforce = 21010sim_vortex_joint_motorconstraintfrictionloss = 21011sim_vortex_joint_p0loss = 21012sim_vortex_joint_p0stiffness = 21013sim_vortex_joint_p0damping = 21014sim_vortex_joint_p0frictioncoeff = 21015sim_vortex_joint_p0frictionmaxforce = 21016sim_vortex_joint_p0frictionloss = 21017sim_vortex_joint_p1loss = 21018sim_vortex_joint_p1stiffness = 21019sim_vortex_joint_p1damping = 21020sim_vortex_joint_p1frictioncoeff = 21021sim_vortex_joint_p1frictionmaxforce = 21022sim_vortex_joint_p1frictionloss = 21023sim_vortex_joint_p2loss = 21024sim_vortex_joint_p2stiffness = 21025sim_vortex_joint_p2damping = 21026sim_vortex_joint_p2frictioncoeff = 21027sim_vortex_joint_p2frictionmaxforce = 21028sim_vortex_joint_p2frictionloss = 21029sim_vortex_joint_a0loss = 21030sim_vortex_joint_a0stiffness = 21031sim_vortex_joint_a0damping = 21032sim_vortex_joint_a0frictioncoeff = 21033sim_vortex_joint_a0frictionmaxforce = 21034sim_vortex_joint_a0frictionloss = 21035sim_vortex_joint_a1loss = 21036sim_vortex_joint_a1stiffness = 21037sim_vortex_joint_a1damping = 21038sim_vortex_joint_a1frictioncoeff = 21039sim_vortex_joint_a1frictionmaxforce = 21040sim_vortex_joint_a1frictionloss = 21041sim_vortex_joint_a2loss = 21042sim_vortex_joint_a2stiffness = 21043sim_vortex_joint_a2damping = 21044sim_vortex_joint_a2frictioncoeff = 21045sim_vortex_joint_a2frictionmaxforce = 21046sim_vortex_joint_a2frictionloss = 21047sim_vortex_joint_dependencyfactor = 21048sim_vortex_joint_dependencyoffset = 21049sim_vortex_joint_float_end = 21050sim_vortex_joint_int_start = 22000sim_vortex_joint_bitcoded = 22001sim_vortex_joint_relaxationenabledbc = 22002sim_vortex_joint_frictionenabledbc = 22003sim_vortex_joint_frictionproportionalbc = 22004sim_vortex_joint_objectid = 22005sim_vortex_joint_dependentobjectid = 22006sim_vortex_joint_int_end = 22007sim_vortex_joint_bool_start = 23000sim_vortex_joint_motorfrictionenabled = 23001sim_vortex_joint_proportionalmotorfriction = 23002sim_vortex_joint_bool_end = 23003sim_vortex_body_float_start = 24000sim_vortex_body_primlinearaxisfriction = 24001sim_vortex_body_seclinearaxisfriction = 24002sim_vortex_body_primangularaxisfriction = 24003sim_vortex_body_secangularaxisfriction = 24004sim_vortex_body_normalangularaxisfriction = 24005sim_vortex_body_primlinearaxisstaticfrictionscale = 24006sim_vortex_body_seclinearaxisstaticfrictionscale = 24007sim_vortex_body_primangularaxisstaticfrictionscale = 24008sim_vortex_body_secangularaxisstaticfrictionscale = 24009sim_vortex_body_normalangularaxisstaticfrictionscale = 24010sim_vortex_body_compliance = 24011sim_vortex_body_damping = 24012sim_vortex_body_restitution = 24013sim_vortex_body_restitutionthreshold = 24014sim_vortex_body_adhesiveforce = 24015sim_vortex_body_linearvelocitydamping = 24016sim_vortex_body_angularvelocitydamping = 24017sim_vortex_body_primlinearaxisslide = 24018sim_vortex_body_seclinearaxisslide = 24019sim_vortex_body_primangularaxisslide = 24020sim_vortex_body_secangularaxisslide = 24021sim_vortex_body_normalangularaxisslide = 24022sim_vortex_body_primlinearaxisslip = 24023sim_vortex_body_seclinearaxisslip = 24024sim_vortex_body_primangularaxisslip = 24025sim_vortex_body_secangularaxisslip = 24026sim_vortex_body_normalangularaxisslip = 24027sim_vortex_body_autosleeplinearspeedthreshold = 24028sim_vortex_body_autosleeplinearaccelthreshold = 24029sim_vortex_body_autosleepangularspeedthreshold = 24030sim_vortex_body_autosleepangularaccelthreshold = 24031sim_vortex_body_skinthickness = 24032sim_vortex_body_autoangulardampingtensionratio = 24033sim_vortex_body_primaxisvectorx = 24034sim_vortex_body_primaxisvectory = 24035sim_vortex_body_primaxisvectorz = 24036sim_vortex_body_float_end = 24037sim_vortex_body_int_start = 25000sim_vortex_body_primlinearaxisfrictionmodel = 25001sim_vortex_body_seclinearaxisfrictionmodel = 25002sim_vortex_body_primangulararaxisfrictionmodel = 25003sim_vortex_body_secmangulararaxisfrictionmodel = 25004sim_vortex_body_normalmangulararaxisfrictionmodel = 25005sim_vortex_body_bitcoded = 25006sim_vortex_body_autosleepsteplivethreshold = 25007sim_vortex_body_materialuniqueid = 25008sim_vortex_body_int_end = 25009sim_vortex_body_bool_start = 26000sim_vortex_body_pureshapesasconvex = 26001sim_vortex_body_convexshapesasrandom = 26002sim_vortex_body_randomshapesasterrain = 26003sim_vortex_body_fastmoving = 26004sim_vortex_body_autoslip = 26005sim_vortex_body_seclinaxissameasprimlinaxis = 26006sim_vortex_body_secangaxissameasprimangaxis = 26007sim_vortex_body_normangaxissameasprimangaxis = 26008sim_vortex_body_autoangulardamping = 26009sim_vortex_body_bool_end = 26010sim_newton_global_float_start = 27000sim_newton_global_stepsize = 27001sim_newton_global_contactmergetolerance = 27002sim_newton_global_float_end = 27003sim_newton_global_int_start = 28000sim_newton_global_constraintsolvingiterations = 28001sim_newton_global_bitcoded = 28002sim_newton_global_int_end = 28003sim_newton_global_bool_start = 29000sim_newton_global_multithreading = 29001sim_newton_global_exactsolver = 29002sim_newton_global_highjointaccuracy = 29003sim_newton_global_bool_end = 29004sim_newton_joint_float_start = 30000sim_newton_joint_dependencyfactor = 30001sim_newton_joint_dependencyoffset = 30002sim_newton_joint_float_end = 30003sim_newton_joint_int_start = 31000sim_newton_joint_objectid = 31001sim_newton_joint_dependentobjectid = 31002sim_newton_joint_int_end = 31003sim_newton_joint_bool_start = 32000sim_newton_joint_bool_end = 32001sim_newton_body_float_start = 33000sim_newton_body_staticfriction = 33001sim_newton_body_kineticfriction = 33002sim_newton_body_restitution = 33003sim_newton_body_lineardrag = 33004sim_newton_body_angulardrag = 33005sim_newton_body_float_end = 33006sim_newton_body_int_start = 34000sim_newton_body_bitcoded = 34001sim_newton_body_int_end = 34002sim_newton_body_bool_start = 35000sim_newton_body_fastmoving = 35001sim_newton_body_bool_end = 35002
sim_vortex_bodyfrictionmodel_box = 0sim_vortex_bodyfrictionmodel_scaledbox = 1sim_vortex_bodyfrictionmodel_proplow = 2sim_vortex_bodyfrictionmodel_prophigh = 3sim_vortex_bodyfrictionmodel_scaledboxfast = 4sim_vortex_bodyfrictionmodel_neutral = 5sim_vortex_bodyfrictionmodel_none = 6
sim_bullet_constraintsolvertype_sequentialimpulse = 0sim_bullet_constraintsolvertype_nncg = 1sim_bullet_constraintsolvertype_dantzig = 2sim_bullet_constraintsolvertype_projectedgaussseidel = 3
sim_objdynprop_dynamic = 1sim_objdynprop_respondable = 2
sim_announce_pureconenotsupported = 0sim_announce_purespheroidnotsupported = 1sim_announce_containsnonpurenonconvexshapes = 2sim_announce_containsstaticshapesondynamicconstruction = 3sim_announce_purehollowshapenotsupported = 4sim_announce_vortexpluginisdemo = 5sim_announce_newtondynamicrandommeshnotsupported = 6
sim_dynamicsimicon_none = 0sim_dynamicsimicon_objectisdynamicallysimulated = 1sim_dynamicsimicon_objectisnotdynamicallyenabled = 2
sim_filtercomponent_originalimage_deprecated = 1sim_filtercomponent_originaldepth_deprecated = 2sim_filtercomponent_uniformimage_deprecated = 3sim_filtercomponent_tooutput_deprecated = 4sim_filtercomponent_tobuffer1_deprecated = 5sim_filtercomponent_tobuffer2_deprecated = 6sim_filtercomponent_frombuffer1_deprecated = 7sim_filtercomponent_frombuffer2_deprecated = 8sim_filtercomponent_swapbuffers_deprecated = 9sim_filtercomponent_addbuffer1_deprecated = 10sim_filtercomponent_subtractbuffer1_deprecated = 11sim_filtercomponent_multiplywithbuffer1_deprecated = 12sim_filtercomponent_horizontalflip_deprecated = 13sim_filtercomponent_verticalflip_deprecated = 14sim_filtercomponent_rotate_deprecated = 15sim_filtercomponent_shift_deprecated = 16sim_filtercomponent_resize_deprecated = 17sim_filtercomponent_3x3filter_deprecated = 18sim_filtercomponent_5x5filter_deprecated = 19sim_filtercomponent_sharpen_deprecated = 20sim_filtercomponent_edge_deprecated = 21sim_filtercomponent_rectangularcut_deprecated = 22sim_filtercomponent_circularcut_deprecated = 23sim_filtercomponent_normalize_deprecated = 24sim_filtercomponent_intensityscale_deprecated = 25sim_filtercomponent_keeporremovecolors_deprecated = 26sim_filtercomponent_scaleandoffsetcolors_deprecated = 27sim_filtercomponent_binary_deprecated = 28sim_filtercomponent_swapwithbuffer1_deprecated = 29sim_filtercomponent_addtobuffer1_deprecated = 30sim_filtercomponent_subtractfrombuffer1_deprecated = 31sim_filtercomponent_correlationwithbuffer1_deprecated = 32sim_filtercomponent_colorsegmentation_deprecated = 33sim_filtercomponent_blobextraction_deprecated = 34sim_filtercomponent_imagetocoord_deprecated = 35sim_filtercomponent_pixelchange_deprecated = 36sim_filtercomponent_velodyne_deprecated = 37sim_filtercomponent_todepthoutput_deprecated = 38sim_filtercomponent_customized_deprecated = 1000
sim_buffer_uint8 = 0sim_buffer_int8 = 1sim_buffer_uint16 = 2sim_buffer_int16 = 3sim_buffer_uint32 = 4sim_buffer_int32 = 5sim_buffer_float = 6sim_buffer_double = 7sim_buffer_uint8rgb = 8sim_buffer_uint8bgr = 9sim_buffer_uint8rgba = 10sim_buffer_uint8argb = 11sim_buffer_base64 = 12sim_buffer_split = 13sim_buffer_clamp = 256
sim_imgcomb_vertical = 0sim_imgcomb_horizontal = 1
sim_dynmat_default = 2310013sim_dynmat_highfriction = 2310014sim_dynmat_lowfriction = 2310015sim_dynmat_nofriction = 2310016sim_dynmat_reststackgrasp = 2310017sim_dynmat_foot = 2310018sim_dynmat_wheel = 2310019sim_dynmat_gripper = 2310020sim_dynmat_floor = 2310021
sim_rendermode_opengl = 0sim_rendermode_auxchannels = 1sim_rendermode_colorcoded = 2sim_rendermode_povray = 3sim_rendermode_reserved = 4sim_rendermode_extrenderer = 5sim_rendermode_extrendererwindowed = 6sim_rendermode_opengl3 = 7sim_rendermode_opengl3windowed = 8
sim_syncobj_worldcont = 0sim_syncobj_world = 1sim_syncobj_ikgroup = 2sim_syncobj_ikelement = 3sim_syncobj_collision = 4sim_syncobj_distance = 5sim_syncobj_collection = 6sim_syncobj_collectionelement = 7sim_syncobj_color = 8sim_syncobj_sceneobjectstart = 9sim_syncobj_dummy = 9sim_syncobj_joint = 10sim_syncobj_sceneobjectend = 10
simx_cmdnull_start = 0simx_cmd_synchronous_enable = 1simx_cmd_synchronous_disable = 2simx_cmd_synchronous_next = 3simx_cmd_get_last_errors = 4simx_cmd_close_scene = 5simx_cmd_get_object_selection = 6simx_cmd_reserved1 = 7simx_cmd_reserved2 = 8simx_cmd_create_dummy = 9simx_cmd_kill_connection = 10simx_cmdnull_custom_start = 2048simx_cmd4bytes_start = 4096simx_cmd_get_joint_position = 4097simx_cmd_set_joint_position = 4098simx_cmd_get_vision_sensor_image_bw = 4099simx_cmd_get_vision_sensor_image_rgb = 4100simx_cmd_set_vision_sensor_image_bw = 4101simx_cmd_set_vision_sensor_image_rgb = 4102simx_cmd_start_pause_stop_simulation = 4103simx_cmd_set_joint_target_velocity = 4104simx_cmd_read_proximity_sensor = 4105simx_cmd_get_joint_matrix = 4106simx_cmd_set_spherical_joint_matrix = 4107simx_cmd_set_joint_target_position = 4108simx_cmd_get_joint_force = 4109simx_cmd_set_joint_force = 4110simx_cmd_read_force_sensor = 4111simx_cmd_break_force_sensor = 4112simx_cmd_read_vision_sensor = 4113simx_cmd_get_object_parent = 4114simx_cmd_spotcanbeused5 = 4115simx_cmd_aux_console_close = 4116simx_cmd_aux_console_print = 4117simx_cmd_aux_console_show = 4118simx_cmd_get_vision_sensor_depth_buffer = 4119simx_cmd_get_object_orientation = 4120simx_cmd_get_object_position = 4121simx_cmd_set_object_orientation = 4122simx_cmd_set_object_position = 4123simx_cmd_set_object_parent = 4124simx_cmd_get_array_parameter = 4125simx_cmd_set_array_parameter = 4126simx_cmd_get_boolean_parameter = 4127simx_cmd_set_boolean_parameter = 4128simx_cmd_get_integer_parameter = 4129simx_cmd_set_integer_parameter = 4130simx_cmd_get_floating_parameter = 4131simx_cmd_set_floating_parameter = 4132simx_cmd_get_string_parameter = 4133simx_cmd_read_collision = 4134simx_cmd_read_distance = 4135simx_cmd_remove_object = 4136simx_cmd_remove_ui = 4137simx_cmd_get_objects = 4138simx_cmd_end_dialog = 4139simx_cmd_get_dialog_input = 4140simx_cmd_get_dialog_result = 4141simx_cmd_copy_paste_objects = 4142simx_cmd_set_object_selection = 4143simx_cmd_spotcanbeused1 = 4144simx_cmd_spotcanbeused2 = 4145simx_cmd_spotcanbeused3 = 4146simx_cmd_spotcanbeused4 = 4147simx_cmd_get_model_property = 4148simx_cmd_set_model_property = 4149simx_cmd_get_object_velocity = 4150simx_cmd_remove_model = 4151simx_cmd_get_joint_max_force = 4152simx_cmd4bytes_custom_start = 6144simx_cmd_set_object_quaternion = 6145simx_cmd8bytes_start = 8192simx_cmd_get_ui_slider = 8193simx_cmd_set_ui_slider = 8194simx_cmd_get_ui_event_button = 8195simx_cmd_get_ui_button_property = 8196simx_cmd_set_ui_button_property = 8197simx_cmd_set_ui_button_label = 8198simx_cmd_get_object_float_parameter = 8199simx_cmd_get_object_int_parameter = 8200simx_cmd_set_object_float_parameter = 8201simx_cmd_set_object_int_parameter = 8202simx_cmd_get_object_child = 8203simx_cmd_get_object_group_data = 8204simx_cmd_get_object_orientation2 = 8205simx_cmd_get_object_position2 = 8206simx_cmd8bytes_custom_start = 10240simx_cmd_get_object_quaternion = 10241simx_cmd1string_start = 12288simx_cmd_get_object_handle = 12289simx_cmd_load_scene = 12290simx_cmd_load_model = 12291simx_cmd_transfer_file = 12292simx_cmd_load_ui = 12293simx_cmd_erase_file = 12294simx_cmd_get_ui_handle = 12295simx_cmd_add_statusbar_message = 12296simx_cmd_aux_console_open = 12297simx_cmd_get_collision_handle = 12298simx_cmd_get_distance_handle = 12299simx_cmd_display_dialog = 12300simx_cmd_clear_float_signal = 12301simx_cmd_clear_integer_signal = 12302simx_cmd_clear_string_signal = 12303simx_cmd_get_float_signal = 12304simx_cmd_get_integer_signal = 12305simx_cmd_get_string_signal = 12306simx_cmd_set_float_signal = 12307simx_cmd_set_integer_signal = 12308simx_cmd_set_string_signal = 12309simx_cmd_append_string_signal = 12310simx_cmd_write_string_stream = 12310simx_cmd_get_and_clear_string_signal = 12311simx_cmd_read_string_stream = 12312simx_cmd_get_collection_handle = 12313simx_cmd4bytes2strings_start = 13312simx_cmd_call_script_function = 13313simx_cmd4bytes2strings_end = 13568simx_cmd1string_custom_start = 14336simx_cmdreserved_start = 16384simx_cmdmask = 65535simx_opmode_oneshot = 0simx_opmode_blocking = 65536simx_opmode_oneshot_wait = 65536simx_opmode_streaming = 131072simx_opmode_continuous = 131072simx_opmode_oneshot_split = 196608simx_opmode_streaming_split = 262144simx_opmode_continuous_split = 262144simx_opmode_discontinue = 327680simx_opmode_buffer = 393216simx_opmode_remove = 458752
simx_return_ok = 0simx_return_novalue_flag = 1simx_return_timeout_flag = 2simx_return_illegal_opmode_flag = 4simx_return_remote_error_flag = 8simx_return_split_progress_flag = 16simx_return_local_error_flag = 32simx_return_initialize_error_flag = 64
simx_error_noerror = 0simx_error_novalue_flag = 1simx_error_timeout_flag = 2simx_error_illegal_opmode_flag = 4simx_error_remote_error_flag = 8simx_error_split_progress_flag = 16simx_error_local_error_flag = 32simx_error_initialize_error_flag = 64
simros_strmcmdnull_start = 0simros_strmcmd_get_object_selection = 1simros_strmcmd_get_info = 2simros_strmcmdnull_subscriber_start = 2048simros_strmcmd_add_status_bar_message = 2049simros_strmcmd_set_object_selection = 2050simros_strmcmd_set_joint_state = 2051simros_strmcmdint_start = 4096simros_strmcmd_get_array_parameter = 4097simros_strmcmd_get_boolean_parameter = 4098simros_strmcmd_get_dialog_result = 4099simros_strmcmd_get_floating_parameter = 4100simros_strmcmd_get_integer_parameter = 4101simros_strmcmd_get_joint_state = 4102simros_strmcmd_get_object_parent = 4103simros_strmcmd_get_objects = 4104simros_strmcmd_get_string_parameter = 4105simros_strmcmd_get_ui_event_button = 4106simros_strmcmd_get_vision_sensor_depth_buffer = 4107simros_strmcmd_get_vision_sensor_image = 4108simros_strmcmd_read_collision = 4109simros_strmcmd_read_distance = 4110simros_strmcmd_read_force_sensor = 4111simros_strmcmd_read_proximity_sensor = 4112simros_strmcmd_read_vision_sensor = 4113simros_strmcmd_get_vision_sensor_info = 4114simros_strmcmd_get_range_finder_data = 4115simros_strmcmd_get_laser_scanner_data = 4116simros_strmcmd_get_odom_data = 4117simros_strmcmd_get_depth_sensor_data = 4118simros_strmcmdint_subscriber_start = 6144simros_strmcmd_auxiliary_console_print = 6145simros_strmcmd_set_array_parameter = 6146simros_strmcmd_set_boolean_parameter = 6147simros_strmcmd_set_floating_parameter = 6148simros_strmcmd_set_integer_parameter = 6149simros_strmcmd_set_joint_force = 6150simros_strmcmd_set_joint_position = 6151simros_strmcmd_set_joint_target_position = 6152simros_strmcmd_set_joint_target_velocity = 6153simros_strmcmd_set_vision_sensor_image = 6154simros_strmcmd_set_joy_sensor = 6155simros_strmcmd_set_twist_command = 6156simros_strmcmdintint_start = 8192simros_strmcmd_get_object_pose = 8193simros_strmcmd_get_object_float_parameter = 8194simros_strmcmd_get_object_int_parameter = 8195simros_strmcmd_get_ui_button_property = 8196simros_strmcmd_get_ui_slider = 8197simros_strmcmd_get_transform = 8198simros_strmcmd_get_object_group_data = 8199simros_strmcmdintint_subscriber_start = 10240simros_strmcmd_set_object_float_parameter = 10241simros_strmcmd_set_object_int_parameter = 10242simros_strmcmd_set_object_pose = 10243simros_strmcmd_set_object_position = 10244simros_strmcmd_set_object_quaternion = 10245simros_strmcmd_set_ui_button_label = 10246simros_strmcmd_set_ui_button_property = 10247simros_strmcmd_set_ui_slider = 10248simros_strmcmdstring_start = 12288simros_strmcmd_get_float_signal = 12289simros_strmcmd_get_integer_signal = 12290simros_strmcmd_get_string_signal = 12291simros_strmcmd_reserved1 = 12292simros_strmcmd_get_and_clear_string_signal = 12293simros_strmcmdstring_subscriber_start = 14336simros_strmcmd_clear_float_signal = 14337simros_strmcmd_clear_integer_signal = 14338simros_strmcmd_clear_string_signal = 14339simros_strmcmd_set_float_signal = 14340simros_strmcmd_set_integer_signal = 14341simros_strmcmd_set_string_signal = 14342simros_strmcmd_reserved2 = 14343simros_strmcmd_append_string_signal = 14344simros_strmcmd_set_joint_trajectory = 14345simros_strmcmdintstring_start = 16384simros_strmcmd_get_twist_status = 16385simros_strmcmd_receive_data_from_script_function = 16386simros_strmcmdintstring_subscriber_start = 18432simros_strmcmd_send_data_to_script_function = 18433simros_strmcmdreserved_start = 20480
# Followings are copied from official simConst.py (so possibly deprecated in C++ API)sim_appobj_constraintsolver_type = 114sim_boolparam_full_model_copy_from_api = 24sim_boolparam_joint_motion_handling_enabled = 7sim_boolparam_path_motion_handling_enabled = 8sim_boolparam_threaded_rendering_enabled = 32sim_ik_avoidance_constraint = 64sim_intparam_event_flags_read = 17sim_intparam_event_flags_read_clear = 18sim_jointmode_ikdependent = 3sim_jointmode_motion = 1sim_modelproperty_not_cuttable = 16sim_mplanintparam_clear_nodes = 25002sim_mplanintparam_nodes_computed = 25000sim_mplanintparam_prepare_nodes = 25001sim_navigation_ikmanip = 12sim_navigation_jointpathtest = 11sim_navigation_objectmultipleselection = 13sim_object_volume_type = 10sim_objectspecialproperty_cuttable = 1024sim_pathproperty_auto_velocity_profile_rotation = 512sim_pathproperty_auto_velocity_profile_translation = 256sim_pathproperty_endpoints_at_zero = 1024sim_pathproperty_infinite_acceleration = 32sim_pathproperty_invert_velocity = 16sim_scripttype_contactcallback = 5sim_scripttype_generalcallback = 7sim_scripttype_jointctrlcallback = 412345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576from threading import Lockfrom typing import List, Tuplefrom pyrep.backend import simfrom pyrep.objects.object import Objectfrom pyrep.objects.shape import Shapefrom pyrep.objects.dummy import Dummyfrom pyrep.objects.cartesian_path import CartesianPathfrom pyrep.objects.joint import Jointfrom pyrep.objects.vision_sensor import VisionSensorfrom pyrep.objects.force_sensor import ForceSensorfrom pyrep.objects.proximity_sensor import ProximitySensorfrom pyrep.objects.camera import Camerafrom pyrep.objects.octree import Octree
step_lock = Lock()
def to_type(handle: int) -> Object: """Converts an object handle to the correct sub-type.
:param handle: The internal handle of an object. :return: The sub-type of this object. """ t = sim.simGetObjectType(handle) if t == sim.sim_object_shape_type: return Shape(handle) elif t == sim.sim_object_dummy_type: return Dummy(handle) elif t == sim.sim_object_path_type: return CartesianPath(handle) elif t == sim.sim_object_joint_type: return Joint(handle) elif t == sim.sim_object_visionsensor_type: return VisionSensor(handle) elif t == sim.sim_object_forcesensor_type: return ForceSensor(handle) elif t == sim.sim_object_proximitysensor_type: return ProximitySensor(handle) elif t == sim.sim_object_camera_type: return Camera(handle) elif t == sim.sim_object_octree_type: return Octree(handle) raise ValueError
def script_call(function_name_at_script_name: str, script_handle_or_type: int, ints=(), floats=(), strings=(), bytes='') -> ( Tuple[List[int], List[float], List[str], str]): """Calls a script function (from a plugin, the main client application, or from another script). This represents a callback inside of a script.
:param function_name_at_script_name: A string representing the function name and script name, e.g. myFunctionName@theScriptName. When the script is not associated with an object, then just specify the function name. :param script_handle_or_type: The handle of the script, otherwise the type of the script. :param ints: The input ints to the script. :param floats: The input floats to the script. :param strings: The input strings to the script. :param bytes: The input bytes to the script (as a string). :return: Any number of return values from the called Lua function. """ return sim.simExtCallScriptFunction( function_name_at_script_name, script_handle_or_type, list(ints), list(floats), list(strings), bytes)
def _is_in_ipython(): try: __IPYTHON__ return True except NameError: pass return False12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849from pyrep.errors import PyRepErrorfrom pyrep.backend import simfrom typing import Union
class Distance(object): """Allows registering distance objects which are measurable entity-pairs."""
def __init__(self, name_or_handle: Union[str, int]): raise PyRepError( 'Currently there is an error in CoppeliaSim with distance objects. ' 'As soon as CoppeliaSim resolves this issue, this error will be ' 'removed.') self._handle: int if isinstance(name_or_handle, int): self._handle = name_or_handle else: self._handle = sim.simGetDistanceHandle(name_or_handle) # The entity needs to be set as explicit handling for reads to work. if not sim.simGetExplicitHandling(self._handle): sim.simSetExplicitHandling(self._handle, 1)
def __eq__(self, other: object): if not isinstance(other, Distance): raise NotImplementedError return self.get_handle() == other.get_handle()
def get_handle(self) -> int: """Gets the internal handle of this object.
:return: The internal handle. """ return self._handle
def read(self) -> Union[float, None]: """Reads the distance of a registered distance object.
:raises: PyRepError if no objects could be measured.
:return: The smallest distance between the 2 entities or None if no measurement could be made. """ num_measurements = sim.simHandleDistance(self._handle) if num_measurements == 0: raise PyRepError( 'Could not make a measurement. Are both entities associated ' 'with the distance object marked as measurable?') return (None if num_measurements == 0 else sim.simReadDistance(self._handle))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102from pyrep.errors import PyRepErrorfrom pyrep.backend import simfrom typing import Any
class Signal(object): """Signals can be seen as global variables.
Four types of signals are currently supported: integer-, floating-, double-, and string-type signals. Signals can be defined, redefined, read and cleared. """
def __init__(self, name): self._name = name
def set(self, value) -> None: """Sets the value of this signal.
:param value: The value of the signal. """ pass
def get(self) -> Any: """Gets the value of this signal.
:raises PyRepError if signal does not exist. :return: The value of the signal. """ pass
def clear(self) -> int: """Clears the value of this signal.
:return: The number of signals cleared. Either 0 or 1. """ pass
def _check_signal(self, value: int, type_name: str) -> None: if value == 0: raise PyRepError('Signal %s of type %s does not exist.' % ( self._name, type_name))
class IntegerSignal(Signal): """An integer-type signal."""
def set(self, value) -> None: sim.simSetIntegerSignal(self._name, value)
def get(self) -> int: ret, value = sim.simGetIntegerSignal(self._name) self._check_signal(ret, 'int') return value
def clear(self) -> int: return sim.simClearIntegerSignal(self._name)
class FloatSignal(Signal): """An float-type signal."""
def set(self, value) -> None: sim.simSetFloatSignal(self._name, value)
def get(self) -> float: ret, value = sim.simGetFloatSignal(self._name) self._check_signal(ret, 'float') return value
def clear(self) -> int: return sim.simClearFloatSignal(self._name)
class DoubleSignal(Signal): """An double-type signal."""
def set(self, value) -> None: sim.simSetDoubleSignal(self._name, value)
def get(self) -> float: ret, value = sim.simGetDoubleSignal(self._name) self._check_signal(ret, 'double') return value
def clear(self) -> int: return sim.simClearDoubleSignal(self._name)
class StringSignal(Signal): """An string-type signal."""
def set(self, value) -> None: sim.simSetStringSignal(self._name, value)
def get(self) -> str: ret, value = sim.simGetStringSignal(self._name) self._check_signal(ret, 'string') return value
def clear(self) -> int: return sim.simClearStringSignal(self._name)12345678910from pyrep.objects.object import Objectfrom pyrep.objects.cartesian_path import CartesianPathfrom pyrep.objects.dummy import Dummyfrom pyrep.objects.force_sensor import ForceSensorfrom pyrep.objects.joint import Jointfrom pyrep.objects.proximity_sensor import ProximitySensorfrom pyrep.objects.shape import Shapefrom pyrep.objects.vision_sensor import VisionSensorfrom pyrep.objects.octree import Octreefrom pyrep.objects.camera import Camera123456789101112131415161718192021from typing import Unionfrom pyrep.objects.object import Object, object_type_to_classfrom pyrep.const import ObjectType
class Camera(Object): """Cameras can be associated with views. """
def __init__(self, name_or_handle: Union[str, int]): super().__init__(name_or_handle) @staticmethod def create(): raise NotImplementedError("API does not provide simCreateCamera.")
def _get_requested_type(self) -> ObjectType: return ObjectType.CAMERA
object_type_to_class[ObjectType.CAMERA] = Camera123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107from typing import Tuple, Listfrom pyrep.backend import simfrom pyrep.objects.object import Object, object_type_to_classfrom pyrep.const import ObjectType
class CartesianPath(Object): """An object that defines a cartesian path or trajectory in space. """
@staticmethod def create(show_line: bool = True, show_orientation: bool = True, show_position: bool = True, closed_path: bool = False, automatic_orientation: bool = True, flat_path: bool = False, keep_x_up: bool = False, line_size: int = 1, length_calculation_method: int = sim.sim_distcalcmethod_dl_if_nonzero, control_point_size: float = 0.01, ang_to_lin_conv_coeff: float = 1., virt_dist_scale_factor: float = 1., path_color: tuple = (0.1, 0.75, 1.)) -> 'CartesianPath': """Creates a cartesian path and inserts in the scene.
:param show_line: Shows line in UI. :param show_position: Shows line in UI. :param show_orientation: Shows orientation in UI. :param closed_path: If set, then a path's last control point will be linked to its first control point to close the path and make its operation cyclic. A minimum of 3 control points are required for a path to be closed. :param automatic_orientation: If set, then all control points and Bezier point's orientation will automatically be calculated in order to have a point's z-axis along the path, and its y-axis pointing outwards its curvature (if keep x up is enabled, the y-axis is not particularly constrained). If disabled, the user determines the control point's orientation and the Bezier points' orientation will be interpolated from the path's control points' orientation. :param flat_path: If set, then all control points (and subsequently all Bezier points) will be constraint to the z=0 plane of the path object's local reference frame. :param keep_x_up: If set, then the automatic orientation functionality will align each Bezier point's z-axis along the path and keep its x-axis pointing along the path object's z-axis. :param line_size: Size of the line in pixels. :param length_calculation_method: Method for calculating the path length. See https://www.coppeliarobotics.com/helpFiles/en/apiConstants.htm#distanceCalculationMethods :param control_point_size: Size of the control points in the path. :param ang_to_lin_conv_coeff: The angular to linear conversion coefficient. :param virt_dist_scale_factor: The virtual distance scaling factor. :param path_color: Ambient diffuse rgb color of the path.
:return: The newly created cartesian path. """ attributes = 0 if show_line: attributes |= sim.sim_pathproperty_show_line if show_orientation: attributes |= sim.sim_pathproperty_show_orientation if closed_path: attributes |= sim.sim_pathproperty_closed_path if automatic_orientation: attributes |= sim.sim_pathproperty_automatic_orientation if flat_path: attributes |= sim.sim_pathproperty_flat_path if show_position: attributes |= sim.sim_pathproperty_show_position if keep_x_up: attributes |= sim.sim_pathproperty_keep_x_up
handle = sim.simCreatePath(attributes, [line_size, length_calculation_method, 0], [control_point_size, ang_to_lin_conv_coeff, virt_dist_scale_factor], list(path_color)) return CartesianPath(handle)
def _get_requested_type(self) -> ObjectType: return ObjectType.PATH
def get_pose_on_path(self, relative_distance: float ) -> Tuple[List[float], List[float]]: """Retrieves the absolute interpolated pose of a point along the path.
:param relative_distance: A value between 0 and 1, where 0 is the beginning of the path, and 1 the end of the path. :return: A tuple containing the x, y, z position, and the x, y, z orientation of the point on the path (in radians). """ pos = sim.simGetPositionOnPath(self._handle, relative_distance) ori = sim.simGetOrientationOnPath(self._handle, relative_distance) return pos, ori
def insert_control_points(self, poses: List[List[float]]) -> None: """Inserts one or several control points into the path.
:param poses: A list of lists containing 6 values representing the pose of each of the new control points. Orientation in radians. """ data = [] for p in poses: data.extend(p) self._script_call('insertPathControlPoint@PyRep', ints=[self._handle, len(poses)], floats=data)
def _script_call(self, func: str, ints=(), floats=(), strings=(), bytes=''): return sim.simExtCallScriptFunction( func, sim.sim_scripttype_addonscript, list(ints), list(floats), list(strings), bytes)
object_type_to_class[ObjectType.PATH] = CartesianPath1234567891011121314151617181920212223242526from pyrep.objects.object import Object, object_type_to_classfrom pyrep.const import ObjectTypefrom pyrep.backend import sim
class Dummy(Object): """A point with orientation.
Dummies are multipurpose objects that can have many different applications. """
@staticmethod def create(size=0.01) -> 'Dummy': """Creates a dummy object and inserts in the scene.
:param size: The size of the dummy object. :return: The newly created Dummy. """ handle = sim.simCreateDummy(size, None) return Dummy(handle)
def _get_requested_type(self) -> ObjectType: return ObjectType.DUMMY
object_type_to_class[ObjectType.DUMMY] = Dummy12345678910111213141516171819202122232425262728293031323334from typing import Tuple, Listfrom pyrep.backend import simfrom pyrep.objects.object import Object, object_type_to_classfrom pyrep.const import ObjectType
class ForceSensor(Object): """An object able to measure forces and torques that are applied to it. """
def _get_requested_type(self) -> ObjectType: return ObjectType.FORCE_SENSOR
@classmethod def create(cls, sensor_size=0.01) -> 'ForceSensor': options = 0 # force and torque threshold are disabled intParams = [0, 0, 0, 0, 0] floatParams = [sensor_size, 0, 0, 0, 0] handle = sim.simCreateForceSensor(options=0, intParams=intParams, floatParams=floatParams, color=None) return cls(handle)
def read(self) -> Tuple[List[float], List[float]]: """Reads the force and torque applied to a force sensor.
:return: A tuple containing the applied forces along the sensor's x, y and z-axes, and the torques along the sensor's x, y and z-axes. """ _, forces, torques = sim.simReadForceSensor(self._handle) return forces, torques
object_type_to_class[ObjectType.FORCE_SENSOR] = ForceSensor123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255from typing import Tuple, List, Unionfrom pyrep.backend import sim, utilsfrom pyrep.const import JointType, JointModefrom pyrep.objects.object import Object, object_type_to_classfrom pyrep.const import ObjectType
class Joint(Object): """A joint or actuator.
Four types are supported: revolute joints, prismatic joints, screws and spherical joints. """
def __init__(self, name_or_handle: Union[str, int]): super().__init__(name_or_handle)
def _get_requested_type(self) -> ObjectType: return ObjectType.JOINT
def get_joint_type(self) -> JointType: """Retrieves the type of a joint.
:return: The type of the joint. """ return JointType(sim.simGetJointType(self._handle))
def get_joint_position(self) -> float: """Retrieves the intrinsic position of a joint.
This function cannot be used with spherical joints.
:return: Intrinsic position of the joint. This is a one-dimensional value: if the joint is revolute, the rotation angle is returned, if the joint is prismatic, the translation amount is returned, etc. """ return sim.simGetJointPosition(self._handle)
def set_joint_position(self, position: float, disable_dynamics: bool = False) -> None: """Sets the intrinsic position of the joint.
:param disable_dynamics: If True, then the position can be set even when the joint mode is in Force mode. It will disable dynamics, move the joint, and then re-enable dynamics.
:param position: Position of a joint (angular or linear values depending on the joint type). """ if not disable_dynamics: sim.simSetJointPosition(self._handle, position) return
is_model = self.is_model() if not is_model: self.set_model(True)
prior = sim.simGetModelProperty(self.get_handle()) p = prior | sim.sim_modelproperty_not_dynamic # Disable the dynamics sim.simSetModelProperty(self._handle, p) with utils.step_lock: sim.simExtStep(True) # Have to step for changes to take effect
sim.simSetJointPosition(self._handle, position) self.set_joint_target_position(position)
with utils.step_lock: sim.simExtStep(True) # Have to step for changes to take effect # Re-enable the dynamics sim.simSetModelProperty(self._handle, prior) self.set_model(is_model)
def get_joint_target_position(self) -> float: """Retrieves the target position of a joint.
:return: Target position of the joint (angular or linear value depending on the joint type). """ return sim.simGetJointTargetPosition(self._handle)
def set_joint_target_position(self, position: float) -> None: """Sets the target position of a joint.
This command makes only sense when the joint is in torque/force mode (also make sure that the joint's motor and position control are enabled).
:param position: Target position of the joint (angular or linear value depending on the joint type). """ sim.simSetJointTargetPosition(self._handle, position)
def get_joint_target_velocity(self) -> float: """Retrieves the intrinsic target velocity of a non-spherical joint.
:return: Target velocity of the joint (linear or angular velocity depending on the joint-type). """ return sim.simGetJointTargetVelocity(self._handle)
def set_joint_target_velocity(self, velocity: float) -> None: """Sets the intrinsic target velocity of a non-spherical joint.
This command makes only sense when the joint mode is torque/force mode: the dynamics functionality and the joint motor have to be enabled (position control should however be disabled).
:param velocity: Target velocity of the joint (linear or angular velocity depending on the joint-type). """ sim.simSetJointTargetVelocity(self._handle, velocity)
def get_joint_force(self) -> float: """Retrieves the force or torque applied along/about its active axis.
This function retrieves meaningful information only if the joint is prismatic or revolute, and is dynamically enabled. With the Bullet engine, this function returns the force or torque applied to the joint motor (torques from joint limits are not taken into account). With the ODE and Vortex engine, this function returns the total force or torque applied to a joint along/about its z-axis.
:return: The force or the torque applied to the joint along/about its z-axis. """ return sim.simGetJointForce(self._handle)
def set_joint_force(self, force: float) -> None: """Sets the maximum force or torque that a joint can exert.
The joint will apply that force/torque until the joint target velocity has been reached. To apply a negative force/torque, set a negative target velocity. This function has no effect when the joint is not dynamically enabled, or when it is a spherical joint.
:param force: The maximum force or torque that the joint can exert. This cannot be a negative value. """ sim.simSetJointMaxForce(self._handle, force)
def get_joint_velocity(self) -> float: """Get the current joint velocity.
:return: Velocity of the joint (linear or angular velocity depending on the joint-type). """ return sim.simGetObjectFloatParameter( self._handle, sim.sim_jointfloatparam_velocity)
def get_joint_interval(self) -> Tuple[bool, List[float]]: """Retrieves the interval parameters of a joint.
:return: A tuple containing a bool indicates whether the joint is cyclic (the joint varies between -pi and +pi in a cyclic manner), and a list containing the interval of the joint. interval[0] is the joint minimum allowed value, interval[1] is the joint range (the maximum allowed value is interval[0]+interval[1]). When the joint is "cyclic", then the interval parameters don't have any meaning. """ cyclic, interval = sim.simGetJointInterval(self._handle) return cyclic, interval
def set_joint_interval(self, cyclic: bool, interval: List[float]) -> None: """Sets the interval parameters of a joint (i.e. range values).
The attributes or interval parameters might have no effect, depending on the joint-type.
:param cyclic: Indicates whether the joint is cyclic. Only revolute joints with a pitch of 0 can be cyclic. :param interval: Interval of the joint. interval[0] is the joint minimum allowed value, interval[1] is the joint range (i.e. the maximum allowed value is interval[0]+interval[1]). """ sim.simSetJointInterval(self._handle, cyclic, interval)
def get_joint_upper_velocity_limit(self) -> float: """Gets the joints upper velocity limit.
:return: The upper velocity limit. """ return sim.simGetObjectFloatParameter( self._handle, sim.sim_jointfloatparam_upper_limit)
def is_control_loop_enabled(self) -> bool: """Gets whether the control loop is enable.
:return: True if the control loop is enabled. """ return sim.simGetObjectInt32Parameter( self._handle, sim.sim_jointintparam_ctrl_enabled)
def set_control_loop_enabled(self, value: bool) -> None: """Sets whether the control loop is enable.
:param value: The new value for the control loop state. """ sim.simSetObjectInt32Parameter( self._handle, sim.sim_jointintparam_ctrl_enabled, value)
def is_motor_enabled(self) -> bool: """Gets whether the motor is enable.
:return: True if the motor is enabled. """ return sim.simGetObjectInt32Parameter( self._handle, sim.sim_jointintparam_motor_enabled)
def set_motor_enabled(self, value: bool) -> None: """Sets whether the motor is enable.
:param value: The new value for the motor state. """ sim.simSetObjectInt32Parameter( self._handle, sim.sim_jointintparam_motor_enabled, value)
def is_motor_locked_at_zero_velocity(self) -> bool: """Gets if the motor is locked when target velocity is zero.
When enabled in velocity mode and its target velocity is zero, then the joint is locked in place.
:return: If the motor will be locked at zero velocity. """ return sim.simGetObjectInt32Parameter( self._handle, sim.sim_jointintparam_velocity_lock)
def set_motor_locked_at_zero_velocity(self, value: bool) -> None: """Set if the motor is locked when target velocity is zero.
When enabled in velocity mode and its target velocity is zero, then the joint is locked in place.
:param value: If the motor should be locked at zero velocity. """ sim.simSetObjectInt32Parameter( self._handle, sim.sim_jointintparam_velocity_lock, value)
def get_joint_mode(self) -> JointMode: """Retrieves the operation mode of the joint.
:return: The joint mode. """ return JointMode(sim.simGetJointMode(self._handle))
def set_joint_mode(self, value: JointMode) -> None: """Sets the operation mode of the joint.
:param value: The new joint mode value. """ sim.simSetJointMode(self._handle, value.value)
object_type_to_class[ObjectType.JOINT] = Joint123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125import warningsimport numpy as npfrom typing import Unionfrom pyrep.backend import simfrom pyrep.const import ObjectTypefrom pyrep.objects.object import Object, object_type_to_class
class Light(Object): """A light. """
def __init__(self, name_or_handle: Union[str, int]): super().__init__(name_or_handle)
def _get_requested_type(self) -> ObjectType: return ObjectType.LIGHT
# On and Off
def turn_on(self): """ Turn the light on. """ sim.simSetLightParameters(self._handle, True)
def turn_off(self): """ Turn the light off. """ sim.simSetLightParameters(self._handle, False)
def is_on(self): """ Determines whether the light is on. return: Boolean """ return sim.simGetLightParameters(self._handle)[0]
def is_off(self): """ Determines whether the light is off. return: Boolean """ return not sim.simGetLightParameters(self._handle)[0]
# Get and Set Color
def get_diffuse(self): """ Get the diffuse colors of the light. return: 3-vector np.array of diffuse colors """ return np.asarray(sim.simGetLightParameters(self._handle)[1])
def set_diffuse(self, diffuse): """ Set the diffuse colors of the light. """ sim.simSetLightParameters(self._handle, self.is_on(), list(diffuse))
def get_specular(self): """ Get the specular colors of the light. return: 3-vector np.array of specular colors """ return np.asarray(sim.simGetLightParameters(self._handle)[2])
def set_specular(self, specular): """ Set the specular colors of the light. """ sim.simSetLightParameters(self._handle, self.is_on(), specularPart=list(specular))
# Intensity Properties
def get_intensity_properties(self): """ Gets light intensity properties.
:return: The light intensity properties cast_shadows, spot_exponent, spot_cutoff, const_atten_factor, linear_atten_factor, quad_atten_factor """ cast_shadows = sim.simGetObjectInt32Parameter(self._handle, sim.sim_lightintparam_pov_casts_shadows) spot_exponent = sim.simGetObjectFloatParameter(self._handle, sim.sim_lightfloatparam_spot_exponent) spot_cutoff = sim.simGetObjectFloatParameter(self._handle, sim.sim_lightfloatparam_spot_cutoff) const_atten_factor = sim.simGetObjectFloatParameter(self._handle, sim.sim_lightfloatparam_const_attenuation) linear_atten_factor = sim.simGetObjectFloatParameter(self._handle, sim.sim_lightfloatparam_lin_attenuation) quad_atten_factor = sim.simGetObjectFloatParameter(self._handle, sim.sim_lightfloatparam_quad_attenuation) return bool(cast_shadows), spot_exponent, spot_cutoff, const_atten_factor, linear_atten_factor,\ quad_atten_factor
def set_intensity_properties(self, cast_shadows=None, spot_exponent=None, spot_cutoff=None, const_atten_factor=None, linear_atten_factor=None, quad_atten_factor=None): """ Set light intensity properties.
:param cast_shadows: POV-Ray light casts shadows :param spot_exponent: light spot exponent :param spot_cutoff: light spot cutoff :param const_atten_factor: light constant attenuation factor, currently not supported :param linear_atten_factor: light linear attenuation factor, currently not supported :param quad_atten_factor: light quadratic attenuation factor, currently not supported """ if cast_shadows is not None: sim.simSetObjectInt32Parameter( self._handle, sim.sim_lightintparam_pov_casts_shadows, int(cast_shadows)) if spot_exponent is not None: if spot_exponent % 1 != 0: warnings.warn('spot exponent must be an integer, rounding input of {} to {}'.format( spot_exponent, round(spot_exponent))) sim.simSetObjectFloatParameter( self._handle, sim.sim_lightfloatparam_spot_exponent, float(round(spot_exponent))) if spot_cutoff is not None: spot_cutoff = float(spot_cutoff) if spot_cutoff > np.pi/2: warnings.warn('Tried to set spot_cutoff to {}, but the maximum allowed value is pi/2,' 'therefore setting to pi/2'.format(spot_cutoff)) sim.simSetObjectFloatParameter( self._handle, sim.sim_lightfloatparam_spot_cutoff, float(spot_cutoff)) if const_atten_factor is not None: raise Exception('CoppeliaSim currently does not support setting attenuation factors') # sim.simSetObjectFloatParameter( # self._handle, sim.sim_lightfloatparam_const_attenuation, float(const_atten_factor)) if linear_atten_factor is not None: raise Exception('CoppeliaSim currently does not support setting attenuation factors') # sim.simSetObjectFloatParameter( # self._handle, sim.sim_lightfloatparam_lin_attenuation, float(linear_atten_factor)) if quad_atten_factor is not None: raise Exception('CoppeliaSim currently does not support setting attenuation factors') # sim.simSetObjectFloatParameter( # self._handle, sim.sim_lightfloatparam_quad_attenuation, float(quad_atten_factor))
object_type_to_class[ObjectType.LIGHT] = Light123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756import warnings
from pyrep.backend import simfrom pyrep.errors import *from pyrep.const import ObjectTypefrom pyrep.errors import WrongObjectTypeErrorfrom typing import Any, Dict, List, Tuple, Unionimport numpy as np
object_type_to_class: Dict[ObjectType, Any] = {}
class Object(object): """Base class for V-REP scene objects that are used for building a scene.
Objects are visible in the scene hierarchy and in the scene view. """
def __init__(self, name_or_handle: Union[str, int]): if isinstance(name_or_handle, int): self._handle = name_or_handle else: self._handle = sim.simGetObjectHandle(name_or_handle) assert_type = self._get_requested_type() actual = ObjectType(sim.simGetObjectType(self._handle)) if actual != assert_type: raise WrongObjectTypeError( 'You requested object of type %s, but the actual type was ' '%s' % (assert_type.name, actual.name))
def __eq__(self, other: object): if not isinstance(other, Object): raise NotImplementedError return self.get_handle() == other.get_handle()
@staticmethod def exists(name: str) -> bool: """Checks if the given object is in the scene.
:param id: name/id of object. If the name is appended by a "@alt" suffix, then the object handle based on the object's alternative name will be retrieved. :return: True of the object exists. """ return sim.hasObjectHandle(name)
@staticmethod def get_object_type(name: str) -> ObjectType: """Gets the type of the object.
:return: Type of the object. """ return ObjectType(sim.simGetObjectType(sim.simGetObjectHandle(name)))
@staticmethod def get_object_name(name_or_handle: Union[str, int]) -> str: """Gets object name.
:return: Object name. """ if isinstance(name_or_handle, int): name = sim.simGetObjectName(name_or_handle) else: name = name_or_handle return name
@staticmethod def get_object(name_or_handle: str) -> 'Object': """Gets object retrieved by name.
:return: The object. """ name = Object.get_object_name(name_or_handle) object_type = Object.get_object_type(name) cls = object_type_to_class[object_type] return cls(name)
def _get_requested_type(self) -> ObjectType: """Used for internally checking assumptions user made about object type.
:return: Type of the object. """ raise NotImplementedError('Must be overridden.')
def get_type(self) -> ObjectType: """Gets the type of the object.
:return: Type of the object. """ return ObjectType(sim.simGetObjectType(self._handle))
def get_handle(self) -> int: """Gets the internal handle of this object.
:return: The internal handle. """ return self._handle
def still_exists(self) -> bool: """Gets whether this object is still in the scene or not.
:return: Whether the object exists or not. """ return sim.simGetObjectName(self._handle) != ''
def get_name(self) -> str: """Gets the objects name in the scene.
:return: The objects name. """ return sim.simGetObjectName(self._handle)
def set_name(self, name: str) -> None: """Sets the objects name in the scene. """ sim.simSetObjectName(self._handle, name)
def get_position(self, relative_to=None) -> np.ndarray: """Gets the position of this object.
:param relative_to: Indicates relative to which reference frame we want the position. Specify None to retrieve the absolute position, or an Object relative to whose reference frame we want the position. :return: An array containing the x, y, z position of the object. """ relto = -1 if relative_to is None else relative_to.get_handle() position = sim.simGetObjectPosition(self._handle, relto) return np.array(position, dtype=np.float64)
def set_position(self, position: Union[list, np.ndarray], relative_to=None, reset_dynamics=True) -> None: """Sets the position of this object.
:param position: A list containing the x, y, z position of the object. :param relative_to: Indicates relative to which reference frame the the position is specified. Specify None to set the absolute position, or an Object relative to whose reference frame the position is specified. :param reset_dynamics: If we want to reset the dynamics when moving an object instantaneously. """ relto = -1 if relative_to is None else relative_to.get_handle() if reset_dynamics: for ob in self.get_objects_in_tree(exclude_base=False): ob.reset_dynamic_object()
sim.simSetObjectPosition(self._handle, relto, list(position))
def get_orientation(self, relative_to=None) -> np.ndarray: """Gets the orientation of this object.
:param relative_to: Indicates relative to which reference frame we want the orientation. Specify None to retrieve the absolute orientation, or an Object relative to whose reference frame we want the orientation. :return: A list containing the x, y, z orientation of the object (in radians). """ relto = -1 if relative_to is None else relative_to.get_handle() orientation = sim.simGetObjectOrientation(self._handle, relto) return np.array(orientation, dtype=np.float64)
def set_orientation(self, orientation: Union[list, np.ndarray], relative_to=None, reset_dynamics=True) -> None: """Sets the orientation of this object.
:param orientation: An array containing the x, y, z orientation of the object (in radians). :param relative_to: Indicates relative to which reference frame the the orientation is specified. Specify None to set the absolute orientation, or an Object relative to whose reference frame the orientation is specified. :param reset_dynamics: If we want to reset the dynamics when rotating an object instantaneously. """ relto = -1 if relative_to is None else relative_to.get_handle() if reset_dynamics: for ob in self.get_objects_in_tree(exclude_base=False): ob.reset_dynamic_object() sim.simSetObjectOrientation(self._handle, relto, list(orientation))
def get_quaternion(self, relative_to=None) -> np.ndarray: """Retrieves the quaternion (x,y,z,w) of an object.
:param relative_to: Indicates relative to which reference frame we want the orientation. Specify None to retrieve the absolute orientation, or an Object relative to whose reference frame we want the orientation. :return: A list containing the quaternion (x,y,z,w). """ relto = -1 if relative_to is None else relative_to.get_handle() quaternion = sim.simGetObjectQuaternion(self._handle, relto) return np.array(quaternion, dtype=np.float64)
def set_quaternion(self, quaternion: Union[list, np.ndarray], relative_to=None, reset_dynamics=True) -> None: """Sets the orientation of this object.
If the quaternion is not normalised, it will be normalised for you.
:param quaternion: An array containing the quaternion (x,y,z,w). :param relative_to: Indicates relative to which reference frame the the orientation is specified. Specify None to set the absolute orientation, or an Object relative to whose reference frame the orientation is specified. :param reset_dynamics: If we want to reset the dynamics when rotating an object instantaneously. """ assert len(quaternion) == 4 quaternion = np.asarray(quaternion) norm = np.linalg.norm(quaternion) if norm != 1.0: quaternion = quaternion / norm relto = -1 if relative_to is None else relative_to.get_handle() if reset_dynamics: for ob in self.get_objects_in_tree(exclude_base=False): ob.reset_dynamic_object() sim.simSetObjectQuaternion(self._handle, relto, list(quaternion))
def get_pose(self, relative_to=None) -> np.ndarray: """Retrieves the position and quaternion of an object
:param relative_to: Indicates relative to which reference frame we want the pose. Specify None to retrieve the absolute pose, or an Object relative to whose reference frame we want the pose. :return: An array containing the (X,Y,Z,Qx,Qy,Qz,Qw) pose of the object. """ position = self.get_position(relative_to) quaternion = self.get_quaternion(relative_to) return np.r_[position, quaternion]
def set_pose(self, pose: Union[list, np.ndarray], relative_to=None, reset_dynamics=True) -> None: """Sets the position and quaternion of an object.
:param pose: An array containing the (X,Y,Z,Qx,Qy,Qz,Qw) pose of the object. :param relative_to: Indicates relative to which reference frame the the pose is specified. Specify None to set the absolute pose, or an Object relative to whose reference frame the pose is specified. :param reset_dynamics: If we want to reset the dynamics when rotating an object instantaneously. """ assert len(pose) == 7 self.set_position(pose[:3], relative_to, reset_dynamics) self.set_quaternion(pose[3:], relative_to, reset_dynamics)
def get_velocity(self) -> Tuple[np.ndarray, np.ndarray]: """Get the velocity of this object.
:return: A pair of linear and angular velocity. """ linear_vel, angular_vel = sim.simGetObjectVelocity(self._handle) linear_vel = np.array(linear_vel, dtype=np.float64) angular_vel = np.array(angular_vel, dtype=np.float64) return linear_vel, angular_vel
def get_parent(self) -> Union['Object', None]: """Gets the parent of this object in the scene hierarchy.
:return: The parent of this object, or None if it doesn't have a parent. """ try: handle = sim.simGetObjectParent(self._handle) except RuntimeError: # Most probably no parent. return None object_type = ObjectType(sim.simGetObjectType(handle)) cls = object_type_to_class.get(object_type, Object) return cls(handle)
def set_parent(self, parent_object: Union['Object', None], keep_in_place=True) -> None: """Sets this objects parent object in the scene hierarchy.
:param parent_object: The object that will become parent, or None if the object should become parentless. :param keep_in_place: Indicates whether the object's absolute position and orientation should stay same """ parent = -1 if parent_object is None else parent_object.get_handle() sim.simSetObjectParent(self._handle, parent, keep_in_place)
def get_matrix(self, relative_to=None) -> np.ndarray: """Retrieves the transformation matrix of this object.
:param relative_to: Indicates relative to which reference frame we want the matrix. Specify None to retrieve the absolute transformation matrix, or an Object relative to whose reference frame we want the transformation matrix. :return: A 4x4 transformation matrix. """ relto = -1 if relative_to is None else relative_to.get_handle() m = sim.simGetObjectMatrix(self._handle, relto) m_np = np.array(m).reshape((3, 4)) return np.concatenate([m_np, [np.array([0, 0, 0, 1])]])
def set_matrix(self, matrix: np.ndarray, relative_to=None) -> None: """Sets the transformation matrix of this object.
:param relative_to: Indicates relative to which reference frame the matrix is specified. Specify None to set the absolute transformation matrix, or an Object relative to whose reference frame the transformation matrix is specified. :param matrix: A 4x4 transformation matrix. """ if not isinstance(matrix, np.ndarray): raise ValueError('Expected Numpy 4x4 array.') relto = -1 if relative_to is None else relative_to.get_handle() sim.simSetObjectMatrix( self._handle, relto, matrix[:3, :4].reshape((12)).tolist())
def is_collidable(self) -> bool: """Whether the object is collidable or not.
:return: If the object is collidable. """ return self._get_property(sim.sim_objectspecialproperty_collidable)
def set_collidable(self, value: bool) -> None: """Set whether the object is collidable or not.
:param value: The new value of the collidable state. """ self._set_property(sim.sim_objectspecialproperty_collidable, value)
def get_contact(self, contact_obj=None, get_contact_normal: bool = True) -> List: """Get the contact point and force with other object
:param contact_obj: The object want to check contact info with, set to None to get contact with all objects :param get_contact_normal: Weather get the force and direction :return: a list of all the contact info """ contact_info = sim.simGetContactInfo(self.get_handle(), get_contact_normal) if contact_obj is None: return contact_info else: result = [] check_handle = contact_obj.get_handle() for contact in contact_info: if check_handle in contact['contact_handles']: result.append(contact) return result
def is_measurable(self) -> bool: """Whether the object is measurable or not.
:return: If the object is measurable. """ return self._get_property(sim.sim_objectspecialproperty_measurable)
def set_measurable(self, value: bool): """Set whether the object is measurable or not.
:param value: The new value of the measurable state. """ self._set_property(sim.sim_objectspecialproperty_measurable, value)
def is_detectable(self) -> bool: """Whether the object is detectable or not.
:return: If the object is detectable. """ return self._get_property(sim.sim_objectspecialproperty_detectable_all)
def set_detectable(self, value: bool): """Set whether the object is detectable or not.
:param value: The new value of the detectable state. """ self._set_property(sim.sim_objectspecialproperty_detectable_all, value)
def is_renderable(self) -> bool: """Whether the object is renderable or not.
:return: If the object is renderable. """ return self._get_property(sim.sim_objectspecialproperty_renderable)
def set_renderable(self, value: bool): """Set whether the object is renderable or not.
:param value: The new value of the renderable state. """ self._set_property(sim.sim_objectspecialproperty_renderable, value)
def is_model(self) -> bool: """Whether the object is a model or not.
:return: If the object is a model. """ prop = sim.simGetModelProperty(self._handle) return not (prop & sim.sim_modelproperty_not_model)
def set_model(self, value: bool): """Set whether the object is a model or not.
:param value: True to set as a model. """ current = sim.simGetModelProperty(self._handle) current |= sim.sim_modelproperty_not_model if value: current -= sim.sim_modelproperty_not_model sim.simSetModelProperty(self._handle, current)
def remove(self) -> None: """Removes this object/model from the scene.
:raises: ObjectAlreadyRemoved if the object is no longer on the scene. """ try: if self.is_model(): sim.simRemoveModel(self._handle) else: sim.simRemoveObject(self._handle) except RuntimeError as e: raise ObjectAlreadyRemovedError( 'The object/model was already deleted.') from e
def reset_dynamic_object(self) -> None: """Dynamically resets an object that is dynamically simulated.
This means that the object representation in the dynamics engine is removed, and added again. This can be useful when the set-up of a dynamically simulated chain needs to be modified during simulation (e.g. joint or shape attachement position/orientation changed). It should be noted that calling this on a dynamically simulated object might slightly change its position/orientation relative to its parent (since the object will be disconnected from the dynamics world in its current position/orientation), so the user is in charge of rectifying for that. """ sim.simResetDynamicObject(self._handle)
def get_bounding_box(self) -> List[float]: """Gets the bounding box (relative to the object reference frame).
:return: A list containing the min x, max x, min y, max y, min z, max z positions. """ params = [sim.sim_objfloatparam_objbbox_min_x, sim.sim_objfloatparam_objbbox_max_x, sim.sim_objfloatparam_objbbox_min_y, sim.sim_objfloatparam_objbbox_max_y, sim.sim_objfloatparam_objbbox_min_z, sim.sim_objfloatparam_objbbox_max_z] return [sim.simGetObjectFloatParameter( self._handle, p) for p in params]
def get_extension_string(self) -> str: """A string that describes additional environment/object properties.
:return: The extension string. """ return sim.simGetExtensionString(self._handle, -1, '')
def get_configuration_tree(self) -> bytes: """Retrieves configuration information for a hierarchy tree.
Configuration includes object relative positions/orientations, joint/path values. Calling :py:meth:`PyRep.set_configuration_tree` at a later time, will restore the object configuration (use this function to temporarily save object positions/orientations/joint/path values).
:return: The configuration tree. """ return sim.simGetConfigurationTree(self._handle)
def rotate(self, rotation: List[float]) -> None: """Rotates a transformation matrix.
:param rotation: The x, y, z rotation to perform (in radians). """ m = sim.simGetObjectMatrix(self._handle, -1) x_axis = [m[0], m[4], m[8]] y_axis = [m[1], m[5], m[9]] z_axis = [m[2], m[6], m[10]] axis_pos = sim.simGetObjectPosition(self._handle, -1) m = sim.simRotateAroundAxis(m, z_axis, axis_pos, rotation[2]) m = sim.simRotateAroundAxis(m, y_axis, axis_pos, rotation[1]) m = sim.simRotateAroundAxis(m, x_axis, axis_pos, rotation[0]) sim.simSetObjectMatrix(self._handle, -1, m)
def check_collision(self, obj: 'Object' = None) -> bool: """Checks whether two entities are colliding.
:param obj: The other collidable object to check collision against, or None to check against all collidable objects. Note that objects must be marked as collidable! :return: If the object is colliding. """ handle = sim.sim_handle_all if obj is None else obj.get_handle() return sim.simCheckCollision(self._handle, handle) == 1
# === Model specific methods ===
def is_model_collidable(self) -> bool: """Whether the model is collidable or not.
:raises: ObjectIsNotModel if the object is not a model. :return: If the model is collidable. """ return self._get_model_property( sim.sim_modelproperty_not_collidable)
def set_model_collidable(self, value: bool): """Set whether the model is collidable or not.
:param value: The new value of the collidable state of the model. :raises: ObjectIsNotModel if the object is not a model. """ self._set_model_property( sim.sim_modelproperty_not_collidable, value)
def is_model_measurable(self) -> bool: """Whether the model is measurable or not.
:raises: ObjectIsNotModel if the object is not a model. :return: If the model is measurable. """ return self._get_model_property( sim.sim_modelproperty_not_measurable)
def set_model_measurable(self, value: bool): """Set whether the model is measurable or not.
:param value: The new value of the measurable state of the model. :raises: ObjectIsNotModel if the object is not a model. """ self._set_model_property( sim.sim_modelproperty_not_measurable, value)
def is_model_detectable(self) -> bool: """Whether the model is detectable or not.
:raises: ObjectIsNotModel if the object is not a model. :return: If the model is detectable. """ return self._get_model_property( sim.sim_modelproperty_not_detectable)
def set_model_detectable(self, value: bool): """Set whether the model is detectable or not.
:param value: The new value of the detectable state of the model. :raises: ObjectIsNotModel if the object is not a model. """ self._set_model_property( sim.sim_modelproperty_not_detectable, value)
def is_model_renderable(self) -> bool: """Whether the model is renderable or not.
:raises: ObjectIsNotModel if the object is not a model. :return: If the model is renderable. """ return self._get_model_property( sim.sim_modelproperty_not_renderable)
def set_model_renderable(self, value: bool): """Set whether the model is renderable or not.
:param value: The new value of the renderable state of the model. :raises: ObjectIsNotModel if the object is not a model. """ self._set_model_property( sim.sim_modelproperty_not_renderable, value)
def is_model_dynamic(self) -> bool: """Whether the model is dynamic or not.
:raises: ObjectIsNotModel if the object is not a model. :return: If the model is dynamic. """ return self._get_model_property( sim.sim_modelproperty_not_dynamic)
def set_model_dynamic(self, value: bool): """Set whether the model is dynamic or not.
:param value: The new value of the dynamic state of the model. :raises: ObjectIsNotModel if the object is not a model. """ self._set_model_property( sim.sim_modelproperty_not_dynamic, value)
def is_model_respondable(self) -> bool: """Whether the model is respondable or not.
:raises: ObjectIsNotModel if the object is not a model. :return: If the model is respondable. """ return self._get_model_property( sim.sim_modelproperty_not_respondable)
def set_model_respondable(self, value: bool): """Set whether the model is respondable or not.
:param value: The new value of the respondable state of the model. :raises: ObjectIsNotModel if the object is not a model. """ self._set_model_property( sim.sim_modelproperty_not_respondable, value)
def save_model(self, path: str) -> None: """Saves a model.
Object can be turned to models via :py:meth:`Object.set_model`. Any existing file with same name will be overwritten.
:param path: model filename. The filename extension is required ("ttm"). :raises: ObjectIsNotModel if the object is not a model. """ self._check_model() sim.simSaveModel(self._handle, path)
def get_model_bounding_box(self) -> List[float]: """Gets the models bounding box (relative to models reference frame).
:raises: ObjectIsNotModel if the object is not a model. :return: A list containing the min x, max x, min y, max y, min z, max z positions. """ self._check_model() params = [sim.sim_objfloatparam_modelbbox_min_x, sim.sim_objfloatparam_modelbbox_max_x, sim.sim_objfloatparam_modelbbox_min_y, sim.sim_objfloatparam_modelbbox_max_y, sim.sim_objfloatparam_modelbbox_min_z, sim.sim_objfloatparam_modelbbox_max_z] return [sim.simGetObjectFloatParameter( self._handle, p) for p in params]
@staticmethod def _get_objects_in_tree(root_object=None, object_type=ObjectType.ALL, exclude_base=True, first_generation_only=False ) -> List['Object']: if root_object is None: root_object = sim.sim_handle_scene elif isinstance(root_object, Object): root_object = root_object.get_handle() elif not isinstance(root_object, int): raise ValueError('root_object must be None, int or Object')
options = 0 if exclude_base: options |= 1 if first_generation_only: options |= 2 handles = sim.simGetObjectsInTree( root_object, object_type.value, options) objects = [] for handle in handles: try: objects.append(Object.get_object(handle)) except KeyError: name = Object.get_object_name(handle) type = Object.get_object_type(name) warnings.warn( "Object ({}, '{}') has {}, " 'which is not supported'.format(handle, name, type)) return objects
def get_objects_in_tree(self, *args, **kwargs) -> List['Object']: """Retrieves the objects in a given hierarchy tree.
:param object_type: The object type to retrieve. One of :py:class:`.ObjectType`. :param exclude_base: Exclude the tree base from the returned list. :param first_generation_only: Include in the returned list only the object's first children. Otherwise, entire hierarchy is returned. :return: A list of objects in the hierarchy tree. """ return self._get_objects_in_tree(self._handle, *args, **kwargs)
def copy(self) -> 'Object': """Copy and pastes object in the scene.
The object is copied together with all its associated calculation objects and associated scripts.
:return: The new pasted object. """ return self.__class__((sim.simCopyPasteObjects([self._handle], 0)[0]))
def check_distance(self, other: 'Object') -> float: """Checks the minimum distance between two objects.
:param other: The other object to check distance against. :return: The distance between the objects. """ return sim.simCheckDistance( self.get_handle(), other.get_handle(), -1)[6]
def get_bullet_friction(self) -> float: """Get bullet friction parameter.
:return: The friction. """ return sim.simGetEngineFloatParameter(sim.sim_bullet_body_friction, self._handle)
def set_bullet_friction(self, friction) -> None: """Set bullet friction parameter.
:param friction: The friction to set. """ sim.simSetEngineFloatParameter(sim.sim_bullet_body_friction, self._handle, friction)
def get_explicit_handling(self) -> int: """Get explicit handling flags.
:return: The flag: enabled(1) or disabled(0). """ return sim.simGetExplicitHandling(self._handle)
def set_explicit_handling(self, value: int) -> None: """Set explicit handling flags.
:param value: A flag to enable(1) or disable(0) explicit handling. """ sim.simSetExplicitHandling(self._handle, value)
# === Private methods ===
def _check_model(self) -> None: if not self.is_model(): raise ObjectIsNotModelError( "Object '%s' is not a model. Use 'set_model(True)' to convert.")
def _get_model_property(self, prop_type: int) -> bool: current = sim.simGetModelProperty(self._handle) return (current & prop_type) == 0
def _set_model_property(self, prop_type: int, value: bool) -> None: current = sim.simGetModelProperty(self._handle) current |= prop_type # Makes is not X if value: current -= prop_type sim.simSetModelProperty(self._handle, current)
def _get_property(self, prop_type: int) -> bool: current = sim.simGetObjectSpecialProperty(self._handle) return current & prop_type
def _set_property(self, prop_type: int, value: bool) -> None: current = sim.simGetObjectSpecialProperty(self._handle) current |= prop_type if not value: current -= prop_type sim.simSetObjectSpecialProperty(self._handle, current)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123from pyrep.backend import simfrom typing import List, Optional, Unionfrom pyrep.objects.object import Object, object_type_to_classfrom pyrep.const import ObjectType
class Octree(Object): """An octree object."""
def __init__(self, name_or_handle: Union[str, int]): super().__init__(name_or_handle)
@staticmethod def create(voxel_size: float, point_size: Optional[float] = None, options: int = 0) -> 'Octree': """Creates an octree object and inserts in the scene. :param voxelSize: The resolution of octree voxels. :param options: Octree options. :param pointSize: Point representation size of voxels. :return: The newly created Octree. """ if point_size is None: point_size = voxel_size handle = sim.simCreateOctree(voxel_size, options, point_size) return Octree(handle)
def _get_requested_type(self) -> ObjectType: return ObjectType.OCTREE
def insert_voxels(self, points: List[float], color: Optional[float] = None, options: int = 0) -> None: """Inserts voxels into the octree. :param points: A list of x,y,z numbers. :param color: A list containing RGB data, or None. :param options: Voxel insertion options. """ if not isinstance(points, list): raise ValueError( 'Octree.insert_voxels: points parameter is not a list.') if len(points) % 3 != 0: raise ValueError( 'Octree.insert_voxels: points parameter length ' 'not a multiple of 3.') if color is not None: if not isinstance(color, list): raise ValueError( 'Octree.insert_voxels: color parameter not a list.') elif len(color) != 3: raise ValueError( 'Octree.insert_voxels: color parameter not an RGB list.') sim.simInsertVoxelsIntoOctree(self._handle, options, points, color,None) return
def remove_voxels(self, points : Optional[List[float]], options: int = 0) -> None: """Remove voxels from the octree. :param points: A list of x,y,z numbers, or None to clear the octree. :param options: Voxel removal options. """ if points is not None: if not isinstance(points, list): raise ValueError( 'Octree.insert_voxels: points parameter is not a list.') if len(points) % 3 != 0: raise ValueError( 'Octree.insert_voxels: points parameter length ' 'not a multiple of 3.') sim.simRemoveVoxelsFromOctree(self._handle, options, points)
def get_voxels(self) -> list: """Returns voxels from the octree. :return: List of voxel x,y,z coordinates. """ return sim.simGetOctreeVoxels(self._handle)
def insert_object(self, obj: Object, color: Optional[float] = None, options: int = 0) -> None: """Inserts object into the octree. :param obj: Object to insert. :param color: A list containing RGB data, or None. :param options: Object insertion options. """ if color is not None: if not isinstance(color, list): raise ValueError( 'Octree.insert_object: color parameter not a list.') elif len(color) != 3: raise ValueError( 'Octree.insert_object: color parameter not an RGB list.') sim.simInsertObjectIntoOctree(self._handle, obj.get_handle(), options, color, 0) return
def subtract_object(self, obj: Object, options: int = 0) -> None: """Subtract object from the octree. :param obj: Object to subtract. :param options: Object subtraction options. """ sim.simSubtractObjectFromOctree(self._handle, obj.get_handle(), options) return
def check_point_occupancy(self, points: List[float], options: int = 0) -> bool: if not isinstance(points, list): raise ValueError( 'Octree.check_point_occupancy: points parameter is not a list.') if len(points) % 3 != 0: raise ValueError( 'Octree._check_point_occupancy: points parameter length ' 'not a multiple of 3.') return sim.simCheckOctreePointOccupancy(self._handle, options, points)
def clear_voxels(self) -> None: """Clears all voxels from the octree. """ sim.simRemoveVoxelsFromOctree(self._handle, 0, None)
object_type_to_class[ObjectType.OCTREE] = Octree1234567891011121314151617181920212223242526272829303132333435363738394041from math import sqrt
from pyrep.backend import simfrom pyrep.objects.object import Object, object_type_to_classfrom pyrep.const import ObjectType
class ProximitySensor(Object): """Detects objects within a detection volume.
V-REP supports pyramid-, cylinder-, disk-, cone- and ray-type proximity sensors. """
def _get_requested_type(self) -> ObjectType: return ObjectType.PROXIMITY_SENSOR
def read(self) -> float: """Read the distance between sensor and first detected object. If there is no detected object returns -1.0. It can be considered as maximum measurable distance of the sensor.
:return: Float distance to the first detected object """ state, _, points, _ = sim.simReadProximitySensor(self._handle) if state: return sqrt(points[0] ** 2 + points[1] ** 2 + points[2] ** 2) return -1.0
def is_detected(self, obj: Object) -> bool: """Checks whether the proximity sensor detects the indicated object.
:param obj: The object to detect. :return: Bool indicating if the object was detected. """ state, point = sim.simCheckProximitySensor( self._handle, obj.get_handle()) return state == 1
object_type_to_class[ObjectType.PROXIMITY_SENSOR] = ProximitySensor123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584from typing import List, Tupleimport numpy as npfrom pyrep.backend import simfrom pyrep.objects.object import Object, object_type_to_classfrom pyrep.const import ObjectType, PrimitiveShape, TextureMappingModefrom pyrep.textures.texture import Textureimport osimport collections
SShapeVizInfo = collections.namedtuple( 'SShapeVizInfo', [ 'vertices', 'indices', 'normals', 'shading_angle', 'colors', 'texture', 'texture_id', 'texture_coords', 'texture_apply_mode', 'texture_options', ],)
class Shape(Object): """Shapes are rigid mesh objects that are composed of triangular faces. """
@staticmethod def create(type: PrimitiveShape, size: List[float], mass=1., backface_culling=False, visible_edges=False, smooth=False, respondable=True, static=False, renderable=True, position=None, orientation=None, color=None) -> 'Shape': """Creates a primitive shape in the scene.
:param type: The type of primitive to shape. One of: PrimitiveShape.CUBOID PrimitiveShape.SPHERE PrimitiveShape.CYLINDER PrimitiveShape.CONE :param size: A list of the x, y, z dimensions. :param mass: A float representing the mass of the object. :param backface_culling: If backface culling is enabled. :param visible_edges: If the object will have visible edges. :param smooth: If the shape appears smooth. :param respondable: Shape is responsible. :param static: If the shape is static. :param renderable: If the shape is renderable. :param position: The x, y, z position. :param orientation: The x, y, z orientation (in radians). :param color: The r, g, b values of the shape. :return: The created Shape object. """ options = 0 if backface_culling: options |= 1 if visible_edges: options |= 2 if smooth: options |= 4 if respondable: options |= 8 if static: options |= 16
handle = sim.simCreatePureShape(type.value, options, size, mass, None) ob = Shape(handle) ob.set_renderable(renderable) if position is not None: ob.set_position(position) if orientation is not None: ob.set_orientation(orientation) if color is not None: ob.set_color(color) return ob
@classmethod def import_shape(cls, filename: str, scaling_factor=1.0, keep_identical_vertices=False, ignore_color=False, ignore_texture=False, reorient_bounding_box=False, ignore_up_vector=False) -> 'Shape': """Imports a shape with visuals from a file.
:param filename: The location of the file to import. :param scaling_factor: The scaling factor to apply to the imported vertices :param keep_identical_vertices: Keep identical vertices. :param ignore_color: Do not preserve colors. :param ignore_texture: Do not preserve texture. :param reorient_bounding_box: Reorient the shape's bounding box with the world. :param ignore_up_vector: Ignore up-vector coded in file. :return: The Shape object. """ if not os.path.isfile(filename): raise ValueError('Filename does not exist: ' + filename)
options = 0 if keep_identical_vertices: options |= 1 if ignore_color: options |= 8 if not ignore_texture: options |= 16 if reorient_bounding_box: options |= 32 if ignore_up_vector: options |= 128
handle = sim.simImportShape(0, filename, options, 0, scaling_factor) return cls(handle)
@staticmethod def import_mesh(filename: str, scaling_factor=1.0, keep_identical_vertices=False, ignore_up_vector=False) -> 'Shape': """Imports a mesh from a file.
:param filename: The location of the file to import. :param scaling_factor: The scaling factor to apply to the imported vertices :param keep_identical_vertices: Keep identical vertices. :param ignore_up_vector: Ignore up-vector coded in file. :return: The grouped Shape object. """
if not os.path.isfile(filename): raise ValueError('Filename does not exist: ' + filename)
options = 0 if keep_identical_vertices: options |= 1 if ignore_up_vector: options |= 128
# fileformat is 0 as it is automatically detected. # identicalVerticeTolerance has no effect. Setting to zero. verticies, indices, names = sim.simImportMesh( 0, filename, options, 0, scaling_factor) mesh_objects = [] for v, i, n in zip(verticies, indices, names): mesh_ob = Shape.create_mesh(v, i) mesh_objects.append(mesh_ob) grouped = mesh_objects[0] if len(mesh_objects) > 1: handles = [o.get_handle() for o in mesh_objects] handle = sim.simGroupShapes(handles) grouped = Shape(handle) return grouped
@staticmethod def create_mesh(vertices: List[float], indices: List[int], shading_angle=None, backface_culling=False, visible_edges=False) -> 'Shape': """Creates a mesh shape.
:param vertices: A list of vertices. :param indices: A list of indices. :param shading_angle: The shading angle (in radians). :param backface_culling: To enable backface culling. :param visible_edges: To enable visible edges. :return: The newly created mesh. """ options = 0 if backface_culling: options |= 1 if visible_edges: options |= 2 if shading_angle is None: shading_angle = 20.0 * 3.1415 / 180.0 handle = sim.simCreateMeshShape( options, shading_angle, vertices, indices) return Shape(handle)
def _get_requested_type(self) -> ObjectType: return ObjectType.SHAPE
def is_respondable(self) -> bool: """Whether the shape is respondable or not.
:return: If the shape is respondable. """ return sim.simGetObjectInt32Parameter( self._handle, sim.sim_shapeintparam_respondable)
def set_respondable(self, value: bool) -> None: """Set whether the shape is respondable or not.
:param value: The new value of the respondable state of the shape. """ sim.simSetObjectInt32Parameter( self._handle, sim.sim_shapeintparam_respondable, value) self.reset_dynamic_object()
def is_dynamic(self) -> bool: """Whether the shape is dynamic or not.
:return: If the shape is dynamic. """ return not sim.simGetObjectInt32Parameter( self._handle, sim.sim_shapeintparam_static)
def set_dynamic(self, value: bool) -> None: """Set whether the shape is dynamic or not.
:param value: The new value of the dynamic state of the shape. """ sim.simSetObjectInt32Parameter( self._handle, sim.sim_shapeintparam_static, not value) self.reset_dynamic_object()
def get_color(self) -> List[float]: """Gets the shape color.
:return: The r, g, b values of the shape. """ return sim.simGetShapeColor( self._handle, None, sim.sim_colorcomponent_ambient_diffuse)
def set_color(self, color: List[float]) -> None: """Sets the color of the shape.
:param color: The r, g, b values of the shape. """ sim.simSetShapeColor( self._handle, None, sim.sim_colorcomponent_ambient_diffuse, color)
def get_transparency(self) -> float: """Sets the transparency of the shape.
:return: The transparency values of the shape. """ return sim.simGetShapeColor( self._handle, None, sim.sim_colorcomponent_transparency)[0]
def set_transparency(self, value: float) -> None: """Sets the transparency of the shape.
:param value: Value between 0 and 1. """ if 0 > value > 1: raise ValueError('Value must be between 0 and 1.') sim.simSetShapeColor( self._handle, None, sim.sim_colorcomponent_transparency, [value])
def get_mass(self) -> float: """Gets the mass of the shape.
:return: A float representing the mass. """ return sim.simGetObjectFloatParameter(self._handle, sim.sim_shapefloatparam_mass)
def set_mass(self, mass: float) -> None: """Sets the mass of the shape.
:param mass: The new mass value. """ sim.simSetObjectFloatParameter( self._handle, sim.sim_shapefloatparam_mass, mass)
def compute_mass_and_inertia(self, density: float) -> None: """Computes and applies the mass and inertia properties for a convex shape (or convex compound shape), based on a density value.
:param density: The density expressed in kg/m^3 """ ret = sim.simComputeMassAndInertia(self._handle, density) if ret == 0: raise ValueError( 'The shape must be a convex shape (or convex compound shape)')
def get_mesh_data(self) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: """Retrieves a shape's mesh information.
:param asnumpy: A flag to cast vertices as numpy array with reshape. :return: A tuple containing a list of vertices, indices, and normals. """ vertices, indices, normals = sim.simGetShapeMesh(self._handle) vertices = np.array(vertices, dtype=np.float64).reshape(-1, 3) indices = np.array(indices, dtype=np.int64).reshape(-1, 3) normals = np.array(normals, dtype=np.float64).reshape(-1, 3) return vertices, indices, normals
def decimate_mesh(self, percentage: float) -> 'Shape': """Retrieves a shape's mesh information.
:param percentage: The percentage of the desired decimation (0.1-0.9). :return: A new shape that has a decimated mesh. """ if percentage < 0.1 or percentage > 0.9: raise ValueError('percentage param must be between 0.1 and 0.9.') # verts, inds, _ = self.get_mesh_data() verts, inds, _ = sim.simGetShapeMesh(self._handle) new_verts, new_inds = sim.simGetDecimatedMesh( # verts.reshape(-1).tolist(), inds.reshape(-1).tolist(), percentage) verts, inds, percentage) s = Shape.create_mesh(new_verts, new_inds) s.set_matrix(self.get_matrix()) return s
def get_convex_decomposition(self, morph=False, same=False, use_vhacd=False, individual_meshes=False, hacd_extra_points=True, hacd_face_points=True, hacd_min_clusters=1, hacd_tri_target=500, hacd_max_vertex=200, hacd_max_iter=4, hacd_max_concavity=100, hacd_max_dist=30, hacd_cluster_thresh=0.25, vhacd_pca=False, vhacd_tetrahedron=False, vhacd_res=100000, vhacd_depth=20, vhacd_plane_downsample=4, vhacd_hull_downsample=4, vhacd_max_vertex=64, vhacd_concavity=0.0025, vhacd_alpha=0.05, vhacd_beta=0.05, vhacd_gamma=0.00125, vhacd_min_vol=0.0001 ) -> 'Shape': """ Compute the convex decomposition of the shape using HACD or V-HACD algorithms :param morph: The shape will be morphed into its convex decomposition. Otherwise a new shape will be created. :param same: Use the same parameters as the last call to the function. :param use_vhacd: Use V-HACD algorithm. :param individual_meshes: Each individual mesh of a compound shape will be handled on its own during decomposition, otherwise the compound shape is considered as a single mesh. :param hacd_extra_points: HACD: Extra points will be added when computing the concavity. :param hacd_face_points: HACD: Faces points will be added when computing the concavity. :param hacd_min_clusters: HACD: Minimum number of clusters to generate. :param hacd_tri_target: HACD: Targeted number of triangles of the decimated mesh. :param hacd_max_vertex: HACD: Maximum number of vertices for each generated convex hull. :param hacd_max_iter: HACD: Maximum number of iterations. :param hacd_max_concavity: HACD: The maximum allowed concavity. :param hacd_max_dist: HACD: The maximum allowed distance to get convex clusters connected. :param hacd_cluster_thresh: HACD: The threshold to detect small clusters, expressed as a fraction of the total mesh surface. :param vhacd_pca: V-HACD: Enable PCA. :param vhacd_tetrahedron: V-HACD: Tetrahedron-based approximate convex decomposition. Otherwise, voxel-based decomposition is used. :param vhacd_res: V-HACD: Resolution (10000-64000000) :param vhacd_depth: V-HACD: Depth (1-32) :param vhacd_plane_downsample: V-HACD: Plane downsampling (1-16) :param vhacd_hull_downsample: V-HACD: Convex hull downsampling (1-16) :param vhacd_max_vertex: V-HACD: Maximum number of vertices per convex hull (4-1024) :param vhacd_concavity: V-HACD: Concavity (0.0-1.0) :param vhacd_alpha: V-HACD: Alpha (0.0-1.0) :param vhacd_beta: V-HACD: Beta (0.0-1.0) :param vhacd_gamma: V-HACD: Gamma (0.0-1.0) :param vhacd_min_vol: V-HACD: Minimum volume per convex hull (0.0-0.01) :return: Convex Decomposition of the shape. """ options = 0 if morph: options |= 1 if same: options |= 4 if hacd_extra_points: options |= 8 if hacd_face_points: options |= 16 if individual_meshes: options |= 32 if use_vhacd: options |= 128 if vhacd_pca: options |= 256 if vhacd_tetrahedron: options |= 512
int_params = [ hacd_min_clusters, # [0] hacd_tri_target, # [1] hacd_max_vertex, # [2] hacd_max_iter, # [3] 0, # [4] vhacd_res, # [5] vhacd_depth, # [6] vhacd_plane_downsample, # [7] vhacd_hull_downsample, # [8] vhacd_max_vertex # [9] ]
float_params = [ hacd_max_concavity, # [0] hacd_max_dist, # [1] hacd_cluster_thresh, # [2] 0.0, # [3] 0.0, # [4] vhacd_concavity, # [5] vhacd_alpha, # [6] vhacd_beta, # [7] vhacd_gamma, # [8] vhacd_min_vol # [9] ]
return Shape(sim.simConvexDecompose(self.get_handle(), options, int_params, float_params))
def get_texture(self): """Retrieves the texture from the shape. :return: The texture associated with this object. """ return Texture(sim.simGetShapeTextureId(self.get_handle()))
def remove_texture(self): """Removes the texture from the shape. """ sim.simSetShapeTexture(self.get_handle(), -1, 0, 0, [1, 1], None, None)
def set_texture(self, texture: Texture, mapping_mode: TextureMappingMode, interpolate=True, decal_mode=False, repeat_along_u=False, repeat_along_v=False, uv_scaling=[1., 1.], position: List[float] = None, orientation: List[float] = None): """Applies a texture to a shape
:param texture: The texture to add. :param mapping_mode: The texture mapping mode. One of: TextureMappingMode.PLANE TextureMappingMode.CYLINDER TextureMappingMode.SPHERE TextureMappingMode.CUBE :param interpolate: Adjacent texture pixels are not interpolated. :param decal_mode: Texture is applied as a decal (its appearance won't be influenced by light conditions). :param repeat_along_u: Texture will be repeated along the U direction. :param repeat_along_v: Texture will be repeated along the V direction. :param uv_scaling: A list of 2 values containig the texture scaling factors along the U and V directions. :param position: A list of (x,y,z) values that indicate the texture position on the shape. Can be None for default. :param orientation: A list of 3 Euler angles that indicate the texture orientation on the shape. Can be None for default. """ options = 0 if not interpolate: options |= 1 if decal_mode: options |= 2 if repeat_along_u: options |= 4 if repeat_along_v: options |= 8 sim.simSetShapeTexture( self.get_handle(), texture.get_texture_id(), mapping_mode.value, options, list(uv_scaling), position, orientation)
def ungroup(self) -> List['Shape']: """Ungroups a compound shape into several simple shapes.
:return: A list of shapes. """ handles = sim.simUngroupShape(self.get_handle()) return [Shape(handle) for handle in handles]
def apply_texture(self, texture_coords: np.ndarray, texture: np.ndarray, interpolate: bool = True, decal_mode: bool = False, is_rgba: bool = False, fliph: bool = False, flipv: bool = False) -> None: """Apply texture to the shape.
:param texture_coords: A list of (u, v) values that indicate the vertex position on the shape. For each of the shape's triangle, there should be exactly 3 UV texture coordinate pairs :param texture: The RGB or RGBA texture. :param interpolate: A flag to interpolate adjacent texture pixels. :param decal_mode: Texture is applied as a decal (its appearance won't be influenced by light conditions). :param is_rgba: A flag to use RGBA texture. :param fliph: A flag to flip texture horizontally. :param flipv: A flag to flip texture vertically. Note that CoppeliaSim texture coordinates are flipped vertically compared with Pillow and OpenCV and this flag must be true in general. """ texture_coords = np.asarray(texture_coords) if not isinstance(texture, np.ndarray): raise TypeError('texture must be np.ndarray type') height, width = texture.shape[:2]
options = 0 if not interpolate: options |= 1 if decal_mode: options |= 2 if is_rgba: options |= 16 if fliph: options |= 32 if flipv: options |= 64
sim.simApplyTexture( self._handle, textureCoordinates=texture_coords.flatten().tolist(), textCoordSize=texture_coords.size, texture=texture.flatten().tolist(), textureResolution=(width, height), options=options, )
def get_shape_viz(self, index): """Retrieves a shape's visual information.
:param index: 0-based index of the shape element to retrieve (compound shapes contain more than one shape element)
:return: SShapeVizInfo. """ info = sim.simGetShapeViz(shapeHandle=self._handle, index=index)
vertices = np.array(info.vertices, dtype=float).reshape(-1, 3) indices = np.array(info.indices, dtype=float).reshape(-1, 3) normals = np.array(info.normals, dtype=float).reshape(-1, 3) colors = np.array(info.colors, dtype=float) texture = np.array(info.texture, dtype=np.uint8).reshape( info.textureRes[1], info.textureRes[0], 4) textureCoords = np.array(info.textureCoords, dtype=float).reshape( -1, 2)
res = SShapeVizInfo( vertices=vertices, indices=indices, normals=normals, shading_angle=info.shadingAngle, colors=colors, texture=texture, texture_id=info.textureId, texture_coords=textureCoords, texture_apply_mode=info.textureApplyMode, texture_options=info.textureOptions, ) return res
def reorient_bounding_box(self, relative_to=None) -> None: relto = -1 if relative_to is None else relative_to.get_handle() sim.simReorientShapeBoundingBox(self._handle, relto)
def add_force(self, position: np.ndarray, force: np.ndarray, reset_force_torque: bool = False) -> None: """ Adds a non-central force to a shape object that is dynamically enabled. Added forces are cumulative.
:param position: Relative position where the force should be applied. :param force: The force (in relative coordinates) to add. :param reset_force_torque: Clears the accumulated force and torque. """ h = (self._handle | sim.sim_handleflag_resetforcetorque if reset_force_torque else self._handle) sim.simAddForce(h, list(position), list(force))
def add_force_and_torque(self, force: np.ndarray, torque: np.ndarray, reset_force: bool = False, reset_torque: bool = False) -> None: """ Adds a force and/or torque to a shape object that is dynamically enabled. Forces are applied at the center of mass. Added forces and torques are cumulative.
:param force: The force (in absolute coordinates) to add. :param torque: The torque (in absolute coordinates) to add. :param reset_force: Clears the accumulated force. :param reset_torque: Clears the accumulated torque. """ h = self._handle if reset_force: h |= sim.sim_handleflag_resetforce if reset_torque: h |= sim.sim_handleflag_resettorque sim.simAddForceAndTorque(h, None if force is None else list(force), None if torque is None else list(torque))
object_type_to_class[ObjectType.SHAPE] = Shape123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423import mathfrom typing import List, Union, Sequencefrom pyrep.backend import simfrom pyrep.objects.object import Object, object_type_to_classimport numpy as npfrom pyrep.const import ObjectType, PerspectiveMode, RenderMode
class VisionSensor(Object): """A camera-type sensor, reacting to light, colors and images. """
def __init__(self, name_or_handle: Union[str, int]): super().__init__(name_or_handle) self.resolution = sim.simGetVisionSensorResolution(self._handle)
@staticmethod def create(resolution: List[int], explicit_handling=False, perspective_mode=True, show_volume_not_detecting=True, show_volume_detecting=True, passive=False, use_local_lights=False, show_fog=True, near_clipping_plane=1e-2, far_clipping_plane=10.0, view_angle=60.0, ortho_size=1.0, sensor_size=None, background_color=None, render_mode=RenderMode.OPENGL3, position=None, orientation=None) -> 'VisionSensor': """ Create a Vision Sensor
:param resolution: List of the [x, y] resolution. :param explicit_handling: Sensor will be explicitly handled. :param perspective_mode: Sensor will be operated in Perspective Mode. Orthographic mode if False. :param show_volume_not_detecting: Sensor volume will be shown when not detecting anything. :param show_volume_detecting: Sensor will be shown when detecting. :param passive: Sensor will be passive (use an external image). :param use_local_lights: Sensor will use local lights. :param show_fog: Sensor will show fog (if enabled). :param near_clipping_plane: Near clipping plane. :param far_clipping_plane: Far clipping plane. :param view_angle: Perspective angle (in degrees) if in Perspective Mode. :param ortho_size: Orthographic projection size [m] if in Orthographic Mode. :param sensor_size: Size [x, y, z] of the Vision Sensor object. :param render_mode: Sensor rendering mode, one of: RenderMode.OPENGL RenderMode.OPENGL_AUXILIARY RenderMode.OPENGL_COLOR_CODED RenderMode.POV_RAY RenderMode.EXTERNAL RenderMode.EXTERNAL_WINDOWED RenderMode.OPENGL3 RenderMode.OPENGL3_WINDOWED :param position: The [x, y, z] position, if specified. :param orientation: The [x, y, z] orientation in radians, if specified. :return: The created Vision Sensor. """ options = 0 if explicit_handling: options |= 1 if perspective_mode: options |= 2 if not show_volume_not_detecting: options |= 4 if not show_volume_detecting: options |= 8 if passive: options |= 16 if use_local_lights: options |= 32 if not show_fog: options |= 64
if background_color: #show_default_background_color: options |= 128 else: background_color = [0.0, 0.0, 0.0]
int_params = [ resolution[0], # 0 resolution[1], # 1 0, # 2 0 # 3 ]
if sensor_size is None: sensor_size = [0.01, 0.01, 0.03] # sensor_size[1] and sensor_size[2] should be 0 according to the documentation...
float_params = [ near_clipping_plane, # 0 far_clipping_plane, # 1 math.radians(view_angle) if perspective_mode else ortho_size, # 2 sensor_size[0], # 3 sensor_size[1], # 4 sensor_size[2], # 5 background_color[0], # 6 background_color[1], # 7 background_color[2], # 8 0.0, # 9 0.0, # 10 ]
vs = VisionSensor( sim.simCreateVisionSensor(options, int_params, float_params, None) ) vs.set_render_mode(render_mode) if position is not None: vs.set_position(position) if orientation is not None: vs.set_orientation(orientation) return vs
def _get_requested_type(self) -> ObjectType: return ObjectType.VISION_SENSOR
def handle_explicitly(self) -> None: """Handle sensor explicitly.
This enables capturing image (e.g., capture_rgb()) without PyRep.step(). """ if not self.get_explicit_handling(): raise RuntimeError('The explicit_handling is disabled. ' 'Call set_explicit_handling(value=1) to enable explicit_handling first.') sim.simHandleVisionSensor(self._handle)
def capture_rgb(self) -> np.ndarray: """Retrieves the rgb-image of a vision sensor.
:return: A numpy array of size (width, height, 3) """ return sim.simGetVisionSensorImage(self._handle, self.resolution)
def capture_depth(self, in_meters=False) -> np.ndarray: """Retrieves the depth-image of a vision sensor.
:param in_meters: Whether the depth should be returned in meters. :return: A numpy array of size (width, height) """ return sim.simGetVisionSensorDepthBuffer( self._handle, self.resolution, in_meters)
def capture_pointcloud(self) -> np.ndarray: """Retrieves point cloud in word frame.
:return: A numpy array of size (width, height, 3) """ d = self.capture_depth(in_meters=True) return self.pointcloud_from_depth(d)
def pointcloud_from_depth(self, depth: np.ndarray) -> np.ndarray: """Converts depth (in meters) to point cloud in word frame.
:return: A numpy array of size (width, height, 3) """ intrinsics = self.get_intrinsic_matrix() return VisionSensor.pointcloud_from_depth_and_camera_params( depth, self.get_matrix(), intrinsics)
@staticmethod def pointcloud_from_depth_and_camera_params( depth: np.ndarray, extrinsics: np.ndarray, intrinsics: np.ndarray) -> np.ndarray: """Converts depth (in meters) to point cloud in word frame. :return: A numpy array of size (width, height, 3) """ upc = _create_uniform_pixel_coords_image(depth.shape) pc = upc * np.expand_dims(depth, -1) C = np.expand_dims(extrinsics[:3, 3], 0).T R = extrinsics[:3, :3] R_inv = R.T # inverse of rot matrix is transpose R_inv_C = np.matmul(R_inv, C) extrinsics = np.concatenate((R_inv, -R_inv_C), -1) cam_proj_mat = np.matmul(intrinsics, extrinsics) cam_proj_mat_homo = np.concatenate( [cam_proj_mat, [np.array([0, 0, 0, 1])]]) cam_proj_mat_inv = np.linalg.inv(cam_proj_mat_homo)[0:3] world_coords_homo = np.expand_dims(_pixel_to_world_coords( pc, cam_proj_mat_inv), 0) world_coords = world_coords_homo[..., :-1][0] return world_coords
def get_intrinsic_matrix(self): res = np.array(self.get_resolution()) pp_offsets = res / 2 ratio = res[0] / res[1] pa_x = pa_y = math.radians(self.get_perspective_angle()) if ratio > 1: pa_y = 2 * np.arctan(np.tan(pa_y / 2) / ratio) elif ratio < 1: pa_x = 2 * np.arctan(np.tan(pa_x / 2) * ratio) persp_angles = np.array([pa_x, pa_y]) focal_lengths = -res / (2 * np.tan(persp_angles / 2)) return np.array( [[focal_lengths[0], 0., pp_offsets[0]], [0., focal_lengths[1], pp_offsets[1]], [0., 0., 1.]])
def get_resolution(self) -> List[int]: """ Return the Sensor's resolution.
:return: Resolution [x, y] """ return sim.simGetVisionSensorResolution(self._handle)
def set_resolution(self, resolution: List[int]) -> None: """ Set the Sensor's resolution.
:param resolution: New resolution [x, y] """ sim.simSetObjectInt32Parameter( self._handle, sim.sim_visionintparam_resolution_x, resolution[0] ) sim.simSetObjectInt32Parameter( self._handle, sim.sim_visionintparam_resolution_y, resolution[1] ) self.resolution = resolution
def get_perspective_mode(self) -> PerspectiveMode: """ Retrieve the Sensor's perspective mode.
:return: The current PerspectiveMode. """ perspective_mode = sim.simGetObjectInt32Parameter( self._handle, sim.sim_visionintparam_perspective_operation, ) return PerspectiveMode(perspective_mode)
def set_perspective_mode(self, perspective_mode: PerspectiveMode) -> None: """ Set the Sensor's perspective mode.
:param perspective_mode: The new perspective mode, one of: PerspectiveMode.ORTHOGRAPHIC PerspectiveMode.PERSPECTIVE """ sim.simSetObjectInt32Parameter( self._handle, sim.sim_visionintparam_perspective_operation, perspective_mode.value )
def get_render_mode(self) -> RenderMode: """ Retrieves the Sensor's rendering mode
:return: RenderMode for the current rendering mode. """ render_mode = sim.simGetObjectInt32Parameter( self._handle, sim.sim_visionintparam_render_mode ) return RenderMode(render_mode)
def set_render_mode(self, render_mode: RenderMode) -> None: """ Set the Sensor's rendering mode
:param render_mode: The new sensor rendering mode, one of: RenderMode.OPENGL RenderMode.OPENGL_AUXILIARY RenderMode.OPENGL_COLOR_CODED RenderMode.POV_RAY RenderMode.EXTERNAL RenderMode.EXTERNAL_WINDOWED RenderMode.OPENGL3 RenderMode.OPENGL3_WINDOWED """ sim.simSetObjectInt32Parameter( self._handle, sim.sim_visionintparam_render_mode, render_mode.value )
def get_windowed_size(self) -> Sequence[int]: """Get the size of windowed rendering.
:return: The (x, y) resolution of the window. 0 for full-screen. """ size_x = sim.simGetObjectInt32Parameter( self._handle, sim.sim_visionintparam_windowed_size_x) size_y = sim.simGetObjectInt32Parameter( self._handle, sim.sim_visionintparam_windowed_size_y) return size_x, size_y
def set_windowed_size(self, resolution: Sequence[int] = (0, 0)) -> None: """Set the size of windowed rendering.
:param resolution: The (x, y) resolution of the window. 0 for full-screen. """ sim.simSetObjectInt32Parameter( self._handle, sim.sim_visionintparam_windowed_size_x, resolution[0]) sim.simSetObjectInt32Parameter( self._handle, sim.sim_visionintparam_windowed_size_y, resolution[1])
def get_perspective_angle(self) -> float: """ Get the Sensor's perspective angle.
:return: The sensor's perspective angle (in degrees). """ return math.degrees(sim.simGetObjectFloatParameter( self._handle, sim.sim_visionfloatparam_perspective_angle ))
def set_perspective_angle(self, angle: float) -> None: """ Set the Sensor's perspective angle.
:param angle: New perspective angle (in degrees) """ sim.simSetObjectFloatParameter( self._handle, sim.sim_visionfloatparam_perspective_angle, math.radians(angle) )
def get_orthographic_size(self) -> float: """ Get the Sensor's orthographic size.
:return: The sensor's orthographic size (in metres). """ return sim.simGetObjectFloatParameter( self._handle, sim.sim_visionfloatparam_ortho_size )
def set_orthographic_size(self, ortho_size: float) -> None: """ Set the Sensor's orthographic size.
:param angle: New orthographic size (in metres) """ sim.simSetObjectFloatParameter( self._handle, sim.sim_visionfloatparam_ortho_size, ortho_size )
def get_near_clipping_plane(self) -> float: """ Get the Sensor's near clipping plane.
:return: Near clipping plane (metres) """ return sim.simGetObjectFloatParameter( self._handle, sim.sim_visionfloatparam_near_clipping )
def set_near_clipping_plane(self, near_clipping: float) -> None: """ Set the Sensor's near clipping plane.
:param near_clipping: New near clipping plane (in metres) """ sim.simSetObjectFloatParameter( self._handle, sim.sim_visionfloatparam_near_clipping, near_clipping )
def get_far_clipping_plane(self) -> float: """ Get the Sensor's far clipping plane.
:return: Near clipping plane (metres) """ return sim.simGetObjectFloatParameter( self._handle, sim.sim_visionfloatparam_far_clipping )
def set_far_clipping_plane(self, far_clipping: float) -> None: """ Set the Sensor's far clipping plane.
:param far_clipping: New far clipping plane (in metres) """ sim.simSetObjectFloatParameter( self._handle, sim.sim_visionfloatparam_far_clipping, far_clipping )
def set_entity_to_render(self, entity_to_render: int) -> None: """ Set the entity to render to the Sensor, this can be an object or more usefully a collection. -1 to render all objects in scene.
:param entity_to_render: Handle of the entity to render """ sim.simSetObjectInt32Parameter( self._handle, sim.sim_visionintparam_entity_to_render, entity_to_render )
def get_entity_to_render(self) -> None: """ Get the entity to render to the Sensor, this can be an object or more usefully a collection. -1 if all objects in scene are rendered.
:return: Handle of the entity to render """ return sim.simGetObjectInt32Parameter( self._handle, sim.sim_visionintparam_entity_to_render )
def _create_uniform_pixel_coords_image(resolution: np.ndarray): pixel_x_coords = np.reshape( np.tile(np.arange(resolution[1]), [resolution[0]]), (resolution[0], resolution[1], 1)).astype(np.float32) pixel_y_coords = np.reshape( np.tile(np.arange(resolution[0]), [resolution[1]]), (resolution[1], resolution[0], 1)).astype(np.float32) pixel_y_coords = np.transpose(pixel_y_coords, (1, 0, 2)) uniform_pixel_coords = np.concatenate( (pixel_x_coords, pixel_y_coords, np.ones_like(pixel_x_coords)), -1) return uniform_pixel_coords
def _transform(coords, trans): h, w = coords.shape[:2] coords = np.reshape(coords, (h * w, -1)) coords = np.transpose(coords, (1, 0)) transformed_coords_vector = np.matmul(trans, coords) transformed_coords_vector = np.transpose( transformed_coords_vector, (1, 0)) return np.reshape(transformed_coords_vector, (h, w, -1))
def _pixel_to_world_coords(pixel_coords, cam_proj_mat_inv): h, w = pixel_coords.shape[:2] pixel_coords = np.concatenate( [pixel_coords, np.ones((h, w, 1))], -1) world_coords = _transform(pixel_coords, cam_proj_mat_inv) world_coords_homo = np.concatenate( [world_coords, np.ones((h, w, 1))], axis=-1) return world_coords_homo
object_type_to_class[ObjectType.VISION_SENSOR] = VisionSensor123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496import logging
from ctypes import alignmentfrom pyrep.backend import sim, utilsfrom pyrep.objects import Objectfrom pyrep.objects.dummy import Dummyfrom pyrep.robots.configuration_paths.arm_configuration_path import ( ArmConfigurationPath)from pyrep.robots.robot_component import RobotComponentfrom pyrep.objects.cartesian_path import CartesianPathfrom pyrep.errors import ConfigurationError, ConfigurationPathError, IKErrorfrom pyrep.const import ConfigurationPathAlgorithms as Algosfrom pyrep.const import PYREP_SCRIPT_TYPEfrom typing import List, Unionimport numpy as npimport warnings
class Arm(RobotComponent): """Base class representing a robot arm with path planning support. """
def __init__(self, count: int, name: str, num_joints: int, base_name: str = None, max_velocity=1.0, max_acceleration=4.0, max_jerk=1000): """Count is used for when we have multiple copies of arms""" self.name = name joint_names = ['%s_joint%d' % (name, i+1) for i in range(num_joints)] super().__init__(count, name, joint_names, base_name)
# Used for motion planning self.max_velocity = max_velocity self.max_acceleration = max_acceleration self.max_jerk = max_jerk
# Motion planning handles suffix = '' if count == 0 else '#%d' % (count - 1) self._ik_target = Dummy('%s_target%s' % (name, suffix)) self._ik_tip = Dummy('%s_tip%s' % (name, suffix)) self._ik_group = sim.simGetIkGroupHandle('%s_ik%s' % (name, suffix)) self._collision_collection = sim.simGetCollectionHandle( '%s_arm%s' % (name, suffix))
def set_ik_element_properties(self, constraint_x=True, constraint_y=True, constraint_z=True, constraint_alpha_beta=True, constraint_gamma=True) -> None: constraints = 0 if constraint_x: constraints |= sim.sim_ik_x_constraint if constraint_y: constraints |= sim.sim_ik_y_constraint if constraint_z: constraints |= sim.sim_ik_z_constraint if constraint_alpha_beta: constraints |= sim.sim_ik_alpha_beta_constraint if constraint_gamma: constraints |= sim.sim_ik_gamma_constraint sim.simSetIkElementProperties( ikGroupHandle=self._ik_group, tipDummyHandle=self._ik_tip.get_handle(), constraints=constraints, precision=None, weight=None, )
def set_ik_group_properties(self, resolution_method='pseudo_inverse', max_iterations=6, dls_damping=0.1) -> None: try: res_method = {'pseudo_inverse': sim.sim_ik_pseudo_inverse_method, 'damped_least_squares': sim.sim_ik_damped_least_squares_method, 'jacobian_transpose': sim.sim_ik_jacobian_transpose_method}[resolution_method] except KeyError: raise Exception('Invalid resolution method,' 'Must be one of ["pseudo_inverse" | "damped_least_squares" | "jacobian_transpose"]') sim.simSetIkGroupProperties( ikGroupHandle=self._ik_group, resolutionMethod=res_method, maxIterations=max_iterations, damping=dls_damping )
def solve_ik_via_sampling(self, position: Union[List[float], np.ndarray], euler: Union[List[float], np.ndarray] = None, quaternion: Union[List[float], np.ndarray] = None, ignore_collisions: bool = False, trials: int = 300, max_configs: int = 1, distance_threshold: float = 0.65, max_time_ms: int = 10, relative_to: Object = None ) -> np.ndarray: """Solves an IK group and returns the calculated joint values.
This IK method performs a random searches for manipulator configurations that matches the given end-effector pose in space. When the tip pose is close enough then IK is computed in order to try to bring the tip onto the target. This is the method that should be used when the start pose is far from the end pose.
We generate 'max_configs' number of samples within X number of 'trials', before ranking them according to angular distance.
Must specify either rotation in euler or quaternions, but not both!
:param position: The x, y, z position of the target. :param euler: The x, y, z orientation of the target (in radians). :param quaternion: A list containing the quaternion (x,y,z,w). :param ignore_collisions: If collision checking should be disabled. :param trials: The maximum number of attempts to reach max_configs. :param max_configs: The maximum number of configurations we want to generate before sorting them. :param distance_threshold: Distance indicating when IK should be computed in order to try to bring the tip onto the target. :param max_time_ms: Maximum time in ms spend searching for each configuation. :param relative_to: Indicates relative to which reference frame we want the target pose. Specify None to retrieve the absolute pose, or an Object relative to whose reference frame we want the pose. :raises: ConfigurationError if no joint configuration could be found.
:return: 'max_configs' number of joint configurations, ranked according to angular distance. """ if not ((euler is None) ^ (quaternion is None)): raise ConfigurationError( 'Specify either euler or quaternion values, but not both.')
prev_pose = self._ik_target.get_pose() self._ik_target.set_position(position, relative_to) if euler is not None: self._ik_target.set_orientation(euler, relative_to) elif quaternion is not None: self._ik_target.set_quaternion(quaternion, relative_to)
handles = [j.get_handle() for j in self.joints] cyclics, intervals = self.get_joint_intervals() low_limits, max_limits = list(zip(*intervals)) # If there are huge intervals, then limit them low_limits = np.maximum(low_limits, -np.pi*2).tolist() max_limits = np.minimum(max_limits, np.pi*2).tolist()
collision_pairs = [] if not ignore_collisions: collision_pairs = [self._collision_collection, sim.sim_handle_all]
metric = joint_options = None valid_joint_positions = [] for i in range(trials): config = sim.simGetConfigForTipPose( self._ik_group, handles, distance_threshold, int(max_time_ms), metric, collision_pairs, joint_options, low_limits, max_limits) if len(config) > 0: valid_joint_positions.append(config) if len(valid_joint_positions) >= max_configs: break
self._ik_target.set_pose(prev_pose) if len(valid_joint_positions) == 0: raise ConfigurationError( 'Could not find a valid joint configuration for desired ' 'end effector pose.')
if len(valid_joint_positions) > 1: current_config = np.array(self.get_joint_positions()) # Sort based on angular distance valid_joint_positions.sort( key=lambda x: np.linalg.norm(current_config - x))
return np.array(valid_joint_positions)
def get_configs_for_tip_pose(self, position: Union[List[float], np.ndarray], euler: Union[List[float], np.ndarray] = None, quaternion: Union[List[float], np.ndarray] = None, ignore_collisions=False, trials=300, max_configs=60, relative_to: Object = None ) -> List[List[float]]: """Gets a valid joint configuration for a desired end effector pose. Must specify either rotation in euler or quaternions, but not both! :param position: The x, y, z position of the target. :param euler: The x, y, z orientation of the target (in radians). :param quaternion: A list containing the quaternion (x,y,z,w). :param ignore_collisions: If collision checking should be disabled. :param trials: The maximum number of attempts to reach max_configs :param max_configs: The maximum number of configurations we want to generate before ranking them. :param relative_to: Indicates relative to which reference frame we want the target pose. Specify None to retrieve the absolute pose, or an Object relative to whose reference frame we want the pose. :raises: ConfigurationError if no joint configuration could be found. :return: A list of valid joint configurations for the desired end effector pose. """
warnings.warn("Please use 'solve_ik_via_sampling' instead.", DeprecationWarning) return list(self.solve_ik_via_sampling( position, euler, quaternion, ignore_collisions, trials, max_configs, relative_to=relative_to))
def solve_ik_via_jacobian( self, position: Union[List[float], np.ndarray], euler: Union[List[float], np.ndarray] = None, quaternion: Union[List[float], np.ndarray] = None, relative_to: Object = None) -> List[float]: """Solves an IK group and returns the calculated joint values.
This IK method performs a linearisation around the current robot configuration via the Jacobian. The linearisation is valid when the start and goal pose are not too far away, but after a certain point, linearisation will no longer be valid. In that case, the user is better off using 'solve_ik_via_sampling'.
Must specify either rotation in euler or quaternions, but not both!
:param position: The x, y, z position of the target. :param euler: The x, y, z orientation of the target (in radians). :param quaternion: A list containing the quaternion (x,y,z,w). :param relative_to: Indicates relative to which reference frame we want the target pose. Specify None to retrieve the absolute pose, or an Object relative to whose reference frame we want the pose. :return: A list containing the calculated joint values. """ self._ik_target.set_position(position, relative_to) if euler is not None: self._ik_target.set_orientation(euler, relative_to) elif quaternion is not None: self._ik_target.set_quaternion(quaternion, relative_to)
ik_result, joint_values = sim.simCheckIkGroup( self._ik_group, [j.get_handle() for j in self.joints]) if ik_result == sim.sim_ikresult_fail: raise IKError('IK failed. Perhaps the distance was between the tip ' ' and target was too large.') elif ik_result == sim.sim_ikresult_not_performed: raise IKError('IK not performed.') return joint_values
def solve_ik(self, position: Union[List[float], np.ndarray], euler: Union[List[float], np.ndarray] = None, quaternion: Union[List[float], np.ndarray] = None, relative_to: Object = None) -> List[float]: """Solves an IK group and returns the calculated joint values.
Must specify either rotation in euler or quaternions, but not both!
:param position: The x, y, z position of the target. :param euler: The x, y, z orientation of the target (in radians). :param quaternion: A list containing the quaternion (x,y,z,w). :param relative_to: Indicates relative to which reference frame we want the target pose. Specify None to retrieve the absolute pose, or an Object relative to whose reference frame we want the pose. :return: A list containing the calculated joint values. """ warnings.warn("Please use 'solve_ik_via_jacobian' instead.", DeprecationWarning) return self.solve_ik_via_jacobian( position, euler, quaternion, relative_to)
def get_path_from_cartesian_path(self, path: CartesianPath ) -> ArmConfigurationPath: """Translate a path from cartesian space, to arm configuration space.
Note: It must be possible to reach the start of the path via a linear path, otherwise an error will be raised.
:param path: A :py:class:`CartesianPath` instance to be translated to a configuration-space path. :raises: ConfigurationPathError if no path could be created.
:return: A path in the arm configuration space. """ handles = [j.get_handle() for j in self.joints] _, ret_floats, _, _ = utils.script_call( 'getPathFromCartesianPath@PyRep', PYREP_SCRIPT_TYPE, ints=[path.get_handle(), self._ik_group, self._ik_target.get_handle()] + handles) if len(ret_floats) == 0: raise ConfigurationPathError( 'Could not create a path from cartesian path.') return ArmConfigurationPath(self, ret_floats)
def get_linear_path(self, position: Union[List[float], np.ndarray], euler: Union[List[float], np.ndarray] = None, quaternion: Union[List[float], np.ndarray] = None, steps=50, ignore_collisions=False, relative_to: Object = None) -> ArmConfigurationPath: """Gets a linear configuration path given a target pose.
Generates a path that drives a robot from its current configuration to its target dummy in a straight line (i.e. shortest path in Cartesian space).
Must specify either rotation in euler or quaternions, but not both!
:param position: The x, y, z position of the target. :param euler: The x, y, z orientation of the target (in radians). :param quaternion: A list containing the quaternion (x,y,z,w). :param steps: The desired number of path points. Each path point contains a robot configuration. A minimum of two path points is required. If the target pose distance is large, a larger number of steps leads to better results for this function. :param ignore_collisions: If collision checking should be disabled. :param relative_to: Indicates relative to which reference frame we want the target pose. Specify None to retrieve the absolute pose, or an Object relative to whose reference frame we want the pose. :raises: ConfigurationPathError if no path could be created.
:return: A linear path in the arm configuration space. """ if not ((euler is None) ^ (quaternion is None)): raise ConfigurationPathError( 'Specify either euler or quaternion values, but not both.')
prev_pose = self._ik_target.get_pose() self._ik_target.set_position(position, relative_to) if euler is not None: self._ik_target.set_orientation(euler, relative_to) elif quaternion is not None: self._ik_target.set_quaternion(quaternion, relative_to) handles = [j.get_handle() for j in self.joints]
collision_pairs = [] if not ignore_collisions: collision_pairs = [self._collision_collection, sim.sim_handle_all] joint_options = None ret_floats = sim.generateIkPath( self._ik_group, handles, steps, collision_pairs, joint_options) self._ik_target.set_pose(prev_pose) if len(ret_floats) == 0: raise ConfigurationPathError('Could not create path.') return ArmConfigurationPath(self, ret_floats)
def get_nonlinear_path(self, position: Union[List[float], np.ndarray], euler: Union[List[float], np.ndarray] = None, quaternion: Union[List[float], np.ndarray] = None, ignore_collisions=False, trials=300, max_configs=1, distance_threshold: float = 0.65, max_time_ms: int = 10, trials_per_goal=1, algorithm=Algos.SBL, relative_to: Object = None ) -> ArmConfigurationPath: """Gets a non-linear (planned) configuration path given a target pose.
A path is generated by finding several configs for a pose, and ranking them according to the distance in configuration space (smaller is better).
Must specify either rotation in euler or quaternions, but not both!
:param position: The x, y, z position of the target. :param euler: The x, y, z orientation of the target (in radians). :param quaternion: A list containing the quaternion (x,y,z,w). :param ignore_collisions: If collision checking should be disabled. :param trials: The maximum number of attempts to reach max_configs. See 'solve_ik_via_sampling'. :param max_configs: The maximum number of configurations we want to generate before sorting them. See 'solve_ik_via_sampling'. :param distance_threshold: Distance indicating when IK should be computed in order to try to bring the tip onto the target. See 'solve_ik_via_sampling'. :param max_time_ms: Maximum time in ms spend searching for each configuation. See 'solve_ik_via_sampling'. :param trials_per_goal: The number of paths per config we want to trial. :param algorithm: The algorithm for path planning to use. :param relative_to: Indicates relative to which reference frame we want the target pose. Specify None to retrieve the absolute pose, or an Object relative to whose reference frame we want the pose. :raises: ConfigurationPathError if no path could be created.
:return: A non-linear path in the arm configuration space. """
logging.debug("planning non linear path")
handles = [j.get_handle() for j in self.joints]
try: configs = self.solve_ik_via_sampling( position, euler, quaternion, ignore_collisions, trials, max_configs, distance_threshold, max_time_ms, relative_to) except ConfigurationError as e: raise ConfigurationPathError('Could not create path.') from e
logging.debug("calling external script")
_, ret_floats, _, _ = utils.script_call( 'getNonlinearPath@PyRep', PYREP_SCRIPT_TYPE, ints=[self._collision_collection, int(ignore_collisions), trials_per_goal] + handles, floats=configs.flatten().tolist(), strings=[algorithm.value])
logging.debug("Done calling external script")
if len(ret_floats) == 0: raise ConfigurationPathError('Could not create path.') return ArmConfigurationPath(self, ret_floats)
def get_path(self, position: Union[List[float], np.ndarray], euler: Union[List[float], np.ndarray] = None, quaternion: Union[List[float], np.ndarray] = None, ignore_collisions=False, trials=300, max_configs=1, distance_threshold: float = 0.65, max_time_ms: int = 10, trials_per_goal=1, algorithm=Algos.SBL, relative_to: Object = None ) -> ArmConfigurationPath: """Tries to get a linear path, failing that tries a non-linear path.
Must specify either rotation in euler or quaternions, but not both!
:param position: The x, y, z position of the target. :param euler: The x, y, z orientation of the target (in radians). :param quaternion: A list containing the quaternion (x,y,z,w). :param ignore_collisions: If collision checking should be disabled. :param trials: The maximum number of attempts to reach max_configs. See 'solve_ik_via_sampling'. :param max_configs: The maximum number of configurations we want to generate before sorting them. See 'solve_ik_via_sampling'. :param distance_threshold: Distance indicating when IK should be computed in order to try to bring the tip onto the target. See 'solve_ik_via_sampling'. :param max_time_ms: Maximum time in ms spend searching for each configuation. See 'solve_ik_via_sampling'. :param trials_per_goal: The number of paths per config we want to trial. :param algorithm: The algorithm for path planning to use. :param relative_to: Indicates relative to which reference frame we want the target pose. Specify None to retrieve the absolute pose, or an Object relative to whose reference frame we want the pose.
:raises: ConfigurationPathError if neither a linear or non-linear path can be created. :return: A linear or non-linear path in the arm configuration space. """ logging.debug("planning linear path") try: p = self.get_linear_path(position, euler, quaternion, ignore_collisions=ignore_collisions, relative_to=relative_to) return p except ConfigurationPathError as e: #logging.error("configuration error", e) pass # Allowed. Try again, but with non-linear.
# This time if an exception is thrown, we dont want to catch it. p = self.get_nonlinear_path( position, euler, quaternion, ignore_collisions, trials, max_configs, distance_threshold, max_time_ms, trials_per_goal, algorithm, relative_to) return p
def get_tip(self) -> Dummy: """Gets the tip of the arm.
Each arm is required to have a tip for path planning.
:return: The tip of the arm. """ return self._ik_tip
def get_jacobian(self): """Calculates the Jacobian.
:return: the row-major Jacobian matix. """ self._ik_target.set_matrix(self._ik_tip.get_matrix()) sim.simCheckIkGroup(self._ik_group, [j.get_handle() for j in self.joints]) jacobian, (rows, cols) = sim.simGetIkGroupMatrix(self._ik_group, 0) jacobian = np.array(jacobian).reshape((rows, cols), order='F') return jacobian
def check_arm_collision(self, obj: 'Object' = None) -> bool: """Checks whether two entities are colliding.
:param obj: The other collidable object to check collision against, or None to check against all collidable objects. Note that objects must be marked as collidable! :return: If the object is colliding. """ handle = sim.sim_handle_all if obj is None else obj.get_handle() return sim.simCheckCollision(self._collision_collection, handle) == 1external/pyrep/.github/stale.ymlAdded+17
external/pyrep/.github/workflows/build.ymlAdded+46
external/pyrep/PyRep.egg-info/PKG-INFOAdded+8
external/pyrep/PyRep.egg-info/SOURCES.txtAdded+103
external/pyrep/PyRep.egg-info/dependency_links.txtAdded+1
external/pyrep/PyRep.egg-info/top_level.txtAdded+1
external/pyrep/cffi_build/__init__.pyAdded
external/pyrep/cffi_build/cffi_build.pyAdded+757
external/pyrep/cffi_build/sim.hAdded+712
external/pyrep/docs/MakefileAdded+19
external/pyrep/docs/make.batAdded+35
external/pyrep/docs/source/conf.pyAdded+62
external/pyrep/docs/source/index.rstAdded+24
external/pyrep/docs/source/modules.rstAdded+7
external/pyrep/docs/source/pyrep.objects.rstAdded+78
external/pyrep/docs/source/pyrep.robots.arms.rstAdded+46
external/pyrep/docs/source/pyrep.robots.end_effectors.rstAdded+38
external/pyrep/docs/source/pyrep.robots.rstAdded+30
external/pyrep/docs/source/pyrep.rstAdded+47
external/pyrep/docs/source/pyrep.textures.rstAdded+22
external/pyrep/examples/example_baxter_pick_and_pass.pyAdded+115
external/pyrep/examples/example_locobot_stack_cube.pyAdded+96
external/pyrep/examples/example_panda_end_effector_control.pyAdded+35
external/pyrep/examples/example_panda_ik.pyAdded+41
external/pyrep/examples/example_panda_reach_target.pyAdded+59
external/pyrep/examples/example_reinforcement_learning_env.pyAdded+90
external/pyrep/examples/example_turtlebot_navigation.pyAdded+53
external/pyrep/examples/example_youbot_navigation.pyAdded+51
external/pyrep/pyrep/backend/__init__.pyAdded
external/pyrep/pyrep/backend/sim.pyAdded+1500
external/pyrep/pyrep/backend/simAddOnScript_PyRep.luaAdded+410
external/pyrep/pyrep/backend/simConst.pyAdded+1726
external/pyrep/pyrep/backend/utils.pyAdded+76
external/pyrep/pyrep/misc/__init__.pyAdded
external/pyrep/pyrep/misc/distance.pyAdded+49
external/pyrep/pyrep/misc/signals.pyAdded+102
external/pyrep/pyrep/objects/__init__.pyAdded+10
external/pyrep/pyrep/objects/camera.pyAdded+21
external/pyrep/pyrep/objects/cartesian_path.pyAdded+107
external/pyrep/pyrep/objects/dummy.pyAdded+26
external/pyrep/pyrep/objects/force_sensor.pyAdded+34
external/pyrep/pyrep/objects/joint.pyAdded+255
external/pyrep/pyrep/objects/light.pyAdded+125
external/pyrep/pyrep/objects/object.pyAdded+756
external/pyrep/pyrep/objects/octree.pyAdded+123
external/pyrep/pyrep/objects/proximity_sensor.pyAdded+41
external/pyrep/pyrep/objects/shape.pyAdded+584
external/pyrep/pyrep/objects/vision_sensor.pyAdded+423
external/pyrep/pyrep/robots/arms/__init__.pyAdded
external/pyrep/pyrep/robots/arms/arm.pyAdded+496