Skip to content

Commit 6b10f92

Browse files
committed
general tidyup
1 parent 4ec69ab commit 6b10f92

File tree

7 files changed

+16
-13
lines changed

7 files changed

+16
-13
lines changed

demos/car_anim_rs.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
maxcurv = 1/5; % 5m turning circle
2626
rs = ReedsShepp(q0, qf, maxcurv, dl)
2727

28-
%% set up a vehicle model
28+
% set up a vehicle model
2929
[car.image,~,car.alpha] = imread('car2.png');
3030
car.rotation = 180;
3131
car.centre = [81,110];
3232
car.centre = [648; 173];
3333
car.length = 4.2;
3434

35-
%% now animate
35+
% now animate
3636
clf; plotvol([-4 8 -6 6])
3737

3838
a = gca;

demos/fdyn.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
% with zero applied joint torques
4141

4242
tic
43-
[t q qd] = p560.nofriction().fdyn(10, [], qz);
43+
[t,q,qd] = p560.nofriction().fdyn(10, [], qz);
4444
toc
4545

4646
% and the resulting motion can be plotted versus time

demos/particlefilt.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
V = diag([0.1, 1*pi/180].^2);
3434

3535
% then use this to create an instance of a Vehicle class
36-
veh = Vehicle(V);
36+
veh = Bicycle(V);
3737

3838
% and then add a "driver" to move it between random waypoints in a square
3939
% region with dimensions from -10 to +10
@@ -42,14 +42,14 @@
4242

4343
% Creating the map. The map covers a square region with dimensions from
4444
% -10 to +10 and contains 20 randomly placed landmarks
45-
map = Map(20, 10);
45+
map = LandmarkMap(20, 10);
4646

4747
% Creating the sensor. We firstly define the covariance of the sensor measurements
4848
% which report distance and bearing angle
4949
W = diag([0.1, 1*pi/180].^2);
5050

5151
% and then use this to create an instance of the Sensor class.
52-
sensor = RangeBearingSensor(veh, map, W, 'animate');
52+
sensor = RangeBearingSensor(veh, map, 'covar', W, 'animate');
5353
% Note that the sensor is mounted on the moving robot and observes the features
5454
% in the world so it is connected to the already created Vehicle and Map objects.
5555

@@ -80,7 +80,7 @@
8080
% hypotheses are very spread out, but soon start to cluster around the actual pose
8181
% of the robot. The pose is 3D (x,y, theta) so if you rotate the graph while the
8282
% simulation is running you can see the theta dimension as well.
83-
pf.run(200);
83+
pf.run(100);
8484
% all the results of the simulation are stored within the ParticleFilter object
8585

8686
% First let's plot the map

demos/pgslam.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
clf; pg.plot()
3232

3333
% we optimize the pose graph
34-
pg.optimize();
34+
pg2 = pg.optimize();
3535

3636
% and then plot the optimized graph in a new figure
3737
figure; pg2.plot

demos/reedsshepp.mlx

-474 Bytes
Binary file not shown.

demos/rtbdemo_gui.fig

4.19 KB
Binary file not shown.

demos/slam.m

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,34 +55,37 @@
5555

5656
% Create the filter. First we need to determine the initial covariance of the
5757
% vehicle, this is our uncertainty about its pose (x, y, theta)
58-
P0 = diag([0.005, 0.005, 0.001].^2);
58+
P0 = diag([0.005, 0.005, 0.001].^2)*1000;
59+
5960

6061
% Now we create an instance of the EKF filter class
6162
ekf = EKF(veh, V, P0, sensor, W, []);
6263
% and connect it to the vehicle and the sensor and give estimates of the vehicle
63-
% and sensor covariance (we never know this is practice).
64+
% and sensor covariance (we never know this in practice).
6465

6566
% Now we will run the filter for 1000 time steps. At each step the vehicle
6667
% moves, reports its odometry and the sensor measurements and the filter updates
6768
% its estimate of the vehicle's pose
68-
ekf.run(1000);
69+
ekf.run(500, 'plot');
6970
% all the results of the simulation are stored within the EKF object
7071

71-
% First let's plot the map
72-
clf; map.plot()
72+
%% First let's plot the map
73+
map.plot()
7374
% and then overlay the path actually taken by the vehicle
7475
veh.plot_xy('b');
7576
% and then overlay the path estimated by the filter
7677
ekf.plot_xy('r');
7778
% which we see are pretty close
7879

7980
% Now let's plot the error in estimating the pose
81+
figure
8082
ekf.plot_error()
8183
% and this is overlaid with the estimated covariance of the error.
8284

8385
% Remember that the SLAM filter has not only estimated the robot's pose, it has
8486
% simultaneously estimated the positions of the landmarks as well. How well did it
8587
% do at that task? We will show the landmarks in the map again
88+
figure
8689
map.plot();
8790
% and this time overlay the estimated landmark (with a +) and the 95% confidence
8891
% bounds as green ellipses

0 commit comments

Comments
 (0)