summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/localization
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/localization')
-rw-r--r--SD-VBS/benchmarks/localization/Makefile3
-rw-r--r--SD-VBS/benchmarks/localization/data/Makefile3
-rw-r--r--SD-VBS/benchmarks/localization/data/cif/Makefile7
-rwxr-xr-xSD-VBS/benchmarks/localization/data/cif/VBS_Ver1bin0 -> 99419 bytes
-rwxr-xr-xSD-VBS/benchmarks/localization/data/cif/cifbin0 -> 99219 bytes
-rw-r--r--SD-VBS/benchmarks/localization/data/cif/expected.m3
-rwxr-xr-xSD-VBS/benchmarks/localization/data/cif/localizationbin0 -> 57424 bytes
-rw-r--r--SD-VBS/benchmarks/localization/data/qcif/Makefile8
-rw-r--r--SD-VBS/benchmarks/localization/data/qcif/expected.m3
-rwxr-xr-xSD-VBS/benchmarks/localization/data/qcif/localizationbin0 -> 51536 bytes
-rw-r--r--SD-VBS/benchmarks/localization/data/sim/Makefile8
-rw-r--r--SD-VBS/benchmarks/localization/data/sim/expected.m3
-rwxr-xr-xSD-VBS/benchmarks/localization/data/sim/localizationbin0 -> 51832 bytes
-rw-r--r--SD-VBS/benchmarks/localization/data/sim_fast/Makefile8
-rw-r--r--SD-VBS/benchmarks/localization/data/sim_fast/expected.m3
-rwxr-xr-xSD-VBS/benchmarks/localization/data/sim_fast/localizationbin0 -> 51536 bytes
-rw-r--r--SD-VBS/benchmarks/localization/data/sqcif/Makefile8
-rw-r--r--SD-VBS/benchmarks/localization/data/sqcif/expected.m3
-rwxr-xr-xSD-VBS/benchmarks/localization/data/sqcif/localizationbin0 -> 51536 bytes
-rw-r--r--SD-VBS/benchmarks/localization/data/test/Makefile8
-rw-r--r--SD-VBS/benchmarks/localization/data/test/expected.m3
-rwxr-xr-xSD-VBS/benchmarks/localization/data/test/localizationbin0 -> 51832 bytes
-rw-r--r--SD-VBS/benchmarks/localization/data/vga/Makefile7
-rw-r--r--SD-VBS/benchmarks/localization/data/vga/expected.m3
-rwxr-xr-xSD-VBS/benchmarks/localization/data/vga/localizationbin0 -> 57424 bytes
-rw-r--r--SD-VBS/benchmarks/localization/src/c/eul2quat.c50
-rw-r--r--SD-VBS/benchmarks/localization/src/c/generateSample.c88
-rw-r--r--SD-VBS/benchmarks/localization/src/c/get3DGaussianProb.c49
-rw-r--r--SD-VBS/benchmarks/localization/src/c/localization.h24
-rw-r--r--SD-VBS/benchmarks/localization/src/c/mcl.c34
-rw-r--r--SD-VBS/benchmarks/localization/src/c/quat2eul.c47
-rw-r--r--SD-VBS/benchmarks/localization/src/c/quatConj.c32
-rw-r--r--SD-VBS/benchmarks/localization/src/c/quatMul.c55
-rw-r--r--SD-VBS/benchmarks/localization/src/c/quatRot.c47
-rw-r--r--SD-VBS/benchmarks/localization/src/c/readSensorData.c63
-rw-r--r--SD-VBS/benchmarks/localization/src/c/script_localization.c534
-rw-r--r--SD-VBS/benchmarks/localization/src/c/weightedSample.c37
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/addEulNoise.m12
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/calculate3DGaussian.m11
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/drawLog.m44
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/eul2quat.m9
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/generateSample.m25
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/get3DGaussianProb.m22
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/getGroundData.m5
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/mcl.m9
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/mclWhole.m18
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/quat2eul.m6
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/quatConj.m5
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/quatMul.m18
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/quatRot.m24
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/readLoc.m53
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/readMatrix.m28
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/readSensorData.m46
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/script_run_profile.m209
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/selfCheck.m33
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/sumCol.m14
-rw-r--r--SD-VBS/benchmarks/localization/src/matlab/weightedSample.m20
57 files changed, 1752 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/localization/Makefile b/SD-VBS/benchmarks/localization/Makefile
new file mode 100644
index 0000000..60cc0ec
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/Makefile
@@ -0,0 +1,3 @@
1include ../../common/makefiles/Makefile.include
2include $(MAKEFILE_COMMON_DIR)/Makefile.recurse
3
diff --git a/SD-VBS/benchmarks/localization/data/Makefile b/SD-VBS/benchmarks/localization/data/Makefile
new file mode 100644
index 0000000..ba33d35
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/Makefile
@@ -0,0 +1,3 @@
1include ../../../common/makefiles/Makefile.include
2include $(MAKEFILE_COMMON_DIR)/Makefile.recurse
3
diff --git a/SD-VBS/benchmarks/localization/data/cif/Makefile b/SD-VBS/benchmarks/localization/data/cif/Makefile
new file mode 100644
index 0000000..4bd562f
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/cif/Makefile
@@ -0,0 +1,7 @@
1include ../../../../common/makefiles/Makefile.include
2
3BMARK=localization
4INPUT=cif
5
6include $(MAKEFILE_COMMON_DIR)/Makefile.common
7
diff --git a/SD-VBS/benchmarks/localization/data/cif/VBS_Ver1 b/SD-VBS/benchmarks/localization/data/cif/VBS_Ver1
new file mode 100755
index 0000000..b04da34
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/cif/VBS_Ver1
Binary files differ
diff --git a/SD-VBS/benchmarks/localization/data/cif/cif b/SD-VBS/benchmarks/localization/data/cif/cif
new file mode 100755
index 0000000..8489f9a
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/cif/cif
Binary files differ
diff --git a/SD-VBS/benchmarks/localization/data/cif/expected.m b/SD-VBS/benchmarks/localization/data/cif/expected.m
new file mode 100644
index 0000000..22ef940
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/cif/expected.m
@@ -0,0 +1,3 @@
11264.100919 1018.646860 -66.744065 1325.148554 -524.072802 104.959493 1293.736304 -176.791171 129.794173 28.123781 -825.907469 110.949588 -53.030419 -387.071088 175.278628 -306.960407 -332.128807 -859.326326 96.550227 -269.287595 -19.835881 207.383563 -251.431495 -71.876639 241.454426 -291.088405 115.707219 337.421875 329.434722 -31.556631 200.761584 273.097048 -209.534328 -460.765107 186.245449 116.289195 -351.230797 108.699099 -71.331712 386.736600 -292.419981 -0.334981 -242.589950 -353.060399 -99.262004 -109.249025 -360.813810 -40.844284 -206.722293 -430.241768 29.072174 -266.322402 -260.740639 -436.982547 -175.357022 283.583788 -279.093973 -387.176464 248.837096 447.196705 -268.019516 -298.939012 343.244024 206.071785 -225.746220 -187.288143 200.444712 -93.034358 -165.697562 15.808615 -304.358091 415.538855 63.043500 -136.137632 -383.437919 -7.746789 -329.599742 -221.224972 -348.912560 -202.666314 -227.899182 -232.552441 384.227756 166.317852 -184.182201 -68.725094 54.730375 0.000000
2148.469605 249783.963758 249783.963758 2180.681112 383736.909385 383736.909385 253883.626524 253883.626524 476143.774773 476143.774773 389683.019120 389683.019120 545807.588908 545807.588908 232299.455988 599622.582238 599622.582238 417714.138595 417714.138595 646854.785707 646854.785707 517757.007454 517757.007454 687063.797171 687063.797171 337856.935013 720555.709843 720555.709843 508182.601804 508182.601804 752242.685858 752242.685858 596994.900082 596994.900082 781076.846278 781076.846278 408387.972486 804774.536536 804774.536536 572505.759937 572505.759937 829541.440024 829541.440024 656637.597514 656637.597514 852188.058601 852188.058601 464317.955836 871738.416433 871738.416433 625271.852328 625271.852328 892047.804954 892047.804954 706766.734908 706766.734908 911202.007529 911202.007529 761878.379462 761878.379462 929603.367197 929603.367197 805063.056324 805063.056324 947078.978085 947078.978085 841497.089926 841497.089926 714530.798901 871063.266696 871063.266696 847094.846486 847094.846486 900419.631759 900419.631759 907069.193562 907069.193562 927072.876646 927072.876646 695517.442884 948856.006854 948856.006854 840738.929439 840738.929439 972511.540879 972511.540879 909607.468542 0.000000
34907681162.639265 4996983773.346421 4996983773.346421 4907470495.183228 4968360833.406909 4968360833.406909 4908709186.117507 4908709186.117507 4953769759.629911 4953769759.629911 4909434990.624061 4909434990.624061 4944946321.273969 4944946321.273969 4908726987.816192 4939055160.653013 4939055160.653013 4909755868.543180 4909755868.543180 4934891702.718277 4934891702.718277 4910373711.010693 4910373711.010693 4931739973.964623 4931739973.964623 4909601991.354140 4929263185.565628 4929263185.565628 4910590381.898005 4910590381.898005 4927366117.137535 4927366117.137535 4911182724.385408 4911182724.385408 4925842684.055954 4925842684.055954 4910387212.896085 4924580415.310893 4924580415.310893 4911364419.082825 4911364419.082825 4923588892.702791 4923588892.702791 4911945399.855221 4911945399.855221 4922665132.406710 4922665132.406710 4911146778.096742 4921854906.683125 4921854906.683125 4912117527.337012 4912117527.337012 4921247956.389248 4921247956.389248 4912691752.735250 4912691752.735250 4920632038.287462 4920632038.287462 4913140704.670214 4913140704.670214 4920169402.955149 4920169402.955149 4913521889.855532 4913521889.855532 4919786752.370605 4919786752.370605 4913870380.414716 4913870380.414716 4918135706.514756 4914176948.628077 4914176948.628077 4918436009.170393 4918436009.170393 4914475956.108191 4914475956.108191 4918424403.658169 4918424403.658169 4914736253.512666 4914736253.512666 4917126279.233858 4914920865.993999 4914920865.993999 4917765910.500541 4917765910.500541 4915042054.464935 4915042054.464935 4918118358.250251 0.000000
diff --git a/SD-VBS/benchmarks/localization/data/cif/localization b/SD-VBS/benchmarks/localization/data/cif/localization
new file mode 100755
index 0000000..be524d2
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/cif/localization
Binary files differ
diff --git a/SD-VBS/benchmarks/localization/data/qcif/Makefile b/SD-VBS/benchmarks/localization/data/qcif/Makefile
new file mode 100644
index 0000000..d18c02d
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/qcif/Makefile
@@ -0,0 +1,8 @@
1include ../../../../common/makefiles/Makefile.include
2
3BMARK=localization
4INPUT=qcif
5
6include $(MAKEFILE_COMMON_DIR)/Makefile.common
7
8
diff --git a/SD-VBS/benchmarks/localization/data/qcif/expected.m b/SD-VBS/benchmarks/localization/data/qcif/expected.m
new file mode 100644
index 0000000..4263b3d
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/qcif/expected.m
@@ -0,0 +1,3 @@
1631.976450 516.498284 -197.996728 663.497659 -22.288426 -28.903321 647.817138 -351.955521 -312.433355 44.896667 -150.353868 -67.000702 -370.502974 26.299828 -488.261017 -321.672753 -20.467725 -293.286835 -85.465502 -243.718793 -74.565859 -549.266195 30.999329 -160.813808 -121.355881 -483.242401 -79.323855 -151.906467 -595.771606 12.823360 -12.448671 -172.470587 -511.488467 -21.514722 42.089059 -185.300910 -324.317055 89.756283 -187.135260 -628.505815 29.732164 124.069805 -182.587245 -367.573870 -76.374400 148.479017 -172.587616 -145.562423 167.983942 -157.609772 -529.296685 21.322336 179.630194 -137.981888 -185.584066 -112.106506 185.662406 -114.184459 25.859838 -163.799486 189.409619 -87.299860 149.829422 -166.716356 189.327882 -58.163997 221.918824 -144.524825 183.798380 253.096143 -116.072162 284.431081 -110.520707 261.347591 -74.376768 318.351401 -83.847971 256.673574 -30.452642 285.051087 232.480691 6.336376 352.034688 -65.985798 202.705055 47.633804 382.774465 0.000000
274.359725 55442.431887 55442.431887 916.112559 85048.747743 85048.747743 57211.398438 57211.398438 105779.314664 105779.314664 87600.029083 87600.029083 121512.447801 121512.447801 52860.067135 133141.106400 133141.106400 94517.909665 94517.909665 143946.045181 143946.045181 117118.457039 117118.457039 153064.488091 153064.488091 77359.640694 160318.887671 160318.887671 115674.880954 115674.880954 167827.918882 167827.918882 135968.435504 135968.435504 174698.161121 174698.161121 94713.555770 180133.542229 180133.542229 131871.515823 131871.515823 186165.689411 186165.689411 151252.883116 151252.883116 191909.078626 191909.078626 109392.213684 196358.978485 196358.978485 146078.668403 146078.668403 201651.395781 201651.395781 165046.805127 165046.805127 206711.131954 206711.131954 178320.376082 178320.376082 211596.482547 211596.482547 188947.507546 188947.507546 216497.738288 216497.738288 197921.386091 197921.386091 165985.571620 205091.855127 205091.855127 196779.521358 196779.521358 212609.207639 212609.207639 211533.666997 211533.666997 219561.468379 219561.468379 166056.319552 225227.570848 225227.570848 200047.795792 200047.795792 231596.764178 231596.764178 216995.904046 0.000000
32453723755.101060 2473138738.478060 2473138738.478060 2453633812.224546 2466744375.113051 2466744375.113051 2453912441.757200 2453912441.757200 2463514723.222767 2463514723.222767 2454091490.868995 2454091490.868995 2461535850.721794 2461535850.721794 2453959313.433379 2460231345.559122 2460231345.559122 2454218817.973337 2454218817.973337 2459307064.549955 2459307064.549955 2454389996.064240 2454389996.064240 2458639118.655468 2458639118.655468 2454254726.669796 2458128486.626955 2458128486.626955 2454513520.017527 2454513520.017527 2457726299.581051 2457726299.581051 2454684774.597973 2454684774.597973 2457410967.437045 2457410967.437045 2454549597.959815 2457150540.743558 2457150540.743558 2454807555.250977 2454807555.250977 2456916627.143601 2456916627.143601 2454977251.488404 2454977251.488404 2456719675.377667 2456719675.377667 2454837557.911356 2456573728.470717 2456573728.470717 2455086906.118260 2455086906.118260 2456453336.049111 2456453336.049111 2455239927.219034 2455239927.219034 2456371158.832802 2456371158.832802 2455342631.649824 2455342631.649824 2456355762.744594 2456355762.744594 2455396094.462677 2455396094.462677 2456381099.252142 2456381099.252142 2455441691.541200 2455441691.541200 2456128146.863575 2455477781.414840 2455477781.414840 2456282488.340037 2456282488.340037 2455516633.096739 2455516633.096739 2456357066.451140 2456357066.451140 2455552537.419121 2455552537.419121 2456129670.296010 2455581213.884797 2455581213.884797 2456300055.909151 2456300055.909151 2455615007.049098 2455615007.049098 2456385531.538922 0.000000
diff --git a/SD-VBS/benchmarks/localization/data/qcif/localization b/SD-VBS/benchmarks/localization/data/qcif/localization
new file mode 100755
index 0000000..e2fb417
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/qcif/localization
Binary files differ
diff --git a/SD-VBS/benchmarks/localization/data/sim/Makefile b/SD-VBS/benchmarks/localization/data/sim/Makefile
new file mode 100644
index 0000000..5dde8fe
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/sim/Makefile
@@ -0,0 +1,8 @@
1include ../../../../common/makefiles/Makefile.include
2
3BMARK=localization
4INPUT=sim
5
6include $(MAKEFILE_COMMON_DIR)/Makefile.common
7
8
diff --git a/SD-VBS/benchmarks/localization/data/sim/expected.m b/SD-VBS/benchmarks/localization/data/sim/expected.m
new file mode 100644
index 0000000..eb3b6a7
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/sim/expected.m
@@ -0,0 +1,3 @@
112.543452 13.658157 13.497180 13.894946 13.959641 13.788874 13.848866 13.673453 13.788413 13.616173 13.675684 13.496716 13.628587 13.453379 13.516593 13.560943 13.384332 13.462265 13.282183 13.388606 13.211571 13.284906 13.102213 13.225472 13.047242 13.124615 13.157999 12.976742 13.069521 12.884701 12.981088 12.800202 12.888504 12.701228 12.814751 12.629592 12.721974 12.743435 12.557293 12.665573 12.476815 12.562721 12.375911 12.479525 12.287222 12.390423 12.201016 12.309248 12.317883 12.128404 12.252886 12.058258 12.132629 11.941091 12.061026 11.865997 11.957748 11.764361 11.888852 11.692058 11.785975 11.590614 11.715017 11.515945 11.611867 11.414693 11.539084 11.338245 11.436080 11.460551 11.257957 11.375602 11.175996 11.267413 11.064235 11.177627 10.976366 11.082948 10.877846 10.998140 11.002795 10.797280 10.937839 10.734714 10.807476 10.600371 10.736720 0.000000
21.632000 8.714650 8.714650 5.129768 12.757521 12.757521 15.132782 15.132782 19.299372 19.299372 21.467915 21.467915 24.972680 24.972680 19.672340 27.024481 27.024481 28.587185 28.587185 33.309821 33.309821 34.866787 34.866787 38.902191 38.902191 33.038006 40.913687 40.913687 41.893676 41.893676 47.112254 47.112254 48.100977 48.100977 52.615488 52.615488 46.241199 54.584753 54.584753 55.038349 55.038349 60.707646 60.707646 61.196608 61.196608 66.137221 66.137221 59.308127 68.071141 68.071141 68.059927 68.059927 74.125293 74.125293 74.174756 74.174756 79.495501 79.495501 79.469368 79.469368 84.667799 84.667799 84.745876 84.745876 89.812215 89.812215 90.008499 90.008499 87.828764 91.936749 91.936749 96.350144 96.350144 98.015654 98.015654 102.254126 102.254126 103.429097 103.429097 100.240384 105.344169 105.344169 108.716083 108.716083 111.397402 111.397402 114.567665 0.000000
349065484.652770 49065766.480798 49065766.480798 49064922.448163 49065254.824174 49065254.824174 49064855.994251 49064855.994251 49065287.991179 49065287.991179 49064888.152999 49064888.152999 49065317.057455 49065317.057455 49064879.431549 49065327.674120 49065327.674120 49064924.733918 49064924.733918 49065360.164908 49065360.164908 49064957.077832 49064957.077832 49065389.450818 49065389.450818 49064948.446741 49065400.174667 49065400.174667 49064993.921333 49064993.921333 49065432.868549 49065432.868549 49065026.426106 49065026.426106 49065462.347468 49065462.347468 49065017.873205 49065473.165037 49065473.165037 49065063.495276 49065063.495276 49065506.035072 49065506.035072 49065096.136128 49065096.136128 49065535.679932 49065535.679932 49065087.648925 49065546.577815 49065546.577815 49065133.393946 49065133.393946 49065579.597091 49065579.597091 49065166.145727 49065166.145727 49065609.380717 49065609.380717 49065194.860230 49065194.860230 49065638.305742 49065638.305742 49065223.608757 49065223.608757 49065667.272949 49065667.272949 49065252.386982 49065252.386982 49065658.990318 49065263.289712 49065263.289712 49065705.110400 49065705.110400 49065296.295918 49065296.295918 49065738.239086 49065738.239086 49065326.035265 49065326.035265 49065729.995233 49065336.962269 49065336.962269 49065776.182626 49065776.182626 49065370.006395 49065370.006395 49065809.367845 0.000000
diff --git a/SD-VBS/benchmarks/localization/data/sim/localization b/SD-VBS/benchmarks/localization/data/sim/localization
new file mode 100755
index 0000000..4650997
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/sim/localization
Binary files differ
diff --git a/SD-VBS/benchmarks/localization/data/sim_fast/Makefile b/SD-VBS/benchmarks/localization/data/sim_fast/Makefile
new file mode 100644
index 0000000..236ff8b
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/sim_fast/Makefile
@@ -0,0 +1,8 @@
1include ../../../../common/makefiles/Makefile.include
2
3BMARK=localization
4INPUT=sim_fast
5
6include $(MAKEFILE_COMMON_DIR)/Makefile.common
7
8
diff --git a/SD-VBS/benchmarks/localization/data/sim_fast/expected.m b/SD-VBS/benchmarks/localization/data/sim_fast/expected.m
new file mode 100644
index 0000000..9841d62
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/sim_fast/expected.m
@@ -0,0 +1,3 @@
13.685028 3.432348 3.427322 3.424184 3.427974 3.422786 3.419637 3.414578 3.415206 3.410068 3.410692 3.405226 3.405845 3.400579 3.401194 3.405009 3.399313 3.396114 3.390933 3.391537 3.386565 3.387164 3.382115 3.382710 0.000000
20.570000 1.130093 1.130093 1.003619 1.457224 1.457224 1.872936 1.872936 2.195236 2.195236 2.517823 2.517823 2.839430 2.839430 2.624478 3.070964 3.070964 3.479898 3.479898 3.796360 3.796360 4.113478 4.113478 4.428227 0.000000
314719241.537176 14719192.885416 14719192.885416 14719192.253043 14719194.529914 14719194.529914 14719196.620169 14719196.620169 14719198.260497 14719198.260497 14719199.898726 14719199.898726 14719201.534841 14719201.534841 14719200.454656 14719202.721015 14719202.721015 14719204.800656 14719204.800656 14719206.430317 14719206.430317 14719208.057811 14719208.057811 14719209.683107 0.000000
diff --git a/SD-VBS/benchmarks/localization/data/sim_fast/localization b/SD-VBS/benchmarks/localization/data/sim_fast/localization
new file mode 100755
index 0000000..82e40a9
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/sim_fast/localization
Binary files differ
diff --git a/SD-VBS/benchmarks/localization/data/sqcif/Makefile b/SD-VBS/benchmarks/localization/data/sqcif/Makefile
new file mode 100644
index 0000000..496053b
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/sqcif/Makefile
@@ -0,0 +1,8 @@
1include ../../../../common/makefiles/Makefile.include
2
3BMARK=localization
4INPUT=sqcif
5
6include $(MAKEFILE_COMMON_DIR)/Makefile.common
7
8
diff --git a/SD-VBS/benchmarks/localization/data/sqcif/expected.m b/SD-VBS/benchmarks/localization/data/sqcif/expected.m
new file mode 100644
index 0000000..ec25c0d
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/sqcif/expected.m
@@ -0,0 +1,3 @@
11011.303794 817.965338 52.925944 1061.980393 0.000000
2118.818062 154080.851618 154080.851618 1652.527205 0.000000
33926083200.206786 3980824114.940394 3980824114.940394 3925922636.742242 0.000000
diff --git a/SD-VBS/benchmarks/localization/data/sqcif/localization b/SD-VBS/benchmarks/localization/data/sqcif/localization
new file mode 100755
index 0000000..d26f656
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/sqcif/localization
Binary files differ
diff --git a/SD-VBS/benchmarks/localization/data/test/Makefile b/SD-VBS/benchmarks/localization/data/test/Makefile
new file mode 100644
index 0000000..c997c9b
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/test/Makefile
@@ -0,0 +1,8 @@
1include ../../../../common/makefiles/Makefile.include
2
3BMARK=localization
4INPUT=test
5
6include $(MAKEFILE_COMMON_DIR)/Makefile.common
7
8
diff --git a/SD-VBS/benchmarks/localization/data/test/expected.m b/SD-VBS/benchmarks/localization/data/test/expected.m
new file mode 100644
index 0000000..d64ef46
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/test/expected.m
@@ -0,0 +1,3 @@
13.685028 3.432348 3.380028 3.349426 0.000000
20.570000 6.035935 6.035935 4.771188 0.000000
314719241.537176 14719192.900190 14719192.900190 14719192.267816 0.000000
diff --git a/SD-VBS/benchmarks/localization/data/test/localization b/SD-VBS/benchmarks/localization/data/test/localization
new file mode 100755
index 0000000..2ac32af
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/test/localization
Binary files differ
diff --git a/SD-VBS/benchmarks/localization/data/vga/Makefile b/SD-VBS/benchmarks/localization/data/vga/Makefile
new file mode 100644
index 0000000..9d6ce33
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/vga/Makefile
@@ -0,0 +1,7 @@
1include ../../../../common/makefiles/Makefile.include
2
3BMARK=localization
4INPUT=vga
5
6include $(MAKEFILE_COMMON_DIR)/Makefile.common
7
diff --git a/SD-VBS/benchmarks/localization/data/vga/expected.m b/SD-VBS/benchmarks/localization/data/vga/expected.m
new file mode 100644
index 0000000..652c96f
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/vga/expected.m
@@ -0,0 +1,3 @@
12528.691892 2020.606280 42.673530 2649.158291 -514.634787 -292.512047 2578.263949 -7.269003 194.344630 324.075534 -884.272217 -529.018602 -176.396317 -373.999381 141.933329 509.836051 -61.997773 -777.150225 -582.644009 -1449.348371 117.943370 -1299.856855 -24.357194 303.856978 101.324880 1351.287196 1422.667628 -81.220795 344.584054 305.716500 394.536408 -315.995792 1224.113905 -116.964887 -895.290651 -373.194309 -1302.711786 -1435.755958 -242.449596 -575.245533 -412.057612 -1163.249025 31.633454 -103.634994 415.883979 -436.888318 292.040993 -444.018359 393.038935 455.211286 226.985703 -74.940082 1088.234539 506.285008 -1138.224729 231.353564 1450.108183 424.629158 1302.669340 -76.648346 1416.427855 244.239852 681.206342 -224.646828 1050.911515 9.704005 -1471.352151 -152.384502 480.602928 -1300.853407 143.685698 523.473516 287.188506 131.080484 309.861529 -1053.044149 150.207963 1360.602516 248.798640 1127.783455 1393.329528 1.177020 559.095648 -122.280172 663.266614 -284.008725 -1411.582432 0.000000
2296.698921 1111596.955926 1111596.955926 5126.049004 1711524.062418 1711524.062418 1121309.558827 1121309.558827 2122440.593817 2122440.593817 1725419.018071 1725419.018071 2432383.209869 2432383.209869 1024122.336452 2673880.369984 2673880.369984 1845737.015282 1845737.015282 2878366.041242 2878366.041242 2287693.000146 2287693.000146 3049953.380640 3049953.380640 1482353.660475 3188497.912222 3188497.912222 2229222.979737 2229222.979737 3305572.873952 3305572.873952 2612927.563784 2612927.563784 3403916.191632 3403916.191632 1753858.573799 3484955.565597 3484955.565597 2457415.775389 2457415.775389 3562678.977792 3562678.977792 2811889.463107 2811889.463107 3634601.849246 3634601.849246 1933573.519582 3697605.496416 3697605.496416 2624334.404817 2624334.404817 3762379.511669 3762379.511669 2969426.090059 2969426.090059 3822569.851774 3822569.851774 3195245.108477 3195245.108477 3881298.776581 3881298.776581 3368029.173453 3368029.173453 3937734.089771 3937734.089771 3515391.167840 3515391.167840 2881400.524568 3633838.763944 3633838.763944 3446715.106174 3446715.106174 3742334.428186 3742334.428186 3694017.653500 3694017.653500 3843749.772586 3843749.772586 2733802.286928 3926154.773246 3926154.773246 3358856.453555 3358856.453555 4004479.104494 4004479.104494 3646943.706728 0.000000
39815876281.390493 10219639146.152300 10219639146.152300 9815391366.338209 10092396791.994455 10092396791.994455 9820918023.651031 9820918023.651031 10026942674.566353 10026942674.566353 9824054607.271921 9824054607.271921 9986540179.952711 9986540179.952711 9820749328.610571 9958801841.680529 9958801841.680529 9825149742.124517 9825149742.124517 9937856152.645214 9937856152.645214 9827762146.439236 9827762146.439236 9919827156.765738 9919827156.765738 9824274661.168266 9902186131.605909 9902186131.605909 9828584290.748890 9828584290.748890 9890460431.944111 9890460431.944111 9831101864.497566 9831101864.497566 9882225999.229254 9882225999.229254 9827389673.717871 9876391451.389120 9876391451.389120 9831433794.626633 9831433794.626633 9872465819.701366 9872465819.701366 9833630954.938072 9833630954.938072 9870024758.678486 9870024758.678486 9829700710.912729 9867664635.469746 9867664635.469746 9833696340.678921 9833696340.678921 9865370958.567533 9865370958.567533 9835815770.213318 9835815770.213318 9864069463.541668 9864069463.541668 9837362817.867367 9837362817.867367 9862759213.674345 9862759213.674345 9838621454.607281 9838621454.607281 9861780884.733627 9861780884.733627 9839784146.273586 9839784146.273586 9855374465.163700 9840749921.502296 9840749921.502296 9856998863.783821 9856998863.783821 9841720196.125462 9841720196.125462 9857185100.692745 9857185100.692745 9842629577.938219 9842629577.938219 9851296681.760395 9843405989.632635 9843405989.632635 9853618282.752998 9853618282.752998 9844190452.540911 9844190452.540911 9854355745.217056 0.000000
diff --git a/SD-VBS/benchmarks/localization/data/vga/localization b/SD-VBS/benchmarks/localization/data/vga/localization
new file mode 100755
index 0000000..cf7cdfd
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/data/vga/localization
Binary files differ
diff --git a/SD-VBS/benchmarks/localization/src/c/eul2quat.c b/SD-VBS/benchmarks/localization/src/c/eul2quat.c
new file mode 100644
index 0000000..bea75cf
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/eul2quat.c
@@ -0,0 +1,50 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* eul2quat(F2D* angle)
10{
11 F2D *ret;
12 F2D *x, *y, *z;
13 int k, i, j;
14 int rows, cols;
15
16 rows = angle->height;
17 cols = angle->width;
18
19 x = fDeepCopyRange(angle, 0, angle->height, 0, 1);
20 y = fDeepCopyRange(angle, 0, angle->height, 1, 1);
21 z = fDeepCopyRange(angle, 0, angle->height, 2, 1);
22
23 ret = fSetArray(x->height, 4, 0);
24
25 for(i=0; i<rows; i++)
26 {
27 float xi, yi, zi;
28 k = 0;
29 xi = asubsref(x,i);
30 yi = asubsref(y,i);
31 zi = asubsref(z,i);
32
33 subsref(ret,i,k) = cos(xi/2)*cos(yi/2)*cos(zi/2)+sin(xi/2)*sin(yi/2)*sin(zi/2);
34 k++;
35 subsref(ret,i,k) = sin(xi/2)*cos(yi/2)*cos(zi/2)-cos(xi/2)*sin(yi/2)*sin(zi/2);
36 k++;
37 subsref(ret,i,k) = cos(xi/2)*sin(yi/2)*cos(zi/2)+sin(xi/2)*cos(yi/2)*sin(zi/2);
38 k++;
39 subsref(ret,i,k) = cos(xi/2)*cos(yi/2)*sin(zi/2)-sin(xi/2)*sin(yi/2)*cos(zi/2);
40 }
41
42 fFreeHandle(x);
43 fFreeHandle(y);
44 fFreeHandle(z);
45
46 return ret;
47}
48
49
50
diff --git a/SD-VBS/benchmarks/localization/src/c/generateSample.c b/SD-VBS/benchmarks/localization/src/c/generateSample.c
new file mode 100644
index 0000000..3acb4d7
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/generateSample.c
@@ -0,0 +1,88 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9void generateSample(F2D *w, F2D *quat, F2D *vel, F2D *pos)
10{
11 int rows, cols, i, j, index;
12 I2D *sampleXId;
13 F2D *retQuat, *retVel, *retPos;
14
15 sampleXId = weightedSample(w);
16
17 rows = sampleXId->height;
18 cols = sampleXId->width;
19
20 if(cols > 1)
21 printf("ERROR: Cols more than 1.. Handle this case \n");
22
23 retQuat = fSetArray(quat->height, quat->width, 0);
24 retVel = fSetArray(vel->height, vel->width, 0);
25 retPos = fSetArray(pos->height, pos->width, 0);
26
27 for(i=0; i<rows; i++)
28 {
29 index = asubsref(sampleXId, i) - 1;
30 for(j=0; j<quat->width; j++)
31 {
32 subsref(retQuat,i,j) = subsref(quat,index,j);
33 }
34 }
35
36 for(i=0; i<rows; i++)
37 {
38 index = asubsref(sampleXId, i) - 1;
39 for(j=0; j<vel->width; j++)
40 {
41 subsref(retVel,i,j) = subsref(vel,index,j);
42 }
43 }
44
45 for(i=0; i<rows; i++)
46 {
47 index = asubsref(sampleXId, i) - 1;
48 for(j=0; j<pos->width; j++)
49 {
50 subsref(retPos,i,j) = subsref(pos,index,j);
51 }
52 }
53
54 for(i=0; i<quat->height; i++)
55 {
56 for(j=0; j<quat->width; j++)
57 {
58 subsref(quat,i,j) = subsref(retQuat,i,j);
59 }
60 }
61
62 for(i=0; i<vel->height; i++)
63 {
64 for(j=0; j<vel->width; j++)
65 {
66 subsref(vel,i,j) = subsref(retVel,i,j);
67 }
68 }
69
70 for(i=0; i<pos->height; i++)
71 {
72 for(j=0; j<pos->width; j++)
73 {
74 subsref(pos,i,j) = subsref(retPos,i,j);
75 }
76 }
77
78 fFreeHandle(retQuat);
79 fFreeHandle(retVel);
80 fFreeHandle(retPos);
81 iFreeHandle(sampleXId);
82
83 return;
84}
85
86
87
88
diff --git a/SD-VBS/benchmarks/localization/src/c/get3DGaussianProb.c b/SD-VBS/benchmarks/localization/src/c/get3DGaussianProb.c
new file mode 100644
index 0000000..58c4475
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/get3DGaussianProb.c
@@ -0,0 +1,49 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* get3DGaussianProb( F2D* data, F2D* mean, F2D* A)
10{
11 F2D *p, *diff, *temp1, *temp2, *mt;
12 float temp;
13 int n_data, n_channel;
14 int i, j, k;
15 F2D* t;
16 float pi = 3.1412;
17
18 n_data = data->height;
19 n_channel = data->width;
20
21 t = fSetArray(n_data, 1, 1);
22
23 mt = fMtimes(t, mean);
24 diff = fMinus( data, mt);
25 p = fSetArray(diff->height, 1, 0);
26
27 temp = sqrt(1.0/(pow(2*pi, n_channel)));
28 temp2 = randWrapper(diff->height,1);
29
30 j = (temp2->height*temp2->width);
31 for(i=0; i<j; i++)
32 {
33 float temp2i;
34 temp2i = asubsref(temp2,i);
35
36 temp2i = exp(-0.5*temp2i);
37 asubsref(p,i) = temp2i*temp;
38 }
39
40 fFreeHandle(t);
41 fFreeHandle(temp2);
42 fFreeHandle(mt);
43 fFreeHandle(diff);
44
45 return p;
46}
47
48
49
diff --git a/SD-VBS/benchmarks/localization/src/c/localization.h b/SD-VBS/benchmarks/localization/src/c/localization.h
new file mode 100644
index 0000000..b2c03bb
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/localization.h
@@ -0,0 +1,24 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#ifndef _LOCALIZATION_
6#define _LOCALIZATION_
7
8#include "sdvbs_common.h"
9
10int script_localization();
11F2D* eul2quat(F2D* angle);
12void generateSample(F2D *w, F2D *quat, F2D *vel, F2D *pos);
13F2D* get3DGaussianProb( F2D* data, F2D* mean, F2D* A);
14F2D* mcl(F2D* x, F2D* sData, F2D* invConv);
15F2D* quat2eul(F2D* quat);
16F2D* quatConj(F2D* a);
17F2D* quatMul(F2D* a, F2D* b);
18F2D* quatRot(F2D* vec, F2D* rQuat);
19F2D* readSensorData(I2D* index, F2D* fid, I2D* type, I2D* eof);
20I2D* weightedSample(F2D* w);
21
22#endif
23
24
diff --git a/SD-VBS/benchmarks/localization/src/c/mcl.c b/SD-VBS/benchmarks/localization/src/c/mcl.c
new file mode 100644
index 0000000..a3c56b6
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/mcl.c
@@ -0,0 +1,34 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* mcl(F2D* x, F2D* sData, F2D* invConv)
10{
11 int i, j;
12 F2D *retW, *retX, *sum;
13 float sumVal;
14
15 retX = fDeepCopy(x);
16 retW = get3DGaussianProb(retX, sData, invConv);
17 sum = fSum(retW);
18 if(sum->height == 1 && sum->width ==1)
19 {
20 sumVal = asubsref(sum,0);
21 for(i=0; i<retW->height; i++)
22 for(j=0; j<retW->width; j++)
23 subsref(retW,i,j) = subsref(retW,i,j)/sumVal;
24 }
25 else
26 retW = fMdivide(retW, sum);
27
28 fFreeHandle(retX);
29 fFreeHandle(sum);
30
31 return retW;
32}
33
34
diff --git a/SD-VBS/benchmarks/localization/src/c/quat2eul.c b/SD-VBS/benchmarks/localization/src/c/quat2eul.c
new file mode 100644
index 0000000..bc581c9
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/quat2eul.c
@@ -0,0 +1,47 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8#include <math.h>
9
10F2D* quat2eul(F2D* quat)
11{
12 F2D *retEul;
13 int i, j, k;
14 int rows, cols;
15
16 rows = quat->height;
17 cols = quat->width;
18
19 retEul = fSetArray(rows, 3, 0);
20
21 for(i=0; i<rows; i++)
22 {
23 float temp, temp1, temp2, temp3, temp4;
24 float quati2, quati3, quati1, quati0;
25
26 quati0 = subsref(quat,i,0);
27 quati1 = subsref(quat,i,1);
28 quati2 = subsref(quat,i,2);
29 quati3 = subsref(quat,i,3);
30
31 temp = 2 *quati2 * quati3 + quati0 * quati1;
32 temp1 = pow(quati0,2) - pow(quati1,2) - pow(quati2,2) + pow(quati3,2);
33 temp2 = -2*quati1 * quati2 + quati0 * quati3;
34 temp3 = 2*quati1 * quati2 + quati0 * quati3;
35 temp4 = pow(quati0,2) + pow(quati1,2) - pow(quati2,2) - pow(quati3,2);
36
37 asubsref(retEul,k++) = atan2(temp, temp1);
38 asubsref(retEul,k++) = asin(temp2);
39 asubsref(retEul,k++) = atan2(temp3, temp4);
40 }
41
42 return retEul;
43}
44
45
46
47
diff --git a/SD-VBS/benchmarks/localization/src/c/quatConj.c b/SD-VBS/benchmarks/localization/src/c/quatConj.c
new file mode 100644
index 0000000..6607186
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/quatConj.c
@@ -0,0 +1,32 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* quatConj(F2D* a)
10{
11 F2D* retQuat;
12 int rows, cols;
13 int i, j, k;
14
15 rows = a->height;
16 cols = a->width;
17 retQuat = fSetArray(rows, 4, 0);
18
19 for(i=0; i<rows; i++)
20 {
21 k=0;
22 subsref(retQuat,i,k++) = subsref(a,i,0);
23 subsref(retQuat,i,k++) = -subsref(a,i,1);
24 subsref(retQuat,i,k++) = -subsref(a,i,2);
25 subsref(retQuat,i,k) = -subsref(a,i,3);
26 }
27
28 return retQuat;
29}
30
31
32
diff --git a/SD-VBS/benchmarks/localization/src/c/quatMul.c b/SD-VBS/benchmarks/localization/src/c/quatMul.c
new file mode 100644
index 0000000..8b8dafe
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/quatMul.c
@@ -0,0 +1,55 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* quatMul(F2D* a, F2D* b)
10{
11 int ra, ca, rb, cb;
12 F2D *ret;
13 int i, j, k=0;
14
15 ra = a->height;
16 ca = a->width;
17
18 rb = b->height;
19 cb = b->width;
20
21 ret = fSetArray(ra, 4, 0);
22
23 j = 0;
24 for(i=0; i<ra; i++)
25 {
26 k = 0;
27 float ai0, ai1, ai2, ai3;
28 float bj0, bj1, bj2, bj3;
29
30 ai0 = subsref(a,i,0);
31 ai1 = subsref(a,i,1);
32 ai2 = subsref(a,i,2);
33 ai3 = subsref(a,i,3);
34
35 bj0 = subsref(b,j,0);
36 bj1 = subsref(b,j,1);
37 bj2 = subsref(b,j,2);
38 bj3 = subsref(b,j,3);
39
40 subsref(ret,i,k++) = ai0*bj0 - ai1*bj1 - ai2*bj2 - ai3*bj3;
41 subsref(ret,i,k++) = ai0*bj1 + ai1*bj0 + ai2*bj3 - ai3*bj2;
42 subsref(ret,i,k++) = ai0*bj2 - ai1*bj3 + ai2*bj0 + ai3*bj1;
43 subsref(ret,i,k++) = ai0*bj3 + ai1*bj2 - ai2*bj1 + ai3*bj0;
44
45 if(rb == ra)
46 j++;
47 }
48
49 return ret;
50}
51
52
53
54
55
diff --git a/SD-VBS/benchmarks/localization/src/c/quatRot.c b/SD-VBS/benchmarks/localization/src/c/quatRot.c
new file mode 100644
index 0000000..4962b55
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/quatRot.c
@@ -0,0 +1,47 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* quatRot(F2D* vec, F2D* rQuat)
10{
11 F2D *ret;
12 int nr, i, j, k, rows, cols;
13 F2D *tv, *vQuat, *temp, *temp1;
14 F2D *retVec;
15
16 nr = vec->height;
17 tv = fSetArray(nr, 1, 0);
18 vQuat = fHorzcat(tv, vec);
19 temp = quatMul(rQuat, vQuat);
20 temp1 = quatConj(rQuat);
21 retVec = quatMul(temp, temp1);
22
23 rows = retVec->height;
24 cols = retVec->width;
25
26 ret = fSetArray(rows, 3, 0);
27
28 for(i=0; i<rows; i++)
29 {
30 k = 0;
31 for(j=1; j<4; j++)
32 {
33 subsref(ret,i,k) = subsref(retVec,i,j);
34 k++;
35 }
36 }
37
38 fFreeHandle(tv);
39 fFreeHandle(vQuat);
40 fFreeHandle(temp);
41 fFreeHandle(temp1);
42 fFreeHandle(retVec);
43
44 return ret;
45}
46
47
diff --git a/SD-VBS/benchmarks/localization/src/c/readSensorData.c b/SD-VBS/benchmarks/localization/src/c/readSensorData.c
new file mode 100644
index 0000000..12c0dc0
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/readSensorData.c
@@ -0,0 +1,63 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* readSensorData(I2D* index, F2D* fid, I2D* type, I2D* eof)
10{
11 F2D *retData;
12 int rows, i, j, k;
13 int atype=-1, aindex;
14
15 aindex = asubsref(index, 0);
16
17 asubsref(index,0) = asubsref(index,0) + 1;
18 rows = fid->height;
19 asubsref(type,0) = 0;
20 retData = fSetArray(1, 8, 0);
21
22 if( asubsref(index,0) > (rows-1) )
23 asubsref(eof,0) = 1;
24 else
25 {
26 if( asubsref(index,0) == rows)
27 asubsref(eof,0) = 1;
28 else
29 asubsref(eof,0) = 0;
30
31 k = asubsref(index,0);
32 atype = subsref(fid, k, 1);
33 if( (atype == 1) || (atype == 2) || (atype == 3) )
34 {
35 for(i=0; i<3; i++)
36 {
37 asubsref(retData,i) = subsref(fid,k,(i+2));
38 }
39 }
40 if( atype == 4 )
41 {
42 for(i=0; i<3; i++)
43 {
44 asubsref(retData,i) = subsref(fid,k,(i+2));
45 }
46 for(i=3; i<8; i++)
47 {
48 asubsref(retData,i) = subsref(fid,k+1,(i-3));
49 }
50 aindex = aindex + 1;
51 }
52 aindex = aindex + 1;
53 }
54
55 asubsref(index,0) = aindex;
56 asubsref(type, 0) = atype;
57
58 return retData;
59}
60
61
62
63
diff --git a/SD-VBS/benchmarks/localization/src/c/script_localization.c b/SD-VBS/benchmarks/localization/src/c/script_localization.c
new file mode 100644
index 0000000..3392320
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/script_localization.c
@@ -0,0 +1,534 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <malloc.h>
8#include "localization.h"
9#include "extra.h"
10#define LOCOLIZATION_MEM 1<<24
11int main(int argc, char* argv[])
12{
13 SET_UP
14 mallopt(M_TOP_PAD, LOCOLIZATION_MEM);
15 mallopt(M_MMAP_MAX, 0);
16 int n, i, j, k, icount=-1;
17 F2D* fid;
18 float gyroTimeInterval=0.01;
19 float acclTimeInterval=0.01;
20
21 float STDDEV_GPSVel=0.5;
22 float STDDEV_ODOVel=0.1;
23 float STDDEV_ACCL=1;
24 float M_STDDEV_GYRO=0.1;
25 float M_STDDEV_POS=0.1;
26 float M_STDDEV_VEL=0.02;
27
28 F2D *pos, *vel;
29 float pi = 3.1416;
30 F2D *eul1, *eul2, *quat;
31 F2D *sData, *gyro, *norm_gyro, *angleAlpha;
32 F2D *quatDelta, *Opos, *temp_STDDEV_GPSPos, *w;
33 F2D *qConj, *orgWorld, *accl, *gtemp;
34 F2D *gravity, *t1;
35 I2D *tStamp, *sType, *isEOF;
36 I2D *index;
37 int rows, cols;
38 F2D *resultMat;
39 F2D *STDDEV_GPSPos;
40 F2D *ones, *randW;
41
42 char im1[100];
43
44 printf("Input txt File: ");
45 scanf("%s", im1);
46
47 fid = readFile(im1);
48
49 n = 1000;
50
51 #ifdef test
52 n = 3;
53 gyroTimeInterval = 0.1;
54 acclTimeInterval = 0.1;
55 M_STDDEV_VEL = 0.2;
56 #endif
57 #ifdef sim_fast
58 n = 3;
59 #endif
60 #ifdef sim
61 n = 10;
62 #endif
63 #ifdef sqcif
64 n = 800;
65 #endif
66 #ifdef qcif
67 n = 500;
68 #endif
69 #ifdef vga
70 n = 2000;
71 #endif
72 #ifdef wuxga
73 n = 3000;
74 #endif
75
76 resultMat = fSetArray(3,fid->height, 0);
77
78 pos = fSetArray(n, 3, 0);
79 vel = fSetArray(n, 3, 0);
80 ones = fSetArray(n,1,1);
81
82
83 F2D *randn;
84
85 randn = randWrapper(n,3);
86 printf("start\n");
87 for_each_job{
88 fResetArray(pos,n, 3, 0);
89 fResetArray(vel,n, 3, 0);
90 fResetArray(ones,n,1,1);
91
92 {
93 int j;
94 for(i=0; i<n; i++)
95 for(j=0; j<3; j++)
96 subsref(vel, i, j) += subsref(randn,i,j) * STDDEV_ODOVel;
97
98 }
99
100
101
102 {
103 F2D *eulAngle, *randn;
104 eulAngle = fSetArray(n, 3, 0);
105 randn = randWrapper(n,1);
106
107 for(i=0; i<n; i++)
108 {
109 subsref(eulAngle, i, 2) = subsref(randn, i, 0) * 2 * pi;
110 }
111
112 eul1 = eul2quat(eulAngle);
113 fFreeHandle(eulAngle);
114
115 eulAngle = fSetArray(1, 3, 0);
116 subsref(eulAngle, 0, 0) = pi;
117 eul2 = eul2quat(eulAngle);
118
119 fFreeHandle(randn);
120 fFreeHandle(eulAngle);
121 }
122
123 quat = quatMul(eul1, eul2);
124 fFreeHandle(eul1);
125 fFreeHandle(eul2);
126
127 i=0;
128 index = iSetArray(1,1,-1);
129 sType = iSetArray(1,1,-1);
130 isEOF = iSetArray(1,1,-1);
131
132
133 rows =0;
134 cols = 5;
135 STDDEV_GPSPos = fSetArray(3,3,0);
136 randW = randnWrapper(n,3);
137 icount=-1;
138 while(1)
139 {
140 icount=icount+1;
141
142 /*
143 S = 4
144 A = 3
145 G = 2
146 V = 1
147 */
148
149 sData = readSensorData(index, fid, sType, isEOF);
150 rows++;
151
152
153
154 if( asubsref(sType,0) ==2)
155 {
156
157 //Motion model
158
159 {
160 int i;
161 F2D *t, *t1;
162 F2D *abc, *abcd;
163 int qD_r=0, qD_c=0;
164 F2D *cosA, *sinA;
165
166 t = fDeepCopyRange(sData, 0, 1, 0, 3);
167 gyro = fMtimes(ones, t);
168 abc = fMallocHandle(gyro->height, gyro->width);
169 t1 = fDeepCopy(randW);
170
171 for(i=0; i<(n*3); i++)
172 {
173 asubsref(t1,i) = asubsref(randW,i) * M_STDDEV_GYRO;
174 asubsref(gyro, i) += asubsref(t1,i);
175 asubsref(abc, i) = pow(asubsref(gyro, i), 2);
176 }
177 fFreeHandle(t1);
178 abcd = fSum2(abc, 2);
179
180 norm_gyro = fMallocHandle(abcd->height,abcd->width);
181 angleAlpha = fMallocHandle(abcd->height, abcd->width);
182
183 for(i=0; i<(abcd->height*abcd->width); i++)
184 {
185 asubsref(norm_gyro, i) = sqrt(asubsref(abcd,i));
186 asubsref(angleAlpha,i) = asubsref(norm_gyro,i) * gyroTimeInterval;
187 }
188
189 qD_r += angleAlpha->height + gyro->height;
190 qD_c += angleAlpha->width + 3;
191
192 fFreeHandle(t);
193 fFreeHandle(abcd);
194
195 cosA = fSetArray(angleAlpha->height, angleAlpha->width, 0);
196 sinA = fSetArray(angleAlpha->height, angleAlpha->width, 0);
197
198 for(i=0; i<(cosA->height*cosA->width); i++)
199 asubsref(cosA,i) = cos( asubsref(angleAlpha,i) /2 );
200
201 for(i=0; i<(sinA->height*sinA->width); i++)
202 asubsref(sinA,i) = sin( asubsref(angleAlpha,i) /2 );
203
204
205 fFreeHandle(abc);
206 abc = fSetArray(1,3,1);
207 t1 = fMtimes(norm_gyro, abc);
208 t = ffDivide(gyro, t1);
209 fFreeHandle(t1);
210
211 abcd = fMtimes(sinA, abc);
212 t1 = fTimes(t, abcd);
213 quatDelta = fHorzcat(cosA, t1);
214
215 fFreeHandle(abcd);
216 fFreeHandle(t);
217 fFreeHandle(t1);
218 fFreeHandle(abc);
219
220 t = quatMul(quat, quatDelta);
221 fFreeHandle(quat);
222 fFreeHandle(quatDelta);
223 quat = fDeepCopy(t);
224
225 fFreeHandle(t);
226 fFreeHandle(norm_gyro);
227 fFreeHandle(gyro);
228 fFreeHandle(angleAlpha);
229 fFreeHandle(cosA);
230 fFreeHandle(sinA);
231
232 }
233 }
234
235 if( asubsref(sType,0) ==4)
236 {
237 //Observation
238
239 float tempSum=0;
240 F2D *Ovel;
241 float OvelNorm;
242 int i;
243
244
245 asubsref(STDDEV_GPSPos, 0) = asubsref(sData, 6);
246 asubsref(STDDEV_GPSPos, 4) = asubsref(sData,7);
247 asubsref(STDDEV_GPSPos, 8) = 15;
248
249 Opos = fDeepCopyRange(sData, 0, 1, 0, 3);
250
251 //Initialize
252
253 for(i=0; i<(pos->height*pos->width); i++)
254 tempSum += asubsref(pos,i);
255
256 if(tempSum == 0)
257 {
258 F2D *t, *t1;
259 t = fMtimes( randW, STDDEV_GPSPos);
260 t1 = fMtimes(ones, Opos);
261
262 for(i=0; i<(pos->height*pos->width); i++)
263 asubsref(pos,i) = asubsref(t,i) + asubsref(t1,i);
264
265 fFreeHandle(t);
266 fFreeHandle(t1);
267 }
268 else
269 {
270 int rows, cols;
271 int mnrows, mncols;
272
273 rows = STDDEV_GPSPos->height;
274 cols = STDDEV_GPSPos->width;
275
276 temp_STDDEV_GPSPos = fSetArray(rows,cols,1);
277 for( mnrows=0; mnrows<rows; mnrows++)
278 {
279 for( mncols=0; mncols<cols; mncols++)
280 {
281 subsref(temp_STDDEV_GPSPos,mnrows,mncols) = pow(subsref(STDDEV_GPSPos,mnrows,mncols),-1);
282 }
283 }
284
285 w = mcl(pos, Opos , temp_STDDEV_GPSPos);
286 generateSample(w, quat, vel, pos);
287 }
288 fFreeHandle(Opos);
289
290 //compare direction
291 Ovel = fDeepCopyRange(sData, 0, 1, 3, 3);
292 OvelNorm=2;//1.1169e+09;
293
294 if (OvelNorm>0.5)
295 {
296 F2D *t;
297 t = fDeepCopy(Ovel);
298 fFreeHandle(Ovel);
299 /* This is a double precision division */
300 Ovel = fDivide(t, OvelNorm);
301 qConj = quatConj(quat);
302 fFreeHandle(t);
303
304 {
305 t = fSetArray(1,3,0);
306 subsref(t,0,0) = 1;
307 orgWorld = quatRot(t, qConj);
308 fFreeHandle(t);
309 fFreeHandle(qConj);
310 t = fSetArray(3,3,0);
311 asubsref(t,0) = 1;
312 asubsref(t,4) = 1;
313 asubsref(t,8) = 1;
314
315 {
316 int i;
317 for(i=0; i<(t->height*t->width); i++)
318 asubsref(t, i) = asubsref(t,i)/STDDEV_GPSVel;
319 w = mcl( orgWorld, Ovel, t);
320 generateSample(w, quat, vel, pos);
321 }
322
323 fFreeHandle(t);
324 fFreeHandle(w);
325 fFreeHandle(orgWorld);
326 }
327 }
328 fFreeHandle(Ovel);
329 }
330
331 if( asubsref(sType,0) ==1)
332 {
333 //Observation
334 F2D *Ovel;
335 F2D *t, *t1, *t2;
336 float valVel;
337
338 t = fSetArray(vel->height, 1, 0);
339
340 for(i=0; i<vel->height; i++)
341 {
342 subsref(t,i,0) = sqrt(pow(subsref(vel,i,0),2) + pow(subsref(vel,i,1),2) + pow(subsref(vel,i,2),2));
343 }
344
345 Ovel = fSetArray(1, 1, asubsref(sData,0));
346 valVel = 1.0/STDDEV_ODOVel;
347
348 t1 = fSetArray(1,1,(1.0/STDDEV_ODOVel));
349 w = mcl (t, Ovel, t1);
350 generateSample(w, quat, vel, pos);
351
352
353 fFreeHandle(w);
354 fFreeHandle(t);
355 fFreeHandle(t1);
356 fFreeHandle(Ovel);
357 }
358
359 if( asubsref(sType,0) ==3)
360 {
361 //Observation
362 F2D *t;
363 t = fSetArray(1, 3, 0);
364 asubsref(t,2) = -9.8;
365
366 accl = fDeepCopyRange(sData, 0, 1, 0, 3);
367 gtemp = fMtimes( ones, t);
368 gravity = quatRot(gtemp, quat);
369
370 fFreeHandle(gtemp);
371 fFreeHandle(t);
372 t = fSetArray(3,3,0);
373 asubsref(t,0) = 1;
374 asubsref(t,4) = 1;
375 asubsref(t,8) = 1;
376
377 {
378 int i;
379 for(i=0; i<(t->height*t->width); i++)
380 asubsref(t,i) = asubsref(t,i)/STDDEV_ACCL;
381 w = mcl( gravity, accl, t);
382 }
383
384 generateSample(w, quat, vel, pos);
385 fFreeHandle(t);
386 //Motion model
387 t = fMtimes(ones, accl);
388 fFreeHandle(accl);
389
390 accl = fMinus(t, gravity);
391
392 fFreeHandle(w);
393 fFreeHandle(gravity);
394 fFreeHandle(t);
395
396 {
397 //pos=pos+quatRot(vel,quatConj(quat))*acclTimeInterval+1/2*quatRot(accl,quatConj(quat))*acclTimeInterval^2+randn(n,3)*M_STDDEV_POS;
398
399 F2D *s, *is;
400 int i;
401 is = quatConj(quat);
402 s = quatRot(vel, is);
403 fFreeHandle(is);
404
405 for(i=0; i<(s->height*s->width); i++)
406 {
407 asubsref(s,i) = asubsref(s,i)*acclTimeInterval; //+(1/2);
408 }
409 is = fPlus(pos, s);
410 fFreeHandle(pos);
411 pos = fDeepCopy(is);
412 fFreeHandle(is);
413 fFreeHandle(s);
414
415 /** pos_ above stores: pos+quatRot(vel,quatConj(quat))*acclTimeInterval **/
416
417 is = quatConj(quat);
418 s = quatRot(accl, is);
419 t = fDeepCopy(s);
420 for(i=0; i<(s->height*s->width); i++)
421 {
422 asubsref(t,i) = 1/2*asubsref(s,i)*acclTimeInterval*acclTimeInterval;
423 }
424
425 /** t_ above stores: 1/2*quatRot(accl,quatCong(quat))*acclTimeInterval^2 **/
426
427 fFreeHandle(s);
428 fFreeHandle(is);
429 s = randnWrapper(n,3);
430
431 for(i=0; i<(s->height*s->width); i++)
432 {
433 asubsref(s,i) = asubsref(s,i) * M_STDDEV_POS;
434 }
435
436 /** s_ above stores: randn(n,3)*M_STDDEV_POS **/
437
438 is = fPlus(pos, t);
439 fFreeHandle(pos);
440 pos = fPlus(is, s);
441
442 fFreeHandle(s);
443 fFreeHandle(t);
444 fFreeHandle(is);
445
446 // vel=vel+accl*acclTimeInterval+randn(n,3)*M_STDDEV_VEL; %??
447
448 t = fDeepCopy(accl);
449 for(i=0; i<(accl->height*accl->width); i++)
450 asubsref(t,i) = asubsref(accl,i) * acclTimeInterval;
451
452 is = fPlus(vel, t);
453
454 fFreeHandle(accl);
455 fFreeHandle(t);
456 s = randnWrapper(n,3);
457 for(i=0; i<(s->height*s->width); i++)
458 {
459 asubsref(s,i) = asubsref(s,i) * M_STDDEV_VEL;
460 }
461
462 fFreeHandle(vel);
463 vel = fPlus(is, s);
464 fFreeHandle(is);
465 fFreeHandle(s);
466 }
467
468 }
469
470 // Self check
471 {
472 F2D* temp;
473 float quatOut=0, velOut=0, posOut=0;
474 int i;
475
476 for(i=0; i<(quat->height*quat->width); i++)
477 quatOut += asubsref(quat, i);
478
479 for(i=0; i<(vel->height*vel->width); i++)
480 velOut += asubsref(vel, i);
481
482 for(i=0; i<(pos->height*pos->width); i++)
483 posOut += asubsref(pos, i);
484
485 subsref(resultMat,0,icount) = quatOut;
486 subsref(resultMat,1,icount) = velOut;
487 subsref(resultMat,2,icount) = posOut;
488 }
489
490 fFreeHandle(sData);
491
492
493 if (asubsref(isEOF,0) == 1)
494 break;
495 }
496 }
497 printf("end..\n");
498
499#ifdef CHECK
500
501 // Self checking - use expected.txt from data directory
502 {
503 int ret=0;
504 float tol = 2.0;
505#ifdef GENERATE_OUTPUT
506 fWriteMatrix(resultMat, argv[1]);
507#endif
508 ret = fSelfCheck(resultMat, "./expected_C.txt", tol);
509 if (ret == -1)
510 printf("Error in Localization\n");
511 }
512 // Self checking done
513#endif
514
515
516 fFreeHandle(STDDEV_GPSPos);
517 iFreeHandle(index);
518 iFreeHandle(sType);
519 iFreeHandle(isEOF);
520 fFreeHandle(fid);
521 fFreeHandle(resultMat);
522 fFreeHandle(pos);
523 fFreeHandle(vel);
524 fFreeHandle(quat);
525 fFreeHandle(ones);
526 fFreeHandle(randW);
527 fFreeHandle(randn);
528 WRITE_TO_FILE
529 return 0;
530
531}
532
533
534
diff --git a/SD-VBS/benchmarks/localization/src/c/weightedSample.c b/SD-VBS/benchmarks/localization/src/c/weightedSample.c
new file mode 100644
index 0000000..28099e8
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/c/weightedSample.c
@@ -0,0 +1,37 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <math.h>
8#include "localization.h"
9
10I2D* weightedSample(F2D* w)
11{
12 I2D *bin;
13 F2D *seed;
14 int n, i, j;
15
16 n = w->height;
17 seed = randWrapper(n, 1);
18 bin = iSetArray(n, 1, 0);
19
20 for(i=0; i<n; i++)
21 {
22 for(j=0; j<n; j++)
23 {
24 if(asubsref(seed,j) > 0)
25 asubsref(bin,j) = asubsref(bin,j) + 1;
26 }
27 for(j=0; j<n; j++)
28 asubsref(seed,j) = asubsref(seed,j) - asubsref(w,i);
29 }
30
31 free(seed);
32 return bin;
33}
34
35
36
37
diff --git a/SD-VBS/benchmarks/localization/src/matlab/addEulNoise.m b/SD-VBS/benchmarks/localization/src/matlab/addEulNoise.m
new file mode 100644
index 0000000..3d2ac76
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/addEulNoise.m
@@ -0,0 +1,12 @@
1function retQuat=addEulNoise(quat, STD)
2n=size(quat,1);
3
4% KVS: replacing randnWrapper(n,3) with rand(n,3)
5gyro=randnWrapper(n,3)*STD;
6
7norm_gyro=sqrt(sum(gyro.^2,2));
8angleAlpha=norm_gyro;
9quatDelta=[cos(angleAlpha/2), gyro./(norm_gyro*ones(1,3)).*(sin(angleAlpha/2)*ones(1,3))];
10
11retQuat=quatMul(quat, quatDelta);
12
diff --git a/SD-VBS/benchmarks/localization/src/matlab/calculate3DGaussian.m b/SD-VBS/benchmarks/localization/src/matlab/calculate3DGaussian.m
new file mode 100644
index 0000000..060713a
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/calculate3DGaussian.m
@@ -0,0 +1,11 @@
1function [meanColor A]=calculate3DGaussian(data)
2n_data=size(data,1);
3n_channel=size(data,2);
4meanColor=mean(data);
5diff=double(data)-ones(n_data,1)*meanColor;
6diifTr = transpose(diff);
7Ainv=(diffTr*diff/n_data);
8AinvTr = transpose(Ainv);
9A=inv(AinvTr);
10
11
diff --git a/SD-VBS/benchmarks/localization/src/matlab/drawLog.m b/SD-VBS/benchmarks/localization/src/matlab/drawLog.m
new file mode 100644
index 0000000..f88e078
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/drawLog.m
@@ -0,0 +1,44 @@
1function drawLog(data, ground_data)
2subplot(1,3,1);
3[nr nc]=size(data);
4for i=1:nr
5 x=data(i,2);
6 y=data(i,3);
7 z=data(i,4);
8 R=[1 0 0; 0 cos(x) sin(x); 0 -sin(x) cos(x)]...
9 *[cos(y) 0 -sin(y); 0 1 0; sin(y) 0 cos(y)]...
10 *[cos(z) sin(z) 0; -sin(z) cos(z) 0; 0 0 1];
11 coord=R*[1 0 0]';
12 axis([-1 1 -1 1 -1 1]);axis on
13 plot3([0 coord(1)], [0 coord(2)], [0 coord(3)], 'b'); hold on
14end
15
16[nr nc]=size(ground_data);
17for i=1:nr
18x=ground_data(i,2);
19y=ground_data(i,3);
20z=ground_data(i,4);
21R=[1 0 0; 0 cos(x) sin(x); 0 -sin(x) cos(x)]...
22 *[cos(y) 0 -sin(y); 0 1 0; sin(y) 0 cos(y)]...
23 *[cos(z) sin(z) 0; -sin(z) cos(z) 0; 0 0 1];
24coord=R*[1 0 0]';
25coord2=R*[0 -1 0]';
26axis([-1 1 -1 1 -1 1]);axis on
27plot3([0 coord(1)], [0 coord(2)], [0 coord(3)], 'r'); hold on
28plot3([0 coord2(1)], [0 coord2(2)], [0 coord2(3)], 'g');
29end
30
31xlabel('x');
32ylabel('y');
33zlabel('z');
34hold off
35drawnow
36subplot(1,3,2);
37Xoffset=4422610;
38Yoffset=483660;
39axis([4422610-Xoffset 4422660-Xoffset 483620-Yoffset 483720-Yoffset]);axis on
40scatter(data(:,5)-Xoffset, data(:,6)-Yoffset, 8, 'b'); hold on
41axis([4422610-Xoffset 4422660-Xoffset 483620-Yoffset 483720-Yoffset]);axis on
42scatter(ground_data(:,5)-Xoffset, ground_data(:,6)-Yoffset, 10, 'r'); hold off
43drawnow
44
diff --git a/SD-VBS/benchmarks/localization/src/matlab/eul2quat.m b/SD-VBS/benchmarks/localization/src/matlab/eul2quat.m
new file mode 100644
index 0000000..57001a8
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/eul2quat.m
@@ -0,0 +1,9 @@
1function retQuat=eul2quat(eulAngle)
2x=eulAngle(:,1);
3y=eulAngle(:,2);
4z=eulAngle(:,3);
5retQuat=[cos(x/2).*cos(y/2).*cos(z/2)+sin(x/2).*sin(y/2).*sin(z/2) ...
6 sin(x/2).*cos(y/2).*cos(z/2)-cos(x/2).*sin(y/2).*sin(z/2) ...
7 cos(x/2).*sin(y/2).*cos(z/2)+sin(x/2).*cos(y/2).*sin(z/2) ...
8 cos(x/2).*cos(y/2).*sin(z/2)-sin(x/2).*sin(y/2).*cos(z/2)];
9
diff --git a/SD-VBS/benchmarks/localization/src/matlab/generateSample.m b/SD-VBS/benchmarks/localization/src/matlab/generateSample.m
new file mode 100644
index 0000000..f3658f8
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/generateSample.m
@@ -0,0 +1,25 @@
1function [retQuat retVel retPos]=generateSample(w, quat, vel, pos, STDDEV_VEL, STDDEV_POS)
2sampledXId=weightedSample(w);
3
4rows = size(sampledXId, 1);
5cols = size(sampledXId, 2);
6
7if(cols > 1)
8 disp(123456);
9end
10
11% retQuat = zeros(rows, 1);
12% retVel = zeros(rows, 1);
13% retPos = zeros(rows, 1);
14
15% for i=1:rows
16% retQuat(i,1) = quat(sampleXId(i,1),1);
17% retVel(i,1) = vel(sampleXId(i,1),1) + randnWrapper(1,1) * STDDEV_VEL;
18% retPos(i,1) = pos(sampleXId(i,1),1) + randnWrapper(1,1) * STDDEV_POS;
19% end
20
21retQuat=quat(sampledXId,:);
22retVel=vel(sampledXId,:);%+randnWrappern(n,3)*STDDEV_VEL;
23retPos=pos(sampledXId,:);%+randnWrappern(n,3)*STDDEV_POS;
24
25
diff --git a/SD-VBS/benchmarks/localization/src/matlab/get3DGaussianProb.m b/SD-VBS/benchmarks/localization/src/matlab/get3DGaussianProb.m
new file mode 100644
index 0000000..6a54530
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/get3DGaussianProb.m
@@ -0,0 +1,22 @@
1function p=get3DGaussianProb(data, mean, A)
2n_data=size(data,1);
3n_channel=size(data,2);
4
5p=zeros(n_data,1);
6diff=(data)-ones(n_data,1)*mean;
7detA = 1; %detA = det(A)
8dotA = randWrapper(size(diff,1),1); %dotA = dot(diff*A, diff, 2)
9p=sqrt(detA/((2*pi)^n_channel))*exp(-0.5*dotA);
10
11%% KVS If the above doesnt work, try uncommenting these lines below
12
13%%temp = (det(A)/((2*pi)^n_channel));
14%temp = (1.0/((2*pi)^n_channel));
15%temp1 = dot(diff*A,diff,2);
16%%temp1 = rand(1000,1);
17%temp2 = exp(-0.5*temp1);
18%p = sqrt(temp) * exp(temp2);
19%
20
21
22
diff --git a/SD-VBS/benchmarks/localization/src/matlab/getGroundData.m b/SD-VBS/benchmarks/localization/src/matlab/getGroundData.m
new file mode 100644
index 0000000..7cf5f9c
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/getGroundData.m
@@ -0,0 +1,5 @@
1function retData=getGroundData(data, tStamp)
2idx=find(data(:,1)==tStamp);
3retData=data(idx,:);
4
5
diff --git a/SD-VBS/benchmarks/localization/src/matlab/mcl.m b/SD-VBS/benchmarks/localization/src/matlab/mcl.m
new file mode 100644
index 0000000..8ab8aa6
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/mcl.m
@@ -0,0 +1,9 @@
1function [retX, retW]=mcl(x,sData, invCov)
2%instead of using importance resampling, I assumed 3D gaussian for each
3%particle
4%retX=x+randn(nr,nc)*(invCov^-1); %add noise
5retX=x;
6retW=get3DGaussianProb(retX, sData, invCov);
7retW=retW/sum(retW);
8
9
diff --git a/SD-VBS/benchmarks/localization/src/matlab/mclWhole.m b/SD-VBS/benchmarks/localization/src/matlab/mclWhole.m
new file mode 100644
index 0000000..4e78b8f
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/mclWhole.m
@@ -0,0 +1,18 @@
1function retW=mclWhole(quat, Ovel, STDDEV_GPSVel, accl, STDDEV_ACCL)
2n=size(quat,1);
3OvelNorm=norm(Ovel);
4if (OvelNorm>0.5)
5 Ovel=Ovel/norm(Ovel);
6 %trick
7 %quat=addEulNoise(quat, STDDEV_GPSVel);
8 orgWorld=quatRot([1 0 0],quatConj(quat));
9 p1=get3DGaussianProb(orgWorld, Ovel, eye(3)./STDDEV_GPSVel);
10else
11 p1=zeros(n,1);
12end
13
14gravity=quatRot(ones(n,1)*[0 0 -9.8], quat);
15p2=get3DGaussianProb(gravity, accl, eye(3)./(STDDEV_ACCL));
16retW=p1+p2;
17retW=retW/sum(retW);
18 \ No newline at end of file
diff --git a/SD-VBS/benchmarks/localization/src/matlab/quat2eul.m b/SD-VBS/benchmarks/localization/src/matlab/quat2eul.m
new file mode 100644
index 0000000..a6b48ee
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/quat2eul.m
@@ -0,0 +1,6 @@
1function retEul=quat2eul(quat)
2retEul=[atan2(2*(quat(:,3).*quat(:,4)+quat(:,1).*quat(:,2))...
3 ,(quat(:,1).^2 -quat(:,2).^2 -quat(:,3).^2 +quat(:,4).^2)) ...
4 asin(-2*(quat(:,2).*quat(:,4)-quat(:,1).*quat(:,3))) ...
5 atan2(2*(quat(:,2).*quat(:,3)+quat(:,1).*quat(:,4))...
6 ,(quat(:,1).^2 +quat(:,2).^2 -quat(:,3).^2 -quat(:,4).^2))];
diff --git a/SD-VBS/benchmarks/localization/src/matlab/quatConj.m b/SD-VBS/benchmarks/localization/src/matlab/quatConj.m
new file mode 100644
index 0000000..ff494b4
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/quatConj.m
@@ -0,0 +1,5 @@
1function retQuat=quatConj(a)
2rows = size(a,1);
3retQuat = zeros(rows, 4);
4retQuat=[a(:,1), -a(:,2), -a(:,3), -a(:,4)];
5
diff --git a/SD-VBS/benchmarks/localization/src/matlab/quatMul.m b/SD-VBS/benchmarks/localization/src/matlab/quatMul.m
new file mode 100644
index 0000000..b397554
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/quatMul.m
@@ -0,0 +1,18 @@
1function retQuat=quatMul(a, b)
2
3rowsa = size(a,1);
4colsa = size(a,2);
5
6rowsb = size(b,1);
7colsb = size(b,2);
8
9retQuat=[a(:,1).*b(:,1) - a(:,2).*b(:,2) - a(:,3).*b(:,3) - a(:,4).*b(:,4) ...
10 a(:,1).*b(:,2) + a(:,2).*b(:,1) + a(:,3).*b(:,4) - a(:,4).*b(:,3) ...
11 a(:,1).*b(:,3) - a(:,2).*b(:,4) + a(:,3).*b(:,1) + a(:,4).*b(:,2) ...
12 a(:,1).*b(:,4) + a(:,2).*b(:,3) - a(:,3).*b(:,2) + a(:,4).*b(:,1)];
13
14% disp('retQuat');
15% disp(retQuat);
16
17
18
diff --git a/SD-VBS/benchmarks/localization/src/matlab/quatRot.m b/SD-VBS/benchmarks/localization/src/matlab/quatRot.m
new file mode 100644
index 0000000..3688172
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/quatRot.m
@@ -0,0 +1,24 @@
1function ret=quatRot(vec, rQuat)
2nr=size(vec,1);
3tv = zeros(nr,1);
4vQuat=[tv, vec];
5temp = quatMul(rQuat, vQuat);
6temp1 = quatConj(rQuat);
7retVec = quatMul(temp, temp1);
8%retVec=quatMul(quatMul(rQuat, vQuat),quatConj(rQuat));
9%ret=retVec(:,2:4);
10rows = size(retVec, 1);
11ret = zeros(rows,3);
12
13for i=1:rows
14 k =1;
15 for j=2:4
16 ret(i,k) = retVec(i,j);
17 k = k+1;
18 end
19end
20%size(ret)
21
22
23
24
diff --git a/SD-VBS/benchmarks/localization/src/matlab/readLoc.m b/SD-VBS/benchmarks/localization/src/matlab/readLoc.m
new file mode 100644
index 0000000..fc679d4
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/readLoc.m
@@ -0,0 +1,53 @@
1function out = readLoc
2out = [...
310.512346 3.466955 9.006616 ;...
413.242645 4.280358 14.675757 ;...
512.418589 6.286052 22.721924 ;...
613.598760 5.229711 19.622804 ;...
713.568058 5.229711 19.622804 ;...
813.537888 5.229711 19.622804 ;...
913.508315 5.229711 19.622804 ;...
1013.479378 5.229711 19.622804 ;...
1113.450420 5.229711 19.622804 ;...
1213.345976 7.607621 29.644342 ;...
1313.500197 7.803792 32.248338 ;...
1413.354279 10.248983 42.939018 ;...
1513.500197 10.442337 45.593042 ;...
1613.354279 12.925516 56.404386 ;...
1713.700372 10.538259 47.007521 ;...
1813.669945 10.538259 47.007521 ;...
1913.640058 10.538259 47.007521 ;...
2013.608179 10.538259 47.007521 ;...
2113.576901 10.538259 47.007521 ;...
2213.545771 10.538259 47.007521 ;...
2313.731515 12.682360 55.887526 ;...
241.016192 12.058634 55.442021 ;...
256.263918 15.094210 64.436498 ;...
266.263918 18.208480 70.198939 ;...
276.263918 20.848498 78.618094 ;...
286.263918 23.887747 84.333007 ;...
296.263918 22.065907 78.853015 ;...
306.237774 22.065907 78.853015 ;...
316.211166 22.065907 78.853015 ;...
326.183471 22.065907 78.853015 ;...
336.155114 22.065907 78.853015 ;...
346.126730 22.065907 78.853015 ;...
356.154098 26.480108 89.543387 ;...
366.168298 28.571946 93.679254 ;...
376.157243 32.868572 105.963003 ;...
386.155032 35.245287 110.401650 ;...
396.155032 38.531472 119.557291 ;...
406.155032 36.849296 111.296948 ;...
416.128369 36.849296 111.296948 ;...
426.101609 36.849296 111.296948 ;...
436.073750 36.849296 111.296948 ;...
446.046859 36.849296 111.296948 ;...
456.019815 36.849296 111.296948 ;...
466.046273 40.863016 123.894104 ;...
476.060599 43.054591 127.680881 ;...
486.049203 47.179478 140.858302 ;...
496.046924 49.530293 145.484328 ;...
506.046924 52.526113 153.189673 ;...
516.046924 51.113294 146.241709 ;...
526.021072 51.113294 146.241709 ...
53]; \ No newline at end of file
diff --git a/SD-VBS/benchmarks/localization/src/matlab/readMatrix.m b/SD-VBS/benchmarks/localization/src/matlab/readMatrix.m
new file mode 100644
index 0000000..fe684c5
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/readMatrix.m
@@ -0,0 +1,28 @@
1function readMatrix(srcImage, outName)
2
3write = fopen([outName '.m'], 'w');
4
5count = fwrite(write, 'function out = ');
6count = fwrite(write, outName);
7fprintf(write, '\n');
8count = fwrite(write, 'out = [...');
9fprintf(write, '\n');
10
11height = size(srcImage,1);
12width = size(srcImage,2);
13
14for nI=1:height
15 for nJ=1:width
16 fprintf(write, '%f ', srcImage(nI,nJ));
17 end
18 if(nI < height)
19 fprintf(write, ';...\n');
20 end
21end
22
23fprintf(write, '...\n');
24count = fwrite(write, '];');
25
26fclose(write);
27
28end
diff --git a/SD-VBS/benchmarks/localization/src/matlab/readSensorData.m b/SD-VBS/benchmarks/localization/src/matlab/readSensorData.m
new file mode 100644
index 0000000..e84a6db
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/readSensorData.m
@@ -0,0 +1,46 @@
1function [retTStamp, retType, retData, retEOF, index]=readSensorData(index1, fid)
2
3index = index1+1;
4rows = size(fid, 1);
5retTStamp = 0;
6retType = 0;
7retData = zeros(1,8);
8
9if(index > rows)
10 retEOF = 1;
11else
12% for i=index:rows
13% index = i;
14% if(fid(i,2) == 4)
15% break;
16% end
17% end
18 if(index == rows)
19 retEOF = 1;
20 else
21 retEOF = 0;
22 end
23
24 k = index;
25 retTStamp=fid(k,1);
26 retType=fid(k,2);
27 if(fid(k, 2) == 1 || fid(k, 2) == 2 || fid(k, 2) == 3)
28 index = k;
29 for i=1:3
30 retData(1,i)=fid(k,i+2);
31% fprintf(1,'retData,i -> %f\t%d\n', retData(1,i), i);
32 end
33 end
34 if(fid(k, 2) == 4)
35 index = k;
36 for i=1:3
37 retData(1,i)=fid(k,i+2);
38% fprintf(1,'retData,i -> %f\t%d\n', retData(1,i), i);
39 end
40 for i=4:8
41 retData(1,i) = fid(k+1,i-3);
42% fprintf(1,'retData,i -> %f\t%d\n', retData(1,i), i);
43 end
44 index = index + 1;
45 end
46end
diff --git a/SD-VBS/benchmarks/localization/src/matlab/script_run_profile.m b/SD-VBS/benchmarks/localization/src/matlab/script_run_profile.m
new file mode 100644
index 0000000..44ce3aa
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/script_run_profile.m
@@ -0,0 +1,209 @@
1function script_run_profile(dataDir, resultDir, type, common, toolDir)
2
3path(path, common);
4file = fopen([dataDir, '/1.txt'], 'r');
5full = fscanf(file,'%f');
6elapsed = zeros(1,2);
7
8rows = full(2);
9cols = full(1);
10fid = zeros(rows, cols);
11
12k = 3;
13for i=1:rows
14 for j =1:cols
15 fid(i,j) = full(k);
16 k = k+1;
17 end
18end
19
20fclose(file);
21
22n=1000;
23
24gyroTimeInterval=0.01;
25acclTimeInterval=0.01;
26
27STDDEV_GPSVel=0.5;
28
29STDDEV_ODOVel=0.1;
30STDDEV_ACCL=1;
31M_STDDEV_GYRO=0.1;
32M_STDDEV_POS=0.1;
33M_STDDEV_VEL=0.02;
34
35if(strcmp(type,'test'))
36 n = 3;
37 gyroTimeInterval = 0.1;
38 acclTimeInterval = 0.1;
39 M_STDDEV_VEL = 0.2;
40
41elseif(strcmp(type, 'sim_fast'))
42 n = 3;
43elseif(strcmp(type, 'sim'))
44 n = 10;
45elseif(strcmp(type, 'sqcif'))
46 n = 800;
47elseif(strcmp(type, 'qcif'))
48 n = 500;
49elseif(strcmp(type, 'vga'))
50 n = 2000;
51elseif(strcmp(type, 'wuxga'))
52 n = 3000;
53end
54
55fprintf(1,'Input size\t\t- (%dx%dx%d)\n', rows, cols,n);
56pos=zeros(n,3);
57
58vel=zeros(n,3) + randWrapper(n,3)*STDDEV_ODOVel;
59pi = 3.1416;
60
61eul1 = eul2quat([zeros(n,2), randWrapper(n,1)*2*pi]);
62eul2 = eul2quat([pi, 0, 0]);
63quat=quatMul(eul1, eul2);
64
65i=0;
66index = 0;
67resultMat = zeros(3,rows);
68
69while 1
70 i=i+1;
71 [tStamp, sType, sData, isEOF, index] = readSensorData(index, fid);
72
73 start = photonStartTiming;
74
75 if(sType==2)
76
77
78 %Motion model
79 gyro = sData(1, 1:3);
80 randnWrapper_mat = randnWrapper(n,3); % KVS: We do not have function implementation for randnWrapper()
81 gyro=ones(n,1)*gyro+randnWrapper_mat*M_STDDEV_GYRO;
82
83 abc = gyro.^2;
84 abcd = sumCol(abc);
85 norm_gyro = sqrt(abcd);
86% norm_gyro=sqrt(sum(gyro.^2,2));
87 angleAlpha=norm_gyro*gyroTimeInterval;
88 quatDelta=[cos(angleAlpha/2), gyro./(norm_gyro*ones(1,3)+0.00000001).*(sin(angleAlpha/2)*ones(1,3))];
89 quat=quatMul(quat, quatDelta);
90
91 end
92
93 if(sType==4)
94 %Observation
95 STDDEV_GPSPos=[sData(1,7), 0, 0; 0, sData(1,8), 0; 0, 0, 15];
96 Opos=sData(1,1:3);
97
98 %Initialize
99
100 randnWrapper_mat = randnWrapper(n,3);
101 if sum(sum(pos))==0
102 pos=ones(n,1) * Opos + randnWrapper_mat*STDDEV_GPSPos;
103 else
104 rows = size(STDDEV_GPSPos, 1);
105 cols = size(STDDEV_GPSPos, 2);
106
107 temp_STDDEV_GPSPos = ones(rows,cols);
108 for mnrows=1:rows % KVS" Photon rejects this loop becasue of too many nestings ??
109 for mncols=1:cols
110 temp_STDDEV_GPSPos(mnrows, mncols) = power(STDDEV_GPSPos(mnrows,mncols),-1);
111 end
112 end
113 [temp, w]=mcl(pos, Opos , temp_STDDEV_GPSPos);
114 [quat, vel, pos]=generateSample(w, quat, vel, pos, M_STDDEV_VEL, M_STDDEV_POS);
115 end
116
117 %compare direction
118 Ovel=sData(1,4:6);
119
120% KVS: We do not have function for norm() yet! So replacing this operating with OvelNorm
121
122% OvelNorm=norm(Ovel);
123 OvelNorm= 2.0; %1.1169e+09;
124
125 if (OvelNorm>0.5)
126
127 % KVS: Similar here: No impln of norm(), so replacing
128 % norm(Ovel) with OvelNorm value
129
130 Ovel=Ovel/OvelNorm;
131 %trick
132 %quat=addEulNoise(quat, STDDEV_GPSVel);
133 qConj = quatConj(quat);
134 orgWorld=quatRot([1, 0, 0],qConj);
135 eye3 = [1,0,0;0,1,0;0,0,1];
136 [temp, w]=mcl(orgWorld, Ovel, eye3./STDDEV_GPSVel);
137 [quat, vel, pos]=generateSample(w, quat, vel, pos, M_STDDEV_VEL, M_STDDEV_POS);
138 end
139
140 end
141
142 if(sType==1)
143
144 %Observation
145 Ovel=sData(1,1);
146 [temp, w]=mcl(sqrt(vel(:,1).^2+vel(:,2).^2+vel(:,3).^2), Ovel, 1/(STDDEV_ODOVel));
147
148 [quat vel pos]=generateSample(w, quat, vel, pos, M_STDDEV_VEL, M_STDDEV_POS);
149 end
150
151 if(sType==3)
152 %Observation
153 accl=sData(1,1:3);
154
155 gtemp = ones(n,1) * [0 0 -9.8];
156
157 gravity=quatRot(gtemp, quat);
158 eye3 = [1,0,0;0,1,0;0,0,1];
159 [gravity, w]=mcl(gravity, accl, eye3./(STDDEV_ACCL));
160
161 [quat, vel, pos]=generateSample(w, quat, vel, pos, M_STDDEV_VEL, M_STDDEV_POS);
162
163 %Motion model
164 accl=ones(n,1)*accl;
165 accl=accl-gravity;
166 pos=pos+quatRot(vel,quatConj(quat))*acclTimeInterval ...
167 +1/2*quatRot(accl,quatConj(quat))*acclTimeInterval^2 ...
168 +randnWrapper(n,3)*M_STDDEV_POS;
169 vel=vel+accl*acclTimeInterval+randnWrapper(n,3)*M_STDDEV_VEL;
170
171 end
172
173 stop = photonEndTiming;
174
175 temp = photonReportTiming(start, stop);
176 elapsed(1) = elapsed(1) + temp(1);
177 elapsed(2) = elapsed(2) + temp(2);
178
179 % Self check
180
181 quatOut = 0;
182 posOut = 0;
183 velOut = 0;
184
185 for ij=1:(size(quat,1)*size(quat,2))
186 quatOut = quatOut + quat(ij);
187 end
188
189 for ij=1:(size(vel,1)*size(vel,2))
190 velOut = velOut + vel(ij);
191 end
192
193 for ij=1:(size(pos,1)*size(pos,2))
194 posOut = posOut + pos(ij);
195 end
196
197 resultMat(:, i) = [quatOut, velOut, posOut];
198
199 if (isEOF == 1)
200 break;
201 end
202end
203
204%% Timing
205photonPrintTiming(elapsed);
206
207%% Self checking %%
208fWriteMatrix(resultMat,dataDir);
209
diff --git a/SD-VBS/benchmarks/localization/src/matlab/selfCheck.m b/SD-VBS/benchmarks/localization/src/matlab/selfCheck.m
new file mode 100644
index 0000000..ac80ebd
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/selfCheck.m
@@ -0,0 +1,33 @@
1function ret = selfCheck(in1, in2, tol)
2
3r1 = size(in1, 1);
4c1 = size(in1, 2);
5
6r2 = size(in2, 1);
7c2 = size(in2, 2);
8
9ret = 1;
10
11if r1~=r2
12 disp(1298);
13 ret = 0;
14end
15
16if c1 ~= c2
17 disp(1297);
18 ret = 0;
19end
20
21for i=1:r1
22 if(ret == 0)
23 break;
24 end
25 for j=1:c1
26 if( abs(in1(i,j)-in2(i,j)) > tol)
27 ret = 0;
28 break;
29 end
30 end
31end
32
33
diff --git a/SD-VBS/benchmarks/localization/src/matlab/sumCol.m b/SD-VBS/benchmarks/localization/src/matlab/sumCol.m
new file mode 100644
index 0000000..ad0114e
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/sumCol.m
@@ -0,0 +1,14 @@
1function ret = sumCol(mat)
2
3row = size(mat, 1);
4col = size(mat, 2);
5
6ret = zeros(row, 1);
7
8for i=1:row
9 temp = 0;
10 for j=1:col
11 temp = temp + mat(i, j);
12 end
13 ret(i, 1) = temp;
14end
diff --git a/SD-VBS/benchmarks/localization/src/matlab/weightedSample.m b/SD-VBS/benchmarks/localization/src/matlab/weightedSample.m
new file mode 100644
index 0000000..dc9274b
--- /dev/null
+++ b/SD-VBS/benchmarks/localization/src/matlab/weightedSample.m
@@ -0,0 +1,20 @@
1%function x_gen_id=weightedSample(w)
2function bin=weightedSample(w)
3n=size(w,1);
4seed=randWrapper(n,1);
5bin = zeros(n,1);
6%x_gen_id=zeros(n,1);
7 for i=1:n
8 for j=1:n
9 if(seed(j,1) > 0)
10 bin(j,1) = bin(j,1) + 1;
11% x_gen_id(j,1) = x_gen_id(j,1) + bin(j,1);
12 end
13 end
14% bin = (seed>0);
15% x_gen_id=x_gen_id+bin;
16 seed=seed-w(i,1);
17 end
18% x_gen_id = bin;
19%x_gen=x(:,x_gen_id);
20