tunernoise
Noise structure of fusion filter
Description
returns the measurement noise structure for the filter with name specified by the
noiseStruct
= tunernoise(filterName
)filterName
input.
returns the measurement noise structure for the filter object.noiseStruct
= tunernoise(filter
)
Examples
Obtain the measurement noise structure of the insfilterAsync
object.
noiseStruct = tunernoise('insfilterAsync')
noiseStruct = struct with fields:
AccelerometerNoise: 1
GyroscopeNoise: 1
MagnetometerNoise: 1
GPSPositionNoise: 1
GPSVelocityNoise: 1
Load the recorded sensor data and ground truth data.
load('insfilterAsyncTuneData.mat');
Create timetables for the sensor data and the truth data.
sensorData = timetable(Accelerometer, Gyroscope, ... Magnetometer, GPSPosition, GPSVelocity, 'SampleRate', 100); groundTruth = timetable(Orientation, Position, ... 'SampleRate', 100);
Create an insfilterAsync
filter object that has a few noise properties.
filter = insfilterAsync('State', initialState, ... 'StateCovariance', initialStateCovariance, ... 'AccelerometerBiasNoise', 1e-7, ... 'GyroscopeBiasNoise', 1e-7, ... 'MagnetometerBiasNoise', 1e-7, ... 'GeomagneticVectorNoise', 1e-7);
Create a tuner configuration object for the filter. Set the maximum iterations to two. Also, set the tunable parameters as the unspecified properties.
config = tunerconfig('insfilterAsync','MaxIterations',8); config.TunableParameters = setdiff(config.TunableParameters, ... {'GeomagneticVectorNoise', 'AccelerometerBiasNoise', ... 'GyroscopeBiasNoise', 'MagnetometerBiasNoise'}); config.TunableParameters
ans = 1×10 string
"AccelerationNoise" "AccelerometerNoise" "AngularVelocityNoise" "GPSPositionNoise" "GPSVelocityNoise" "GyroscopeNoise" "MagnetometerNoise" "PositionNoise" "QuaternionNoise" "VelocityNoise"
Use the tuner noise function to obtain a set of initial sensor noises used in the filter.
measNoise = tunernoise('insfilterAsync')
measNoise = struct with fields:
AccelerometerNoise: 1
GyroscopeNoise: 1
MagnetometerNoise: 1
GPSPositionNoise: 1
GPSVelocityNoise: 1
Tune the filter and obtain the tuned parameters.
tunedParams = tune(filter,measNoise,sensorData,groundTruth,config);
Iteration Parameter Metric _________ _________ ______ 1 AccelerationNoise 2.1345 1 AccelerometerNoise 2.1264 1 AngularVelocityNoise 1.9659 1 GPSPositionNoise 1.9341 1 GPSVelocityNoise 1.8420 1 GyroscopeNoise 1.7589 1 MagnetometerNoise 1.7362 1 PositionNoise 1.7362 1 QuaternionNoise 1.7218 1 VelocityNoise 1.7218 2 AccelerationNoise 1.7190 2 AccelerometerNoise 1.7170 2 AngularVelocityNoise 1.6045 2 GPSPositionNoise 1.5948 2 GPSVelocityNoise 1.5323 2 GyroscopeNoise 1.4803 2 MagnetometerNoise 1.4703 2 PositionNoise 1.4703 2 QuaternionNoise 1.4632 2 VelocityNoise 1.4632 3 AccelerationNoise 1.4596 3 AccelerometerNoise 1.4548 3 AngularVelocityNoise 1.3923 3 GPSPositionNoise 1.3810 3 GPSVelocityNoise 1.3322 3 GyroscopeNoise 1.2998 3 MagnetometerNoise 1.2976 3 PositionNoise 1.2976 3 QuaternionNoise 1.2943 3 VelocityNoise 1.2943 4 AccelerationNoise 1.2906 4 AccelerometerNoise 1.2836 4 AngularVelocityNoise 1.2491 4 GPSPositionNoise 1.2258 4 GPSVelocityNoise 1.1880 4 GyroscopeNoise 1.1701 4 MagnetometerNoise 1.1698 4 PositionNoise 1.1698 4 QuaternionNoise 1.1688 4 VelocityNoise 1.1688 5 AccelerationNoise 1.1650 5 AccelerometerNoise 1.1569 5 AngularVelocityNoise 1.1454 5 GPSPositionNoise 1.1100 5 GPSVelocityNoise 1.0778 5 GyroscopeNoise 1.0709 5 MagnetometerNoise 1.0675 5 PositionNoise 1.0675 5 QuaternionNoise 1.0669 5 VelocityNoise 1.0669 6 AccelerationNoise 1.0634 6 AccelerometerNoise 1.0549 6 AngularVelocityNoise 1.0549 6 GPSPositionNoise 1.0180 6 GPSVelocityNoise 0.9866 6 GyroscopeNoise 0.9810 6 MagnetometerNoise 0.9775 6 PositionNoise 0.9775 6 QuaternionNoise 0.9768 6 VelocityNoise 0.9768 7 AccelerationNoise 0.9735 7 AccelerometerNoise 0.9652 7 AngularVelocityNoise 0.9652 7 GPSPositionNoise 0.9283 7 GPSVelocityNoise 0.8997 7 GyroscopeNoise 0.8947 7 MagnetometerNoise 0.8920 7 PositionNoise 0.8920 7 QuaternionNoise 0.8912 7 VelocityNoise 0.8912 8 AccelerationNoise 0.8885 8 AccelerometerNoise 0.8811 8 AngularVelocityNoise 0.8807 8 GPSPositionNoise 0.8479 8 GPSVelocityNoise 0.8238 8 GyroscopeNoise 0.8165 8 MagnetometerNoise 0.8165 8 PositionNoise 0.8165 8 QuaternionNoise 0.8159 8 VelocityNoise 0.8159
Fuse the sensor data using the tuned filter.
dt = seconds(diff(groundTruth.Time)); N = size(sensorData,1); qEst = quaternion.zeros(N,1); posEst = zeros(N,3); % Iterate the filter for prediction and correction using sensor data. for ii=1:N if ii ~= 1 predict(filter, dt(ii-1)); end if all(~isnan(Accelerometer(ii,:))) fuseaccel(filter,Accelerometer(ii,:), ... tunedParams.AccelerometerNoise); end if all(~isnan(Gyroscope(ii,:))) fusegyro(filter, Gyroscope(ii,:), ... tunedParams.GyroscopeNoise); end if all(~isnan(Magnetometer(ii,1))) fusemag(filter, Magnetometer(ii,:), ... tunedParams.MagnetometerNoise); end if all(~isnan(GPSPosition(ii,1))) fusegps(filter, GPSPosition(ii,:), ... tunedParams.GPSPositionNoise, GPSVelocity(ii,:), ... tunedParams.GPSVelocityNoise); end [posEst(ii,:), qEst(ii,:)] = pose(filter); end
Compute the RMS errors.
orientationError = rad2deg(dist(qEst, Orientation)); rmsorientationError = sqrt(mean(orientationError.^2))
rmsorientationError = 2.7801
positionError = sqrt(sum((posEst - Position).^2, 2)); rmspositionError = sqrt(mean( positionError.^2))
rmspositionError = 0.5966
Visualize the results.
figure(); t = (0:N-1)./ groundTruth.Properties.SampleRate; subplot(2,1,1) plot(t, positionError, 'b'); title("Tuned insfilterAsync" + newline + "Euclidean Distance Position Error") xlabel('Time (s)'); ylabel('Position Error (meters)') subplot(2,1,2) plot(t, orientationError, 'b'); title("Orientation Error") xlabel('Time (s)'); ylabel('Orientation Error (degrees)');
Input Arguments
Name of fusion filter, specified as specified as one of these:
'ahrs10filter'
'insfilterAsync'
'insfilterMARG'
'insfitlerErrorState'
'insfilterNonholonomic'
Fusion filter, specified as one of these fusion filter objects:
.
Output Arguments
Structure of measurement noise, returned as a structure. The exact fields of structure depend on the filter object.
For example, the structure contains these fields for the insfilterAsync
object.
Field | Description | Default |
---|---|---|
AccelerometerNoise | Variance of accelerometer noise, specified as a scalar in (m/s2)2 | 1 |
GyroscopeNoise | Variance of gyroscope noise, specified as a scalar in (rad/s)2 | 1 |
MagnetometerNoise | Variance of magnetometer noise, specified as a scalar in (μT)2. | 1 |
GPSPositionNoise | Variance of GPS position noise, specified as a scalar in m2 | 1 |
GPSVelocityNoise | Standard deviation of GPS velocity noise, specified as a scalar in (m/s)2 | 1 |
To use this structure with a tune
function, change the values of
the noise to proper values as initial guesses for tuning the noise. When the function
tunes the measurement noise, it tunes all the elements in each field together. For
example, if the AccelerometerNoise
is specified as diag([1
0.1 1])
, then the tune function varies AccelerometerNoise
as the product of a scalar and the original diag([1 0.1 1])
.
Version History
Introduced in R2020b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)