diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-09-01 19:55:48 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-09-01 19:56:42 +0200 |
commit | cf62c892f9a8016ee238be269ee6c4b674928e7f (patch) | |
tree | 6b0f432930c168cd20d362dd5b2358c394ccd184 /apps/drivers | |
parent | 1cebdf6fb2724b94bce53f37a516dfc913fae994 (diff) | |
download | px4-firmware-cf62c892f9a8016ee238be269ee6c4b674928e7f.tar.gz px4-firmware-cf62c892f9a8016ee238be269ee6c4b674928e7f.tar.bz2 px4-firmware-cf62c892f9a8016ee238be269ee6c4b674928e7f.zip |
Added temperature measurement, added led system command
Diffstat (limited to 'apps/drivers')
-rw-r--r-- | apps/drivers/drv_accel.h | 11 | ||||
-rw-r--r-- | apps/drivers/drv_gyro.h | 8 | ||||
-rw-r--r-- | apps/drivers/mpu6000/mpu6000.cpp | 10 |
3 files changed, 22 insertions, 7 deletions
diff --git a/apps/drivers/drv_accel.h b/apps/drivers/drv_accel.h index 55b7a6b2b..6d0c8c545 100644 --- a/apps/drivers/drv_accel.h +++ b/apps/drivers/drv_accel.h @@ -52,14 +52,17 @@ */ struct accel_report { uint64_t timestamp; - float x; - float y; - float z; - float range_m_s2; + float x; /**< acceleration in the NED X board axis in m/s^2 */ + float y; /**< acceleration in the NED Y board axis in m/s^2 */ + float z; /**< acceleration in the NED Z board axis in m/s^2 */ + float temperature; /**< temperature in degrees celsius */ + float range_m_s2; /**< range in m/s^2 (+- this value) */ float scaling; + int16_t x_raw; int16_t y_raw; int16_t z_raw; + int16_t temperature_raw; }; /** accel scaling factors; Vout = (Vin * Vscale) + Voffset */ diff --git a/apps/drivers/drv_gyro.h b/apps/drivers/drv_gyro.h index 9c34ac314..5c646f243 100644 --- a/apps/drivers/drv_gyro.h +++ b/apps/drivers/drv_gyro.h @@ -52,15 +52,17 @@ */ struct gyro_report { uint64_t timestamp; - float x; - float y; - float z; + float x; /**< angular velocity in the NED X board axis in rad/s */ + float y; /**< angular velocity in the NED Y board axis in rad/s */ + float z; /**< angular velocity in the NED Z board axis in rad/s */ + float temperature; /**< temperature in degrees celcius */ float range_rad_s; float scaling; int16_t x_raw; int16_t y_raw; int16_t z_raw; + int16_t temperature_raw; }; /** gyro scaling factors; Vout = (Vin * Vscale) + Voffset */ diff --git a/apps/drivers/mpu6000/mpu6000.cpp b/apps/drivers/mpu6000/mpu6000.cpp index 83bd13860..04ba4cbbb 100644 --- a/apps/drivers/mpu6000/mpu6000.cpp +++ b/apps/drivers/mpu6000/mpu6000.cpp @@ -877,6 +877,9 @@ MPU6000::measure() _accel_report.scaling = _accel_range_scale; _accel_report.range_m_s2 = _accel_range_m_s2; + _accel_report.temperature_raw = report.temp; + _accel_report.temperature = (report.temp) / 361.0f + 35.0f; + _gyro_report.x_raw = report.gyro_x; _gyro_report.y_raw = report.gyro_y; _gyro_report.z_raw = report.gyro_z; @@ -887,6 +890,9 @@ MPU6000::measure() _gyro_report.scaling = _gyro_range_scale; _gyro_report.range_rad_s = _gyro_range_rad_s; + _gyro_report.temperature_raw = report.temp; + _gyro_report.temperature = (report.temp) / 361.0f + 35.0f; + /* notify anyone waiting for data */ poll_notify(POLLIN); _gyro->parent_poll_notify(); @@ -1041,6 +1047,10 @@ test() warnx("gyro range: %8.4f rad/s (%d deg/s)", (double)g_report.range_rad_s, (int)((g_report.range_rad_s / M_PI_F) * 180.0f+0.5f)); + warnx("temp: \t%8.4f\tdeg celsius", (double)a_report.temperature); + warnx("temp: \t%d\traw 0x%0x", (short)a_report.temperature_raw, (unsigned short)a_report.temperature_raw); + + /* XXX add poll-rate tests here too */ reset(); |