aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-07-04 15:48:01 +0200
committerLorenz Meier <lm@inf.ethz.ch>2013-07-04 15:48:01 +0200
commitcefebb9699760b23b1298ee46a0d72ae22b6ecd8 (patch)
tree0e20569ba82c1af7f5c0687e2273547da6d859a0 /src/modules
parentd72e9929aa7f3066c3c8c6a09df7a9690b3cdbc5 (diff)
downloadpx4-firmware-cefebb9699760b23b1298ee46a0d72ae22b6ecd8.tar.gz
px4-firmware-cefebb9699760b23b1298ee46a0d72ae22b6ecd8.tar.bz2
px4-firmware-cefebb9699760b23b1298ee46a0d72ae22b6ecd8.zip
Small improvements in system lib
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/systemlib/conversions.h6
-rw-r--r--src/modules/systemlib/geo/geo.h16
-rw-r--r--src/modules/systemlib/pid/pid.h3
3 files changed, 20 insertions, 5 deletions
diff --git a/src/modules/systemlib/conversions.h b/src/modules/systemlib/conversions.h
index 5d485b01f..064426f21 100644
--- a/src/modules/systemlib/conversions.h
+++ b/src/modules/systemlib/conversions.h
@@ -43,11 +43,7 @@
#define CONVERSIONS_H_
#include <float.h>
#include <stdint.h>
-
-#define CONSTANTS_ONE_G 9.80665f // m/s^2
-#define CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C 1.225f // kg/m^3
-#define CONSTANTS_AIR_GAS_CONST 287.1f // J/(kg * K)
-#define CONSTANTS_ABSOLUTE_NULL_CELSIUS -273.15f // °C
+#include <systemlib/geo/geo.h>
__BEGIN_DECLS
diff --git a/src/modules/systemlib/geo/geo.h b/src/modules/systemlib/geo/geo.h
index 84097b49f..dadec51ec 100644
--- a/src/modules/systemlib/geo/geo.h
+++ b/src/modules/systemlib/geo/geo.h
@@ -45,9 +45,23 @@
* Additional functions - @author Doug Weibel <douglas.weibel@colorado.edu>
*/
+#pragma once
+
+__BEGIN_DECLS
#include <stdbool.h>
+#define CONSTANTS_ONE_G 9.80665f /* m/s^2 */
+#define CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C 1.225f /* kg/m^3 */
+#define CONSTANTS_AIR_GAS_CONST 287.1f /* J/(kg * K) */
+#define CONSTANTS_ABSOLUTE_NULL_CELSIUS -273.15f /* °C */
+#define CONSTANTS_RADIUS_OF_EARTH 6371000 /* meters (m) */
+
+/* compatibility aliases */
+#define RADIUS_OF_EARTH CONSTANTS_RADIUS_OF_EARTH
+#define GRAVITY_MSS CONSTANTS_ONE_G
+
+// XXX remove
struct crosstrack_error_s {
bool past_end; // Flag indicating we are past the end of the line/arc segment
float distance; // Distance in meters to closest point on line/arc
@@ -111,3 +125,5 @@ __EXPORT float _wrap_180(float bearing);
__EXPORT float _wrap_360(float bearing);
__EXPORT float _wrap_pi(float bearing);
__EXPORT float _wrap_2pi(float bearing);
+
+__END_DECLS
diff --git a/src/modules/systemlib/pid/pid.h b/src/modules/systemlib/pid/pid.h
index 714bf988f..eca228464 100644
--- a/src/modules/systemlib/pid/pid.h
+++ b/src/modules/systemlib/pid/pid.h
@@ -53,6 +53,8 @@
#include <stdint.h>
+__BEGIN_DECLS
+
/* PID_MODE_DERIVATIV_CALC calculates discrete derivative from previous error
* val_dot in pid_calculate() will be ignored */
#define PID_MODE_DERIVATIV_CALC 0
@@ -87,5 +89,6 @@ __EXPORT float pid_calculate(PID_t *pid, float sp, float val, float val_dot, flo
__EXPORT void pid_reset_integral(PID_t *pid);
+__END_DECLS
#endif /* PID_H_ */