<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    After a discussion the consensus was to imply that all components
    are responsible for normalising their quaternions before putting
    them on any output port. Therefore the isValid check will be
    extended by:<br>
    <br>
    fabs(ori.squaredNorm()-1.0) &lt; 1e-6;&nbsp;&nbsp;&nbsp;&nbsp; //assuming at least
    single precision <br>
    <br>
    Alex<br>
    <br>
    <br>
    On 07/02/2012 11:39 AM, Alexander Duda wrote:
    <blockquote cite="mid:4FF16C35.7010901@dfki.de" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      On 07/02/2012 09:08 AM, Felix Rehrmann wrote:
      <blockquote cite="mid:4FF148D7.4030901@dfki.de" type="cite">
        <meta content="text/html; charset=ISO-8859-1"
          http-equiv="Content-Type">
        <div class="moz-cite-prefix">Hi all,<br>
          <br>
          I would like to propose to have a seperate function like
          isUnitQuaternion or similiar.<br>
          <br>
          One says that the rotation is not set,often because only
          position data are transmitted.<br>
          The other one is to check only the quaternion, which can also
          be non-unit for numeric reasons.<br>
        </div>
      </blockquote>
      Do you have a real use case for non-unit quaternions? I would
      favour to use unit quaternions for all base types as convention to
      remove another source of errors. In that case I would add the
      check insight isValidValue<br>
      <br>
      Alex<br>
      <br>
      <blockquote cite="mid:4FF148D7.4030901@dfki.de" type="cite">
        <div class="moz-cite-prefix"> <br>
          The user then would have the possiblity to decide what he
          wants to know. Furthermore<br>
          this function could have the accuracy as argument: bool
          isUnitQuaternion (double accuracy = 1e-6).<br>
          I would guess it could be hard to find a fixed value here. I
          would consider some deviation from 1.0<br>
          fine for further computation (e.g. like 0.9999something ).<br>
          <br>
          So long!<br>
          &nbsp;&nbsp;&nbsp; Felix<br>
          <br>
          <br>
          Am 29.06.2012 18:43, schrieb Janosch Machowinski:<br>
        </div>
        <blockquote cite="mid:4FEDDB34.3010305@dfki.de" type="cite">
          <meta content="text/html; charset=ISO-8859-1"
            http-equiv="Content-Type">
          <div class="moz-cite-prefix">Uhm, <br>
            <br>
            fabs(ori.squaredNorm() -1) &lt; 1e-6<br>
            <br>
            Just as an idea ;-)<br>
            Greetings<br>
            &nbsp;&nbsp;&nbsp; Janosch<br>
            <br>
            On 29.06.2012 17:58, Javier Hidalgo Carri&oacute; wrote:<br>
          </div>
          <blockquote cite="mid:4FEDD0C3.60008@dfki.de" type="cite">
            <meta content="text/html; charset=ISO-8859-1"
              http-equiv="Content-Type">
            <div class="moz-cite-prefix">On 06/29/2012 05:20 PM,
              Alexander Duda wrote:<br>
            </div>
            <blockquote cite="mid:4FEDC7D6.6010602@dfki.de" type="cite">
              <meta content="text/html; charset=ISO-8859-1"
                http-equiv="Content-Type">
              On 06/29/2012 05:02 PM, Javier Hidalgo Carri&oacute; wrote:
              <blockquote cite="mid:4FEDC387.8010806@dfki.de"
                type="cite">
                <meta content="text/html; charset=ISO-8859-1"
                  http-equiv="Content-Type">
                <div class="moz-cite-prefix">+1<br>
                  Since Orientation is a Eigen::Quaternion we could even
                  use the norm() method.<br>
                  <br>
                  Javier.<br>
                  <br>
                  <table class="memname">
                    <tbody>
                      <tr>
                        <td class="memname"><a moz-do-not-send="true"
                            class="el"
