My hinges move in directions they are not supposed to

JoostHuizinga
Posts: 6
Joined: Sun Jan 20, 2013 10:45 pm

My hinges move in directions they are not supposed to

Post by JoostHuizinga »

Hello Bullet forum,

I have a, probably simple, question but I seem unable to find the answer. I have a robot with 4 legs. Each leg consists of two Cylinders connected by a hinge constraint. These legs are connected to the main body, which is a box, also with a hinge.

Now, I am using the motor to move all joints to random positions between -45 and 45 degrees. What happens is that two of the legs 'give in': the hinge connecting the upper body, which is only supposed to be moving up and down, bend sideways.

No I am pretty sure the axis are correct, if I lift the robot its legs `snap' to the correct position. I have already tried different values for impulse, I have tried to work with different values for the limits, I have tried to increase or reduce the mass of the different objects, but the problem remains. I suspect that there is some value that controls how 'rigid' a hinge is, but If so, I am unable to discover what it is.
hsim
Posts: 11
Joined: Sat Nov 03, 2012 8:14 pm

Re: My hinges move in directions they are not supposed to

Post by hsim »

Hello JoostHuizinga,
This problem appears when the mass ratio between your rigid bodies (the ones which are connected by hinges) is too important (greater than 10 or smaller than 1/10, depending on how you see it). I experienced the same issue. I also have posted something on the forum, but got no answer...
That is annoying because components can move "out" of their hinge axis..
:-(
Erwin: HEEEEEELLLLPPPPP ;-)
allenshen
Posts: 6
Joined: Mon Jan 28, 2013 2:51 am

Re: My hinges move in directions they are not supposed to

Post by allenshen »

I got the same problem ..... :(
hsim
Posts: 11
Joined: Sat Nov 03, 2012 8:14 pm

Re: My hinges move in directions they are not supposed to

Post by hsim »

That would be very cool if ERWIN could help us, or at least give an indication to bypass/fix this hinge issue.
Bullet is really awesome, but because of this "unstable" - "hinge mass ratio" limitation, I can't use it for my specific project.
ERWIN please HELP :cry: :cry: :cry:
JoostHuizinga
Posts: 6
Joined: Sun Jan 20, 2013 10:45 pm

Re: My hinges move in directions they are not supposed to

Post by JoostHuizinga »

Okay, I have solved my problem. My problem had nothing to do with the "hinge mass ratio", my problem was that I was being an idiot.

I used the ragdoll demo as a template for my program, and I used the localCreateRigidBody() function to create my rigid bodies... and then I added the rigid body to m_dynamicsWorld. However, since localCreateRigidBody() also adds the body to m_dynamicsWorld, every body was added twice. And this caused all kinds of weird behavior, including my unstable hinges, but also weirdly moving cylinders.

This obviously does not solve the "hinge mass ratio" problem, and I hope someone will be able to give some advice for the others that are having this problem.

Nevertheless, thanks for your responses!
hsim
Posts: 11
Joined: Sat Nov 03, 2012 8:14 pm

Re: My hinges move in directions they are not supposed to

Post by hsim »

ahah, you solved your problem, good news :-)
henokyen
Posts: 6
Joined: Wed Feb 20, 2013 6:14 am

Re: My hinges move in directions they are not supposed to

Post by henokyen »

hi JoostHuizinga
I want to have the same robot with 4 legs. Each leg consists of two Cylinders connected by a hinge constraint. These legs are connected to the main body, which is a box, also with a hinge.

can you post thecode that does this ?
Thanks