Help with a revolute joint chain config

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Abuzer
Posts: 20
Joined: Thu Jan 19, 2012 4:12 pm

Help with a revolute joint chain config

Post by Abuzer »

Hi,

I'm trying to setup the joints for the "hydraulic suspension" on a vehicle in our game. In the image below, i'm showing basically what I'm trying out as a first pass. There is a high-res render model inside the cubes that I'm showing in the image. The boxes are the actual BEPU collision entities. The cyan circles are where I am placing the joints (identical config for each of the three legs).

Image

So there's basically two hinge joints per leg, for which i'm using the RevoluteJoint in BEPU. All of the entities are collision grouped such that they do not register inter-collisions, so I'm good on that front. While I almost get the look I want, unfortunately there is a bit of constant jiggle in the joints and fiddling with the joint settings I couldn't really eliminate it. As hydraulic pistons usually work, the idea is that there'd be high damping on these joints and also be relatively stiff at the same time.

It looks like the main problem I'm getting with the jiggle is that the lower leg (and possibly to a degree the upper leg) has a tendency to move side-to-side even though the hinge joint is supposed to have that axis removed from the rotation degree of freedom. When the vehicle settles on the ground, since the whole body is resting on these legs, the slight jiggly rotation is pretty apparent. I realize that joints try to maintain their requested transforms by applying impulses, so removing all of the unwanted rotation might be tough, but I was expecting that I could get it to look better. After all, what I'm trying to achieve should be a fairly standard thing for physics engines.

On a side note, I guess I should also add that, I can't reliably get the object to completely settle on the ground. There always seems to be a constant bounce in the springs, almost like the time step isn't small enough type of a deal. If I set the dampen coefficient too high in the servo motor to be high, then the joint rotates away from the goal and cannot get back and if i set it lower, then it starts bouncing...

So, I'm wondering if there is a relatively easy way for me to completely lock down or severely dampen the side-to-side movement of the legs as well as the overall bounciness. I wouldn't be surprised if I'm perhaps missing an obvious setting in the joint.... or perhaps I might need to add another limit solver on top of the revolute joint to further constrict the movement.

As I write this, I'm also going thru the BEPU demos to see if there's anything in there that might be of help to me.

Any help would be very much appreciated.

Thanks
Abuzer
Posts: 20
Joined: Thu Jan 19, 2012 4:12 pm

Re: Help with a revolute joint chain config

Post by Abuzer »

Update: I'm reading thru the BEPU joint documentation online. <crosses fingers> I'm hoping I'll be able to answer my own question :)

Update:

Nope. Still no cigar. I tried different joint configs such as combining a BallSocketJoint with a RevoluteAngularJoint and a RevoluteMotor, and the results are pretty much the same.
The vehicle just won't come to a stop and keeps bouncing around. I even tried increasing the min iteration steps and also decreasing the min impulse on the solver settings for every joint involved in the vehicle and still no difference. I also tried increasing the mass of the object to be around 5 and 50 thinking that perhaps there was a sweet spot in BEPU (looking at the demos, they seem to be around 10+ units).

At this point, i'm wondering if perhaps I shouldn't rely on rotational joints to suspend an object, and perhaps use linear joints (though I don't know exactly how I'd convert our given rig to such a configuration). Seeing how stable the car is in the SuspensionCarDemo, I'm wondering what the trick is there...
Last edited by Abuzer on Tue Jun 12, 2012 2:10 am, edited 1 time in total.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Help with a revolute joint chain config

Post by Norbo »

The first thing to try would be setting the Space.Solver.IterationLimit to something really high- say, 300, instead of the default of 10. If the jiggliness vanishes completely, then it's at least partially a matter of the joint configuration being hard to solve. Sources of this include large mass ratios (i.e. heavy objects dependent on light objects) and long lever arms, or sometimes just a fundamentally hard structure. If the jiggliness remains with tons of iterations, then the configuration is likely goofed up (or something else is making it too hard to solve, like an unusually long time step duration).

Assuming the mass ratios are reasonable, that structure looks pretty easily solvable. In fact, it looks like a fun structure for a demo, so I went ahead and made something similar!

In that demo, the spiderbot is very stable. It's possible to force it to be far less stable by making the legs much lighter and the body far heavier, though it still works decently with 7 mass for the legs and 500 for the body.
Abuzer
Posts: 20
Joined: Thu Jan 19, 2012 4:12 pm

Re: Help with a revolute joint chain config

Post by Abuzer »

Thanks a bunch! I'll analyze this new demo and see if I can apply it to our situation.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Help with a revolute joint chain config

Post by Norbo »

I also tried increasing the mass of the object to be around 5 and 50 thinking that perhaps there was a sweet spot in BEPU (looking at the demos, they seem to be around 10+ units).
There is indeed a sweet spot for masses based upon a constraint's SolverSettings.MinimumImpulse value (which defaults to SolverSettings.DefaultMinimumImpulse), though its effect is very tiny. Basically, if things are very light (<< 1 unit of mass), the impulses will generally early out very quickly. This makes the simulation faster but less stable if not enough iterations have executed. On the other hand, if things are very heavy (>> 1000 units of mass), it will typically not get below the minimum impulse value. This results in higher simulation quality due to the extra solving, but it takes proportionally longer. Generally, this effect is invisible unless extreme masses are chosen, so it's probably not contributing to the observed issue.
Abuzer
Posts: 20
Joined: Thu Jan 19, 2012 4:12 pm

Re: Help with a revolute joint chain config

Post by Abuzer »

That spider demo helped immensely. From what I gathered a few things weren't properly setup. My basis was incorrect as well as the mass being too light. And finally (probably just as important), the legs were too light causing the body to press down too hard.

Once I got those all squared away, it looks like now it's working like a charm.

The only slight concern i have is that the debug drawer doesn't seem to draw the constraint properly (at least not like the way it does in the spider demo). I dunno if i'll take the time to look into it, but depending on how things go, i might just do that down the line.

Cheers
Post Reply