Added temperature measurement, added led system command

This commit is contained in:
Lorenz Meier
2012-09-01 19:56:42 +02:00
parent 1cebdf6fb2
commit cf62c892f9
5 changed files with 262 additions and 7 deletions
+7 -4
View File
@@ -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 */
+5 -3
View File
@@ -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 */
+10
View File
@@ -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();