fixes in shared memory client/server: check for valid pointers
This commit is contained in:
@@ -203,6 +203,7 @@ void MyCallback(int buttonId, bool buttonState, void* userPtr)
|
|||||||
command.m_requestDebugLinesArguments.m_debugMode = btIDebugDraw::DBG_DrawWireframe;//:DBG_DrawConstraints;
|
command.m_requestDebugLinesArguments.m_debugMode = btIDebugDraw::DBG_DrawWireframe;//:DBG_DrawConstraints;
|
||||||
command.m_requestDebugLinesArguments.m_startingLineIndex = 0;
|
command.m_requestDebugLinesArguments.m_startingLineIndex = 0;
|
||||||
cl->enqueueCommand(command);
|
cl->enqueueCommand(command);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,6 +272,8 @@ void PhysicsClientExample::createButtons()
|
|||||||
{
|
{
|
||||||
bool isTrigger = false;
|
bool isTrigger = false;
|
||||||
|
|
||||||
|
if (m_guiHelper && m_guiHelper->getParameterInterface())
|
||||||
|
{
|
||||||
createButton("Load URDF",CMD_LOAD_URDF, isTrigger);
|
createButton("Load URDF",CMD_LOAD_URDF, isTrigger);
|
||||||
createButton("Step Sim",CMD_STEP_FORWARD_SIMULATION, isTrigger);
|
createButton("Step Sim",CMD_STEP_FORWARD_SIMULATION, isTrigger);
|
||||||
createButton("Send Bullet Stream",CMD_SEND_BULLET_DATA_STREAM, isTrigger);
|
createButton("Send Bullet Stream",CMD_SEND_BULLET_DATA_STREAM, isTrigger);
|
||||||
@@ -278,7 +281,7 @@ void PhysicsClientExample::createButtons()
|
|||||||
createButton("Send Desired State",CMD_SEND_DESIRED_STATE, isTrigger);
|
createButton("Send Desired State",CMD_SEND_DESIRED_STATE, isTrigger);
|
||||||
createButton("Create Box Collider",CMD_CREATE_BOX_COLLISION_SHAPE,isTrigger);
|
createButton("Create Box Collider",CMD_CREATE_BOX_COLLISION_SHAPE,isTrigger);
|
||||||
createButton("Reset Simulation",CMD_RESET_SIMULATION,isTrigger);
|
createButton("Reset Simulation",CMD_RESET_SIMULATION,isTrigger);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsClientExample::initPhysics()
|
void PhysicsClientExample::initPhysics()
|
||||||
@@ -292,6 +295,14 @@ void PhysicsClientExample::initPhysics()
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
MyCallback(CMD_LOAD_URDF, true, this);
|
||||||
|
MyCallback(CMD_STEP_FORWARD_SIMULATION,true,this);
|
||||||
|
MyCallback(CMD_STEP_FORWARD_SIMULATION,true,this);
|
||||||
|
MyCallback(CMD_RESET_SIMULATION,true,this);
|
||||||
|
// MyCallback(CMD_LOAD_URDF, true, this);
|
||||||
|
// MyCallback(CMD_STEP_FORWARD_SIMULATION,true,this);
|
||||||
|
// MyCallback(CMD_RESET_SIMULATION,true,this);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
m_userCommandRequests.push_back(CMD_LOAD_URDF);
|
m_userCommandRequests.push_back(CMD_LOAD_URDF);
|
||||||
m_userCommandRequests.push_back(CMD_REQUEST_ACTUAL_STATE);
|
m_userCommandRequests.push_back(CMD_REQUEST_ACTUAL_STATE);
|
||||||
@@ -353,7 +364,10 @@ void PhysicsClientExample::stepSimulation(float deltaTime)
|
|||||||
SliderParams slider(motorName,&motorInfo->m_velTarget);
|
SliderParams slider(motorName,&motorInfo->m_velTarget);
|
||||||
slider.m_minVal=-4;
|
slider.m_minVal=-4;
|
||||||
slider.m_maxVal=4;
|
slider.m_maxVal=4;
|
||||||
|
if (m_guiHelper && m_guiHelper->getParameterInterface())
|
||||||
|
{
|
||||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
|
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
|
||||||
|
}
|
||||||
m_numMotors++;
|
m_numMotors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -393,7 +407,10 @@ void PhysicsClientExample::stepSimulation(float deltaTime)
|
|||||||
//for the CMD_RESET_SIMULATION we need to do something special: clear the GUI sliders
|
//for the CMD_RESET_SIMULATION we need to do something special: clear the GUI sliders
|
||||||
if (command.m_type==CMD_RESET_SIMULATION)
|
if (command.m_type==CMD_RESET_SIMULATION)
|
||||||
{
|
{
|
||||||
|
if (m_guiHelper->getParameterInterface())
|
||||||
|
{
|
||||||
m_guiHelper->getParameterInterface()->removeAllParameters();
|
m_guiHelper->getParameterInterface()->removeAllParameters();
|
||||||
|
}
|
||||||
m_numMotors=0;
|
m_numMotors=0;
|
||||||
createButtons();
|
createButtons();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1080,8 +1080,10 @@ void PhysicsServerSharedMemory::processClientCommands()
|
|||||||
case CMD_RESET_SIMULATION:
|
case CMD_RESET_SIMULATION:
|
||||||
{
|
{
|
||||||
//clean up all data
|
//clean up all data
|
||||||
|
if (m_data && m_data->m_guiHelper && m_data->m_guiHelper->getRenderInterface())
|
||||||
|
{
|
||||||
m_data->m_guiHelper->getRenderInterface()->removeAllInstances();
|
m_data->m_guiHelper->getRenderInterface()->removeAllInstances();
|
||||||
|
}
|
||||||
deleteDynamicsWorld();
|
deleteDynamicsWorld();
|
||||||
createEmptyDynamicsWorld();
|
createEmptyDynamicsWorld();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user