GameKit's rendering loop: simulation timestep and no GUI

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
Post Reply
aspfreakout
Posts: 6
Joined: Mon Jan 24, 2011 10:15 am

GameKit's rendering loop: simulation timestep and no GUI

Post by aspfreakout »

Hi,

I'm trying to use GameKit for some robotics experiments, which seems quite nice: I can use Blender to design the robot and then load the .blend file using GameKit, add some additional constraints and then simulate the whole thing.
I'm using the C++ interface to GameKit directly (like the CppDemo) instead of the binary to have some more control over the engine, because I need to integrate the whole thing in some other code.

I still have a few problems before I can use this setup for real experiments.

First, how can I control the timestep of the Bullet physics world?
I've been browsing through the code and the time step seems fixed at 1/60s by the ENGINE_TICKS_PER_SECOND macro.
It would be nice if I could fix the controller's timestep to some arbitrary timestep during initialization, while the physics simulation runs at a higher frequency.
The easiest solution would be to have the physics run at some frequency (e.g. 200Hz instead of 60Hz) and then subsample this rate for the controller (e.g. activate the controller every 10th physics tick):
stepSimulation( btScalar timeStep = btScalar(1.)/btScalar(20.),int maxSubSteps=10, btScalar fixedTimeStep=btScalar(1.)/btScalar(200.))=0;
What would be the best way to get GameKit to do this?

Secondly, what would be the easiest way to use GameKit without a GUI?
I'd like to run some simulations on a cluster, so I don't need to see the output immediately.
These simulations don't have to run real time (faster or slower, depending on the complexity of the model).

Lastly, I need to model some compliant joints, for which the btGeneric6DofSpringConstraint seems perfect.
Now this type of joint is still not supported in Blender, unless I add such a constraint directly with python (e.g. constraints.createConstraint( body_a, body_b, 12, -0.01,0, -0.035, 0, 0, 0)).
Of course these constraints do not appear magically when I load such a .blend file with GameKit.
The nice thing however is that GameKit automatically creates a btGeneric6DofSpringConstraint when a 6 DOF constraint exists in Blender, but unfortunately the spring stiffness is not set (see btTypedConstraint* gkDynamicsWorld::createConstraint).
Any idea how I could set these parameters in Blender and then move to GameKit directly (or better, how should I modify the code for this)?

Thanks!
Post Reply