expose timeout in pybullet/shared memory API

add RobotSimulator, a C++ API similar to pybullet. (work-in-progress, only part of API implemeted)
This commit is contained in:
Erwin Coumans
2017-02-24 15:34:11 -08:00
parent bb11884f89
commit a4f1e34899
34 changed files with 1654 additions and 62 deletions

View File

@@ -56,11 +56,13 @@ struct PhysicsDirectInternalData
PhysicsCommandProcessorInterface* m_commandProcessor;
bool m_ownsCommandProcessor;
double m_timeOutInSeconds;
PhysicsDirectInternalData()
:m_hasStatus(false),
m_verboseOutput(false),
m_ownsCommandProcessor(false)
m_ownsCommandProcessor(false),
m_timeOutInSeconds(1e30)
{
}
};
@@ -230,7 +232,7 @@ bool PhysicsDirect::processDebugLines(const struct SharedMemoryCommand& orgComma
b3Clock clock;
double startTime = clock.getTimeInSeconds();
double timeOutInSeconds = 10;
double timeOutInSeconds = m_data->m_timeOutInSeconds;
while ((!hasStatus) && (clock.getTimeInSeconds()-startTime < timeOutInSeconds))
{
@@ -315,7 +317,7 @@ bool PhysicsDirect::processVisualShapeData(const struct SharedMemoryCommand& org
b3Clock clock;
double startTime = clock.getTimeInSeconds();
double timeOutInSeconds = 10;
double timeOutInSeconds = m_data->m_timeOutInSeconds;
while ((!hasStatus) && (clock.getTimeInSeconds()-startTime < timeOutInSeconds))
{
@@ -369,7 +371,7 @@ bool PhysicsDirect::processOverlappingObjects(const struct SharedMemoryCommand&
b3Clock clock;
double startTime = clock.getTimeInSeconds();
double timeOutInSeconds = 10;
double timeOutInSeconds = m_data->m_timeOutInSeconds;
while ((!hasStatus) && (clock.getTimeInSeconds()-startTime < timeOutInSeconds))
{
@@ -427,7 +429,7 @@ bool PhysicsDirect::processContactPointData(const struct SharedMemoryCommand& or
b3Clock clock;
double startTime = clock.getTimeInSeconds();
double timeOutInSeconds = 10;
double timeOutInSeconds = m_data->m_timeOutInSeconds;
while ((!hasStatus) && (clock.getTimeInSeconds()-startTime < timeOutInSeconds))
{
@@ -491,7 +493,7 @@ bool PhysicsDirect::processCamera(const struct SharedMemoryCommand& orgCommand)
b3Clock clock;
double startTime = clock.getTimeInSeconds();
double timeOutInSeconds = 10;
double timeOutInSeconds = m_data->m_timeOutInSeconds;
while ((!hasStatus) && (clock.getTimeInSeconds()-startTime < timeOutInSeconds))
{
@@ -754,7 +756,7 @@ void PhysicsDirect::postProcessStatus(const struct SharedMemoryStatus& serverCmd
b3Clock clock;
double startTime = clock.getTimeInSeconds();
double timeOutInSeconds = 10;
double timeOutInSeconds = m_data->m_timeOutInSeconds;
while ((!hasStatus) && (clock.getTimeInSeconds()-startTime < timeOutInSeconds))
{
@@ -781,7 +783,7 @@ void PhysicsDirect::postProcessStatus(const struct SharedMemoryStatus& serverCmd
b3Clock clock;
double startTime = clock.getTimeInSeconds();
double timeOutInSeconds = 10;
double timeOutInSeconds = m_data->m_timeOutInSeconds;
while ((!hasStatus) && (clock.getTimeInSeconds()-startTime < timeOutInSeconds))
{
@@ -1034,3 +1036,13 @@ void PhysicsDirect::getCachedRaycastHits(struct b3RaycastInformation* raycastHit
raycastHits->m_numRayHits = m_data->m_raycastHits.size();
raycastHits->m_rayHits = raycastHits->m_numRayHits? &m_data->m_raycastHits[0] : 0;
}
void PhysicsDirect::setTimeOut(double timeOutInSeconds)
{
m_data->m_timeOutInSeconds = timeOutInSeconds;
}
double PhysicsDirect::getTimeOut() const
{
return m_data->m_timeOutInSeconds;
}