aboutsummaryrefslogtreecommitdiff
path: root/apps/systemlib/conversions.h
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2012-12-29 16:21:59 +0100
committerLorenz Meier <lm@inf.ethz.ch>2012-12-29 16:21:59 +0100
commit4976a3a47d9ed368734135df04ad67634c39c65d (patch)
treefbbc6b028ee1699a3938aaf859934ea415300996 /apps/systemlib/conversions.h
parent1fc0a6546e30cfc913de8c0c03cfc625fba5d2ae (diff)
downloadpx4-firmware-4976a3a47d9ed368734135df04ad67634c39c65d.tar.gz
px4-firmware-4976a3a47d9ed368734135df04ad67634c39c65d.tar.bz2
px4-firmware-4976a3a47d9ed368734135df04ad67634c39c65d.zip
Added accel magnitude check, added conversion functions for various standard cases
Diffstat (limited to 'apps/systemlib/conversions.h')
-rw-r--r--apps/systemlib/conversions.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/systemlib/conversions.h b/apps/systemlib/conversions.h
index dc383e770..3a24ca9b7 100644
--- a/apps/systemlib/conversions.h
+++ b/apps/systemlib/conversions.h
@@ -44,6 +44,8 @@
#include <float.h>
#include <stdint.h>
+#define CONSTANTS_ONE_G 9.80665f
+
__BEGIN_DECLS
/**
@@ -56,6 +58,26 @@ __BEGIN_DECLS
*/
__EXPORT int16_t int16_t_from_bytes(uint8_t bytes[]);
+/**
+ * Converts a 3 x 3 rotation matrix to an unit quaternion.
+ *
+ * All orientations are expressed in NED frame.
+ *
+ * @param R rotation matrix to convert
+ * @param Q quaternion to write back to
+ */
+__EXPORT void rot2quat(const float R[9], float Q[4]);
+
+/**
+ * Converts an unit quaternion to a 3 x 3 rotation matrix.
+ *
+ * All orientations are expressed in NED frame.
+ *
+ * @param Q quaternion to convert
+ * @param R rotation matrix to write back to
+ */
+__EXPORT void quat2rot(const float Q[4], float R[9]);
+
__END_DECLS
#endif /* CONVERSIONS_H_ */