From 33aa6fe13b0ed765521bf2c974adc0c287f7b398 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Sat, 18 Feb 2012 18:09:40 +0900 Subject: [PATCH] Optflow - added reference to FastSerial to resolve compile error on Arduino 1.0. also removed reference to DCM (no longer required) and removed some old code. --- libraries/AP_OpticalFlow/AP_OpticalFlow.cpp | 29 +-------------------- libraries/AP_OpticalFlow/AP_OpticalFlow.h | 2 +- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/libraries/AP_OpticalFlow/AP_OpticalFlow.cpp b/libraries/AP_OpticalFlow/AP_OpticalFlow.cpp index d2f6daa468..00fb2eca2c 100644 --- a/libraries/AP_OpticalFlow/AP_OpticalFlow.cpp +++ b/libraries/AP_OpticalFlow/AP_OpticalFlow.cpp @@ -108,31 +108,4 @@ AP_OpticalFlow::update_position(float roll, float pitch, float cos_yaw_x, float _last_altitude = altitude; _last_roll = roll; _last_pitch = pitch; -} - - -/* -{ - // only update position if surface quality is good and angle is not over 45 degrees - if( surface_quality >= 10 && fabs(_dcm->roll) <= FORTYFIVE_DEGREES && fabs(_dcm->pitch) <= FORTYFIVE_DEGREES ) { - altitude = max(altitude, 0); - Vector3f omega = _dcm->get_gyro(); - - // calculate expected x,y diff due to roll and pitch change - float exp_change_x = omega.x * radians_to_pixels; - float exp_change_y = -omega.y * radians_to_pixels; - - // real estimated raw change from mouse - float change_x = dx - exp_change_x; - float change_y = dy - exp_change_y; - - // convert raw change to horizontal movement in cm - float x_cm = -change_x * altitude * conv_factor; // perhaps this altitude should actually be the distance to the ground? i.e. if we are very rolled over it should be longer? - float y_cm = -change_y * altitude * conv_factor; // for example if you are leaned over at 45 deg the ground will appear farther away and motion from opt flow sensor will be less - - vlon = (float)x_cm * sin_yaw_y - (float)y_cm * cos_yaw_x; - vlat = (float)y_cm * sin_yaw_y - (float)x_cm * cos_yaw_x; - } -} - -*/ +} \ No newline at end of file diff --git a/libraries/AP_OpticalFlow/AP_OpticalFlow.h b/libraries/AP_OpticalFlow/AP_OpticalFlow.h index 0e36a6c5b3..968de9cd49 100644 --- a/libraries/AP_OpticalFlow/AP_OpticalFlow.h +++ b/libraries/AP_OpticalFlow/AP_OpticalFlow.h @@ -17,8 +17,8 @@ write_register() : writes a value to one of the sensor's register (will be sensor specific) */ +#include #include -#include #include // standard rotation matrices