This video demonstrates how to implement a Kalman filter for sensor fusion in C++ using the Eigen library, covering the complete workflow from setting up the state vector (position and velocity), defining process and measurement noise matrices, implementing prediction and update steps, to applying the filter for pedestrian tracking using laser and radar sensor data. The tutorial emphasizes translating Kalman filter mathematical formulas directly into code, creating a class-based architecture with MeasurementPackage, KalmanFilter, and Tracking classes, and shows how the filter converges toward accurate state estimates by fusing noisy sensor measurements.
Sensor Fusion Kalman Filter C++ Implementation with Eigen
Added:you're talking about the computer and we do is specify assemble its the autonomous bhai call tracking the pedestrian on the road how to do that last video I hope you understand how would he bribed the formula we asked the noise better we asked the contrarian process noise into the update coherent right in on video I mmm I already mind the last video I hope you remember understand when you read a new video and before we coding in a sailor blush we I hope you know how we live right I I will just recap quickly and what we do last video you know we stay we had to go to the face to step right here producing step 9 common feature step in producing step right now we asked we have the noise factor Rd the process noise and the motion noise right here so we are regardless value right we in this producing stay we already pry at this stage way from the motion like the linear motion model right and for the 40 stable to 2d position and to the velocity right and we ask motion going to the stable right and we'd apply the motion node right here right and we also deploy the Kovarian mattress right process covariant mattress right here and we add to this one into the common pewter to show the problem right and in testing the process in a pretty sense faith in the measurement of day we also know treating the first measurement vector Z we got from sensor right the second Matrix measure metric what a measurement metric in this K and what the covariant matrix form in this K Y will go back to the common future you look at why we need us in the computer we need all right we need H right to calculate right and we need a Z the measurement vector to calculate the update measurement it right so I go quickly this one I don't want to read too much right here and we had but what is easy is a measurement vector from sensor where we have h right here and see if we got from light a sense of lightness and so we give us the position PSP why and how to obtain attention I talked another video about the lighter Conklin topic ok and what the H right here that's right here you had to know we had a measurement magazine that the 2d right well stay vector right here 40 so what the measurement metric mapping between two vector so right here what a measurement matrix we can guess dusty this magic right because 2 to 2 times 4 right here you had the dimension of the Ashman 2 to 10 for time to for time one you mean a 2 to 1 right I think you understand that and what the are mattress right here for mattress created two dimension right and they had a same dimension of the Z later because they put you remember that the measurement we put into the symmetric and right here the uncertainty of the equipment we got from them from the manufacturer right is in the stain right okay we now we're tracking the pedestrian with a state vector for the dimension it means 2d position into the velocity right and okay that's required what we will crab work we learn last video okay okay we got the covariant new covered meshes right here for update a new cover on this little process metric right okay and one here is this date mattress right questions is a metric right here over here it doesn't have you to do the coke and okay go to the coke before we go to the code right here I help you I just want to remind you the debate is the easiest one for 1d first right for one day dimension first [Music] all right so right here we have the when the assembles really the easy assemble right here we how we know the priests in the Wendy dimension okay apply the camera future I hope you know how to include the Asian Allah again library in 2d and Visual Studio 2013 is really easy I attend telling dialogue to egon library and when you factor you'd allow it you asking to the project you do it right here will be setting or to here general you ask the mmm Egon library into looking not see that's the way you ask in your library in your library help you to calculate linear algebra multiply transpose inverse another and how is well okay I will show you really basis how the even library helpers if you don't know you can get the link I provide you with how you detail how to use even library for example after that we include the even better okay we declare the name right here with the Eagan column column and letter and mattress right here okay and how to get some relief motivated assemble - no it's the same way I say vector but to preserve my captor okay take permission right here you see you can say okay and you can see another mattress for now the mattress to say the mattress the damn right here you can create any name you want right you can sign a treaty metric okay it's time for four column for okay we just can't believe you won let's roll okay they will show you - really Winston is really example or some places about how they even have ours for example we call a Transpo okay nicely there a transpose okay that's wrong something really basic pain for you you can live alone go to detail multiply or divide something like let us into the leaner give you how to you the even victors we can library okay here's a result right and this is my vector they bring out the better mattress right here and I got the implementer east I got the Transpo mattress okay and right here I got the inverter masteries it cut out this chi-town okay so I hope you understand I give you a link the tissue you have the detail you the Eagle every so that's it so come back to the one-day dimension command people example and right here in a man that's all this one may declare the initial value okay in the this is a state variable 0 0 okay and the matches right here is covariant metric for initial mm so we had a covariant Newsday it's the register really based so we for the part time we don't know exactly okay with a Sunday 1000 and the motion no zero zero right here you see we do not ask the formula where the capital a time with let's say the value right here is the reserved for the Prosecco very well here and the motion already serum is have I hope unis I try to make from very places and to a van is I hope you really understand okay and right now we create a metric better right here single magic it mean single measurement so we call we asked one two three value right here into the measurement vector right here we don't know what the measurement from sensor we create that and we try to run the command filter right here and the common filter will be first the answer update and the measurement and prediction right when for the fatherly okay from a pewter standard computers or how they score in this sample really detail so you have to this work I okay it's easy right so right here we call remembered as I show you how to even library helpers you call the witty divide the SP or that's the variable okay and after that in the more important he how you write a common filter function in equivalent function you know we we had to learn even the gamer here and the state variable and the Kovarian it's been the best by reference right okay and we ensure here after measurement right here okay for example in the measurement vector right now we had three value one two three we re s way here but we're in all the last measurement and we run really come after the formula right here okay you see for the measurement up day and we've been Allegra's oh and the position with another partition right here we have is in symbol I think you easily understand the car marketer and anytime you read the bit application you when refreshable autonomous we have call you with the command Peter prompt you easily understand quickly how do people do that okay let's run the program they learn quite slowly okay this is resumed in this sample I want you understand how you how you write a common filter that's it and in that example we rise deeper in the apps I mean our our interruption programming is really complex so complex so I don't jump to the or interruption programming is quite of all the you know maybe your computer run faster than mine okay does resolve right here it's really lovely we have the update for each day okay from initial live we after first measurement we update a value right here okay one so we they will inherit that okay the first measurements were we have better value and we have additional value something in brackets or wrong Vincente so after the second measurement we obtain a measurement right here and we're addition the two point nine an eye and to the touch measurement we apply the value two upon I and the position three point nine and i right right here you can write you ask any the measurement you want we run those three values into the measurement dish so nothing okay we I hope you understand the basic right here and you can type in I will upload all the coloring to the link so you go to link I love it and party if okay ain't you the knowledge and I want to show you here's the same where we talked into the last video we turn to about the tracking the pedestrian before the automation to the position into the velocity here's a DAT file this device space show you the value we got from sensor right here does fusing sensors so we have to cut the values laser on areas lasers are our radar laser you had we position it as position y and x time we had to be the time rahiba for it for this between a two measurement for laser to calculate the delta T right and the writer later right here I tell you later what the valley right he means because the value is the polar so in the polar coordinate system well now they sent well we showed that so today with some focus on the laser data right here and and how we use us data into the computer I hope you understand is why it's really important and right here we have the used alien library - and right here we have to create a tree glass first time the measurement package class and a second the common filter class and the last one a tracking class tracking classes how about you knew the carbon clock to check this day of the pedestrian right the measurement pocket right here let's all you have you two got my ramen measurement from the TT file and we what the cut the data you need to use right here maybe you say I need the measurement from the laser and it's the measurement from radar way the measurement back is and also we got the tungsten you know in the test file to calculate the delta T between the two measurement or home so the important thing right in this code is I hope you try to understand how people write the common filter right here because they come and filter right here it how we you this one this metrics 44 dimension 4 by 4 right here those data stream matrix and the covariance matrix okay so so it's quite a bit complex in this assemble and and I hope you know about the object-oriented programming and you can understand easily it's now something if you're right now up to oranjee program is really easy to this thing ok that's the digital constructor and into the class and we the more important you really did understand depression efficient and after measurement function right here thus we declare a variable for computer and speak fq r h alright okay what the comment how we write a common filter function class you see that the heater file okay we re I shall attempt so into two city be faulty we have to write a function petition you should just copy the formula line put it on right that's right easily right and if in the update function obey the measurement should win so you the formula and just put everything into the formula write the formula okay this is quite familiar with you okay there's nothing your Hara here for you in this time so and after we already have the class common puter right now how we use this glut into for the track in the pedestrian we create a glut tracking right here attracting right here using we call the object the common filter right here and measurement part at least so right here the more important is the function right here the process measurement versus a measurement we in the process measurement because we use the common future and we knew the the value from measurement from the sensor to to create to get the answer right to get the results for the update and the physician stage and right here we have the noise right here acceleration now you remember in the formula we have the is in a while right and wait and we define the common filter caiera here see we use this class to help up to show the problem right here and what the tracking CBP file right apply so in a tracking CDP Lao you see we declare the initial value right we have the right here snow vector right here I want to stay attracting the pedestrian with a forester with a 44 dimension okay not too little for dimension right here is included a to the position and should be velocity right and coherent matrix you remember chromaticity by right now is a 4 bit for right and this initial value we assume the value right here but with the Kovarian right here's a little bit 1 passion right and after many the iteration you see this value will change smaller right okay and continue we go to the r matrix or matrix from the measurement coherently from the equipment right that's pretty the sense of errors ascending you can guess value some another example really assemble you can see this really different from the manufacturer right okay how about the measurement metric we can we talked in the first video about a measurement matrix okay how about the initial transition matrix we can do our last video right in the first video if you remember the balances and noise right here for us and why we some create a file and write in the we write the easily construct so right here in this measurement this function measure memory here okay it's really important for examine for measurement we got in initial location and and shallow velocity Elson we don't know velocity we says you're right and we got the first value in second value into sensor okay and this is stephanie we need to stand time stand to calculate a dirty right here that's the data t we calculate the delta T in the two measurement without this value from the t-84 right okay microsecond okay for the queue how we calculate how we got the magic our color metric queue right here your cat is it's really complex all right here we kept alive follow-up we debated t so we called it a teeny two three four right here and let's go back to look like you see that's the letter T right here equal identity and Sigma I asked my I Y into the queue so I mean data t to it mean do T power to recorded at era to the T and we creativity I think you easily understand when you hear from here to here right let's plug it into the formula nothing difficult right here delta T for women right here it mean they were T power for nothing different right here the tip of raw data for its help you simplify the formula into the code and we call the cab right here common filter pretty because a function measurement obey does it and preparing down liquor right in the tracking CBP we just called the class common future and we used the petition and update right why well that's it right look at the common tracking hit of are you see okay create the common future right here we use plus rehear right and into tracking we just say kept up with it care to update it does bring to resolve quickly and in a man see I just explain you what the value into dirty the test file right right here we're it about three value into the into the test file is Allah I can run up and let us read the three measurement I bring in the reserve just show you how it's lie you can play with it your computer yeah right you know you see if sensor we use the measurement back it by using if sense come is al-amin we either laser laser measurement right say we use the valley of the measurement right here right from laser we don't use a radar right now with us only for cousin later later week we got the radar later okay that's a reason the there's a fusion sensor so we can buy two data from two sensor boom okay I didn't cut the data from two sensors so we got the value as why we like the value from the five thing you know how to read the file artista file the value from tier two for the terms time uh-huh and we push back all this value into this factor measurement packet list with all these we're all here with this a better measure impeccably right and and we with the following here right I hope you understand that okay and we say image we called a class measurement package right so and we say the object mesh measurement package and we study measurement a sensor measurement package sensitized laser imagine back east across measurement right I go back to see how you measure market you look like they what they include imagine back at its time 10 raw measurement and center time right and let's use them ok with us very measurement packet to send at high or raw measurement and we got the value with it a value from the DAT file ok we push back all the measured back to far right here evaluate into the measurement pathway right and after that we call a tracking okay Chuck instant in a man and okay from that we call the tracking process measurement between that will be now for you all the reserve the update and measurement obey okay that's it that's all you need it's really easy we create a tree the common filter option and measurement project tracking and we go into the main pretty down that's it really easy if you don't understand it was dollar and wait again I hope you understand this form because in a nest nest video we come by laser and beta rather value okay that's Ronnie okay that's a resource because right here we do this is a lot of data right here we only make about three value one through three okay we pretty they print out for us the position right here okay after the first measurement okay which British in don't you see that read the one one one seven one one month two or nine right it's really cool all right and they've read the second measurement 1.61 look at it one point sick okay and continue their plea to the not only the position and saw the velocity for you to and continue the last one test value at 2.1 2.1 AAA it's really close right does you see how they releasing state variable petition right it's really good let try to write out by yourself and play with the co when you understand how to apply the common standard computer for the laser just a laser they gave you the coronary code petition could be the value in Cartesian coordinate system so use common filter right in that time we hear the radar right now where you read a value into the polar coordinate system polar coordinate system is right now we have to know there's no linear motion in order to the curve the circular motion so we have to you extend it common pewter to a pendulum motion right see you next video I forgot it somebody I really want to share with you the book this book really nice this book really I think this will really useful for people learn to computer vision mmm and about 1,000 page the computer vision and I think necessary for you to know about computer vision how to analyze the picture how to do to keep owner descriptor into community in the picture for the next video I will tell you how to the something about the camera computer vision how to build up the CAS system in collision avoidance system and how to calculate the time to collision for the CAS system I used lidar data and camera why we use all the code in to see blah blah the computer vision in a civil we analyze to be sure in a Super Plus so that's a reason I will share this book this book for argue to follow this the common future and support my channel ok ok you can see the return to the command below thank you
Up Next

Delta Robot Simulation: Kinematics, Dynamics & Control in MATLAB/Simulink
@tomasbocco4124
18.3K views•2021-03-07

MathWorks Virtual RoboSub Simulation Environment | Webinar 2026
@RoboNationInc
209 views•2026-03-10

How to Build a Self-Balancing Robot: Arduino Nano & MPU6050
@easytechzones
16.8K views•2022-03-09

Micromouse: The Fastest Maze-Solving Robots on Earth
@veritasium
23.5M views•2023-05-24
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Robotics



![[Sistemas Lineares] Posto e Nulidade](https://i.ytimg.com/vi/yWTAHeS3MoE/sddefault.jpg)



































