Skip to content

Commit 835dea5

Browse files
authored
Merge pull request #963 from erwincoumans/master
disable keyboard toggle in Linux/X11, revert num solver iterations to 50 (from 150)
2 parents 904a1b5 + 8f546ac commit 835dea5

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

examples/ExampleBrowser/OpenGLExampleBrowser.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ void MyKeyboardCallback(int key, int state)
257257

258258
} else
259259
{
260-
261260
b3ChromeUtilsStopTimingsAndWriteJsonFile();
262261
}
263262
#endif //BT_NO_PROFILE

examples/OpenGLWindow/X11OpenGLWindow.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ void X11OpenGLWindow::pumpMessage()
839839

840840
if (m_data->m_keyboardCallback)
841841
{
842-
#if 0
842+
#if 1
843843
unsigned short is_retriggered = 0;
844844
///filter out keyboard repeat
845845
//see http://stackoverflow.com/questions/2100654/ignore-auto-repeat-in-x11-applications
@@ -851,8 +851,8 @@ void X11OpenGLWindow::pumpMessage()
851851
if (nev.type == KeyPress && nev.xkey.time == m_data->m_xev.xkey.time &&
852852
nev.xkey.keycode == m_data->m_xev.xkey.keycode)
853853
{
854-
fprintf (stdout, "key #%ld was retriggered.\n",
855-
(long) MyXLookupKeysym(&nev.xkey, 0));
854+
//fprintf (stdout, "key #%ld was retriggered.\n",
855+
// (long) MyXLookupKeysym(&nev.xkey, 0));
856856

857857
// delete retriggered KeyPress event
858858
MyXNextEvent(m_data->m_dpy, & m_data->m_xev);
@@ -861,6 +861,7 @@ void X11OpenGLWindow::pumpMessage()
861861
}
862862
#endif
863863
int state = 0;
864+
if (!is_retriggered)
864865
(*m_data->m_keyboardCallback)(keycode,state);
865866
}
866867

examples/RoboticsLearning/GripperGraspExample.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ class GripperGraspExample : public CommonExampleInterface
209209

210210
if ((m_options & eONE_MOTOR_GRASP)!=0)
211211
{
212+
m_robotSim.setNumSolverIterations(150);
212213
{
213214
SliderParams slider("Vertical velocity",&sGripperVerticalVelocity);
214215
slider.m_minVal=-2;

examples/RoboticsLearning/b3RobotSimAPI.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,16 @@ void b3RobotSimAPI::setGravity(const b3Vector3& gravityAcceleration)
478478

479479
}
480480

481+
void b3RobotSimAPI::setNumSolverIterations(int numIterations)
482+
{
483+
b3SharedMemoryCommandHandle command = b3InitPhysicsParamCommand(m_data->m_physicsClient);
484+
b3SharedMemoryStatusHandle statusHandle;
485+
b3PhysicsParamSetNumSolverIterations(command, numIterations);
486+
statusHandle = b3SubmitClientCommandAndWaitStatus(m_data->m_physicsClient, command);
487+
b3Assert(b3GetStatusType(statusHandle)==CMD_CLIENT_COMMAND_COMPLETED);
488+
489+
}
490+
481491
void b3RobotSimAPI::setNumSimulationSubSteps(int numSubSteps)
482492
{
483493
b3SharedMemoryCommandHandle command = b3InitPhysicsParamCommand(m_data->m_physicsClient);

examples/RoboticsLearning/b3RobotSimAPI.h

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ class b3RobotSimAPI
157157
void setGravity(const b3Vector3& gravityAcceleration);
158158

159159
void setNumSimulationSubSteps(int numSubSteps);
160+
void setNumSolverIterations(int numIterations);
160161

161162
bool calculateInverseKinematics(const struct b3RobotSimInverseKinematicArgs& args, struct b3RobotSimInverseKinematicsResults& results);
162163

examples/SharedMemory/PhysicsServerCommandProcessor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ void PhysicsServerCommandProcessor::createEmptyDynamicsWorld()
799799
m_data->m_dynamicsWorld->getSolverInfo().m_erp2 = 0.08;
800800

801801
m_data->m_dynamicsWorld->getSolverInfo().m_linearSlop = 0.00001;
802-
m_data->m_dynamicsWorld->getSolverInfo().m_numIterations = 150;
802+
m_data->m_dynamicsWorld->getSolverInfo().m_numIterations = 50;
803803
m_data->m_dynamicsWorld->getSolverInfo().m_leastSquaresResidualThreshold = 1e-7;
804804
// m_data->m_dynamicsWorld->getSolverInfo().m_minimumSolverBatchSize = 2;
805805
//todo: islands/constraints are buggy in btMultiBodyDynamicsWorld! (performance + see slipping grasp)

0 commit comments

Comments
 (0)