-
Notifications
You must be signed in to change notification settings - Fork 1
/
Observation.m
58 lines (43 loc) · 2.45 KB
/
Observation.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
classdef Observation < handle
% _ _ _ _ _ _
% / \ | |_| |_ _ __(_) |__ _ _| |_ ___ ___
% / _ \| __| __| '__| | '_ \| | | | __/ _ \/ __|
% / ___ \ |_| |_| | | | |_) | |_| | || __/\__ \
% /_/ \_\__|\__|_| |_|_.__/ \__,_|\__\___||___/
%
properties
z; % measurement
R; % covariance matrix of the measurement
end % properties
% ____ _ _ _ __ __ _
% | _ \ _ _| |__ | (_) ___ | \/ | ___ _ __ ___ | |__ ___ _ __ ___
% | |_) | | | | '_ \| | |/ __| | |\/| |/ _ \ '_ ` _ \| '_ \ / _ \ '__/ __|
% | __/| |_| | |_) | | | (__ | | | | __/ | | | | | |_) | __/ | \__ \
% |_| \__,_|_.__/|_|_|\___| |_| |_|\___|_| |_| |_|_.__/ \___|_| |___/
%
% Even if Matlab do not provide an "easy" way to discriminate public and private member functions,
% here we firstly define the functions that are intended to be called in the main program
methods
function obj = Observation(landmark) % constructor
obj.z = to_column_vector(landmark);
% Conversion to polar coordinates
r = norm(obj.z);
theta = atan2(obj.z(2), obj.z(1));
% Jacobian of the transformation
jac = [ cos(theta), -r*sin(theta); ...
sin(theta), r*cos(theta)];
% Uncertainties
Q = zeros(2, 2); % uncertainty in polar coordinates
Q(1,1) = 0.01;
Q(2,2) = 0.05 * pi / 180;
obj.R = jac * Q * jac'; % transformation to cartesian coordinates
end
% ____ _ _ __ __ _
% | _ \ _ __(_)_ ____ _| |_ ___ | \/ | ___ _ __ ___ | |__ ___ _ __ ___
% | |_) | '__| \ \ / / _` | __/ _ \ | |\/| |/ _ \ '_ ` _ \| '_ \ / _ \ '__/ __|
% | __/| | | |\ V / (_| | || __/ | | | | __/ | | | | | |_) | __/ | \__ \
% |_| |_| |_| \_/ \__,_|\__\___| |_| |_|\___|_| |_| |_|_.__/ \___|_| |___/
%
% Here are defined auxiliary functions used in the public members or for other simpler computations
end % methods
end % Laserscan class