Im currently working with Kalman Filter for position and velocity, one of the important parameters that im using is the heading that the sensor fusion of the imu gives me, but i have seen that the GPS also provides me one heading called course over the ground, so i think that i will put the heading information as a state variable as well and compare both heading to produce a better estimate, but i want to know how the GPS calculate this information and have not found some valuable information, is this angle with reference to magnetic north? Can i compare these two headings? or they are distinct information. The figure below in orange is the course that i get with gps and in blue is the heading with sensor fusion that IMU provides me, i collected this data with a displacement around my building and recorded it into a sd card. With these data, it seems a good idea to fuse them to get a better estimate of the actual heading.
Now im working with a linear kalman filter,and keep north, east coordinate and north, east velocity. The IMU BNO085 makes the sensor fusion for me, with this i use the heading to get the north and east velocity, using the velocity that is coming from the GPS rmc sentence. And with the R-P-Y angles i rotate the acceleration from body frame to NED frame. With the Lat lon that is coming from the GPS i get the ned coordinates. Im using the equations below to use as the state transition matrix, where $N_k$ is the north coordinate, $E_k$ is the east coordinate, $Vn_k$ is the north velocity abd $Ve_k$ is the east velocity:
$N_k = N_{k-1} + Vn_k * dt +\frac{A_e * dt^2}{2} $
$Vn_k = Vn_{k-1} + A_n * dt $
$E_k = E_{k-1} + Ve_k * dt +\frac{A_e * dt^2}{2} $
$Ve_k = Ve_{k-1} + A_e * dt $
Since the velocity that is coming from the GPS isn't in north and east coordinate i use the heading to get this information as below:
$V_n = V_{GPS} * cos(heading) $
$V_e = V_{GPS} * sin(heading) $
This velocity goes to measurement vector and its used at update step of kalman filter together with GPS LAT-LON converted to ned coordinate.
I have GPS and IMU as the sensors, now im trying to increase the accuracy of the results, so im learning about unscented kalman filter and trying to increase the number of state variables. Any suggestions are welcome. Below is the last result i got walking with the device. In red are the gps data and in blue the filter data.