Hinge Limits Problem

Posted By: NeoJones

Hinge Limits Problem - 05/03/17 20:29

Hi,
ich arbeite aktuell an einem Simulationsprojekt und würde gerne dies umsetzen:



Hinge 1 soll an dem Gondelarm eine Neigung von 12 Grad haben und Hinge 2 soll sich frei um die 12 Grad Neigung drehen können, wie man im Bild sieht. Mit pXcon_setparams2 kann ich beim normalen physX plugin aber die Limits nicht setzen für die 12 Grad Neigung.
Daher möchte ich mich mit der PhysX 3.0 befassen und sehe, das es dort das FIXED joint gibt, aber wie realisiere ich das jetzt?
Bisher habe ich zuerst den Gondelhalter mit dem Arm (Hinge1) verbunden und dann die Gondel mit dem Gondelhalter (Hinge 2).

Kann mir dabei jemand helfen, wie ich das hinbekomme, das ich die Gondel drehen kann bei 12 Grad Neigung?

MFG, Olli
Posted By: NeoJones

Re: Hinge Limits Problem - 05/03/17 22:08

Also ich habe es jetzt nochmal mit 2 Hinge Joints und pX3con_hinge_setlimit versucht und bekomme es einfach nicht hin... bitte um Hilfe, bin da echt ratlos.
Posted By: Ezzett

Re: Hinge Limits Problem - 05/04/17 12:31

Es wäre sehr hilfreich wenn du deinen Code posten könntest.
Posted By: NeoJones

Re: Hinge Limits Problem - 05/04/17 16:49

Habs hinbekommen. pX3con_setposition hat mir geholfen das Gelenk auszurichten. Ich habe die limits dann mit pX3con_hinge_setflag und pX3con_hinge_setlimit gesetzt.

Trotzdem vielen Dank laugh
Posted By: 3run

Re: Hinge Limits Problem - 05/04/17 17:27

Hey.

I don't know German, but older PhysX 3.0 pluging (made by 3dgs_snake) had problems with joings and their limitstions. Maybe a newver version works better, I'm not sure about it.

Greets!
Posted By: NeoJones

Re: Hinge Limits Problem - 05/05/17 12:02

Hi 3run, thank you. I use this: 20131128_ackphysX3CHECKED(0.93) (physX 3.2.4)
Thats not the last version? Can u give me a link for the last updated version please?

At this moment all works fine, but i have a little problem. Is it possible to stop the rotation of a hinge joint, if its rotating fast?

Thats what i have:
Code:
VECTOR gbreak_lin1;
VECTOR gbreak_ang1;

while(1)
{
   if(key_w) //set limit (stop the rotating joint)
   {
        pX3con_getposition(hg1, gbreak_lin1, gbreak_ang1);
	pX3con_hinge_setflag(hg1, PX_HJ_LIMIT_ENABLED, 1);
	pX3con_hinge_setlimit(hg1, vector(gbreak_ang1.x, gbreak_ang1.x+0.01, 0), vector(0,0,0));
	while(key_w) wait(1);
   }
   if(key_e) //reset limit
   {
	pX3con_hinge_setflag(hg1, PX_HJ_LIMIT_ENABLED, 0);
 	pX3con_hinge_setlimit(hg1, NULL, NULL);
	while(key_e) wait(1);
   }
   wait(1);
}



But this doesnt work. If i press W, all connected joints are flickering, vibrating for the moment. Thats a little bit strange, if i stopped hg1.

Someone an idea?
Posted By: Ezzett

Re: Hinge Limits Problem - 05/05/17 14:34

Wie versetzt du den Hinge Joint in Rotation? Mit var pX3con_hinge_setdrivevelocity(var jointId, var velocity);?

Versuche doch einmal, da den Velocity 0 einzusetzen. Und lasse den Rotationsspielraum bei 360 Grad. Das Drive Flag muss noch gesetzt sein, damit die Funktion funktioniert.

Die Limits sind meines Verständnisses nach Grenzwerte, über die das Gelenk nicht hinaus bewegt werden kann. Wenn du jetzt einfach ein schnell rotierende Gelenk nimmst, und da von einem Frame zum nächsten Frame den Bewegungsspielraum von 360 Grad auf 0,01 Grad einschränkst, dann dürfte das aufgrund numerischer Ungenauigkeiten keine Physik-Engine sauber hinbekommen. Laut Nvidia funktionieren Limits wie eine Kollisionserkennung. Und die kollidierenden Physikobjekte brauchen einen gewissen Abstand von einander, damit eine Kollision erfolgreich berechnet werden kann.


------English:
How do you set your hinge joint in rotational motion? With var pX3con_hinge_setdrivevelocity(var jointId, var velocity);?

