Closed Evi5 closed 5 years ago
What timestep and number of solver iterations did you use? Default in robotics is 240 Hz and 50 iterations. How did you benchmark exactly?
changed the same program for diff with stepSimulation (b3RobotSimulatorClientAPI_NoDirect or btDiscreteDynamicsWorld)
debug results shows that slowly problem is caused by stepSimulation
program A ` gContactProcessedCallback = myContactProcessedCallback;
m_collisionConfiguration = new btDefaultCollisionConfiguration();
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
btVector3 worldAabbMin(-10000, -10000, -10000);
btVector3 worldAabbMax(10000, 10000, 10000);
m_broadphase = new btAxisSweep3(worldAabbMin, worldAabbMax);
m_solver = new btSequentialImpulseConstraintSolver;
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher, m_broadphase, m_solver, m_collisionConfiguration);
btScalar timeStep = 0.01;
m_dynamicsWorld->stepSimulation(timeStep, 50, timeStep);
`
program B `
b3RobotSimulatorClientAPI m_robotSim;
m_robotSim.stepSimulation();
`
total running time: program A 0.837053 seconds program B 89.4724 seconds
the program is try to train 10 quadrupedRobots to walk in 1 time,
I am not sure the solver iterations, maybe it's the key?
Timestep should be 1./240. to be equal. m_dynamicsWorld->getSolverInfo().m_numSolverIterations=50 What is inside each world? b3RobotSimulatorClientAPI creates btMultiBody by default.
Please don't use Baido links, just attach zipped source code.
thank you !
I think it's not the problem of stepSimulation according to your answer.
Just check codes and add "m_robotSim->removeBody(this->m_minitaurUid);" in "virtual ~TableRobot ()" fix a bug that add a new robot should delete the old one.
Program B has been speed up to 11.1226 seconds, because we load a robot from urdf, the time is seems to be ok.
Comment out the stepSimulation in program B time less than 1 second, that I just think the stepSimulation of m_robotSim is slowly. that so stupid~.~
there is no m_numSolverIterations but m_numIterations I changed program A to
m_dynamicsWorld->getSolverInfo().m_numIterations=50;
btScalar timeStep = 1./240.;
m_dynamicsWorld->stepSimulation(timeStep, 50, timeStep);
total time up to 2.05036 seconds
download link has been delete. codes follow for the one who want to learning
stepSimulation of b3RobotSimulatorClientAPI_NoDirect running slowly
stepSimulation of btDiscreteDynamicsWorld running so fast!
Why is that? And is there some diff of the two stepSimulation?
I want to use urdf in c with b3RobotSimulatorClientAPI, but the stepSimulation of it is too slowly (>200times).
Macos 10.14.3