From 9ae40a59ba029f3e548463caba2e6ac6a1cd7c56 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Wed, 14 Dec 2016 20:44:10 -0800 Subject: [PATCH] export joint types in pybullet for pybullet.createConstraint revert to premake4.exe, the targetsuffix etc doesn't seem to work in premake5.exe --- build_visual_studio_vr_pybullet_double.bat | 2 +- examples/SharedMemory/SharedMemoryPublic.h | 10 ++++++---- examples/pybullet/pybullet.c | 6 ++++++ examples/pybullet/quadruped.py | 8 ++++---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/build_visual_studio_vr_pybullet_double.bat b/build_visual_studio_vr_pybullet_double.bat index dd180eb6d..f4c43cbb5 100644 --- a/build_visual_studio_vr_pybullet_double.bat +++ b/build_visual_studio_vr_pybullet_double.bat @@ -16,6 +16,6 @@ del tmp1234.txt cd build3 -premake5 --double --midi --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010 +premake4 --double --midi --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010 start vs2010 diff --git a/examples/SharedMemory/SharedMemoryPublic.h b/examples/SharedMemory/SharedMemoryPublic.h index c92d30141..fe79d9dcb 100644 --- a/examples/SharedMemory/SharedMemoryPublic.h +++ b/examples/SharedMemory/SharedMemoryPublic.h @@ -130,10 +130,12 @@ enum // copied from btMultiBodyLink.h enum JointType { - eRevoluteType = 0, - ePrismaticType = 1, - eFixedType = 2, - ePoint2PointType = 3, + eRevoluteType = 0, + ePrismaticType = 1, + eSphericalType = 2, + ePlanarType = 3, + eFixedType = 4, + ePoint2PointType = 5, }; struct b3JointInfo diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index e5f78c1bc..926bf738e 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -3883,6 +3883,12 @@ initpybullet(void) PyModule_AddIntConstant(m, "GUI", eCONNECT_GUI); // user read PyModule_AddIntConstant(m, "UDP", eCONNECT_UDP); // user read + PyModule_AddIntConstant(m, "JOINT_REVOLUTE", eRevoluteType); // user read + PyModule_AddIntConstant(m, "JOINT_PRISMATIC", ePrismaticType); // user read + PyModule_AddIntConstant(m, "JOINT_SPHERICAL", eSphericalType); // user read + PyModule_AddIntConstant(m, "JOINT_PLANAR", ePlanarType); // user read + PyModule_AddIntConstant(m, "JOINT_FIXED", eFixedType); // user read + PyModule_AddIntConstant(m, "JOINT_POINT2POINT", ePoint2PointType); // user read PyModule_AddIntConstant(m, "TORQUE_CONTROL", CONTROL_MODE_TORQUE); PyModule_AddIntConstant(m, "VELOCITY_CONTROL", diff --git a/examples/pybullet/quadruped.py b/examples/pybullet/quadruped.py index 31cffbce4..8431a59bd 100644 --- a/examples/pybullet/quadruped.py +++ b/examples/pybullet/quadruped.py @@ -13,7 +13,7 @@ p.resetJointState(quadruped,0,1.57) p.resetJointState(quadruped,2,-2.2) p.resetJointState(quadruped,3,-1.57) p.resetJointState(quadruped,5,2.2) -p.createConstraint(quadruped,2,quadruped,5,3,[0,0,0],[0,0.01,0.2],[0,-0.015,0.2]) +p.createConstraint(quadruped,2,quadruped,5,p.JOINT_POINT2POINT,[0,0,0],[0,0.01,0.2],[0,-0.015,0.2]) p.setJointMotorControl(quadruped,0,p.POSITION_CONTROL,1.57,1) p.setJointMotorControl(quadruped,1,p.VELOCITY_CONTROL,0,0) @@ -27,7 +27,7 @@ p.resetJointState(quadruped,6,1.57) p.resetJointState(quadruped,8,-2.2) p.resetJointState(quadruped,9,-1.57) p.resetJointState(quadruped,11,2.2) -p.createConstraint(quadruped,8,quadruped,11,3,[0,0,0],[0,-0.01,0.2],[0,0.015,0.2]) +p.createConstraint(quadruped,8,quadruped,11,p.JOINT_POINT2POINT,[0,0,0],[0,-0.01,0.2],[0,0.015,0.2]) p.setJointMotorControl(quadruped,6,p.POSITION_CONTROL,1.57,1) p.setJointMotorControl(quadruped,7,p.VELOCITY_CONTROL,0,0) @@ -42,7 +42,7 @@ p.resetJointState(quadruped,12,1.57) p.resetJointState(quadruped,14,-2.2) p.resetJointState(quadruped,15,-1.57) p.resetJointState(quadruped,17,2.2) -p.createConstraint(quadruped,14,quadruped,17,3,[0,0,0],[0,0.01,0.2],[0,-0.015,0.2]) +p.createConstraint(quadruped,14,quadruped,17,p.JOINT_POINT2POINT,[0,0,0],[0,0.01,0.2],[0,-0.015,0.2]) p.setJointMotorControl(quadruped,12,p.POSITION_CONTROL,1.57,1) p.setJointMotorControl(quadruped,13,p.VELOCITY_CONTROL,0,0) @@ -56,7 +56,7 @@ p.resetJointState(quadruped,18,1.57) p.resetJointState(quadruped,20,-2.2) p.resetJointState(quadruped,21,-1.57) p.resetJointState(quadruped,23,2.2) -p.createConstraint(quadruped,20,quadruped,23,3,[0,0,0],[0,-0.01,0.2],[0,0.015,0.2]) +p.createConstraint(quadruped,20,quadruped,23,p.JOINT_POINT2POINT,[0,0,0],[0,-0.01,0.2],[0,0.015,0.2]) p.setJointMotorControl(quadruped,18,p.POSITION_CONTROL,1.57,1) p.setJointMotorControl(quadruped,19,p.VELOCITY_CONTROL,0,0)