virtualboolinit(boolinitCommAPI=true);// parameter controls whether I2C/SPI interface is initialised (set to false if other devices are on the I2C/SPI bus and have already initialised the interface)
virtualbyteread_register(byteaddress);
virtualvoidwrite_register(byteaddress,bytevalue);
virtualvoidset_orientation(enumRotationrotation);// Rotation vector to transform sensor readings to the body frame.
virtualvoidset_field_of_view(constfloatfov){
field_of_view=fov;update_conversion_factors();
};// sets field of view of sensor
staticvoidread(uint32_t){
if(_sensor!=NULL)_sensor->update();
};// call to update all attached sensors
virtualboolupdate();// read latest values from sensor and fill in x,y and totals. returns true on success
virtualvoidupdate_position(floatroll,floatpitch,floatcos_yaw_x,floatsin_yaw_y,floataltitude);// updates internal lon and lat with estimation based on optical flow
staticAP_OpticalFlow*_sensor;// pointer to the last instantiated optical flow sensor. Will be turned into a table if we ever add support for more than one sensor
enumRotation_orientation;
floatconv_factor;// multiply this number by altitude and pixel change to get horizontal move (in same units as altitude)
floatradians_to_pixels;
float_last_roll,_last_pitch,_last_altitude;
virtualvoidapply_orientation_matrix();// rotate raw values to arrive at final x,y,dx and dy values