top of page

# OndaWire Round Table - Ask your questions

PublicÂ·15 members

# Kalman Filter For Beginners With MATLAB 66

d = distance(kalmanFilter,zmatrix) computes a distance between the location of a detected object and the predicted location by the Kalman filter object. This distance computation takes into account the covariance of the predicted state and the process noise. The distance function can only be called after the predict function.

## Kalman Filter For Beginners With MATLAB 66

The Kalman filter object is designed for tracking. You can use it to predict a physical object's future location, to reduce noise in the detected location, or to help associate multiple physical objects with their corresponding tracks. A Kalman filter object can be configured for each physical object for multiple object tracking. To use the Kalman filter, the object must be moving at constant velocity or constant acceleration.

To make configuring a Kalman filter easier, you can use the configureKalmanFilter object to configure a Kalman filter. It sets up the filter for tracking a physical object in a Cartesian coordinate system, moving with constant velocity or constant acceleration. The statistics are the same along all dimensions. If you need to configure a Kalman filter with different assumptions, do not use the function, use this object directly.

kalmanFilter = vision.KalmanFilter(StateTransitionModel,MeasurementModel,ControlModel,Name,Value) configures the Kalman filter object properties, specified as one or more Name,Value pair arguments. Unspecified properties have default values.

When the tracked object is detected, use the predict and correct functions with the Kalman filter object and the detection measurement. Call the functions in the following order:[...] = predict(kalmanFilter);[...] = correct(kalmanFilter,measurement);

When the tracked object is not detected, call the predict function, but not the correct function. When the tracked object is missing or occluded, no measurement is available. Set the functions up with the following logic:[...] = predict(kalmanFilter);If measurement exists[...] = correct(kalmanFilter,measurement);end

Abstract:The battery State of Charge (SoC) estimation is one of the basic and significant functions for Battery Management System (BMS) in Electric Vehicles (EVs). The SoC is the key to interoperability of various modules and cannot be measured directly. An improved Extended Kalman Filter (iEKF) algorithm based on a composite battery model is proposed in this paper. The approach of the iEKF combines the open-circuit voltage (OCV) method, coulomb counting (Ah) method and EKF algorithm. The mathematical model of the iEKF is built and four groups of experiments are conducted based on LiFePO4 battery for offline parameter identification of the model. The iEKF is verified by real battery data. The simulation results with the proposed iEKF algorithm under both static and dynamic operation conditions show a considerable accuracy of SoC estimation.Keywords: composite battery model; state of charge; improved extended Kalman filter; state of charge estimation

Angus P. Andrews, PhD, is an MIT graduate with a PhD in mathematics from UCLA. His career in aerospace technology development spans more than 50 years, starting with navigation analysis for the Apollo moon missions, and including a dozen years in the analysis, design, development, and testing of inertial navigation systems. His discoveries included the orbital navigation method called unknown landmark tracking, alternative solutions for square root filters, and a model for bearing torques of electrostatic gyroscopes. Since retiring as a senior scientist from the Rockwell Science Center in 2000, he has continued consulting and instructing in sensor error modeling and analysis, and publishing articles and books on these subjects.

Human lower-limb kinematic measurements are critical for many applications including gait analysis, enhancing athletic performance, reducing or monitoring injury risk, augmenting warfighter performance, and monitoring elderly fall risk, among others. We present a new method to estimate lower-limb kinematics using an error-state Kalman filter that utilizes an array of body-worn inertial measurement units (IMUs) and four kinematic constraints. We evaluate the method on a simplified 3-body model of the lower limbs (pelvis and two legs) during walking using data from simulation and experiment. Evaluation on this 3-body model permits direct evaluation of the ErKF method without several confounding error sources from human subjects (e.g., soft tissue artefacts and determination of anatomical frames). RMS differences for the three estimated hip joint angles all remain below 0.2 degrees compared to simulation and 1.4 degrees compared to experimental optical motion capture (MOCAP). RMS differences for stride length and step width remain within 1% and 4%, respectively compared to simulation and 7% and 5%, respectively compared to experiment (MOCAP). The results are particularly important because they foretell future success in advancing this approach to more complex models for human movement. In particular, our future work aims to extend this approach to a 7-body model of the human lower limbs composed of the pelvis, thighs, shanks, and feet.

