Add the pdControlPlugin to the joint control C API, and add the PD control mode (also available in pybullet). Modify the pdControl pybullet example to use the PD control mode with setJointMotorControl API.

This commit is contained in:
YunfeiBai
2018-06-15 17:59:26 -07:00
parent 997211650e
commit 1c0de3c4cb
6 changed files with 95 additions and 12 deletions

View File

@@ -2412,7 +2412,8 @@ static PyObject* pybullet_setJointMotorControl2(PyObject* self, PyObject* args,
if ((controlMode != CONTROL_MODE_VELOCITY) &&
(controlMode != CONTROL_MODE_TORQUE) &&
(controlMode != CONTROL_MODE_POSITION_VELOCITY_PD))
(controlMode != CONTROL_MODE_POSITION_VELOCITY_PD) &&
(controlMode != CONTROL_MODE_PD))
{
PyErr_SetString(SpamError, "Illegral control mode.");
return NULL;
@@ -2441,6 +2442,7 @@ static PyObject* pybullet_setJointMotorControl2(PyObject* self, PyObject* args,
}
case CONTROL_MODE_POSITION_VELOCITY_PD:
case CONTROL_MODE_PD:
{
if (maxVelocity>0)
{
@@ -9546,6 +9548,8 @@ initpybullet(void)
CONTROL_MODE_VELOCITY); // user read
PyModule_AddIntConstant(m, "POSITION_CONTROL",
CONTROL_MODE_POSITION_VELOCITY_PD); // user read
PyModule_AddIntConstant(m, "PD_CONTROL",
CONTROL_MODE_PD); // user read
PyModule_AddIntConstant(m, "LINK_FRAME", EF_LINK_FRAME);
PyModule_AddIntConstant(m, "WORLD_FRAME", EF_WORLD_FRAME);