Re: [Algorithms] Low pass filter on quaternions
Brought to you by:
vexxed72
From: Gino v. d. B. <gin...@gm...> - 2010-03-29 08:41:44
|
Note that with any kind of filtering you will introduce some sluggishness since abrupt changes will be muffled. An intuitive way to get this done is through a dynamics simulation. Define inertia for the controlled object and control its orientation through a damped spring. Let Q0 be the current orientation of the object and Q1 the desired orientation (the orientation of the input device). First make sure that Q0 and Q1 are in the same hemisphere (of a 4D unit sphere). Thus if the 4-component dot product of Q0 and Q1 is negative simply set Q1 to -Q1. Next take the relative rotation, which is Qrel = Q0 Q1*, where Q1* is the conjugate of Q1. We will use log(Qrel) the log of Qrel for computing the torque. The log of a quaternion [xyz,w] is the 3-vector xyz * acos(w) / sqrt(1 - w * w) , (log([0, 0, 0: 1]) = (0, 0, 0)). Instead of the log you could also use the vector part (xyz) as a cheap and dirty log, since acos(w) / sqrt(1 - w * w) approaches 1 for w around 1. The torque can now be defined as log(Qrel) * Cspring, where Cspring is the spring constant. You will need to damp out oscillations, by multiplying the relative angular velocity (also a 3-vector) by a damping constant and subtracting it from the torque. If the input device does not provide an angular velocity, you can take a linear approximation of the angular velocity or simply assume a zero angular velocity. By setting the angular damping to 2 sqrt(inertia Cspring), you will get a critically damped spring (just enough damping to remove all oscillations). In an isolated setting you can use inertia = 1 (identity) and tweak the response of the spring damper by changing the spring constant (keeping the damping critical). Just a thought... Gino On 3/28/2010 5:32 PM, John McCutchan wrote: > Hi, > > Each quaternion represents the orientation of an input device. I want > to remove jitter that comes from holding it in a human hand. > > John > > On Sun, Mar 28, 2010 at 12:56 AM, Marc B. Reynolds > <mar...@or...> wrote: > >> Also, what do they represent? >> >> -----Original Message----- >> From: Robin Green [mailto:rob...@gm...] >> Sent: Sunday, March 28, 2010 8:36 AM >> To: Game Development Algorithms >> Subject: Re: [Algorithms] Low pass filter on quaternions >> >> >> Do you want to lowpass the signal, or do you want to fit a smooth >> curve to the samples? >> Are the samples regularly spaced? >> >> - Robin Green >> >> >> >> On Sat, Mar 27, 2010 at 7:14 PM, John McCutchan<jo...@jo...> >> wrote: >> >>> Hi, >>> >>> I have a sequence of quaternions and want to filter out any high >>> frequency changes. I'm wondering if anyone has a paper or some code >>> for performing a low pass filter on quaternions? >>> >>> Thanks, >>> -- >>> John McCutchan<jo...@jo...> >>> >>> >>> >> ---------------------------------------------------------------------------- >> -- >> >>> Download Intel® Parallel Studio Eval >>> Try the new software tools for yourself. Speed compiling, find bugs >>> proactively, and fine-tune applications for parallel performance. >>> See why Intel Parallel Studio got high marks during beta. >>> http://p.sf.net/sfu/intel-sw-dev >>> _______________________________________________ >>> GDAlgorithms-list mailing list >>> GDA...@li... >>> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >>> Archives: >>> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list >>> >>> >> ---------------------------------------------------------------------------- >> -- >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> GDAlgorithms-list mailing list >> GDA...@li... >> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >> Archives: >> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list >> >> >> >> >> ------------------------------------------------------------------------------ >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> GDAlgorithms-list mailing list >> GDA...@li... >> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >> Archives: >> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list >> >> > > > |