Several methods exist for estimating the kinematics of the human lower limbs using a 7-body representations of the human lower limbs constituting the feet, shanks, thighs and hip. Ahmadi et al. [22] utilize a ZUPT method to estimate ankle position trajectories and combine those with individual segment orientation estimates to yield estimated lower-limb kinematics for straight walking on level ground and stairs. Optimization ensures the joint angles conform to assumed ranges of motion. Results are validated via comparison with MOCAP measurements for short trials (six passes through a MOCAP volume) that may not fully expose the accumulation of (long-term) drift error. The results demonstrate strong correlations (R >0.94) for joint angles, but only those restricted to the sagittal plane. Teufl et al. [23] employ an iterated extended Kalman filter to estimate lower-limb kinematics and with root-mean-square (RMS) joint angle differences (all three axes) below 6 degrees relative to MOCAP measures. Additionally, their method estimates RMS stride length and step width differences of 0.04 and 0.03 meters, respectively, compared to MOCAP [24]. However, their algorithm assumes level-ground (to correct vertical drift and to identify zero-velocity update times), which renders it unsuitable for quantifying gait on general (unconstrained) terrain as often encountered outdoors. Collectively, the limitations of the studies reviewed above point to the need for a general algorithm that accurately estimates lower-limb kinematics over long trials (i.e., greater than five minutes) and without assumptions of terrain morphology.

Reference data set 2: ErKF method estimates for walker compared to MOCAP. Next, we evaluate the performance of the method on the walker during overground walking gait. A marker-based motion-capture (MOCAP) system (Vicon, 18 Vero V2.2 cameras) tracks positions of reflective markers on the model at 100 Hz. Seven reflective markers are attached to each segment (four to define the primary axes and three additional markers, see Fig 1B). Positional estimates of the markers are filtered with a 4th order low-pass Butterworth filter at 20 Hz. Additionally, the attached IMUs yield sampled acceleration and angular rate data at 512 Hz.

Fig 2 shows the differences in the three joint angles as functions of time for the right hip joint over this exemplary long (7 minute) trial (results similar for left hip). Importantly, the results reveal no observable drift in the joint angle differences with time (slopes of linear fits of the joint angle differences versus time remain below 0.1 deg/hr across all joint angles). By contrast, without any filter corrections, the differences can grow to up to 10 degrees due to drift over this same time interval.

Right hip joint angle differences versus time (A) with the ErKF corrections and (B) without any filtering corrections (raw integration). Hip angles are for flexion/extension (Flex./Ext.), internal/external rotation (Int./Ext.), and abduction/adduction (Ab./Ad.). Results reveal no observable drift error despite the long trial with ErKF method.

Next, we evaluate how the differences in estimated joint angles vary with time over the entire ten-minute trial. Fig 6 illustrates the right hip joint angle differences versus time for all straight walking strides (similar results for left hip). While very small biases between the two joint angle estimates exist, the results reveal no observable drift in the differences over the ten-minute trial (slopes of linear fits of the joint angle errors versus time remain below 1.8 deg/hr across all joint angles). By contrast, without any filter corrections, the differences can grow to up to 13 degrees due to drift over the 10-minute trial.

Right hip joint angle differences versus time for all straight walking strides (A) with the ErKF corrections and (B) without any filtering corrections (raw integration). Hip angles are for flexion/extension (Flex./Ext.), internal/external rotation (Int./Ext.), and abduction/adduction (Ab./Ad.). Results reveal no observable drift error despite the long trial with ErKF method.

This paper presents an IMU-based method that accurately estimates the kinematics of a simplified 3-body model of the human lower limbs for overground walking. The estimation method, developed using an error-state Kalman filter, fuses acceleration and angular rate data from three independent IMUs (one per rigid body) using four kinematic constraints. The kinematic constraints capture 1) foot zero-velocity updates, 2) gravitational tilt corrections, 3) joint center corrections and 4) joint axis corrections. The model is tested using two sets of comparison data, namely: 1) simulated IMU data from a simulated walker that yields ground truth results, and 2) experimental IMU data from a physical walker with associated MOCAP results.