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,14 +272,16 @@ void PhysicsClientExample::createButtons()
|
|||||||
{
|
{
|
||||||
bool isTrigger = false;
|
bool isTrigger = false;
|
||||||
|
|
||||||
createButton("Load URDF",CMD_LOAD_URDF, isTrigger);
|
if (m_guiHelper && m_guiHelper->getParameterInterface())
|
||||||
createButton("Step Sim",CMD_STEP_FORWARD_SIMULATION, isTrigger);
|
{
|
||||||
createButton("Send Bullet Stream",CMD_SEND_BULLET_DATA_STREAM, isTrigger);
|
createButton("Load URDF",CMD_LOAD_URDF, isTrigger);
|
||||||
createButton("Get State",CMD_REQUEST_ACTUAL_STATE, isTrigger);
|
createButton("Step Sim",CMD_STEP_FORWARD_SIMULATION, isTrigger);
|
||||||
createButton("Send Desired State",CMD_SEND_DESIRED_STATE, isTrigger);
|
createButton("Send Bullet Stream",CMD_SEND_BULLET_DATA_STREAM, isTrigger);
|
||||||
createButton("Create Box Collider",CMD_CREATE_BOX_COLLISION_SHAPE,isTrigger);
|
createButton("Get State",CMD_REQUEST_ACTUAL_STATE, isTrigger);
|
||||||
createButton("Reset Simulation",CMD_RESET_SIMULATION,isTrigger);
|
createButton("Send Desired State",CMD_SEND_DESIRED_STATE, isTrigger);
|
||||||
|
createButton("Create Box Collider",CMD_CREATE_BOX_COLLISION_SHAPE,isTrigger);
|
||||||
|
createButton("Reset Simulation",CMD_RESET_SIMULATION,isTrigger);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsClientExample::initPhysics()
|
void PhysicsClientExample::initPhysics()
|
||||||
@@ -292,7 +295,15 @@ 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);
|
||||||
m_userCommandRequests.push_back(CMD_SEND_DESIRED_STATE);
|
m_userCommandRequests.push_back(CMD_SEND_DESIRED_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,8 +407,11 @@ 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)
|
||||||
{
|
{
|
||||||
m_guiHelper->getParameterInterface()->removeAllParameters();
|
if (m_guiHelper->getParameterInterface())
|
||||||
m_numMotors=0;
|
{
|
||||||
|
m_guiHelper->getParameterInterface()->removeAllParameters();
|
||||||
|
}
|
||||||
|
m_numMotors=0;
|
||||||
createButtons();
|
createButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1080,9 +1080,11 @@ 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();
|
{
|
||||||
deleteDynamicsWorld();
|
m_data->m_guiHelper->getRenderInterface()->removeAllInstances();
|
||||||
|
}
|
||||||
|
deleteDynamicsWorld();
|
||||||
createEmptyDynamicsWorld();
|
createEmptyDynamicsWorld();
|
||||||
|
|
||||||
SharedMemoryStatus& serverCmd =m_data->createServerStatus(CMD_CLIENT_COMMAND_COMPLETED,clientCmd.m_sequenceNumber,timeStamp);
|
SharedMemoryStatus& serverCmd =m_data->createServerStatus(CMD_CLIENT_COMMAND_COMPLETED,clientCmd.m_sequenceNumber,timeStamp);
|
||||||
|
|||||||
Reference in New Issue
Block a user