-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun_sait_map.sh
135 lines (114 loc) · 4.23 KB
/
run_sait_map.sh
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/sh
# --collision-radius: robot radius for collision checking
# -n N1 N2 N3: N1 maps N2 episodes N3 steps
# --lidar-noise: select number of random laser rays that are not detected correctly and have inf.
# --map-pixel: size of a pixel in the map (in meters)
# --sigma-xy: uncertainly of transition model. std-dev of gaussian blur. it really affects the convergence of belief.
# --prob-roll-out (-pro): probability of saving the data at each step. set to 1.0 if want to save likelihood, GTL, belief. If not, set to 0.0
# --RL-type: 0 for our original setup.
# --load-map: load a map (nupy matrix) if you have one ('randombox' to use random box map)
# --lidar-sigma: scale of gaussian noise to scan vector
# --flip-map: num of random pixels to flip in the map
# --distort-map: erode/dilate the map.
# -f: show figure
# --no-save: don't save logs and figures.
# if you don't want to schedule LM training gains remove the line with --schedule-pm ......
# -pbs: LM model batch size. collect loss for how many steps. RL model updates after each episode.
# --fov: it defines the heading range that is missing from lidar. set --fov 130 230 for turtlebot3 in montreal
# --process-error (-pe) [xy scale] [theta scale]: motion results in errors that accumulate during an episode. normal distribution. std deviations in meters and radians.
# --init-error( -ie): put robot off the center of the grid. uniform distribution.
# --block-penalty=0.1 : it gives penalty of 0.1 when tried to go fwd against an obstacle, based on scan image.
DIM=$1
DIRS=$2
MODE=$3
N_EPISODE=$4
SAVE_LOC=$5
UPDATE=''
## this loads random mazes:
#MAP="maze"
## this loads random box rooms:
# MAP="randombox"
## this loads the SAIT maps:
## the file was saved with np.save() with 0=open space, 1=occupied.
MAP=maps/mlab-02-map-224x224.npy
## to train from the scratch:
# RLMODEL=none
# PMMODEL=none
RLMODEL=RL/rl.model
if [ $DIM = '11' ]; then
PMMODEL=LM/SharonCarter-densenet121-11x11.mdl
PMNET='densenet121'
BEL_GRIDS=11
LM_GRIDS=11
GOAL='2 7'
fi
if [ $DIM = '33' ]; then
PMMODEL=LM/densenet201-SpiderMan.mdl
PMNET='densenet201'
BEL_GRIDS=33
LM_GRIDS=33
GOAL='6 21'
fi
HEADINGS=$DIRS
LP=1e-4
EPISODE_LENGTH=25
N_MAPS=1
if [ $MODE = train_lm ]; then
UPDATE=$UPDATE' --update-pm-by=GTL '
UPDATE=$UPDATE' --schedule-pm --pm-step-size=1000 --pm-decay=0.5 '
UPDATE=$UPDATE' -lp='$LP' -pbs=10 --temp=0.1 '
fi
if [ $MODE = train_rl ]; then
UPDATE=$UPDATE' --update-rl -lr=1e-4 --temp=0.1'
UPDATE=$UPDATE' --schedule-rl --rl-step-size=1000 --rl-decay=0.5 '
fi
if [ $MODE = train_both ]; then
UPDATE=$UPDATE' --update-pm-by=GTL '
UPDATE=$UPDATE' --schedule-pm --pm-step-size=1000 --pm-decay=0.5 '
UPDATE=$UPDATE' -lp='$LP' -pbs=10 --temp=0.1 '
UPDATE=$UPDATE' --update-rl -lr=1e-4 '
UPDATE=$UPDATE'--schedule-rl --rl-step-size=1000 --rl-decay=0.5 '
fi
if [ $MODE = train_both_dry ]; then
UPDATE=$UPDATE' --update-pm-by=GTL '
UPDATE=$UPDATE' --schedule-pm --pm-step-size=1000 --pm-decay=0.5 '
UPDATE=$UPDATE' -lp='$LP' -pbs=10 --temp=0.1 '
UPDATE=$UPDATE' --update-rl -lr=1e-4 '
UPDATE=$UPDATE' --schedule-rl --rl-step-size=1000 --rl-decay=0.5 '
UPDATE=$UPDATE' -f --no-save '
fi
if [ $MODE = test ]; then
UPDATE=' -f --no-save --temp=0.1 '
fi
if [ $MODE = aml ]; then
UPDATE=' --no-save --temp=0.1 --use-aml '
fi
if [ $MODE = test-navi ]; then
UPDATE=' -f --no-save --temp=0.1 --navigate-to '$GOAL' '
fi
if [ $MODE = test_with_gtl ]; then
UPDATE=' -f --no-save --temp=0.1 -ugl '
fi
# If you want to train without popping up the figure window but want to save the figures, uncomment:
# MPLBACKEND='AGG' \
python sim/dal.py \
-v 1 -ug -cr=0.20 --collision-from='scan' \
-n $N_MAPS $N_EPISODE $EPISODE_LENGTH \
--lidar-noise=20 \
--load-map=$MAP \
--map-pixel=0.040 \
--sigma-xy=.66 --trans-belief=stoch-shift \
--pm-scan-step=3 --gtl-src=hd-cos \
--n-lm-grids=$LM_GRIDS --n-state-grids=11 --n-state-dirs=4 \
-fs=1 -rs=1 \
-nh=$HEADINGS --n-local-grids=$BEL_GRIDS \
--prob-roll-out=0.00 \
--rew-bel-gt-nonlog \
--block-penalty=0.1 --process-error 0.0 0.01 \
--RL-type=0 \
--pm-model=$PMMODEL \
--rl-model=$RLMODEL \
--pm-net=$PMNET -ch3=ZERO --drop-rate=0.1 \
--save-loc=$SAVE_LOC \
--init-error=NONE \
$UPDATE \