[Rock-dev] RigidBodyState detecting invalid orientations

Javier Hidalgo Carrió javier.hidalgo_carrio at dfki.de
Fri Jun 29 17:02:31 CEST 2012


+1
Since Orientation is a Eigen::Quaternion we could even use the norm() 
method.

Javier.

Scalar 
<http://eigen.tuxfamily.org/dox/classEigen_1_1QuaternionBase.html#a844358c46408e878e60c4026c52eb1e9> 
norm 	( 	
	) 	const|[inline]|

*Returns:*
    the norm of the quaternion's coefficients 

*See also:*
    QuaternionBase::squaredNorm()
    <http://eigen.tuxfamily.org/dox/classEigen_1_1QuaternionBase.html#a8699d72c996ca6cb4673e810fe3a616c>,
    MatrixBase::norm()
    <http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html#a0be1b433c65ce9d92c81a4718daf54e5>



On 06/29/2012 04:53 PM, Alexander Duda wrote:
> Hi,
>
> the base type samples::RigidBodyState has a function to check if the
> orientation is valid.
> At the moment it only checks if the values of the quaternion
> representing the orientation are different to NaN.
>
> I propose that we also add a check that the quaternion is an unit
> quaternion because otherwise wrongly initialised orientations might lead
> to strange transformation matrices and vanishing objects in OSG.
>
> Any opinions?
>
> Alex
>
>           static bool isValidValue(base::Orientation const& ori)
>           {
>               return !base::isNaN(ori.w()) &&
>                   !base::isNaN(ori.x()) &&
>                   !base::isNaN(ori.y()) &&
>                   !base::isNaN(ori.z()) &&
>                   
> ori.w()*ori.w()+ori.x()*ori.x()+ori.y()*ori.y()+ori.z()*ori.z()-1e6 < 1;
>           }
>


-- 
Javier Hidalgo Carrió
ESA - NPI Programme
Researcher

DFKI Bremen
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
http://robotik.dfki-bremen.de

Phone:+49(0)421 17845 6661
Fax: +49(0)421 17845 4150

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.dfki.de/pipermail/rock-dev/attachments/20120629/5a131b65/attachment.htm 


More information about the Rock-dev mailing list