NewtonClass SetRowStiffness

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonClass SetRowStiffness

Postby AntonSynytsia » Tue Nov 22, 2016 3:46 am

The following code was copied from NewtonClass.cpp:
Code: Select all
void NewtonUserJoint::SetRowStiffness (dgFloat32 stiffness)
{
   dgInt32 index = m_rows - 1;
   if ((index >= 0) &&  (index < dgInt32 (m_maxDOF))) {
      stiffness = dgFloat32 (1.0f) - dgClamp (stiffness, dgFloat32(0.0f), dgFloat32(1.0f));
      stiffness = -dgFloat32 (1.0f) - stiffness / DG_PSD_DAMP_TOL;
      m_param->m_jointStiffness[index] = stiffness;
   }
}

Is there a particular reason the stiffness is clamped, then modified to a negative value, and divided by DG_PSD_DAMP_TOL, making the final stiffness range from -1 to -1001?

I find that removing the modification and changing clamping to (-Infinity, 1.0), that is setting the m_jointStiffness[index] to the actual stiffness parameter that can be a value ranging from -Infinity to 1.0, makes joints a lot stiffer.

The reason I'm posting this is because maybe this was a forgotten file and needs changing to address the joint stiffness.

I understand that I could use newton Skeleton instead to vamp up joint stiffness, but last time I tried it, the skeleton didn't work. Maybe it works now; I'll have to check.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: NewtonClass SetRowStiffness

Postby Julio Jerez » Tue Nov 22, 2016 4:57 pm

I will check out,


AntonSynytsia wrote:I understand that I could use newton Skeleton instead to vamp up joint stiffness, but last time I tried it, the skeleton didn't work. Maybe it works now; I'll have to check.

hey AntonSynytsia I remember you where working of stiff joints, and the problem was tat it was only good for non active bilateral rows, all the short coming of the skeleton class has been addressed.
Now the skeleton handles motors, unilateral rows with limit, and loop joints.
can you try again please it and let me know?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonClass SetRowStiffness

Postby AntonSynytsia » Tue Nov 22, 2016 10:43 pm

Hi, Julio,

I will definitely test them out.

Thanks,
Anton
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: NewtonClass SetRowStiffness

Postby AntonSynytsia » Thu Nov 24, 2016 7:53 am

Conducting a few tests, I found that skeleton containers now work properly if the root body is static, which is very desired! They don't work, however, if any of the linked bodies are static. It's not much of an issue though. I do think, however, that skeleton containers should consider infinite-massed bones. Imagine having a bridge linked with hinge joints with the first and the last body static. That is one case where static bones are necessary.

I also found that changing the stiffness as described in my first post makes skeleton containers stronger, though also unstable in certain ways. So, I think the stiffness should be left as it is. Removing the clamping and modification wouldn't yield desired results if implementing skeleton containers.

What they don't work on is looped joints. How would I apply a skeleton for this type of car:
suspension_car.png
suspension_car.png (209.04 KiB) Viewed 3770 times

This is where looped bones are necessary. I would really like to understand the reason skeleton container can't support looped bones.

Other than that, I have found that skeleton containers are now a lot more stable than I once recall them being.

One question though, what are cycling joints and when is it it necessary to use the NewtonSkeletonContainerAttachCyclingJoint function for a joint. Can I simply call this function for all joints?
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: NewtonClass SetRowStiffness

Postby Julio Jerez » Thu Nov 24, 2016 6:31 pm

AntonSynytsia wrote:Conducting a few tests, I found that skeleton containers now work properly if the root body is static, which is very desired! They don't work, however, if any of the linked bodies are static. It's not much of an issue though. I do think, however, that skeleton containers should consider infinite-massed bones. Imagine having a bridge linked with hinge joints with the first and the last body static. That is one case where static bones are necessary.


Ah now we are talking, yes one of the rule for the skeleton is that that only the root bone can be static, however this is not a problem because that's the improvement of 3.14
you can attach any of the link to any external body that is not part of another skeleton, or you can link any tow body part of the same skeleton using the cycling joint
below is a sketch of a skeleton using cycling joint to link internals and external bodies.
skeleton.png
skeleton.png (16.56 KiB) Viewed 3762 times


I also found that changing the stiffness as described in my first post makes skeleton containers stronger, though also unstable in certain ways. So, I think the stiffness should be left as it is. Removing the clamping and modification wouldn't yield desired results if implementing skeleton containers.

yes that a really bad thing to do, it has to do with a theorem of linear algebra that say that a positive definite matrix must have positive Eigen values. making the stiffness value less that one scale the diagonal of the mass matrix, and that can make the matrix not PSD. That's a really bad thing to do.

I would really like to understand the reason skeleton container can't support looped bones.
One question though, what are cycling joints and when is it necessary to use the

the reason is that for some king of graph, the matrix representation lead to algorithm that can be fasters that the general way of solving them. A skeleton is a special king of graph that can called acyclic, this mean that each nor can only have one parent. put another way a graph is acyclic if the forest visit each node and each only once. this kind of graph can be factored in linear time.
That is what the Newton Skelton is.
as you can see the topology of the graph forbid connecting any two of the node because down that break the acclivity rule. but that's where NewtonSkeletonContainerAttachCyclingJoint come in.
you can now connect any two nodes or any now to any external body using the cycling function.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonClass SetRowStiffness

Postby Julio Jerez » Fri Nov 25, 2016 8:18 am

I made a possible sketch to show one possible way make the skeleton joints and the cycling joints.
basically by inspection of the vehicle hierarchy you can determine the longest path from the chassis to each tire and those you make normal skeleton joints.
For wishbones that connect the tire to the chassis, this is called a four way bar link in mechanisms, very common but they are inherently circular loop (hard to simulate using reduce coordinate systems like newton), but now in newton you can simple add then as cycling joints.
suspension.png
suspension.png (13.95 KiB) Viewed 3747 times


another suggestion is when you make the wishbone, you may think of using hinge for both of them, this is a big mistake.
The reason is that sin the chassis is rigid, each hinge connected to the chassis define a plane, but in the case the tow hinge define tow plane that are coplanar. This will from a close system with a very mass matrix with very high condition number, very hard to solve.

Instead make the firs wishbone a hinge, and the second universal joint. This will let the second wishbone release energy when the constraints are violated by small amount.

also you can try the same for the suspension, you can use a universal joint, this way the tire will be keep on place by the upper wish bone and the other joint are there to supply the forces that move the tire on the plane on motion. This should give you a stable design.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 18 guests

cron