diff options
Diffstat (limited to 'SD-VBS/benchmarks/localization/src')
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/eul2quat.c | 50 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/generateSample.c | 88 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/get3DGaussianProb.c | 49 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/input.txt | 8 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/localization.h | 24 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/mcl.c | 34 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/quat2eul.c | 47 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/quatConj.c | 32 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/quatMul.c | 55 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/quatRot.c | 47 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/readSensorData.c | 63 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/script_localization.c | 534 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/weightedSample.c | 37 |
13 files changed, 1068 insertions, 0 deletions
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 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include "localization.h" | ||
| 8 | |||
| 9 | F2D* 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 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include "localization.h" | ||
| 8 | |||
| 9 | void 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 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include "localization.h" | ||
| 8 | |||
| 9 | F2D* 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 | |||
