aboutsummaryrefslogtreecommitdiff
path: root/apps/commander/calibration_routines.h
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2012-10-21 15:36:29 +0200
committerLorenz Meier <lm@inf.ethz.ch>2012-10-21 15:36:29 +0200
commit096bf2dc93fe8360fa83bee409452f8db7bc3593 (patch)
treebf0bcdeddc29cd32b77343db35241f1c92b3d175 /apps/commander/calibration_routines.h
parent28171fb5965c439b20571648039106e8839be4d8 (diff)
downloadpx4-firmware-096bf2dc93fe8360fa83bee409452f8db7bc3593.tar.gz
px4-firmware-096bf2dc93fe8360fa83bee409452f8db7bc3593.tar.bz2
px4-firmware-096bf2dc93fe8360fa83bee409452f8db7bc3593.zip
Checkpoint: Working, but non-verified full mag calibration
Diffstat (limited to 'apps/commander/calibration_routines.h')
-rw-r--r--apps/commander/calibration_routines.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/commander/calibration_routines.h b/apps/commander/calibration_routines.h
new file mode 100644
index 000000000..c5a184341
--- /dev/null
+++ b/apps/commander/calibration_routines.h
@@ -0,0 +1,21 @@
+
+/**
+ * Least-squares fit of a sphere to a set of points.
+ *
+ * Fits a sphere to a set of points on the sphere surface.
+ *
+ * @param x point coordinates on the X axis
+ * @param y point coordinates on the Y axis
+ * @param z point coordinates on the Z axis
+ * @param size number of points
+ * @param max_iterations abort if maximum number of iterations have been reached. If unsure, set to 100.
+ * @param delta abort if error is below delta. If unsure, set to 0 to run max_iterations times.
+ * @param sphere_x coordinate of the sphere center on the X axis
+ * @param sphere_y coordinate of the sphere center on the Y axis
+ * @param sphere_z coordinate of the sphere center on the Z axis
+ * @param sphere_radius sphere radius
+ *
+ * @return 0 on success, 1 on failure
+ */
+int sphere_fit_least_squares(const float x[], const float y[], const float z[],
+ unsigned int size, unsigned int max_iterations, float delta, float *sphere_x, float *sphere_y, float *sphere_z, float *sphere_radius); \ No newline at end of file