⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 montecarlo.pl

📁 SLAM Gridsim use with sparer sensor
💻 PL
字号:
#!/usr/bin/perl#$M = 10; # num monte carlo trials per datapoint$M = 2;# ["conf-prefix", "param-name", min, max, step size]@experiments = (# 		["test1", "rmax", 0.0, 15, 0.5, ""],# 		["test1", "rho", 1, 180, 4, ""],# 		["test1", "beamwidth", 0.0, 1.5708, 0.05236, ""], # 3 degree incs# 		["test1", "sigma-r", 0.0, 10, 0.2, ""], # up to rmax# 		["test1", "sigma-b", 0.0, 0.08727, 0.00218, ""],# 		["test1", "err-e", 0.0, 0.5, 0.02, ""],# 		["test1", "err-f", 0.0, 0.5, 0.02, ""],# 		["test1", "frequency", 0.5, 20, 0.5, ""],# 		["bearing-only", "rmax", 0.0, 15, 0.5, ""],# 		["bearing-only", "rho", 1, 180, 4, ""],# 		["bearing-only", "beamwidth", 0.0, 1.5708, 0.05236, ""], # 3 degree incs# 		["bearing-only", "sigma-r", 0.0, 10, 0.2, ""], # up to rmax# 		["bearing-only", "sigma-b", 0.0, 0.08727, 0.00218, ""],# 		["bearing-only", "err-e", 0.0, 0.5, 0.02, ""],# 		["bearing-only", "err-f", 0.0, 0.5, 0.02, ""],# 		["bearing-only", "frequency", 0.5, 20, 0.5, ""],# 		["range-only", "rmax", 0.0, 15, 0.5, ""],# 		["range-only", "rho", 1, 180, 4, ""],# 		["range-only", "beamwidth", 0.0, 1.5708, 0.05236, ""], # 3 degree incs# 		["range-only", "sigma-r", 0.0, 10, 0.2, ""], # up to rmax# 		["range-only", "sigma-b", 0.0, 0.08727, 0.00218, ""],# 		["range-only", "err-e", 0.0, 0.5, 0.02, ""],# 		["range-only", "err-f", 0.0, 0.5, 0.02, ""],# 		["range-only", "frequency", 0.5, 20, 0.5, ""],# 		["test1-mrf", "rmax", 0.0, 15, 0.5, "--mrf test.mrf"],# 		["test1-mrf", "rho", 1, 180, 4, "--mrf test.mrf"],# 		["test1-mrf", "beamwidth", 0.0, 1.5708, 0.05236, "--mrf test.mrf"], # 3 degree incs# 		["test1-mrf", "sigma-r", 0.0, 10, 0.2, "--mrf test.mrf"], # up to rmax# 		["test1-mrf", "sigma-b", 0.0, 0.08727, 0.00218, "--mrf test.mrf"],# 		["test1-mrf", "err-e", 0.0, 0.5, 0.02, "--mrf test.mrf"],# 		["test1-mrf", "err-f", 0.0, 0.5, 0.02, "--mrf test.mrf"],# 		["test1-mrf", "frequency", 0.5, 20, 0.5, "--mrf test.mrf"],#		["laser", "rmax", 0.0, 15, 0.5, ""],#		["laser", "rho", 1, 180, 4, ""],#                 ["laser", "beamwidth", 0.0, 1.5708, 0.1047, ""],# 		["laser", "sigma-r", 0.0, 10, 0.2, ""], # up to rmax#                ["laser", "sigma-b", 0.0, 0.08727, 0.003491, ""],#		["laser", "err-e", 0.0, 0.5, 0.02, ""],#		["laser", "err-f", 0.0, 0.5, 0.02, ""],#		["laser", "frequency", 0.5, 20, 0.5, ""],# 		["test1-ran", "rmax", 0.0, 15, 0.5, ""],# 		["test1-ran", "rho", 1, 180, 4, ""],# 		["test1-ran", "beamwidth", 0.0, 1.5708, 0.05236, ""], # 3 degree incs# 		["test1-ran", "sigma-r", 0.0, 10, 0.2, ""], # up to rmax# 		["test1-ran", "sigma-b", 0.0, 0.08727, 0.00218, ""],# 		["test1-ran", "err-e", 0.0, 0.5, 0.02, ""],# 		["test1-ran", "err-f", 0.0, 0.5, 0.02, ""],# 		["test1-ran", "frequency", 0.5, 20, 0.5, ""],#                 ["bearing-only-ran", "rmax", 0.0, 15, 0.5, ""],#                 ["bearing-only-ran", "rho", 1, 180, 4, ""],#                 ["bearing-only-ran", "beamwidth", 0.0, 1.5708, 0.1047, ""],                #                 ["bearing-only-ran", "sigma-r", 0.0, 10, 0.2, ""], # up to rmax#                 ["bearing-only-ran", "sigma-b", 0.0, 0.08727, 0.003491, ""],#                 ["bearing-only-ran", "err-e", 0.0, 0.5, 0.02, ""],#                 ["bearing-only-ran", "err-f", 0.0, 0.5, 0.02, ""],#                 ["bearing-only-ran", "frequency", 0.5, 20, 0.5, ""],# 		["range-only-ran", "rmax", 0.0, 15, 0.5, ""],# 		["range-only-ran", "rho", 1, 180, 4, ""],# 		["range-only-ran", "beamwidth", 0.0, 1.5708, 0.05236, ""], # 3 degree incs# 		["range-only-ran", "sigma-r", 0.0, 10, 0.2, ""], # up to rmax# 		["range-only-ran", "sigma-b", 0.0, 0.08727, 0.00218, ""],# 		["range-only-ran", "err-e", 0.0, 0.5, 0.02, ""],# 		["range-only-ran", "err-f", 0.0, 0.5, 0.02, ""],# 		["range-only-ran", "frequency", 0.5, 20, 0.5, ""],# 		["test1-mrf-ran", "rmax", 0.0, 15, 0.5, "--mrf test.mrf"],# 		["test1-mrf-ran", "rho", 1, 180, 4, "--mrf test.mrf"],# 		["test1-mrf-ran", "beamwidth", 0.0, 1.5708, 0.05236, "--mrf test.mrf"], # 3 degree incs# 		["test1-mrf-ran", "sigma-r", 0.0, 10, 0.2, "--mrf test.mrf"], # up to rmax# 		["test1-mrf-ran", "sigma-b", 0.0, 0.08727, 0.00218, "--mrf test.mrf"],# 		["test1-mrf-ran", "err-e", 0.0, 0.5, 0.02, "--mrf test.mrf"],# 		["test1-mrf-ran", "err-f", 0.0, 0.5, 0.02, "--mrf test.mrf"],# 		["test1-mrf-ran", "frequency", 0.5, 20, 0.5, "--mrf test.mrf"],# 		["laser-ran", "rmax", 0.0, 15, 0.5, ""],# 		["laser-ran", "rho", 1, 180, 4, ""],# 		["laser-ran", "beamwidth", 0.0, 1.5708, 0.05236, ""], # 3 degree incs# 		["laser-ran", "sigma-r", 0.0, 10, 0.2, ""], # up to rmax# 		["laser-ran", "sigma-b", 0.0, 0.08727, 0.00218, ""],# 		["laser-ran", "err-e", 0.0, 0.5, 0.02, ""],# 		["laser-ran", "err-f", 0.0, 0.5, 0.02, ""],# 		["laser-ran", "frequency", 0.5, 20, 0.5, ""],#meifon$                ["sm-bearing-only-ran", "rmax", 0.0, 10, 0.5, ""],                ["sm-bearing-only-ran", "rho", 1, 120, 3, ""],                ["sm-bearing-only-ran", "beamwidth", 0.0, 0.7854, 0.1047, ""],                                ["sm-bearing-only-ran", "sigma-r", 0.0, 10, 0.25, ""], # up to rmax                ["sm-bearing-only-ran", "sigma-b", 0.0, 0.08727, 0.00437, ""],                ["sm-bearing-only-ran", "err-e", 0.0, 0.5, 0.05, ""],                ["sm-bearing-only-ran", "err-f", 0.0, 0.5, 0.05, ""],                ["sm-bearing-only-ran", "frequency", 0.5, 20, 1, ""],#meifon$                ["sm-laser-ran", "rmax", 0.0, 10, 0.5, ""],                ["sm-laser-ran", "rho", 1, 120, 3, ""],                ["sm-laser-ran", "beamwidth", 0.0, 0.7854, 0.1047, ""],                                ["sm-laser-ran", "sigma-r", 0.0, 10, 0.25, ""], # up to rmax                ["sm-laser-ran", "sigma-b", 0.0, 0.08727, 0.00437, ""],                ["sm-laser-ran", "err-e", 0.0, 0.5, 0.05, ""],                ["sm-laser-ran", "err-f", 0.0, 0.5, 0.05, ""],                ["sm-laser-ran", "frequency", 0.5, 20, 1, ""],#marvin$                ["sm-test1-ran", "rmax", 0.0, 10, 0.5, ""],                ["sm-test1-ran", "rho", 1, 120, 3, ""],                ["sm-test1-ran", "beamwidth", 0.0, 0.7854, 0.1047, ""],                		["sm-test1-ran", "sigma-r", 0.0, 10, 0.25, ""], # up to rmax                ["sm-test1-ran", "sigma-b", 0.0, 0.08727, 0.00437, ""],                ["sm-test1-ran", "err-e", 0.0, 0.5, 0.05, ""],                ["sm-test1-ran", "err-f", 0.0, 0.5, 0.05, ""],                ["sm-test1-ran", "frequency", 0.5, 20, 1, ""],#phecda$                ["sm-laser", "rmax", 0.0, 10, 0.5, ""],                ["sm-laser", "rho", 1, 120, 3, ""],                ["sm-laser", "beamwidth", 0.0, 0.7854, 0.1047, ""],                                ["sm-laser", "sigma-r", 0.0, 10, 0.25, ""], # up to rmax                ["sm-laser", "sigma-b", 0.0, 0.08727, 0.00437, ""],                ["sm-laser", "err-e", 0.0, 0.5, 0.05, ""],                ["sm-laser", "err-f", 0.0, 0.5, 0.05, ""],                ["sm-laser", "frequency", 0.5, 20, 1, ""],#gort$		["sm-test1", "rmax", 0.0, 10, 0.5, ""],		["sm-test1", "rho", 1, 120, 3, ""],		["sm-test1", "beamwidth", 0.0, 0.7854, 0.1047, ""],                		["sm-test1", "sigma-r", 0.0, 10, 0.25, ""], # up to rmax		["sm-test1", "sigma-b", 0.0, 0.08727, 0.00437, ""],		["sm-test1", "err-e", 0.0, 0.5, 0.05, ""],		["sm-test1", "err-f", 0.0, 0.5, 0.05, ""],		["sm-test1", "frequency", 0.5, 20, 1, ""],#gort                ["sm-bearing-only", "rmax", 0.0, 10, 0.5, ""],                ["sm-bearing-only", "rho", 1, 120, 3, ""],                ["sm-bearing-only", "beamwidth", 0.0, 0.7854, 0.1047, ""],                                ["sm-bearing-only", "sigma-r", 0.0, 10, 0.25, ""], # up to rmax                ["sm-bearing-only", "sigma-b", 0.0, 0.08727, 0.00437, ""],                ["sm-bearing-only", "err-e", 0.0, 0.5, 0.05, ""],                ["sm-bearing-only", "err-f", 0.0, 0.5, 0.05, ""],                ["sm-bearing-only", "frequency", 0.5, 20, 1, ""],#robby                ["sm-range-only-ran", "rmax", 0.0, 10, 0.5, ""],                ["sm-range-only-ran", "rho", 1, 120, 3, ""],                ["sm-range-only-ran", "beamwidth", 0.0, 0.7854, 0.1047, ""],                                ["sm-range-only-ran", "sigma-r", 0.0, 10, 0.25, ""], # up to rmax                ["sm-range-only-ran", "sigma-b", 0.0, 0.08727, 0.00437, ""],                ["sm-range-only-ran", "err-e", 0.0, 0.5, 0.05, ""],                ["sm-range-only-ran", "err-f", 0.0, 0.5, 0.05, ""],                ["sm-range-only-ran", "frequency", 0.5, 20, 1, ""],#robby/dubhe                ["sm-range-only", "rmax", 0.0, 10, 0.5, ""],                ["sm-range-only", "rho", 1, 120, 3, ""],                ["sm-range-only", "beamwidth", 0.0, 0.7854, 0.1047, ""],                                ["sm-range-only", "sigma-r", 0.0, 10, 0.25, ""], # up to rmax                ["sm-range-only", "sigma-b", 0.0, 0.08727, 0.00437, ""],                ["sm-range-only", "err-e", 0.0, 0.5, 0.05, ""],                ["sm-range-only", "err-f", 0.0, 0.5, 0.05, ""],                ["sm-range-only", "frequency", 0.5, 20, 1, ""],#phecda$                ["sm-test1-mrf", "rmax", 0.0, 10, 0.5, ""],                ["sm-test1-mrf", "rho", 1, 120, 3, ""],                ["sm-test1-mrf", "beamwidth", 0.0, 0.7854, 0.1047, ""],                                ["sm-test1-mrf", "sigma-r", 0.0, 10, 0.25, ""], # up to rmax                ["sm-test1-mrf", "sigma-b", 0.0, 0.08727, 0.00437, ""],                ["sm-test1-mrf", "err-e", 0.0, 0.5, 0.05, ""],                ["sm-test1-mrf", "err-f", 0.0, 0.5, 0.05, ""],                ["sm-test1-mrf", "frequency", 0.5, 20, 1, ""],#dubhe$                ["sm-laser-mrf", "rmax", 0.0, 10, 0.5, ""],                ["sm-laser-mrf", "rho", 1, 120, 3, ""],                ["sm-laser-mrf", "beamwidth", 0.0, 0.7854, 0.1047, ""],                                ["sm-laser-mrf", "sigma-r", 0.0, 10, 0.25, ""], # up to rmax                ["sm-laser-mrf", "sigma-b", 0.0, 0.08727, 0.00437, ""],                ["sm-laser-mrf", "err-e", 0.0, 0.5, 0.05, ""],                ["sm-laser-mrf", "err-f", 0.0, 0.5, 0.05, ""],                ["sm-laser-mrf", "frequency", 0.5, 20, 1, ""],		);foreach $exp (@experiments) {    my ($conf, $param, $min, $max, $step, $flags) = ($$exp[0], $$exp[1], $$exp[2], $$exp[3], $$exp[4], $$exp[5]);    print "$conf $param (" . $M*(($max-$min)/$step) . " runs)\n";    open OUT, ">results/$conf-$param.dat";    for($cur = $min; $cur <= $max; $cur += $step) {	print ".";	my @means = (0, 0, 0, 0, 0, 0, 0);	for($i = 0; $i < $M; ++$i) {	    $out = `./sim -c $conf.conf --$param $cur $flags --nofiles`;	    chomp $out;	    my @res = split(/\s+/, $out);	    for($j = 0; $j < 7; ++$j) { $means[$j] += $res[$j]/$M; }	}	print OUT "$cur";	for($j = 0; $j < 7; ++$j) { print OUT " $means[$j]"; }	print OUT "\n";    }    close OUT;    print "\n\n";}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -