aboutsummaryrefslogtreecommitdiff
path: root/apps/drivers
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2012-08-26 13:51:18 +0200
committerLorenz Meier <lm@inf.ethz.ch>2012-08-26 13:51:18 +0200
commit6026595d83b5ce5048ad77b7e0aa78ecd83e46af (patch)
tree8f1255d8d296fbef67ee993d914364b963f4ad73 /apps/drivers
parent60311a37786a8731b10dba4d4f5ab3a56108788d (diff)
downloadpx4-firmware-6026595d83b5ce5048ad77b7e0aa78ecd83e46af.tar.gz
px4-firmware-6026595d83b5ce5048ad77b7e0aa78ecd83e46af.tar.bz2
px4-firmware-6026595d83b5ce5048ad77b7e0aa78ecd83e46af.zip
Fixed axis assignment and raw value outputs. Scaling and offsets to be done
Diffstat (limited to 'apps/drivers')
-rw-r--r--apps/drivers/hmc5883/hmc5883.cpp13
-rw-r--r--apps/drivers/mpu6000/mpu6000.cpp23
2 files changed, 26 insertions, 10 deletions
diff --git a/apps/drivers/hmc5883/hmc5883.cpp b/apps/drivers/hmc5883/hmc5883.cpp
index d1025bcc6..cd198b6e6 100644
--- a/apps/drivers/hmc5883/hmc5883.cpp
+++ b/apps/drivers/hmc5883/hmc5883.cpp
@@ -658,9 +658,18 @@ HMC5883::collect()
(abs(report.z) > 2048))
goto out;
+ /* raw outputs */
+ /* to align the sensor axes with the board, x and y need to be flipped */
+ _reports[_next_report].x_raw = report.y;
+ _reports[_next_report].y_raw = report.x;
+ /* z remains z */
+ _reports[_next_report].z_raw = report.z;
+
/* scale values for output */
- _reports[_next_report].x = report.x * _scale.x_scale + _scale.x_offset;
- _reports[_next_report].y = report.y * _scale.y_scale + _scale.y_offset;
+ /* to align the sensor axes with the board, x and y need to be flipped */
+ _reports[_next_report].x = report.y * _scale.x_scale + _scale.x_offset;
+ _reports[_next_report].y = report.x * _scale.y_scale + _scale.y_offset;
+ /* z remains z */
_reports[_next_report].z = report.z * _scale.z_scale + _scale.z_offset;
/* publish it */
diff --git a/apps/drivers/mpu6000/mpu6000.cpp b/apps/drivers/mpu6000/mpu6000.cpp
index 3afb0ddda..77b5aaa98 100644
--- a/apps/drivers/mpu6000/mpu6000.cpp
+++ b/apps/drivers/mpu6000/mpu6000.cpp
@@ -790,22 +790,29 @@ MPU6000::measure()
*/
_gyro_report.timestamp = _accel_report.timestamp = hrt_absolute_time();
- _accel_report.x_raw = report.accel_x;
+ /* to align the sensor axes with the board, x and y need to be flipped */
+ _accel_report.x_raw = report.accel_y;
_accel_report.y_raw = report.accel_x;
- _accel_report.z_raw = report.accel_x;
+ /* z remains z and has the right sign */
+ _accel_report.z_raw = report.accel_z;
- _accel_report.x = report.accel_x * _accel_range_scale;
- _accel_report.y = report.accel_y * _accel_range_scale;
+ /* to align the sensor axes with the board, x and y need to be flipped */
+ _accel_report.x = report.accel_y * _accel_range_scale;
+ _accel_report.y = report.accel_x * _accel_range_scale;
+ /* z remains z and has the right sign */
_accel_report.z = report.accel_z * _accel_range_scale;
_accel_report.scaling = _accel_range_scale;
_accel_report.range_m_s2 = _accel_range_m_s2;
- _gyro_report.x_raw = report.gyro_x;
- _gyro_report.y_raw = report.gyro_y;
+ /* to align the sensor axes with the board, x and y need to be flipped */
+ _gyro_report.x_raw = report.gyro_y;
+ _gyro_report.y_raw = report.gyro_x;
+ /* z remains z and has the right sign */
_gyro_report.z_raw = report.gyro_z;
- _gyro_report.x = report.gyro_x * _gyro_range_scale;
- _gyro_report.y = report.gyro_y * _gyro_range_scale;
+ _gyro_report.x = report.gyro_y * _gyro_range_scale;
+ _gyro_report.y = report.gyro_x * _gyro_range_scale;
+ /* z remains z and has the right sign */
_gyro_report.z = report.gyro_z * _gyro_range_scale;
_gyro_report.scaling = _gyro_range_scale;
_gyro_report.range_rad_s = _gyro_range_rad_s;