Index: trunk/BNC/src/bncantex.cpp
===================================================================
--- trunk/BNC/src/bncantex.cpp	(revision 11102)
+++ trunk/BNC/src/bncantex.cpp	(revision 11104)
@@ -786,5 +786,5 @@
                                  const ColumnVector& vSat, ColumnVector& dx,
                                  e_attMode mode, double externalYaw,
-                                 const QString& stateKey) {
+                                 const QString& stateKey, double* yawUsed) {
 
   // separate yaw model states per caller (stateKey), each called in time order
@@ -890,4 +890,23 @@
         sy /= sqrt(DotProduct(sy,sy));
         sx = crossproduct(sy, sz);
+      }
+
+      // yaw angle used: rotation of the body x-axis around sz relative to
+      // the velocity-referenced frame (convention of psiEff/externalYaw)
+      if (yawUsed) {
+        if (useVelocityFrame) {
+          *yawUsed = psiEff;
+        }
+        else if (vSat.size() == 3) {
+          ColumnVector Omega(3); Omega(1) = 0.0; Omega(2) = 0.0; Omega(3) = t_CST::omega;
+          ColumnVector vInert = vSat + crossproduct(Omega, xSat);
+          ColumnVector sy0 = crossproduct(sz, vInert);
+          sy0 /= sqrt(DotProduct(sy0,sy0));
+          ColumnVector sx0 = crossproduct(sy0, sz);
+          *yawUsed = atan2(DotProduct(crossproduct(sx0, sx), sz), DotProduct(sx0, sx));
+        }
+        else {
+          *yawUsed = 0.0;
+        }
       }
 
