cristi-t 103 Report post Posted August 16, 2004 Hi, I am trying to include static friction in my rigid body simulator, but I don't understand the friction cone approximation, I was hoping somebody could clear this up for me. I've seen that simulating static friciton implies considering a pyramid at each contact point. This pyramid has n facets, the more, the better the aproximation of the friction force. Then you would have n versors in the contact plane that make up the static friction force. What I don't understand is: why is this necessary? I already have a 3-axis system defined for each contact - a normal direction, and two ortogonal directions in the contact plane. Isn't this sufficient to determine the tangent friction force? Why do I need to express it in n versors when I can express it in 2? Is it because I don't know which directions to choose if I stick with 2 vectors? I know I'm missing something, here... Also, does this method work for static friction impulses? I use velocity constraints and I would hate to switch to acceleration constraints just to be able to use static friction. Thank you in advance, Cristian 0 Share this post Link to post Share on other sites
Eelco 301 Report post Posted August 16, 2004 the thing with the n-facets is to create a LINEAR approximation of the friction cone. the friction cone describes basicly nothing more than the ratio between normal force and tangential force. if this ratio is below a certain treshold, static friction holds. another way to say this is if the force vector falls within a certain cone, static friction holds. however, this isnt a linear problem, so it cant be solved using a matrix and all. hence the linear appoximation with a bunch of planes, which oobviously are linear. 0 Share this post Link to post Share on other sites
Airo 197 Report post Posted August 16, 2004 I'm working on the same problem as you are but i'm trying to use the acceleration approach you mention. I'm still in the researchphase thus my answer may not be totally correct.the cone is approximated as a polygon to formulate the problem as a linear programming problem. In this LP or is it linear complementary problem there is the constraint that the x's are larger than zero. when you use 2 vectors, this larger than zero constraint forces you to cover only one quadrant of the cone. therefore more points are needed.if i recall correctly the work done by Brian Mirtich covers static and dynamic friction using an impulse based method. This method can handle stacking of particles. I still must find time to look into this method but the lcp method is sucking my time like a vacuum chamber gone bad. 0 Share this post Link to post Share on other sites
cristi-t 103 Report post Posted August 16, 2004 Thanks for replying.Eelco: The static friciton condition is norm(Ft) <= u*norm(Fn). Does this linearization have the purpose of avoiding the norm function, which contains squared coefficients? Airo: yes, choosing more than 2 vectors makes sense now, thinking that the x-es must be positive. But what I still don't get is, why would you need more than 4 vectors? In this paper - [Sauer, Schomer, "A Constraint Based Apporach to Rigid Body Dynamics for Virtual Reality Applications"] they use a 12 vector system in the tangent plane for each contact point. (1) Any vector in the tangent plane could be expressed completely by 4 orthonormal vectors and by coefficients >= 0. So what you would need is a 4-sided pyramid, meaning 4 vectors in the tangent plane, period. Why use more than 4? (2) Le't say I have 4 vectors in the tangent plane and a normal. What are the unknowns for the contact force with static friction? Would I have 5 unknowns for each static contact (1 unknown for the normal component and 4 unknowns for the tangential component)? Cristian 0 Share this post Link to post Share on other sites
Airo 197 Report post Posted August 17, 2004 interesting paper, but way over my head.i found the part where they talk about discretizing the cone. section 2.2.There they say that the minimum direction vectors needed is 4 which makes sense.edit: on reading it again after eelco's comment. the minimum the authors use is 4. it's not necessarily needed.i think you use as much direction vectors as possible because of the nature of the solution you obtain from a lcp. The optimal solution is an unique extreme point or it is a weighted combination of extreme points. when using only 4 direction vectors you could find a solution that is not the physically correct solution but is for instance one extreme point. while the phys. correct solution would require a linear cobination. By introducing more constraints you force the lcp to give the correct physical solution or a better approximation.Do you understand this matrix formulation? I've only read baraffs papers. I can look up the references in this paper. Do you know good papers/books that explain this?[Edited by - Airo on August 17, 2004 5:34:05 AM] 0 Share this post Link to post Share on other sites
Eelco 301 Report post Posted August 17, 2004 Quote:Original post by cristi-tThanks for replying.Eelco: The static friciton condition is norm(Ft) <= u*norm(Fn). Does this linearization have the purpose of avoiding the norm function, which contains squared coefficients?yes, thats one way to phrase it, but whatever way you write it, its not a linear function.Quote:Airo: yes, choosing more than 2 vectors makes sense now, thinking that the x-es must be positive. But what I still don't get is, why would you need more than 4 vectors? In this paper - [Sauer, Schomer, "A Constraint Based Apporach to Rigid Body Dynamics for Virtual Reality Applications"] they use a 12 vector system in the tangent plane for each contact point. (1) Any vector in the tangent plane could be expressed completely by 4 orthonormal vectors and by coefficients >= 0. So what you would need is a 4-sided pyramid, meaning 4 vectors in the tangent plane, period. Why use more than 4? (2) Le't say I have 4 vectors in the tangent plane and a normal. What are the unknowns for the contact force with static friction? Would I have 5 unknowns for each static contact (1 unknown for the normal component and 4 unknowns for the tangential component)? Cristianwell 4 or 12 or 3 or 100: its just an arbitrary number.the vectors define a plane by being the normal to this plane. this set of planes forms a linear approximation of the friction cone. the more planes, the better the approximation. 3 is the minimum, and id say 6 is a good balance between accuracy and speed.so mathematicly the check to see if the forcevector lies within the friction cone is:for all planes:side = plane.normal * force;if (side<0) for any plane, static friction violated (or>0 depending on your normals orientation)or in matrix formulation it would be CONE * force < 0, with each row of the matrix force being a plane normal. 0 Share this post Link to post Share on other sites
ToohrVyk 1596 Report post Posted August 17, 2004 Correct me if I'm wrong, but you can test for the existence of friction fairly easily without advanced linear algebra.Friction appears when N / T > a, where N and T are the lengths of N (normal force) and T (tangent force) and a is a coefficient of your choice.If you have the coordinates of the N+T vector in the (normal,tangent1,tangent2) base of the plane, you can easily compute T^{2} and N^{2} from these coordinates.The above equation then becomes:T^{2} / N^{2} > a^{2}This check is a fairly easy one, so assuming you have the coordinates in the correct base, all it takes is a couple of multiplies and you can check if there is friction or not. 0 Share this post Link to post Share on other sites
Airo 197 Report post Posted August 17, 2004 ToohrVyk: when you know the tangential and normal force in advance it's easy to calculate if there's sliding or not with the method you mention.the purpose of the lcp is to actually determine the forces with the appropriate constraints on the forces built in. 0 Share this post Link to post Share on other sites
cristi-t 103 Report post Posted August 17, 2004 Quote:Original post by AiroDo you understand this matrix formulation? I've only read baraffs papers. I can look up the references in this paper. Do you know good papers/books that explain this?Airo: I haven't really spent time on that paper, but the A matrix seems easy to compute, since all the matrices that get multiplied are defined in the paper. I looked at each matrix they introduced at the beginning and all of them are easy to construct. Th only thing that confused me were the 12 tangent vectors... I still don't get the static friction formulation. Are you having trouble computing A?I'd like to ask you all something about LCP: If I have a correct formulation for Aij and Bi (including static friction) all I need is a classic LCP solver, right? I have implemented the LCP algorithm described by Baraff in "Baraff - Fast Contact Force Computation", but only the fricitonless part. Why does he need to modify the algorithm to include friction? The algorithm for solving the LCP shouldn't care about this, it only cares to output the unknowns under the LCP conditions. Shouldn't the algorithm be exactly the same with and without friciton (and only Aij, Bi change)?Cristian 0 Share this post Link to post Share on other sites
Airo 197 Report post Posted August 18, 2004 cristi-t: yeah i have trouble with calculating the Alk, for example what do the i and j subscripts mean? This double subscripting confuses me. Also I've got trouble implementing the lcp. I know some algebra but i know very little about implementing it on a computer. Do you know good referencs for that?In free flight the inertia matrix gets transformed by R Ibody RTIBody is i think defined when the rotation axis goes to through the center of mass. Do you have to change the Ibody when dealing with contact? There's definately a difference if you spin a rod through the center of mass or by one of it's ends (this happens in a contact i think). 0 Share this post Link to post Share on other sites
cristi-t 103 Report post Posted August 18, 2004 Airo:Alk:l and k are contact indices, while i and j are body indices. Alk means "effect of contact k on contact l". Each contact has two body indices, i and j. For example:mik means mass of body i in contact k;vector noted rkik means the vector from "point of contact k" to "center of mass of body i in contact k";(rabc = vector from point of contact a, to center of mass of body b in contact c).LCP:For the LCP solver read "Baraff - Fast Contact Force Computation". I implemented it from there, but without friction.IInv:You also need IInv (I superscript -1, the inverse of I). This is computed each frame as IInv = R * IBodyInv * RT. IBodyInv (and IBody) is constant and it's computed only once before simulation starts. Cristian 0 Share this post Link to post Share on other sites
Airo 197 Report post Posted August 18, 2004 thanks the subscripts make more sense now.yes, i've read how baraff solved the lcp. i have not tried to implement it because i'm still trying to design a contact detection system that work for various primitive shapes. other problem is how to write the matrix class efficiently and how to deal with floating point inaccuracies.IBodyInv, oops my mistake, i meant this in the equation.my question was, will it change when the body is in contact or not?see diagram 6 of the website belowhttp://physics.uwstout.edu/StatStr/statics/Beams/bdsn47a.htmi think the parallel axis theorem has to be used but i can't remember it being mentioned in the papers i've read, f.e. baraffs lecture notes. 0 Share this post Link to post Share on other sites
cristi-t 103 Report post Posted August 18, 2004 Quote:Original post by Airomy question was, will it change when the body is in contact or not?see diagram 6 of the website belowhttp://physics.uwstout.edu/StatStr/statics/Beams/bdsn47a.htmi think the parallel axis theorem has to be used but i can't remember it being mentioned in the papers i've read, f.e. baraffs lecture notes.For primitives you have formulas that give you the moment of inertia, you don't have to compute it like the general case. For example, for a parallelepiped:http://scienceworld.wolfram.com/physics/MomentofInertiaRectangularParallelepiped.html(Note that this is IBody, you need to invert it to get IBodyInv)IBodyInv never changes. IInv however does change at every time step. It depends on position of the body so you have to compute it every time step as IInv = R*IBodyInv*RT. (During the time step IInv is of course constant.)Cristian 0 Share this post Link to post Share on other sites