mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-23 16:23:56 -04:00
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.
This commit is contained in:
parent
455f1a8093
commit
0b369cf78b
@ -109,30 +109,3 @@ AP_OpticalFlow::update_position(float roll, float pitch, float cos_yaw_x, float
|
|||||||
_last_roll = roll;
|
_last_roll = roll;
|
||||||
_last_pitch = pitch;
|
_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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
write_register() : writes a value to one of the sensor's register (will be sensor specific)
|
write_register() : writes a value to one of the sensor's register (will be sensor specific)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <FastSerial.h>
|
||||||
#include <AP_Math.h>
|
#include <AP_Math.h>
|
||||||
#include <AP_DCM.h>
|
|
||||||
#include <AP_Common.h>
|
#include <AP_Common.h>
|
||||||
|
|
||||||
// standard rotation matrices
|
// standard rotation matrices
|
||||||
|
Loading…
Reference in New Issue
Block a user