inaccuracy in angular movement

madMAx4
Posts: 27
Joined: Fri Apr 20, 2007 7:29 pm
Location: Germany

inaccuracy in angular movement

Post by madMAx4 »

hi,
in order to get my servo working properly i need very accurate calculations.
but this does not happen, even under double precision mode.

imagine you have a btGeneric6DofConstraint which is limited to angular movement around the X axis.
one side of the joint is static an on the other side is a body attached with a distance of 10 units (radius).
the body has mass=1.0 & inertia.getX()=around 0.5
then you apply a constant torque of 50 units.

remember there is no gravity.
the result is a non_constant angular acceleration as you can see in the picture:


legend:
blue: torque
green: angular velocity
yellow: computed angle (btGeneric6DofConstraint->computeAngle(0))
red: just ignore (error value)
Image

another thing is that the angular velocity never gets over a chertain value.

EDIT: the higher the mass of the body the lower the max. angular velocity and the higher the inaccuracy.

so there must be a bottleneck. how can i solve that?

thx in advance
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

So what you have is a hinge joint where the hinge axis equals the global x-axis, right? One body is fixed, the other can move. Now you apply a constant torque, but no gravity. Is this so far correct?

So first thing I recommend is to use the hinge joint, since it should give you better precision. Then what result do you expect? If I understand you correctly the dynamic body should accelerate constant and its angular velocity should grow linear, what it obviously doesn't do. Are you sure angular damping is also disabled? I am not an expert with this, but as far as I know it should be better to use an angular motor and set the target velocity accordingly.


Cheers,
-Dirk
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Yes, as Dirk pointed out, please try it again with the powered hinge in Bullet. Have you checked using the hinge motor, see ConstaintDemo.


Thanks,
Erwin

By the way, the generic d6 joint has a lot of (potential) issues. They might get resolved or documented. Also a Featherstone implementation would probably be better.
madMAx4
Posts: 27
Joined: Fri Apr 20, 2007 7:29 pm
Location: Germany

Post by madMAx4 »

ok i'll try it with a hinge joint, but later i need 2 or even 3 directions of freedom, is that possible with multiple hinge joints?
another question about the angular motor: how does it try to reach the target velocity? does it overshoot under chertain circumstances e.g. gravity?
well, i'll try it out, thx so far.

max
madMAx4
Posts: 27
Joined: Fri Apr 20, 2007 7:29 pm
Location: Germany

Post by madMAx4 »

i noticed that trying the whole thing with a hinge would be a lot of work, which i only want to do if it is possible to simulate a 2-way hinge with only using hinges? (2 directions of rotational movement)

while still testing with the generic constraint i figured out that the body which rotates gets pulled inwards to the axis every 180 degrees (360 would be 1 rotation).
the result to this behavior is a velocity decrease at these points.
(as you can see in my first post)

then i decreased the mass down to 0.01 and applyed only a torque of 1 unit. now i get the same acceleration, but its stable now :)
but in the end it runs into some limitation (see at the plot), which i don't understand.

Image

why is there such a limit at these low velocities and torques,
even with using double precision?

max
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

Erwin, can this be due to angular damping?
madMAx4
Posts: 27
Joined: Fri Apr 20, 2007 7:29 pm
Location: Germany

Post by madMAx4 »

i dont set any damping ;)

setting it to 0 makes no difference,
but with some values such as 0.01 or 0.5 the body flies away out of the joint?

EDIT: everything seems to depend on the timestep:
if i choose a high timestep such as 0.01 a low mass of 0.1 and a torque of 1.0 accelerates the body only to a velocity of 0.005.
with a timestep of 0.02 this reacts normally.

maybe this is the point we should give attention?
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

Can you setup some demo so I can step through it?
DevO
Posts: 95
Joined: Fri Mar 31, 2006 7:13 pm

Post by DevO »

Hi,

time step dependency looks like one of my problem.

Try to disable this in btRigidBody.cpp

Code: Select all

#define EXPERIMENTAL_JITTER_REMOVAL 1
I think some of this parameter should be time step dependent but are not.

Code: Select all

btScalar gLinearAirDamping = btScalar(1.);

//'temporarily' global variables
btScalar	gDeactivationTime = btScalar(2.);

btScalar gLinearSleepingThreshold = btScalar(0.8);
btScalar gAngularSleepingThreshold = btScalar(1.0);
Also updateDeactivation() from btRigidBody seems to
work different dependent on time step.

But may be this is a bit of topic.
Devid
madMAx4
Posts: 27
Joined: Fri Apr 20, 2007 7:29 pm
Location: Germany

Post by madMAx4 »

thx for your replys.

#define EXPERIMENTAL_JITTER_REMOVAL 0 does not change anything.
nor enabling deactivation helps.

tomorrow i will set up a simple demo.
do you have a linux machine with opengl available @Dirk? in the case you have one i can simply provide it with the irrlicht engine.
DevO
Posts: 95
Joined: Fri Mar 31, 2006 7:13 pm

Post by DevO »

Well you need to make it in this way >

Code: Select all

//#define EXPERIMENTAL_JITTER_REMOVAL 1
because there is #ifdef test >

Code: Select all

#ifdef EXPERIMENTAL_JITTER_REMOVAL
even if it is 0 it is still defined.


If you are asking me thin actually no, I am using Win64 and MacOS X.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

No sorry, can you hack it into one of the existing Bullet demos and send it to me?
madMAx4
Posts: 27
Joined: Fri Apr 20, 2007 7:29 pm
Location: Germany

Post by madMAx4 »

after testing the demo i found out that there are only 2 problems:

first, the limit, which depends on mass, torque and timestep

and, with using low torque and higher mass the body does not accelerate.
(can be the same problem, but limit would be much more low)

the other problem (acceleration is unstable) seems to relate on my other code, so i gonna recode it completely. when this is finished i'll test your suggestion DevO.

@dirk i gonna send you the demo now if i find your e-mail addr.
if my plotter and the pngwriter does not compile under win you can disable it in AngularMovementDemo.h ;)
EDIT: just send it to 'dondickied at users.sourceforge.net'
madMAx4
Posts: 27
Joined: Fri Apr 20, 2007 7:29 pm
Location: Germany

Post by madMAx4 »

Dirk recommended me to use ODE for physics.
so i'm tying now to combine ODE with Bullet, see at new thread:
http://www.continuousphysics.com/Bullet ... php?t=1216

max