You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UKF Sensor Fusion with multiple update frequencies? OR How to not write zero to measurement_vector? Solved! You may want to extend your UKF documentation with this! #302
#get sensor 1F=compute_f(dt) # is this the state transition function?kf.predict()
kf.update(z1, R=R1, H=H1) # why u no pass F here as fx=???#get sensor 2F=compute_f(dt) # ok now you use the same function again to write the same variable (that you do not use)?kf.predict()
kf.update(z2, R=R2, H=H2) # ok, but what to return from H2?
For example: I have the following state transition function (not in matrix form for my sanity).
defstate_transition_function(state, dt):
# Unpack the state vector [px, py, pz, vx, vy, vz, ax, ay, az, θx, θy, θz].Tpx, py, pz, vx, vy, vz, ax, ay, az, thetax, thetay, thetaz=state# Predict the next state based on current state and time elapsednext_px=px+vx*dt+0.5*ax*dt**2next_py=py+vy*dt+0.5*ay*dt**2next_pz=pz+vz*dt+0.5*az*dt**2next_vx=vx+ax*dtnext_vy=vy+ay*dtnext_vz=vz+az*dtreturn [next_px, next_py, next_pz, next_vx, next_vy, next_vz, ax, ay, az, thetax, thetay, thetaz]
Is the H_imu ok this way so it only affects the wanted state variables? I'd do ukf.update([0,0,0,0,0,0,ax,ay,az,θx,θy,θz], hx=H_imu). Or do I have to use the approach mentioned in this issue, or is it possible by modifying your pseudo code? Please be specific in your answer, because I cannot fill in the blanks in my understanding of this highly mathematical topic.
defH_imu():
# Creating a 12x12 matrix filled with zerosH=np.zeros((12, 12))
# Filling 7,7 8,8 up to position 12,12 with ones >>> HERE H is only zeros from row 1 to 6. Is this bad?foriinrange(7, 13):
H[i-1, i-1] =1returnHdefH_gnss():
# Creating a 5x12 matrix filled with zerosH=np.zeros((5, 12))
# Filling 1,1 2,2 up to position 5,5 with onesforiinrange(1, 6):
H[i-1, i-1] =1returnH
changed the title [-]UKF Sensor Fusion with multiple update frequencies? OR How to not overwrite measurement_vector?[/-][+]UKF Sensor Fusion with multiple update frequencies? OR How to not write zero to measurement_vector?[/+]on Feb 2, 2024
I found a solution, maybe @rlabbe wants to extend his book by this? Annoying 👺, how long I had to work for this simple UKF with a well made python library, just because the documentation/book is missing this more realistic problem yet.
Note: Make sure to use SI-units everywhere! (especially for dt!!!)
Your book is nice, although the problems you solve there are very limited. One has to search across two chapters (8 & 10) and many examples to piece together how your stuff is supposed to work. If only in chapter 8 your "Sensor fusion: Different Data Rates" Example wasn't such a toy example (different sizes of measurements?) one would easier see how to use H to switch for sensors. Or you could even use one example like this to expand your UKF chapter 10?
Kind regards and I'm looking forward to your answer! 🐣
changed the title [-]UKF Sensor Fusion with multiple update frequencies? OR How to not write zero to measurement_vector?[/-][+]UKF Sensor Fusion with multiple update frequencies? OR How to not write zero to measurement_vector? Solved! You may want to extend your UKF documentation with this![/+]on Feb 3, 2024
I'm not a maths guy (more like Tim Taylor and everything is a nail X), so I have no clue if this helps... I'm also afraid of the Lie Groups stuff you need for quaternions to work with this (I'd use another C++ lib on GH that does this already, if I ever need this to work properly).
Now go play with Harzings PoP and try to sprinkle in the keywords asynchronous and multi-rate (multirate) on various integrated knowledge base apis.
EDIT: Most GNSS-IMU/INS-Fusion Papers just interpolate or drop measurements... maybe also look some of them up. It's always most interesting what ISN'T mentioned.
Is that actually working? Because I am trying to solve a similar problem with a UKF and I saw that S is set to dim_z x dim_z meaning it has a fixed size...
Until now I just put the measures that aren't used to 0 in Z and I kept Z = dim_z x 1... but I noticed now that I didn't adapt R according to the current measure. So for each update, Kalman gains for all states are computed but then ignored by the fact that the not used ones are multiplied by 0 in the multiplication K*y.
Activity
StohanzlMart commentedon Feb 1, 2024
I read various of your answers and have difficulties understanding them.
For example, could you go into a bit more detail what you mean with your pseudo code here?
I quote:
For example: I have the following state transition function (not in matrix form for my sanity).
Is the H_imu ok this way so it only affects the wanted state variables? I'd do
ukf.update([0,0,0,0,0,0,ax,ay,az,θx,θy,θz], hx=H_imu). Or do I have to use the approach mentioned in this issue, or is it possible by modifying your pseudo code? Please be specific in your answer, because I cannot fill in the blanks in my understanding of this highly mathematical topic.Thank you!
[-]UKF Sensor Fusion with multiple update frequencies? OR How to not overwrite measurement_vector?[/-][+]UKF Sensor Fusion with multiple update frequencies? OR How to not write zero to measurement_vector?[/+]StohanzlMart commentedon Feb 3, 2024
I found a solution, maybe @rlabbe wants to extend his book by this? Annoying 👺, how long I had to work for this simple UKF with a well made python library, just because the documentation/book is missing this more realistic problem yet.
Note: Make sure to use SI-units everywhere! (especially for dt!!!)
Your book is nice, although the problems you solve there are very limited. One has to search across two chapters (8 & 10) and many examples to piece together how your stuff is supposed to work. If only in chapter 8 your "Sensor fusion: Different Data Rates" Example wasn't such a toy example (different sizes of measurements?) one would easier see how to use H to switch for sensors. Or you could even use one example like this to expand your UKF chapter 10?
Kind regards and I'm looking forward to your answer! 🐣
[-]UKF Sensor Fusion with multiple update frequencies? OR How to not write zero to measurement_vector?[/-][+]UKF Sensor Fusion with multiple update frequencies? OR How to not write zero to measurement_vector? Solved! You may want to extend your UKF documentation with this![/+]StohanzlMart commentedon Feb 13, 2024
Are you open to a collab regarding that bonus documentation?
All the best, *eat the rest ;]
ariel-m-s commentedon Aug 30, 2024
Does anyone have literature references addressing this topic?
StohanzlMart commentedon Sep 1, 2024
I'd start with rlabbes book in jupyter notebooks (you can modify and play around).
The standard book is called "Probabilistic Robotics" imo.
ariel-m-s commentedon Sep 2, 2024
@StohanzlMart, I meant specifically on what you're discussing here 😅 (variable length measurements).
StohanzlMart commentedon Sep 2, 2024
A quick (Harzings) PoP query of "variable sample rate unscented kalman" on crossref revealed https://doi.org/10.1016/j.jprocont.2017.02.010
I'm not a maths guy (more like Tim Taylor and everything is a nail X), so I have no clue if this helps... I'm also afraid of the Lie Groups stuff you need for quaternions to work with this (I'd use another C++ lib on GH that does this already, if I ever need this to work properly).
A search of the same terms on scopus reveals https://doi.org/10.1016/j.automatica.2015.05.001.
Now go play with Harzings PoP and try to sprinkle in the keywords asynchronous and multi-rate (multirate) on various integrated knowledge base apis.
EDIT: Most GNSS-IMU/INS-Fusion Papers just interpolate or drop measurements... maybe also look some of them up. It's always most interesting what ISN'T mentioned.
julienissuts commentedon Apr 24, 2025
Is that actually working? Because I am trying to solve a similar problem with a UKF and I saw that S is set to
dim_z x dim_zmeaning it has a fixed size...Until now I just put the measures that aren't used to 0 in Z and I kept
Z = dim_z x 1... but I noticed now that I didn't adaptRaccording to the current measure. So for each update, Kalman gains for all states are computed but then ignored by the fact that the not used ones are multiplied by 0 in the multiplication K*y.But I think that affects my covariance matrix...