<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/8686" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2013-05-29T06:33:03+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/8686</id>

		<entry>
		<author><name><![CDATA[Dani3L]]></name></author>
		<updated>2013-05-29T06:33:03+00:00</updated>

		<published>2013-05-29T06:33:03+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30886#p30886</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30886#p30886"/>
		<title type="html"><![CDATA[Re: Hinge constraint]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30886#p30886"><![CDATA[
Ok thanks. For the moment I solve a block for the linear constraints and another block for the angular constraints. So at most, I have to solve a 3x3 system. I handle the limits and motor separately.<br><blockquote class="uncited"><div>If you run a block solver on a mechanic system like a ragdoll I somewhere read years ago that this improves convergence rate by sqrt( 2 ). Please don't ask where this number comes from, sorry <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">.</div></blockquote>Yeah, I have seen that you mentioned that value in other threads in the forum already <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=5337">Dani3L</a> — Wed May 29, 2013 6:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dirk Gregorius]]></name></author>
		<updated>2013-05-29T03:19:10+00:00</updated>

		<published>2013-05-29T03:19:10+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30884#p30884</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30884#p30884"/>
		<title type="html"><![CDATA[Re: Hinge constraint]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30884#p30884"><![CDATA[
Well, you still have this problem when you solve a block of 3x3 for the linear and a block of 2x2 for the angular constraints. But you can also solve a 5x5 block. If you are fancy you can even add the limit and solve a 6x6 system. Note that this would be a small LCP now which you can solve e.g. with direct enumeration. This gets expensive , but the limit gets stiffer.<br><br>I did the 5x5 block solves years ago and want to try it again at some point. At that time it helped since we used 30 gravity and simulated at 15-20 Hz. It helped to keep things together. I am not sure how much it helps if you have a good setup and simulate at 60 Hz. <br><br>If you run a block solver on a mechanic system like a ragdoll I somewhere read years ago that this improves convergence rate by sqrt( 2 ). Please don't ask where this number comes from, sorry <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14">Dirk Gregorius</a> — Wed May 29, 2013 3:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dani3L]]></name></author>
		<updated>2013-05-28T21:46:26+00:00</updated>

		<published>2013-05-28T21:46:26+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30881#p30881</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30881#p30881"/>
		<title type="html"><![CDATA[Re: Hinge constraint]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30881#p30881"><![CDATA[
Thanks for your answer Dirk !<br><br>When you say :<br><blockquote class="uncited"><div>The usual problem is that the linear and angular constraints are fighting each other.</div></blockquote>We have this issue in both situations (solving the constraints by block or individually) right ?<br><br>I have read that in some situations, it is better to solve the constraints by block. What do you suggest ? When is it better to solve the constraints by block and when is it better to solve then individually ?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=5337">Dani3L</a> — Tue May 28, 2013 9:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dirk Gregorius]]></name></author>
		<updated>2013-05-28T19:21:54+00:00</updated>

		<published>2013-05-28T19:21:54+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30879#p30879</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30879#p30879"/>
		<title type="html"><![CDATA[Re: Hinge constraint]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30879#p30879"><![CDATA[
You can do this as well. It is slightly more expensive and I doubt it will make any noticelable difference. The usual problem is that the linear and angular constraints are fighting each other.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14">Dirk Gregorius</a> — Tue May 28, 2013 7:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dani3L]]></name></author>
		<updated>2013-05-27T21:57:39+00:00</updated>

		<published>2013-05-27T21:57:39+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30866#p30866</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30866#p30866"/>
		<title type="html"><![CDATA[Re: Hinge constraint]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30866#p30866"><![CDATA[
<blockquote class="uncited"><div>Note that for solving this you handle each constraint separately. So for a hinge I would suggest solving C1 followed by C2 and finally solve a 3x3 point-to-point constraint.</div></blockquote>Why is it better to solve the two constraints separately and not at the same time where K would be a 2x2 matrix ?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=5337">Dani3L</a> — Mon May 27, 2013 9:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[c0der]]></name></author>
		<updated>2013-01-04T23:11:24+00:00</updated>

		<published>2013-01-04T23:11:24+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29609#p29609</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29609#p29609"/>
		<title type="html"><![CDATA[Re: Hinge constraint]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29609#p29609"><![CDATA[
Thanks a lot Dirk. I transformed my tangent axes with the frame they vary with and it still works both ways, regardless of our Jacobians being different, it was a good mistake on my part to learn from.<br><br>Thanks for the tips on quaternion constraints, you are most helpful.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=9431">c0der</a> — Fri Jan 04, 2013 11:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dirk Gregorius]]></name></author>
		<updated>2013-01-04T17:03:00+00:00</updated>

		<published>2013-01-04T17:03:00+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29606#p29606</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29606#p29606"/>
		<title type="html"><![CDATA[Re: Hinge constraint]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29606#p29606"><![CDATA[
<blockquote class="uncited"><div>dC1/dt = u2.Cross(omegaB, w1) + Cross(omegaA, u2).w1</div></blockquote>'<br>Vice versa: w1 varies with frame A and u2 varies with frame B. So I think my Jacobian is correct.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14">Dirk Gregorius</a> — Fri Jan 04, 2013 5:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[c0der]]></name></author>
		<updated>2013-01-04T10:44:43+00:00</updated>

		<published>2013-01-04T10:44:43+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29602#p29602</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29602#p29602"/>
		<title type="html"><![CDATA[Re: Hinge constraint]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29602#p29602"><![CDATA[
Thanks Dirk! That makes alot more sense<br><br>The way I am following your process is as follows:<br><br>dC1/dt = u2.w1<br>dC1/dt = u2.d/dt(w1) + d(u2)/dt.w1 (Product rule)<br>dC1/dt = u2.Cross(omegaB, w1) + Cross(omegaA, u2).w1 (Since w1 varies with frame B and u2 changes wrt to frame A)<br>dC1/dt = omegaB.Cross(w1, u2) + omegaA.Cross(u2, w1) (Commutativity of the dot product and cross product identities)<br><br>dC1/dt = omegaA.Cross(u2,w1) - omegaB.(Cross(u2,w1)<br>dC1/dt = Cross(u2,w1).(omegaA - omegaB)<br><br>Jv = [ 0 Cross(u2,w1)T 0 -Cross(u2,w1)T ] [ va wa vb wb ]T<br><br>My simulation works well, except when I introduce the bias into it, it becomes erratic.<br><br>My final effective mass matrix after splitting it up and combining it as you suggested as follows:<br><br>Row 1 (Col 1 to 5)<br>Ma^-1 + [~ra]TIa^-1[~ra] + Mb^-1 + [~rb]TIb^-1[~rb]<br>[~ra]TIa^-1(t2xu1) + [~rb]TIb^-1(t2xu1) <br>[~ra]TIa^-1(v2xu1) + [~rb]TIb^-1(v2xu1)     <br><br>Row 2 (Col 1 to 5)<br>(t2xu1)Ia^-1[~ra] + (t2xu1)Ib^-1[~rb]<br>(t2xu1)Ia^-1(t2xu1) + (t2xu1)Ib^-1(t2xu1) <br>(t2xu1)Ia^-1(v2xu1) + (t2xu1)Ib^-1(v2xu1) ]<br><br>Row 3 ( Col 1 to 5)<br>(v2xu1)Ia^-1[~ra] + (v2xu1)Ib^-1[~rb]<br>(v2xu1)Ia^-1(t2xu1) + (v2xu1)Ib^-1(t2xu1) <br>(v2xu1)Ia^-1(v2xu1) + (v2xu1)Ib^-1(v2xu1) ]<br><br>This corresponds to 5 D.O.F removed. The simulation only becomes erratic if I introduce the bias and an angular velocity in the free axis and restricted axis. Any idea why? It seems our Jacobians are backwards in the derivations<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=9431">c0der</a> — Fri Jan 04, 2013 10:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dirk Gregorius]]></name></author>
		<updated>2013-01-02T19:01:52+00:00</updated>

		<published>2013-01-02T19:01:52+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29582#p29582</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29582#p29582"/>
		<title type="html"><![CDATA[Re: Hinge constraint]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29582#p29582"><![CDATA[
This appears like an error in your angular constraints. You block the angular motion using so called orthogonality conditions. Say you have a joint frame u,v,w on both bodies. The w axis on body 1 defines your hinge.  <br><br>// 1. Define the position constraints<br>C1 = u2 * w1 <br>C2 = v2 * w1<br><br>// 2. Build the time derivative<br>dC1/dt = J1 * v = cross( u2, w1 ) * ( omega2 - omega1 )<br>dC2/dt = J2 * v = cross( v2, w1 ) * ( omega2 - omega1 )<br><br>// 3. Identify the Jacobian by inspection<br>J1 = [ 0 | -cross( u2, w1 ) | 0 | cross( u2, w1 ) ]<br>J2 = [ 0 | -cross( v2, w1 ) | 0 | cross( v2, w1 ) ]<br><br>// 4. Build inverse effective mass K = J * M^-1 * JT (the first '*' is a dot product and the second '*' is a matrix times vector multiplication -&gt; the result is a scalar)<br>K1 = cross( u2, w1 ) * [ ( invI1 + invI2 ) * cross( u2, w1 ) ] <br>K2 = cross( v2, w1 ) * [ ( invI1 + invI2 ) * cross( v2, w1 ) ] <br><br>// 5. Solve (use 2. to compute J*v and choose beta between 0.1 - 0.2)<br>DeltaLambda1 = -( J1 * v + beta * C1 / dt ) / K1 <br>DeltaLambda2 = -( J2 * v + beta * C2 / dt ) / K2<br><br><br><br>Note that for solving this you handle each constraint separately. So for a hinge I would suggest solving C1 followed by C2 and finally solve a 3x3 point-to-point constraint. For learning purposes I recommend trying to derive this yourself and ask questions here. Take small steps and try not to combine too many steps into one!<br><br>Also note that there is a tiny gotcha with this formulation. The initial constraint is bi-stable. Note that C = a * b = 0 also holds true for C = -a * b = 0. When this happens the Jacobian flips and the error will be exaggerated. Usually this is a not problem but you see this happen sometimes in some AAA games when e.g. a knee of a ragdoll gets twisted and jitters. Once you are more familiar with the techniques you can look e.g. into quaternion constraints which solve this problem elegantly. Don't let us get ahead of things here. I just mentioned this so you can identify this error if it occurs in your simulation <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Good luck!<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14">Dirk Gregorius</a> — Wed Jan 02, 2013 7:01 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[c0der]]></name></author>
		<updated>2012-12-29T08:51:55+00:00</updated>

		<published>2012-12-29T08:51:55+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29555#p29555</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29555#p29555"/>
		<title type="html"><![CDATA[Re: Hinge constraint]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=29555#p29555"><![CDATA[
Talking to myself here again ...<br><br>I have managed to implement the hinge joint properly and test it with success. Also,  chain of 3 bodies connected with revolute joints works well.<br><br>I am now trying to test the following and am having erratic velocities:<br><br>Body1 is anchored to an immovable body3 using a revolute joint<br>Body1 is anchored to body2 using a hinge joint and both bodies have the same mass<br><br>If I initialise body1 with a velocity about the hinge axis, the simulation is stable, however if i initialise body1 with a velocity about the x axis, the simulation becomes unstable after 10 seconds, however the joint remains in tact.<br><br>The hinge axis initially is (1,0,0) and the restricted tangent axes are (1,0,0) and (0,1,0) and both bodies have an initial orientation aligned with these basis vectors<br><br>Has anyone had this problem and possibly identify the cause? The simulation seems stable when debugging for the hinge joint but the revolute joint is computing a large bias. Even disabling position correction eventually leads to an unstable simulation.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=9431">c0der</a> — Sat Dec 29, 2012 8:51 am</p><hr />
]]></content>
	</entry>
	</feed>
