// calculate expected x,y diff due to roll and pitch change
exp_change_x=diff_roll*radians_to_pixels;
// real estimated raw change from mouse
exp_change_y=diff_pitch*radians_to_pixels;
change_x=dx-exp_change_x;
change_y=dy-exp_change_y;
// real estimated raw change from mouse
change_x=dx-exp_change_x;
change_y=dy-exp_change_y;
// convert raw change to horizontal movement in cm
// convert raw change to horizontal movement in cm
x_cm=-change_x*avg_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?
x_cm=-change_x*avg_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?
y_cm=-change_y*avg_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
y_cm=-change_y*avg_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