Skip to content

Commit 0080ba7

Browse files
authored
Merge pull request #2 from kevin-robb/feat/rie-opt-project
Pose-graph SLAM using GTSAM
2 parents dcccbff + 4f0d995 commit 0080ba7

19 files changed

+1443
-340
lines changed

ekf_ws/src/base_pkg/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ add_message_files(
1515
Command.msg
1616
EKFState.msg
1717
UKFState.msg
18-
PFState.msg
18+
PoseGraphState.msg
19+
NaiveState.msg
1920
)
2021

2122
generate_messages(

ekf_ws/src/base_pkg/config/params.yaml

+39-27
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88

99
# ----- Filter -----
1010
# options: ekf_slam, ukf_loc, ukf_slam, pose_graph
11-
filter: "ekf_slam"
11+
filter: "pose_graph"
1212

13-
# ----- Iteration Period -----
14-
dt: 0.05
13+
# ----- Run duraction & characteristics -----
14+
dt: 0.05 # Period of timers in all nodes.
15+
num_iterations: 1000 # Number of iterations to run sim for when pre-generating a trajectory.
1516

1617
# ----- Initial Vehicle Pose -----
1718
# (will be overridden for some maps)
@@ -26,34 +27,43 @@ constraints:
2627
d_max: 0.1 # max forward motion in one timestep. min is 0.
2728
th_max: 0.0546 # max angular motion magnitude in one timestep. min is -th_max.
2829
vision:
29-
range_max: 4.0
30-
fov_min: -3.141592653589793
31-
fov_max: 3.141592653589793
30+
range_max: 3.0
31+
fov_min: -1.57 #-3.141592653589793
32+
fov_max: 1.57 #3.141592653589793
3233
measurements:
3334
# limitations on measurements:
34-
landmark_id_is_known: False # if true, filter will use the known landmark IDs.
35-
min_landmark_separation: 0.1 # landmarks detected closer together than this are assumed to be the same.
35+
landmark_id_is_known: true # if true, filter will use the known landmark IDs. if false, filter will perform data association.
36+
min_landmark_separation: 0.1 # in data association, landmarks detected closer together than this are assumed to be the same.
3637

3738
# ----- Noise Profiles -----
3839
process_noise:
3940
mean:
4041
v_d: 0.0
4142
v_th: 0.0
4243
cov:
43-
V_00: 0.0004
44-
V_11: 0.00007615435494667714
44+
V_00: 0.01 #0.0004 # covariance on forward commands.
45+
V_11: 0.001 # 0.00007615435494667714 # covariance on angular commands.
4546
sensing_noise:
4647
mean:
4748
w_r: 0.0
4849
w_b: 0.0
4950
cov:
50-
W_00: 0.01
51-
W_11: 0.00030461741978670857
51+
W_00: 0.01 #0.01 # covariance on range measurements.
52+
W_11: 0.01 #0.00030461741978670857 # covariance on bearing measurements.
5253

53-
# ----- UKF -----
54+
# ----- UKF-Specific Parameters -----
5455
ukf:
5556
W_0: 0.2 # weight on mean sigma pt.
5657

58+
# ----- Pose-Graph-SLAM-Specific Parameters -----
59+
pose_graph:
60+
filter_to_compare: "naive" # Other filter to run in tandem and use for initial pose-graph estimate. Options are ekf_slam, ukf_loc, ukf_slam, naive.
61+
implementation: "gtsam" # Specific PGS implementation to run. Options are gtsam, sesync, custom.
62+
verbose: false # if true, spam the console with a ton of logs.
63+
update_landmarks_after_adding: false # if true, allow landmark position estimates from the secondary filter to be used to update the landmark positions stored in the initial pose graph estimate.
64+
solve_graph_every_iteration: true # if false, only run optimization once, after the entire graph has been constructed.
65+
# TODO look into using iSAM, which is designed to work iteratively.
66+
5767
# ----- Map -----
5868
map:
5969
bound: 10.0 # display area is +-bound in both x/y.
@@ -71,30 +81,32 @@ path_planning:
7181
# pure pursuit params.
7282
lookahead_dist_init: 0.2 # meters
7383
lookahead_dist_max: 2 # meters
74-
astar_incl_diagonals: True # A* search diagonals or only orthogonally adjacent cells?
84+
astar_incl_diagonals: true # A* search diagonals or only orthogonally adjacent cells?
7585

7686
# ----- Precomputed Trajectory Generation -----
77-
# (used if precompute_trajectory option is True in roslaunch)
87+
# (used if precompute_trajectory option is true in roslaunch)
7888
trajectory_gen:
79-
num_timesteps: 2000
8089
landmark_noise: 0.2 # noise to use for generating map for TSP solution.
8190
visitation_threshold: 3.0 # how close the veh must get to a lm to mark it as visited in TSP soln.
8291

8392
# ----- Plotter -----
8493
plotter:
85-
save_final_map: False
94+
save_final_map: false # save map to file in base_pkg/plots upon node exit.
8695
# flags to display certain things
87-
show_occ_map: True
88-
show_entire_traj: False
89-
show_true_traj: True
90-
show_true_landmark_map: True
91-
show_landmark_ellipses: True
92-
show_veh_ellipse: True
96+
show_occ_map: true
97+
show_entire_traj: false
98+
show_true_traj: true
99+
show_true_landmark_map: true
100+
show_landmark_ellipses: true
101+
show_veh_ellipse: true
93102
# display params
94103
arrow_len: 0.1 # length of pose arrow.
95104
cov_std_dev: 1 # number of std dev to include in cov ellipses.
96-
plot_pf_arrows: False # show individual heading for all PF particles
97-
plot_ukf_arrows: True # show individual heading for all UKF sigma points
98-
show_landmark_sigma_pts: True # for UKF, show sigma points for landmarks as well as vehicle.
105+
plot_ukf_arrows: true # show individual heading for all UKF sigma points
106+
show_landmark_sigma_pts: true # for UKF, show sigma points for landmarks as well as vehicle.
99107
display_region_mult: 1.0 # amount to multiply map.bound by to get the display region.
100-
list_clicked_points: False # utility to display coords of all clicked points, for manually creating landmark maps.
108+
list_clicked_points: false # utility to display coords of all clicked points, for manually creating landmark maps.
109+
pose_graph:
110+
show_normal_viz_alongside: true # if true, normal sim viz is shown on one subplot, and the pose graph is shown on a second subplot. if false, only the pose graph's plot is shown.
111+
show_meas_connections: false # these are the slowest thing to plot.
112+
show_cmd_connections: false # these are fast to plot but aren't even visible so it's just a waste of runtime.

ekf_ws/src/base_pkg/launch/filter_demo.launch ekf_ws/src/base_pkg/launch/filter_demo_live.launch

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
<arg name="landmark_map" default="random"/> <!-- options: "random", "grid", ... -->
44
<arg name="precompute_trajectory" default="true"/>
55
<arg name="tight_control" default="false"/>
6+
<arg name="timer_period" default="default"/> <!-- By default, uses dt from params.yaml. -->
7+
<arg name="plot_result_only" default="false"/> <!-- Show a live visualization of filter progress. -->
68

79
<!-- Filter node, which will use filter specified in params.yaml -->
8-
<node pkg="localization_pkg" type="localization_node" name="localization_node" output="screen" />
10+
<node pkg="localization_pkg" type="localization_node" name="localization_node" args="$(arg timer_period)" output="screen" />
911

1012
<!-- Call main sim driver script. -->
1113
<include file="$(find base_pkg)/launch/sim_base.launch" >
1214
<arg name="occ_map_img" value="$(arg occ_map_img)"/>
1315
<arg name="landmark_map" value="$(arg landmark_map)"/>
1416
<arg name="precompute_trajectory" value="$(arg precompute_trajectory)"/>
1517
<arg name="tight_control" value="$(arg tight_control)"/>
18+
<arg name="timer_period" value="$(arg timer_period)"/>
19+
<arg name="plot_result_only" value="$(arg plot_result_only)"/>
1620
</include>
1721
</launch>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<launch>
2+
<arg name="occ_map_img" default="blank.jpg"/>
3+
<arg name="landmark_map" default="random"/> <!-- options: "random", "grid", ... -->
4+
<arg name="precompute_trajectory" default="true"/>
5+
<arg name="tight_control" default="false"/>
6+
<arg name="timer_period" default="0.005"/> <!-- Use a very small dt since we don't have to worry about plot update rates. -->
7+
<arg name="plot_result_only" default="true"/> <!-- Don't show a live viz at all, but rather just the final results. -->
8+
9+
<!-- Filter node, which will use filter specified in params.yaml -->
10+
<node pkg="localization_pkg" type="localization_node" name="localization_node" args="$(arg timer_period)" output="screen" />
11+
12+
<!-- Call main sim driver script. -->
13+
<include file="$(find base_pkg)/launch/sim_base.launch" >
14+
<arg name="occ_map_img" value="$(arg occ_map_img)"/>
15+
<arg name="landmark_map" value="$(arg landmark_map)"/>
16+
<arg name="precompute_trajectory" value="$(arg precompute_trajectory)"/>
17+
<arg name="tight_control" value="$(arg tight_control)"/>
18+
<arg name="timer_period" value="$(arg timer_period)"/>
19+
<arg name="plot_result_only" value="$(arg plot_result_only)"/>
20+
</include>
21+
</launch>
+6-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<launch>
22
<!-- Launch the basic necessities for all demos. -->
33
<arg name="occ_map_img" default="blank.jpg"/>
4-
<arg name="landmark_map" default="random"/>
4+
<arg name="landmark_map" default="random"/> <!-- options: "random", "grid", ... -->
55
<arg name="precompute_trajectory" default="false"/>
66
<arg name="use_local_planner" default="false"/>
77
<arg name="tight_control" default="false"/>
8+
<arg name="timer_period" default="default"/> <!-- By default, uses dt from params.yaml. -->
9+
<arg name="plot_result_only" default="false"/> <!-- if true, don't show a live viz at all, but rather just the final results. -->
810

911
<!-- main simulator -->
10-
<node pkg="base_pkg" type="sim_node.py" name="sim_node" args="$(arg occ_map_img) $(arg landmark_map) $(arg precompute_trajectory)" output="screen" />
12+
<node pkg="base_pkg" type="sim_node.py" name="sim_node" args="$(arg occ_map_img) $(arg landmark_map) $(arg precompute_trajectory) $(arg timer_period)" output="screen" />
1113
<!-- plotting node -->
12-
<node pkg="base_pkg" type="plotting_node.py" name="plotting_node" output="screen" />
14+
<node pkg="base_pkg" type="plotting_node.py" name="plotting_node" args="$(arg timer_period) $(arg plot_result_only)" output="screen" />
1315
<!-- path planning/nav -->
14-
<node pkg="planning_pkg" type="goal_pursuit_node.py" name="goal_pursuit_node" args="$(arg use_local_planner) $(arg precompute_trajectory) $(arg tight_control) $(arg occ_map_img)" output="screen" />
16+
<node pkg="planning_pkg" type="goal_pursuit_node.py" name="goal_pursuit_node" args="$(arg use_local_planner) $(arg precompute_trajectory) $(arg tight_control) $(arg occ_map_img) $(arg timer_period)" output="screen" />
1517
</launch>
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Header header
2+
# timestep.
3+
int32 timestep
4+
# vechicle pose.
5+
float32 x_v
6+
float32 y_v
7+
float32 yaw_v

ekf_ws/src/base_pkg/msg/PFState.msg

-8
This file was deleted.
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Header header
2+
# total number of iterations that have elapsed (i.e., number of vehicle poses in full history).
3+
int32 timestep
4+
# vechicle pose components for all iterations.
5+
float32[] x_v
6+
float32[] y_v
7+
float32[] yaw_v
8+
9+
# total number of detected landmarks.
10+
int32 M
11+
# landmark positions [x_1,y_1,...,x_M,y_M] (2M elements).
12+
float32[] landmarks
13+
14+
# we know there is a connection between every pose and the pose at the immediate previous/next iterations.
15+
# however, each vehicle pose may have any number of connections to landmarks (including none).
16+
# list of connections takes the form [i_1,j_1,...,i_k,j_k] where i_t is an iteration number representing a vehicle pose, and j_m is a particular landmark index.
17+
int32[] meas_connections
38.6 KB
Loading

0 commit comments

Comments
 (0)