转载请注明出处:http://blog.csdn.net/c602273091/article/details/52695612
ABSTRACT
Learn by doing !
To do it with EKF-SLAM, you can have better comprehensive understanding of SLAM.
PRINCIPLE
State update by control:(here the control is applied with noise)
Calculate Predict Covariance:
The Jacobian Gv and Gu are calculated by:
The sensor model is update by:
And the Jacobian for robot state is:
the Jacobian for land mark is:
For more details for EKF, search WiKi with EKF.
IMPLEMENTATION
% function my_efk_slam
function my_ekf_2d_slam
%% load data
format compact;
load('example_webmap'); % store in lm, wp
fig = figure;
plot(lm(1,:), lm(2,:), 'b*');
hold on;
axis equal;
plot(wp(1,:), wp(2,:), 'g', wp(1,:), wp(2,:), 'g.');
xlabel('meters'), ylabel('meters');
set(fig, 'name', 'My 2D EKF-SLAM');
%% load parameter
V = 3;% m/s
MAXG = 30*pi/180.0; % maximum steering angles
RATEG = 20*pi/180.0; % maximum rate of change steering angles
WHEELBASE = 4; % vihecle base
DT_CONTROLS = 0.025; % seconds between control signals
sigmaV = 0.3; % m/s
sigmaG = (3.0*pi/180); %radians
Q = [sigmaV^2 0; 0 sigmaG^2];
MAX_RANGE = 30.0; % meters.
DT_OBSERVE = 8*DT_CONTROLS; % time between observation
sigmaR = 0.1;
sigmaB = (1.0*pi/180);
R = [sigmaR^2 0; 0 sigmaB^2];
GATE_REJECT = 4.0; % maximum dis for creation of new feature.
GATE_AUGMENT = 25.0; % minimum dis for creation new feature.
AT_WAYPOINT = 1.0;
NUMBER_LOOPS = 2; % number of loops through the waypoint list.
SWITCH_CONTROL_NOISE= 1;