Hi,
i want to simulate a tracked vehicle and started with the first short track shown in the picture ( 28 links, 2 wheels --> 30 constraints). the track itself is working alright. but the frame rate is about 4 frames per second...and i actually have to simulate 2 chains with more links...
is this a general problem of Bullet caused by too many objects and/or constraints or is it possible to simulate such things with other configurations? or in other words, can I do something to get it faster?
Thanks in advance
Gickl
Too many constraints and dynamic objects in simulation?
-
- Posts: 33
- Joined: Tue Jun 05, 2012 8:43 am
Too many constraints and dynamic objects in simulation?
You do not have the required permissions to view the files attached to this post.
-
- Posts: 33
- Joined: Tue Jun 05, 2012 8:43 am
Re: Too many constraints and dynamic objects in simulation?
i just considered if it is better to use the same collision shape for all the links. at the moment i create new collision shapes for all the convex parts of a link, build a compound shape and construct a rigid body with it. would it be better to use only one compound shape and build all the rigid bodies with the same shape but with other motion states?
it is not easy to test at the moment because of my current implementation framework, so i ask...
it is not easy to test at the moment because of my current implementation framework, so i ask...
-
- Posts: 26
- Joined: Thu Oct 04, 2012 1:58 pm
Re: Too many constraints and dynamic objects in simulation?
Are you compiling in Release or Debug? Debug can be up to ~10x slower than release due to the lack of optimizations.
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: Too many constraints and dynamic objects in simulation?
Way too many constraints in a loop. That thing is going to slow down (every body is checked for collisions) and be unstable (long chains tend to be unstable). Sure you can't just estimate it as two cylinders and a box with custom contact/friction?
-
- Posts: 33
- Joined: Tue Jun 05, 2012 8:43 am
Re: Too many constraints and dynamic objects in simulation?
so you mean boxes as chain links? how could i configure the custom contact or friction? i can't imagine that friction would keep the chain on the wheels and that you can simulate high forces on the track...
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: Too many constraints and dynamic objects in simulation?
Not boxes, box. Rather than have bullet calculate the dynamics you do it yourself. You could probably simplify it even more and just use a single raycast vehicle, but you'll need to check that demo to see if it does what you want.
-
- Posts: 33
- Joined: Tue Jun 05, 2012 8:43 am
Re: Too many constraints and dynamic objects in simulation?
if i can't get it faster my idea was to approximate the shape of the track with wheels (cylinders). maybe with interlaced wheels side by side so that there are no gaps between the wheels and that the surface is almost flat...is that what you meant? i would modify the friction so that the wheels behave like a rubber track..
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: Too many constraints and dynamic objects in simulation?
Almost, but since you'll be using custom friction callbacks anyway you might as well use two cylinders (for the ends) and a box as tall as the cylinders and as wide as the center of one cylinder to the next in place of the track . That would lower the number of objects to three, one of which is the second simplest primitive in bullet.Gickl wrote:if i can't get it faster my idea was to approximate the shape of the track with wheels (cylinders). maybe with interlaced wheels side by side so that there are no gaps between the wheels and that the surface is almost flat...is that what you meant? i would modify the friction so that the wheels behave like a rubber track..
-
- Posts: 33
- Joined: Tue Jun 05, 2012 8:43 am
Re: Too many constraints and dynamic objects in simulation?
but a box would be a static object relative to the body of the robot...how could i use this box for the robot's advance?
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: Too many constraints and dynamic objects in simulation?
Tried looking at the raycast vehicle tutorial? It's probably easier to compute the internal reactions easier without bullet.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Too many constraints and dynamic objects in simulation?
If the problem is mainly performance, you need to share a performance profile.Gickl wrote:Hi,
the track itself is working alright. but the frame rate is about 4 frames per second...
Use a CProfileManager::dumpAll() right after a slow 'world->stepSimulation' and share the console output.
This will tell you where the performance goes. You need to execute the profile in Release/optimized mode (-O2). Debug mode is always slow.
I would guess that your performance problem is mainly due to collision detection. If so, try using simple collision shapes (btBoxShape or btConvexHull, and not btBvhTriangleMeshShape or btCompoundShape etc) or disable collision between objects using collision group masks.
Thanks,
Erwin