AnsweredAssumed Answered

How to initialize and import/export data to/from the Kalman Filter (float16 issue)?

Question asked by TheWiper on Mar 7, 2012
Latest reply on Mar 19, 2012 by CraigG

Hi there,


I want to use the simple Kalman filter from Analog Devices' image tool box. The application is to track a moving part with constant speed. The Kalman model has a state vector dimension of 2 (location + speed) and the measurement is 1-dimensional (only location).


I went into the Kalman code and had a look at the Kalman example, too. It appears to me that this Kalman implementation uses some fixed point format X.Y where the shift of the decimal must be specified when applying the Kalman filter. It also uses some adi_Float16toMaxXY and adi_MatXYtoFloat16 conversions from utililies_ref.c. Looking at float16.h and utilities_ref.c I understood that I need to convert normal measurement input from (normal) float to float16 format and then convert this Float16-Matrix to a MatXY format for the Kalman Filter.


Same applies to initilisation of the matrices A, H, Q,... Now I found the following ackward thing. Trying to convert a number




from float to float16 failed. When using the test fits_to_fl16(1.973) it returned false (failed) and if I still used it it went into the DEBUG message "precision lost" (see float16.h code). So I started to try what numbers are accepted:


fits_to_fl16(1.97) -> false

fits_to_fl16(1.9) -> false

fits_to_fl16(2.0) -> true

fits_to_fl16(0.2) -> false


This looks to me pretty unusable and I found here in the forum:


Please note that the IEEE support for single precision floats has been significantly improved in VisualDSP++ 5.0 Update 9 and it might be that you could consider using standard float types instead. Also the reason that float16.h and _float16 aren't documented is that they are non-standard and not really intended for general use.


So either I use the float16 format wrongly or I should use a different approach to "import" my measurments into the Kalman Filter's update and to initialize the matrices.


I appreciate any help on this issue.