Try using this function with the parameter velocity 0 and don't change the 360 degrees of freedom for the joint. Drive flag must be enabled for this to work.

As I understood this, limits are values that constrain the movement range of the joint. In my opinion, if your are changing the limits in one frame from 360 degrees to 0.01 degrees, this won't work because of numerical instabilities and the speed of the hinge.

Nvidia writes that limits work like collisions and to calculate the collision of two objects successfully you need enough space between them.
Posted By: NeoJones

Re: Hinge Limits Problem - 05/06/17 13:38

Hi Ezzett, ich verwende pX3con_hinge_setdrivevelocity nicht. Meine Gondel dreht sich ausschliesslich durch die Fliehkraft oder Gravitation. Die Arme werden mit einer Winkelkraft gedreht und die Gondel rotiert dadurch.
Um die Gondel im rotierenden Zustand nun zu stoppen, fallen mir nur 2 Ideen ein: Entweder die Limits setzen - was ja nicht sauber funktioniert oder eine Gegenkraft erzeugen. Nur weiss ich nicht, wie ich das anstellen soll, damit die Gondel dann wirklich gestoppt wird und sich nicht auf einmal in die andere Richtung dreht grin

English:
Hi Ezzett, i dont use pX3con_hinge_setdrivevelocity. My gondola revolves exclusively by centrifugal force or gravity.
The arms are turned with an angular force and the gondola rotates thereby.
To stop the gondola in the rotating state now, I only think of two ideas: Either set the limits - which does not work properly or generate a drag. Only I do not know how to do this, so that the gondola is really stopped and does not turn suddenly in the other direction xD
Posted By: Ezzett

Re: Hinge Limits Problem - 05/06/17 17:46

Versuche einmal, die Dämpfung für die Gondel auf einen extrem hohen Wert zu setzen, sobald eine Taste gedrückt wird. Sobald die Taste losgelassen wird, stellst du wieder die normale Dämpfung ein.

Try setting an extremely high damping value for the gondola when pressing a button. When the button is released set the normal damping value again.

Code:
/// Set entity damping. Set linear and angular damping  value.
///
/// @param entity A registered physX entity
/// @param linear Linear damping coefficient. Range: [0,inf)
/// @param angular Angular damping coefficient. Range: [0,inf)
/// @return Nonzero if entity is enabled, 0 otherwise
var pX3ent_setdamping(ENTITY *entity, var linear, var angular);

Posted By: NeoJones

Re: Hinge Limits Problem - 05/06/17 18:50

Das habe ich nun mal versucht. Das kuriose ist, das bei pX3ent_setdamping nur die lineare Dämpfung funktioniert. Wirklich festsetzen kann ich die Gondel damit nicht. Die angulare Dämpfung kann ich auf 0 oder 100 setzen, sie zeigt überhaupt keine Wirkung, was ich nicht so ganz verstehe. Setze ich die lineare und angulare Dämpfung auf 100 z.b., dreht sich die Gondel nur, wenn ich das Gondelkreuz (woran 3 Gondeln befestigt sind mit HINGE) mit pX3con_hinge_setdrivevelocity drehe. Sie dreht sich schonmal nicht zurück durch die Gravitation, was auch richtig ist, aber ich bekomme es nicht hin, sie festzusetzen... ich versuche es mal mit einer starken Dämpfung + Limits, damit die Gondel nicht zu schnell rotiert, wenn ich die Limits setze.

This function will only work for revolute joints. THe limit flag must be enabled for this to work.
/// @param jointId The id of the joint
/// @param params1 Vector containing the first set of parameters (lower, upper and distance parameters). Set to NULL to ignore
/// @param params2 Vector containing the second set of parameters (restitution, spring and damping parameters). Set to NULL to ignore
/// @return Nonzero if successful, 0 otherwise.
var pX3con_hinge_setlimit(var jointId, VECTOR *params1, VECTOR *params2);

Setze ich bei params2 vector(0,0,100), gibt es auch keine Veränderung...
Posted By: Ezzett

Re: Hinge Limits Problem - 05/06/17 19:21

Das kann ich auch nicht nachvollziehen. Ohne deinen bisherigen Code ist das leider immer nur eine Spekulation von meiner Seite. Du kannst mir den Code auch per privater Nachricht schicken, dann kann ich immerhin mal testen, was da los ist. Da eine Lösung zu finden interessiert mich jetzt nämlich auch. Vielleicht ist das auch ein Problem von Physx selbst.
Posted By: NeoJones

Re: Hinge Limits Problem - 05/07/17 17:04

Also ich bin mit den Tests noch nicht ganz durch, aber das wäre ne Menge Code, deshalb hab ichs hier noch nicht gepostet.

@3run, can u tell me about an updated version of physX? I dont found any newer version of that. Maybe that solves my problem..
© 2024 lite-C Forums