href="http://eigen.tuxfamily.org/dox/classEigen_1_1QuaternionBase.html#a844358c46408e878e60c4026c52eb1e9">Scalar</a>
                          norm </td>
                        <td>(</td>
                        <td class="paramname"><br>
                        </td>
                        <td>)</td>
                        <td> const<code> [inline]</code></td>
                      </tr>
                    </tbody>
                  </table>
                  <div class="memdoc">
                    <dl class="return">
                      <dt><b>Returns:</b></dt>
                      <dd>the norm of the quaternion's coefficients </dd>
                    </dl>
                    <dl class="see">
                      <dt><b>See also:</b></dt>
                      <dd><a moz-do-not-send="true" class="el"
href="http://eigen.tuxfamily.org/dox/classEigen_1_1QuaternionBase.html#a8699d72c996ca6cb4673e810fe3a616c">QuaternionBase::squaredNorm()</a>,
                        <a moz-do-not-send="true" class="el"
href="http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html#a0be1b433c65ce9d92c81a4718daf54e5">MatrixBase::norm()</a>
                      </dd>
                    </dl>
                  </div>
                  <br>
                </div>
              </blockquote>
              I think you do not gain so much from this functions as you
              will get a scalar which you have to sum anyway. Do you
              know if there is a function which checks if the quaternion
              is valid?<br>
              <br>
            </blockquote>
            I don't know any valid method. Having no-normalized
            quaternion is sometimes common (e.g, passing a quaternion
            through a EKF) and normalization needs to be done.<br>
            <blockquote cite="mid:4FEDC7D6.6010602@dfki.de" type="cite">
              fabs(ori.w()*ori.w()+ori.x()*ori.x()+ori.y()*ori.y()+ori.z()*ori.z()-1.0)





              &lt; 1e-6<br>
              <br>
            </blockquote>
            What should be the error threshold to define if a quaternion
            is valid or not? Perhaps norm() does some round to 1.00...<br>
            <blockquote cite="mid:4FEDC7D6.6010602@dfki.de" type="cite">
              Alex<br>
              <blockquote cite="mid:4FEDC387.8010806@dfki.de"
                type="cite">
                <div class="moz-cite-prefix"> On 06/29/2012 04:53 PM,
                  Alexander Duda wrote:<br>
                </div>
                <blockquote cite="mid:4FEDC16F.7050503@dfki.de"
                  type="cite">
                  <pre wrap="">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&amp; ori)
         {
             return !base::isNaN(ori.w()) &amp;&amp;
                 !base::isNaN(ori.x()) &amp;&amp;
                 !base::isNaN(ori.y()) &amp;&amp;
                 !base::isNaN(ori.z()) &amp;&amp;
                 
ori.w()*ori.w()+ori.x()*ori.x()+ori.y()*ori.y()+ori.z()*ori.z()-1e6 &lt; 1;
         }

</pre>
                </blockquote>
                <br>
                <br>
              </blockquote>
            </blockquote>
            <br>
          </blockquote>
        </blockquote>
      </blockquote>
      <pre class="moz-signature" cols="72">-- 
Dipl.-Ing. Alexander Duda
Unterwasserrobotik

DFKI Bremen
Robotics Innovation Center
Robert-Hooke-Stra&szlig;e 5
28359 Bremen, Germany

Phone: +49 (0)421 178-456620
Fax:   +49 (0)421 178-454150
E-Mail: <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:alexander.duda@dfki.de">alexander.duda@dfki.de</a>

Weitere Informationen: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.dfki.de/robotik">http://www.dfki.de/robotik</a>
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Stra&szlig;e 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.:    DE 148646973
Steuernummer:  19/673/0060/3 </pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Rock-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Rock-dev@dfki.de">Rock-dev@dfki.de</a>
<a class="moz-txt-link-freetext" href="http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev">http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Dipl.-Ing. Alexander Duda
Unterwasserrobotik

DFKI Bremen
Robotics Innovation Center
Robert-Hooke-Stra&szlig;e 5
28359 Bremen, Germany

Phone: +49 (0)421 178-456620
Fax:   +49 (0)421 178-454150
E-Mail: <a class="moz-txt-link-abbreviated" href="mailto:alexander.duda@dfki.de">alexander.duda@dfki.de</a>

Weitere Informationen: <a class="moz-txt-link-freetext" href="http://www.dfki.de/robotik">http://www.dfki.de/robotik</a>
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Stra&szlig;e 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.:    DE 148646973
Steuernummer:  19/673/0060/3 </pre>
  </body>
</html>