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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2011-09-27T11:45:14+00:00</updated>

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

		<entry>
		<author><name><![CDATA[Dr.Shepherd]]></name></author>
		<updated>2011-09-27T11:45:14+00:00</updated>

		<published>2011-09-27T11:45:14+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25550#p25550</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25550#p25550"/>
		<title type="html"><![CDATA[Re: Set and cap dynamic body rotation]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25550#p25550"><![CDATA[
Yeah, the flickering is quite possible.<br><br>For example, you want your object to stop at 50, and in every tick callback, you check it, if it is over 50, then you set it back to 50. However, the actual case is always like: in the previous tick, it is 49.5, and in the next tick, it is 50.5. So it may shake in a small range.<br><br>One solution is to make your timestep smaller, it's kind of "silly".<br><br>Anyway, you solved it, that's great news!<br><br>Cheers.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=7605">Dr.Shepherd</a> — Tue Sep 27, 2011 11:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pivot]]></name></author>
		<updated>2011-09-27T11:17:54+00:00</updated>

		<published>2011-09-27T11:17:54+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25548#p25548</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25548#p25548"/>
		<title type="html"><![CDATA[Re: Set and cap dynamic body rotation]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25548#p25548"><![CDATA[
Yes, capping the rotation inside the tick call back was the first thing I tried. It work well for capping velocity but for some reason when I tried to cap rotation I ended up with my object flickering (rendering the cap rotation and some other rotation close by). I am not sure why this did not work.<br><br>One thing that somewhat work:  If you create a btGeneric6DofConstraint on your object and then set the upper and lower angle limit as you go with both the destination angle it will kind of work.  <br><br>For example:  in your simulation you want your object to rotate at an angle of value 1:  <br>Call this on your constrain:  constrain-&gt;setLimit(5, 1, 1);.  This will rotate the object around to an angle of value 1.  It work perfectly except for this:  It will rotate itself at some predefine speed.  Not sure what force rotate it and I am not sure how the angular velocity could be increase.<br><br>If there was a way to modify the speed at which the object rotate it would make it an easy and clean way for doing this.  Calling SetAngularVelocity will not work in this case because the constrain somehow take over.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=8772">pivot</a> — Tue Sep 27, 2011 11:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dr.Shepherd]]></name></author>
		<updated>2011-09-23T08:48:16+00:00</updated>

		<published>2011-09-23T08:48:16+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25486#p25486</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25486#p25486"/>
		<title type="html"><![CDATA[Re: Set and cap dynamic body rotation]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25486#p25486"><![CDATA[
Hey, today I just come across the simulation tick callback, I think it would be easier for you to check your rotation at each tick callback, if it is over the limit, then set it back.<br><br>The explanations in the tutorials:<br>Such callback is useful to notify other parts of your application about the simulation or to modify velocities of bodies, for example, if you are building a spaceship and you want each spaceship to have an individual speed cap. No matter how many substeps Bullet will do, your spaceship can have its speed limited at the end of every tick, which helps framerate independance<br><br>Check the link below<br><a href="http://bulletphysics.org/mediawiki-1.5.8/index.php/Simulation_Tick_Callbacks" class="postlink">http://bulletphysics.org/mediawiki-1.5. ... _Callbacks</a><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=7605">Dr.Shepherd</a> — Fri Sep 23, 2011 8:48 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pivot]]></name></author>
		<updated>2011-09-22T10:50:32+00:00</updated>

		<published>2011-09-22T10:50:32+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25478#p25478</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25478#p25478"/>
		<title type="html"><![CDATA[Re: Set and cap dynamic body rotation]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25478#p25478"><![CDATA[
Yes, that does not sound too hard.  I will take a look at those computation.<br><br>I will go ahead and implement the real input controller now.  Up to now I only had an input controller test case.  It is not enough anymore to test what I want to do.<br><br>I will reply here soon and tell how it goes.  Thanks for the help Dr.Shepherd.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=8772">pivot</a> — Thu Sep 22, 2011 10:50 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dr.Shepherd]]></name></author>
		<updated>2011-09-22T09:59:19+00:00</updated>

		<published>2011-09-22T09:59:19+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25477#p25477</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25477#p25477"/>
		<title type="html"><![CDATA[Re: Set and cap dynamic body rotation]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25477#p25477"><![CDATA[
You can compute the torque/time function given the rotation angle, it's not that difficult, more or less like a sin()/cos() function.<br><br>But if you can find a way to stop the bouncing back, that's great and straight. Tell me if it works out.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=7605">Dr.Shepherd</a> — Thu Sep 22, 2011 9:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pivot]]></name></author>
		<updated>2011-09-22T03:07:08+00:00</updated>

		<published>2011-09-22T03:07:08+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25475#p25475</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25475#p25475"/>
		<title type="html"><![CDATA[Re: Set and cap dynamic body rotation]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25475#p25475"><![CDATA[
Yes, I would like the box to stop at the exact rotation specified in code.  This specified rotation might change over time and when it does the box would need to rotate again up or down to the new destination rotation.  I am not 100% sure but it look like that I should be able to modify the constrain new desired angle limit on the fly.  If this is the case it should work fine for me (given that I find a solution for the box angular velocity bouncing back from the constraint angle limit).<br><br>For solving the bouncing issue you would suggest to compute how much torque or angular velocity I need to reach the exact desired angle?   I definitely felt my lack of physics knowledge once I opened the link you gave above <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">  I would probably need to read this link many times <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">  But above all I would wonder how to compute this value given that we have time steps that will likely be none consistent?  Would it not be impossible to reach the exact rotation?<br><br>I would have hope to fix the box angular velocity bouncing back from the constraint angle limit by somehow disabling the box force transfer or bouncing value <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=8772">pivot</a> — Thu Sep 22, 2011 3:07 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dr.Shepherd]]></name></author>
		<updated>2011-09-21T23:17:11+00:00</updated>

		<published>2011-09-21T23:17:11+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25472#p25472</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25472#p25472"/>
		<title type="html"><![CDATA[Re: Set and cap dynamic body rotation]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25472#p25472"><![CDATA[
So what you want is the box stops exactly at the rotation, right?<br><br>Since joint does some work here and it can be integrated with velocity and torque control, we may follow this path.<br><br>What I would further suggest, is to compute the torque as exactly as you need. It is more like a spring-mass system, the rotation speed will accelerate, reach the peak, then slow down, till 0 (Here it should arrive the limit rotation you want !), then if you want, it will accelerate in opposite direction, then .....<br><br><a href="http://en.wikipedia.org/wiki/Harmonic_oscillator" class="postlink">http://en.wikipedia.org/wiki/Harmonic_oscillator</a><br><br>In this way, neither the speed or the torque is constant, you should apply a simple function to accomplish that.<br><br>Hope it works!<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=7605">Dr.Shepherd</a> — Wed Sep 21, 2011 11:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pivot]]></name></author>
		<updated>2011-09-21T12:22:31+00:00</updated>

		<published>2011-09-21T12:22:31+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25470#p25470</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25470#p25470"/>
		<title type="html"><![CDATA[Re: Set and cap dynamic body rotation]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25470#p25470"><![CDATA[
I created a btGeneric6DofConstraint() constraint right in the middle of my object. This indeed cap the object rotation properly.  This solution seems much cleaner.  Thanks for the tips.<br><br>So now I have 1 new problem and 1 more thing to test <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>1 Problem:  The rotation is now cap but when I use applytorque() or setAngularVelocity() to rotate my object it will reach the limit and then bounce back.  Someone knows how to stop the bouncing?<br><br>1 more test to do:  I need to modify the rotation limit in real-time to match the user input.  Not sure if i can do this and if I can what will be the result when the current rotation is higher then a new lower limit...<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=8772">pivot</a> — Wed Sep 21, 2011 12:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pivot]]></name></author>
		<updated>2011-09-21T11:24:13+00:00</updated>

		<published>2011-09-21T11:24:13+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25469#p25469</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25469#p25469"/>
		<title type="html"><![CDATA[Re: Set and cap dynamic body rotation]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25469#p25469"><![CDATA[
I have the same problem with applytorque().  This also make the object rotate but it will not stop properly at a specific rotation without the code I implemented in myProcessCallback() for capping the rotation.  With applytorque() combined with the capping code in myProcessCallback() I am also getting some shaking at the capping rotation.<br><br>I will look at the joint.  That might work.  I am new to bullet so I am not exactly sure how to use this type of constraint.  The quick example I have seen on the forum was about two objects being attached to the joint.  In my case I only have one object, which rotate around his center of mass located in the center of the object.  Maybe I can add a joint in the middle of the object somehow?<br><br>Also, The rotation limit in my case will be changing potentially every frame because the rotation destination will be different based on user input.  Not sure if a constraint can have its limit modified in real time.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=8772">pivot</a> — Wed Sep 21, 2011 11:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dr.Shepherd]]></name></author>
		<updated>2011-09-20T19:05:40+00:00</updated>

		<published>2011-09-20T19:05:40+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25462#p25462</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25462#p25462"/>
		<title type="html"><![CDATA[Re: Set and cap dynamic body rotation]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25462#p25462"><![CDATA[
I am not sure about whether the torque would satisfy your need, but I think you can try that.<br><br>Another method, if it is possible in your case, is to set up a joint. for example a hinge joint. You can specify the limits of the joint, so it will stop exactly at the rotation angle as you like.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=7605">Dr.Shepherd</a> — Tue Sep 20, 2011 7:05 pm</p><hr />
]]></content>
	</entry>
	</feed>
