[Solved] Hinge Joint Rotation Problem

dapaul

01-08-2008 14:27:01

Hi All (Hope Mr. Walaber will read my post),

I'm having some trouble with hinge joints when I use it to combine two compound collisions.

I'm working on a private project that involves robotics simulation. The robot is built from multiple parts. Initially, I used joints to represent the connections between parts. However, this proved very inefficient. So I decided to use a combination of compound collisions and hinge joints. For connected parts that are static, I used a compound collision and hinge joints for dynamic parts (wheels, etc.).

These are the compound collisions I'm working with:


When I apply the hinge joints, this is what happens:


I applied a force to each of the encircled regions to make the spin. Among the three motors, only the one encircled in red is spinning. The other two clearly are interpenetrating and not spinning. I've verified the pin directions as well as the joint position. The difference between the red one is that the orange wheel is not a compound collision, it is a single body. Meanwhile, the one on the sides are compound collisions which are jointed to the main body.

I initially thought that the problem was the mass, but after getting rid of most of the things attached to the wheel and also making the masses smaller, there is no change. the only time they spun was when the orange wheel is not compounded with anything else.

What is wrong with this setup?

I hope somebody can help me, thanks in advance :?

walaber

02-08-2008 23:56:29

there should be no difference when using a hinge on a single collision body, or a compound collision body...

it's hard to say what the problem could be without more information... but are you sure that there aren't any extra bodies causing collision?

dapaul

03-08-2008 07:36:58

Well, I did some more testing, I found that it had something to do with friction.. I scaled my static friction coef to 0.0001 and kinetic friction coef to 0.00005.

The wheels are now spinning and it moved forward slightly. But then, it moved backward.. and since the static friction coef is so low, everything seems to be sliding. The motor has a defined rotation velocity that I keep constant in oder to make the simulation realistic. But it seems it was not strong enough to conquer the friction due to mass. That is why I made the friction coefficients lower. This values above are so far the most stable values, others make everything fly away and other values don't do anything (the wheel still doesn't spin..

Is there another possible problem?

walaber

04-08-2008 00:52:50

in that case, I would guess that you are not calculating the mass, or inertia properly.

what scale are you using for your objects, and how do you calculate the mass and inertia values?

dapaul

10-08-2008 06:19:13

Walaber, you were right!

It turns out, I had the center of mass all wrong. Initially, each part has its own body and center of mass, but when they are to be compounded, I retrieve and calculate their collisions based on their new positions and orientations. I forgot to calculate the new center of mass between the two newly compounded bodies.

The center of mass the entire robot was located at the initial positions of all the bodies (0.0, 0.0, 0.0) >.<. It made all the weight concentrate on the back part of the robot, causing the hind wheel to interpenetrate with the ground.

Additionally, instead of manually applying the force on the wheel, I discovered that it was possible to set the acceleration a hinge joint via. the joint callback. The robot is now moving smoothly.

However, I have a problem when I all of a sudden change the acceleration of the wheel. For example I wanted to reverse the direction of the wheel or if I wanted to instantly stop the wheels. The robot seems to lose its balance because of this. Is it possible to manually set the rotational velocity instead of the acceleration? Is it possible to retrieve the current rotational velocity of a hinge joint?

walaber

11-08-2008 18:45:28

no, you will have to calculate the rotational velocity of the joint manually, by comparing the omega (rotational velocity) of the 2 bodies involved.

the only way to set the rotational velocity of the hinge manually is to use inverse dynamics, to calculate the necessary acceleration, to reach the desired velocity quickly (in 1 step, or more).

dapaul

12-08-2008 09:38:55

Thanks Walaber! It works perfectly. I used the velocity update equation and it is smooth. It stops when we want it to and changes directions with ease. Thank you for all your help!

I'll try to upload video of the finished product after I put some finishing touches

:D

walaber

17-08-2008 16:44:20

great, I look forward to seeing it!