<?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/812" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2006-12-28T17:49:03+00:00</updated>

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

		<entry>
		<author><name><![CDATA[Erin Catto]]></name></author>
		<updated>2006-12-28T17:49:03+00:00</updated>

		<published>2006-12-28T17:49:03+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3031#p3031</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3031#p3031"/>
		<title type="html"><![CDATA[Creating Stiff Angular Springs]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3031#p3031"><![CDATA[
You shouldn't use slop for fixed angles. Slop is useful for inequality (unilateral) constraints. What you have is an equality (bilateral) constraint.<br><br>Let me explain how slop helps limits. Suppose you have an angular limit. The limit has three states: at_lower, neutral, at_upper. At the lower limit the impulse must be positive. In the neutral state, the impulse is zero, the constraint is off. At the upper limit the impulse must be negative.<br><br>Now assume the angle has hit the lower limit because some torque is rotating the body. There will be some overshoot passed the lower limit because of the discrete time step of the integrator. You will detect the overshoot and try to compensate by applying some position bias (or split impulse). You will also arrest any negative angular velocity. There are now two cases:<br><br>1. Your position correction does not overshoot the lower limit into the neutral region. The state remains at_lower. All is good.<br><br>2. Your position correction overshoots the lower limit into the neutral region. The state goes from at_lower to neutral. The next time step the torques in the system might drive the angle back passed the lower limit. We now have oscillations (this is often called a limit cycle).<br><br>Slop remedies case 2 by reducing the chance of overshoot from the lower limit into the neutral region. The position correction only tries to drive the angle up to lower_limit - slop.<br><br>An open question is whether the position correction should try to drive the angle down to lower_limit - slop when the angle is in the range [lower_limit-slop, lower_limit]. In my experiments with contact constraints, this did not help. Intuitively it seems wrong to have an inequality constraint "suck."<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=12">Erin Catto</a> — Thu Dec 28, 2006 5:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[crashlander]]></name></author>
		<updated>2006-12-28T16:08:25+00:00</updated>

		<published>2006-12-28T16:08:25+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3027#p3027</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3027#p3027"/>
		<title type="html"><![CDATA[Creating Stiff Angular Springs]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3027#p3027"><![CDATA[
Yes, "allowed penetration" is what I meant.  I can see using it with limits. I was just not sure it would be helpful for a constraint that is designed to simply keep two bodies at a fixed angle with no "play" in either direction.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=462">crashlander</a> — Thu Dec 28, 2006 4:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dirk Gregorius]]></name></author>
		<updated>2006-12-28T11:17:25+00:00</updated>

		<published>2006-12-28T11:17:25+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3026#p3026</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3026#p3026"/>
		<title type="html"><![CDATA[Creating Stiff Angular Springs]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3026#p3026"><![CDATA[
If you mean by slop some kind of allowed penetration it will also help with the coherence for limits. Basically this is the same concept like contacts. For limits you can also allow some violation of the position constraint...<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14">Dirk Gregorius</a> — Thu Dec 28, 2006 11:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raigan2]]></name></author>
		<updated>2006-12-28T01:58:00+00:00</updated>

		<published>2006-12-28T01:58:00+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3020#p3020</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3020#p3020"/>
		<title type="html"><![CDATA[Creating Stiff Angular Springs]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3020#p3020"><![CDATA[
I'm not -- but let me know if it helps at all. My impression was that the "slop" is left in collision so that the contacts are persistent for warm-starting.. is there any other benefit?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=748">raigan2</a> — Thu Dec 28, 2006 1:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[crashlander]]></name></author>
		<updated>2006-12-27T14:05:55+00:00</updated>

		<published>2006-12-27T14:05:55+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3014#p3014</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3014#p3014"/>
		<title type="html"><![CDATA[Creating Stiff Angular Springs]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3014#p3014"><![CDATA[
Interesting. I will try to implement an AnuglarJoint using this and compare them.<br><br>@raigan2. In you current implementation for the AngularJoint. Do you use any slop factor?  I don't, but was wondering if I should be...<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=462">crashlander</a> — Wed Dec 27, 2006 2:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dirk Gregorius]]></name></author>
		<updated>2006-12-27T09:59:15+00:00</updated>

		<published>2006-12-27T09:59:15+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3013#p3013</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3013#p3013"/>
		<title type="html"><![CDATA[Creating Stiff Angular Springs]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3013#p3013"><![CDATA[
You have to try it. Note that I edited my first post since there was a small typo in dC/dt. It should be quite stable and it saves you the computation of angle.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14">Dirk Gregorius</a> — Wed Dec 27, 2006 9:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raigan2]]></name></author>
		<updated>2006-12-27T02:56:04+00:00</updated>

		<published>2006-12-27T02:56:04+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3005#p3005</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3005#p3005"/>
		<title type="html"><![CDATA[Creating Stiff Angular Springs]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3005#p3005"><![CDATA[
I'm using the same approach as crashlander -- applying orientation-only impulses to drive the difference between relative orientation/angular velocity and target orientation/angular velocity to 0. <br><br>Your suggestion seems like it would be much simpler to extend to 3D, are there any other benefits (stability/etc)?<br><br><br>Another simple solution I haven't got around to trying is: if using a smaller step (and thus keeping the joint error low) really helps, one thing to try might be to take "sub-steps" -- I know someone who uses explicit euler and springs, but gets very rigid behaviour simply by integrating and applying spring forces at &gt;1000hz. Something similar was mentioned in "A Practical Dynamics System" from someone at ILM i think -- at each "frame" you run collision/logic once, but integrate+apply forces/impulses many times.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=748">raigan2</a> — Wed Dec 27, 2006 2:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dirk Gregorius]]></name></author>
		<updated>2006-12-27T09:57:15+00:00</updated>

		<published>2006-12-26T08:46:22+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3000#p3000</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3000#p3000"/>
		<title type="html"><![CDATA[Creating Stiff Angular Springs]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=3000#p3000"><![CDATA[
Hey Raigan,<br><br>how do you formulate your orientation constraint? Assume (in 2D) you have a vector to the pivot point r and two orthonormal vectors describing the constraint space. Let's call them u and v. These vectors are stored as usual w.r.t. to the first and second body. We call these vectors u1', v1' and u2', v2'.<br><br>At each frame you compute the framespace w.r.t to each body as usual:<br><br>u1 = R1 * u1'<br>v1 = R1 * v1'<br>u2 = R2 * u2'<br>v2 = R2 * v2'<br><br>If you now require the u1 and v2 or u2 and v1 to be orthorgonal you block the rotation. Basically you drive the rotation through the projection (dot product) of u onto v or vice versa. So you get:<br><br>C = u1 * v2<br>dC/dt = dot( cross( omega1, u1 ), v2 ) + dot( u1, cross( omega2, v2 ) )<br><br>Cheers,<br>-Dirk<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14">Dirk Gregorius</a> — Tue Dec 26, 2006 8:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raigan2]]></name></author>
		<updated>2006-12-26T03:53:22+00:00</updated>

		<published>2006-12-26T03:53:22+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=2999#p2999</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=2999#p2999"/>
		<title type="html"><![CDATA[Creating Stiff Angular Springs]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=2999#p2999"><![CDATA[
I've also been trying to get rigid orientation constraints working in a 2D sim (for use with physics-driven character animation).. not much luck though. <br><br>This is speculation, but part of the problem may be the way the position-level constraint is approximated/linearized: for larger errors this can result in several dozens of iterations before things converge. For limb-like joints there can be problems when the two "attachment vectors" (objspace r vectors that point from COM to joint position) are near parallel when the joint is violated: the correcting impulses tend to make the bodies' orientations oscillate back and forth as they're very slowly pulled together.<br><br>It's quite possible that my impulse-based attempts had errors in them though.<br><br>I've experimented with some ad-hoc "projection" methods which would attempt to satisfy the joint constraint perfectly in a single step; these are promising but still somewhat unstable (the solution was geometric, based on ideas similar to section 3.5 of this paper: <a href="http://www.icg.seas.gwu.edu/Publications/won_paper.pdf" class="postlink">http://www.icg.seas.gwu.edu/Publications/won_paper.pdf</a> , and doesn't conserve momentum without extra correction/projection steps). It _was_ really nice though to see things snapping together exactly after a single iteration.<br><br><br>One thing I plan on trying after the holidays is to try different methods to solve for the position error/correction; using a more accurate approximation might really help, for instance using second-order/"hessian-based" Newton-Raphson (I _think_ this is what it's called -- online references seem to be ambiguous about whether Newton-Raphson is f(x)/f'(x) or f'(x)/f''(x)). <br><br>The main problem with this approach is that you need to properly derive a set of second-order partial derivatives, which is currently proving to be a bit more than I can handle!<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=748">raigan2</a> — Tue Dec 26, 2006 3:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Erin Catto]]></name></author>
		<updated>2006-12-19T18:21:32+00:00</updated>

		<published>2006-12-19T18:21:32+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=2933#p2933</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=2933#p2933"/>
		<title type="html"><![CDATA[Creating Stiff Angular Springs]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=2933#p2933"><![CDATA[
You can try to use a bias factor of 0.2 to 0.4. That will make it stiffer. Also, you should verify your velocity constraint by setting the bias factor to zero. The relative angle should be locked, but you will get numerical drift.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=12">Erin Catto</a> — Tue Dec 19, 2006 6:21 pm</p><hr />
]]></content>
	</entry>
	</feed>
