Merge pull request #743 from erwincoumans/master
tweak in BEB F1/screenshot handling, by default, have a strong force keep the robot together
This commit is contained in:
@@ -1103,6 +1103,24 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
|||||||
s_app->drawText(bla,10,10);
|
s_app->drawText(bla,10,10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gPngFileName)
|
||||||
|
{
|
||||||
|
|
||||||
|
static int skip = 0;
|
||||||
|
skip--;
|
||||||
|
if (skip<0)
|
||||||
|
{
|
||||||
|
skip=gPngSkipFrames;
|
||||||
|
//printf("gPngFileName=%s\n",gPngFileName);
|
||||||
|
static int s_frameCount = 100;
|
||||||
|
|
||||||
|
sprintf(staticPngFileName,"%s%d.png",gPngFileName,s_frameCount++);
|
||||||
|
//b3Printf("Made screenshot %s",staticPngFileName);
|
||||||
|
s_app->dumpNextFrameToPng(staticPngFileName);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sCurrentDemo)
|
if (sCurrentDemo)
|
||||||
{
|
{
|
||||||
@@ -1145,23 +1163,6 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gPngFileName)
|
|
||||||
{
|
|
||||||
|
|
||||||
static int skip = 0;
|
|
||||||
skip--;
|
|
||||||
if (skip<0)
|
|
||||||
{
|
|
||||||
skip=gPngSkipFrames;
|
|
||||||
//printf("gPngFileName=%s\n",gPngFileName);
|
|
||||||
static int s_frameCount = 100;
|
|
||||||
|
|
||||||
sprintf(staticPngFileName,"%s%d.png",gPngFileName,s_frameCount++);
|
|
||||||
//b3Printf("Made screenshot %s",staticPngFileName);
|
|
||||||
s_app->dumpNextFrameToPng(staticPngFileName);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -696,7 +696,7 @@ void PhysicsServerCommandProcessor::createJointMotors(btMultiBody* mb)
|
|||||||
|
|
||||||
if (supportsJointMotor(mb,mbLinkIndex))
|
if (supportsJointMotor(mb,mbLinkIndex))
|
||||||
{
|
{
|
||||||
float maxMotorImpulse = 0.f;
|
float maxMotorImpulse = 10000.f;
|
||||||
int dof = 0;
|
int dof = 0;
|
||||||
btScalar desiredVelocity = 0.f;
|
btScalar desiredVelocity = 0.f;
|
||||||
btMultiBodyJointMotor* motor = new btMultiBodyJointMotor(mb,mbLinkIndex,dof,desiredVelocity,maxMotorImpulse);
|
btMultiBodyJointMotor* motor = new btMultiBodyJointMotor(mb,mbLinkIndex,dof,desiredVelocity,maxMotorImpulse);
|
||||||
@@ -1602,6 +1602,12 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
|||||||
int totalDegreeOfFreedomQ = 0;
|
int totalDegreeOfFreedomQ = 0;
|
||||||
int totalDegreeOfFreedomU = 0;
|
int totalDegreeOfFreedomU = 0;
|
||||||
|
|
||||||
|
if (mb->getNumLinks()>= MAX_DEGREE_OF_FREEDOM)
|
||||||
|
{
|
||||||
|
serverStatusOut.m_type = CMD_ACTUAL_STATE_UPDATE_FAILED;
|
||||||
|
hasStatus = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//always add the base, even for static (non-moving objects)
|
//always add the base, even for static (non-moving objects)
|
||||||
//so that we can easily move the 'fixed' base when needed
|
//so that we can easily move the 'fixed' base when needed
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#define SHARED_MEMORY_MAX_STREAM_CHUNK_SIZE (256*1024)
|
#define SHARED_MEMORY_MAX_STREAM_CHUNK_SIZE (256*1024)
|
||||||
|
|
||||||
#define SHARED_MEMORY_SERVER_TEST_C
|
#define SHARED_MEMORY_SERVER_TEST_C
|
||||||
#define MAX_DEGREE_OF_FREEDOM 64
|
#define MAX_DEGREE_OF_FREEDOM 128
|
||||||
#define MAX_NUM_SENSORS 256
|
#define MAX_NUM_SENSORS 256
|
||||||
#define MAX_URDF_FILENAME_LENGTH 1024
|
#define MAX_URDF_FILENAME_LENGTH 1024
|
||||||
#define MAX_SDF_FILENAME_LENGTH 1024
|
#define MAX_SDF_FILENAME_LENGTH 1024
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ void TinyRenderer::renderObject(TinyRenderObjectData& renderData)
|
|||||||
renderData.m_viewportMatrix = viewport(0,0,width, height);
|
renderData.m_viewportMatrix = viewport(0,0,width, height);
|
||||||
|
|
||||||
b3AlignedObjectArray<float>& zbuffer = renderData.m_depthBuffer;
|
b3AlignedObjectArray<float>& zbuffer = renderData.m_depthBuffer;
|
||||||
int* segmentationMaskBufferPtr = &renderData.m_segmentationMaskBufferPtr->at(0);
|
int* segmentationMaskBufferPtr = renderData.m_segmentationMaskBufferPtr?&renderData.m_segmentationMaskBufferPtr->at(0):0;
|
||||||
|
|
||||||
TGAImage& frame = renderData.m_rgbColorBuffer;
|
TGAImage& frame = renderData.m_rgbColorBuffer;
|
||||||
|
|
||||||
|
|||||||
@@ -532,7 +532,7 @@ pybullet_setTimeStep(PyObject* self, PyObject* args)
|
|||||||
|
|
||||||
// Internal function used to get the base position and orientation
|
// Internal function used to get the base position and orientation
|
||||||
// Orientation is returned in quaternions
|
// Orientation is returned in quaternions
|
||||||
static void pybullet_internalGetBasePositionAndOrientation(int bodyIndex, double basePosition[3],double baseOrientation[3])
|
static int pybullet_internalGetBasePositionAndOrientation(int bodyIndex, double basePosition[3],double baseOrientation[3])
|
||||||
{
|
{
|
||||||
basePosition[0] = 0.;
|
basePosition[0] = 0.;
|
||||||
basePosition[1] = 0.;
|
basePosition[1] = 0.;
|
||||||
@@ -552,7 +552,11 @@ static void pybullet_internalGetBasePositionAndOrientation(int bodyIndex, double
|
|||||||
b3SubmitClientCommandAndWaitStatus(sm, cmd_handle);
|
b3SubmitClientCommandAndWaitStatus(sm, cmd_handle);
|
||||||
|
|
||||||
const int status_type = b3GetStatusType(status_handle);
|
const int status_type = b3GetStatusType(status_handle);
|
||||||
|
if (status_type != CMD_ACTUAL_STATE_UPDATE_COMPLETED)
|
||||||
|
{
|
||||||
|
PyErr_SetString(SpamError, "getBasePositionAndOrientation failed.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
const double* actualStateQ;
|
const double* actualStateQ;
|
||||||
// const double* jointReactionForces[];
|
// const double* jointReactionForces[];
|
||||||
int i;
|
int i;
|
||||||
@@ -579,6 +583,7 @@ static void pybullet_internalGetBasePositionAndOrientation(int bodyIndex, double
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the positions (x,y,z) and orientation (x,y,z,w) in quaternion
|
// Get the positions (x,y,z) and orientation (x,y,z,w) in quaternion
|
||||||
@@ -606,7 +611,11 @@ pybullet_getBasePositionAndOrientation(PyObject* self, PyObject* args)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pybullet_internalGetBasePositionAndOrientation(bodyIndex,basePosition,baseOrientation);
|
if (0==pybullet_internalGetBasePositionAndOrientation(bodyIndex, basePosition, baseOrientation))
|
||||||
|
{
|
||||||
|
PyErr_SetString(SpamError, "GetBasePositionAndOrientation failed (#joints/links exceeds maximum?).");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -848,14 +857,10 @@ pybullet_getJointInfo(PyObject* self, PyObject* args)
|
|||||||
|
|
||||||
// printf("body index = %d, joint index =%d\n", bodyIndex, jointIndex);
|
// printf("body index = %d, joint index =%d\n", bodyIndex, jointIndex);
|
||||||
|
|
||||||
b3SharedMemoryCommandHandle cmd_handle =
|
|
||||||
b3RequestActualStateCommandInit(sm, bodyIndex);
|
|
||||||
b3SharedMemoryStatusHandle status_handle =
|
|
||||||
b3SubmitClientCommandAndWaitStatus(sm, cmd_handle);
|
|
||||||
|
|
||||||
pyListJointInfo = PyTuple_New(jointInfoSize);
|
pyListJointInfo = PyTuple_New(jointInfoSize);
|
||||||
|
|
||||||
b3GetJointInfo(sm, bodyIndex, jointIndex, &info);
|
if (b3GetJointInfo(sm, bodyIndex, jointIndex, &info))
|
||||||
|
{
|
||||||
|
|
||||||
// printf("Joint%d %s, type %d, at q-index %d and u-index %d\n",
|
// printf("Joint%d %s, type %d, at q-index %d and u-index %d\n",
|
||||||
// info.m_jointIndex,
|
// info.m_jointIndex,
|
||||||
@@ -885,6 +890,12 @@ pybullet_getJointInfo(PyObject* self, PyObject* args)
|
|||||||
PyFloat_FromDouble(info.m_jointFriction));
|
PyFloat_FromDouble(info.m_jointFriction));
|
||||||
return pyListJointInfo;
|
return pyListJointInfo;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PyErr_SetString(SpamError, "GetJointInfo failed.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
@@ -934,12 +945,19 @@ pybullet_getJointState(PyObject* self, PyObject* args)
|
|||||||
{
|
{
|
||||||
if (PyArg_ParseTuple(args, "ii", &bodyIndex, &jointIndex))
|
if (PyArg_ParseTuple(args, "ii", &bodyIndex, &jointIndex))
|
||||||
{
|
{
|
||||||
|
int status_type = 0;
|
||||||
b3SharedMemoryCommandHandle cmd_handle =
|
b3SharedMemoryCommandHandle cmd_handle =
|
||||||
b3RequestActualStateCommandInit(sm, bodyIndex);
|
b3RequestActualStateCommandInit(sm, bodyIndex);
|
||||||
b3SharedMemoryStatusHandle status_handle =
|
b3SharedMemoryStatusHandle status_handle =
|
||||||
b3SubmitClientCommandAndWaitStatus(sm, cmd_handle);
|
b3SubmitClientCommandAndWaitStatus(sm, cmd_handle);
|
||||||
|
|
||||||
|
status_type = b3GetStatusType(status_handle);
|
||||||
|
if (status_type != CMD_ACTUAL_STATE_UPDATE_COMPLETED)
|
||||||
|
{
|
||||||
|
PyErr_SetString(SpamError, "getBasePositionAndOrientation failed.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
pyListJointState = PyTuple_New(sensorStateSize);
|
pyListJointState = PyTuple_New(sensorStateSize);
|
||||||
pyListJointForceTorque = PyTuple_New(forceTorqueSize);
|
pyListJointForceTorque = PyTuple_New(forceTorqueSize);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user