Assignment code for Georgia Tech CS 3630, 2014
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

New Stuff for Assignment 6

james7132 9c686f5f 34a1a2fa

+233 -109
+1
Assignment 6/matlab code/motion_plan.txt
··· 1 + 0 0 0
+2
Assignment 6/matlab code/test.py
··· 1 + test = 1024 2 + print test
+43
Assignment 6/matlab code/visualservo.m
··· 1 + 2 + % get target image position 3 + targetImageName = 'pic-1428531465.jpg'; 4 + targetImage = imread(targetImageName); 5 + 6 + % get list of existing images 7 + images = dir('*.jpg'); 8 + imageNames = cell(size(images, 1), 1); 9 + for i = 1 : size(images, 1) 10 + imageNames{i} = images(i).name; 11 + end 12 + 13 + %while criterion 14 + % construct motion plan 15 + motionPlanSize = 1; 16 + motionPlan = zeros(motionPlanSize, 3); 17 + %CREATE MOTION PLAN HERE 18 + 19 + % write motion plan to text 20 + dlmwrite('motion_plan.txt', motionPlan, ' '); 21 + 22 + % call python script to move robot and take picture 23 + system('python test.py'); 24 + 25 + % get new list of images 26 + images = dir('*.jpg'); 27 + newImageNames = cell(size(images, 1), 1); 28 + for i = 1 : size(images, 1) 29 + newImageNames{i} = images(i).name; 30 + end 31 + 32 + % find the new image 33 + new = ismember(imageNames, newImageNames); 34 + newImageName = newImageNames(~new) 35 + 36 + if size(newImageName, 1) > 0 37 + newImage = imread(newImageName(1)); 38 + else 39 + disp('you done goofed, ya dingus'); 40 + end 41 + 42 + imageNames = newImageNames; 43 + %end
Assignment 6/pic-1428531465.jpg Assignment 6/matlab code/pic-1428531465.jpg
Assignment 6/pic-1428531490.jpg Assignment 6/matlab code/pic-1428531490.jpg
Assignment5/final submission/Assignment5Writeup-HuynhLiu.pdf

This is a binary file and will not be displayed.

Assignment5/final submission/HuynhAlexander_LiuJames_Assignment5.zip

This is a binary file and will not be displayed.

+117
Assignment5/final submission/matlab code/VisualOdo.m
··· 1 + A = zeros(500, 2); 2 + A(A == 0) = NaN; 3 + 4 + f_x = 1211.2959; 5 + f_y = 1206.00512; 6 + s = 0.0; 7 + c_x = 657.15924; 8 + c_y = 403.17667; 9 + 10 + K = [f_x, s, c_x; 11 + 0 , f_y, c_y; 12 + 0 , 0, 1]; 13 + 14 + Camera = CentralCamera('name', 'robocam', 'default'); 15 + 16 + log = fopen('log-1428031739.txt'); 17 + data = textscan(log, '%d %d %s'); 18 + oldImage = 0; 19 + oldSurf = 0; 20 + oldCamera = 0; 21 + imagesData = data{3}; 22 + images = cell(0); 23 + surfs = cell(0); 24 + cameras = cell(0); 25 + matches = cell(0); 26 + solutions = cell(0); 27 + x = zeros([1, 3]); 28 + x_hist = zeros(1, 3); 29 + for i = 1 : size(imagesData, 1) 30 + test = imagesData{i}; 31 + % v = [data{1}(i) 32 + % data{2}(i) 33 + % ]; 34 + % 35 + % % get motor values (Left-Right wrpt Fluke) 36 + % uL=v(1); 37 + % uR=v(2); 38 + % 39 + % scale = 39.3701; %Change it to accordingly to what you used in Assignment 3 40 + % ScaledUL = double(uL)*scale; 41 + % ScaledUR = double(uR)*scale; 42 + % 43 + % r = 1.375; 44 + % L = 5.75; 45 + % 46 + % % calculate speed 47 + % u(1) = 0.04 * r.*((ScaledUL+ScaledUR)./2); 48 + % u(2) = 0.1875 * (r./L).*(ScaledUR-ScaledUL); 49 + % 50 + % x = x + u; 51 + % x_hist = [x_hist; x]; 52 + if(~strcmp(test, '0')) 53 + image = imread(test); 54 + surf = isurf(image); 55 + camera = CentralCamera('image', image, 'default'); 56 + % figure 57 + % imshow(image); 58 + % hold on 59 + % plot(surf.u, surf.v, '*', 'color', 'red'); 60 + 61 + if(oldSurf ~= 0) 62 + match = oldSurf.match(surf, 'thresh', 4); 63 + % figure 64 + % idisp({oldImage, image}); 65 + % match.plot(); 66 + F = match.ransac(@fmatrix, 1e-2, 'verbose'); 67 + % figure 68 + % idisp({oldImage, image}); 69 + % match.inlier.plot('g'); 70 + %E = camera.E(oldCamera); 71 + E = transpose(K) * F * K; 72 + Q = [0 0 100]'; 73 + sol = camera.invE(E, Q); 74 + 75 + R = sol(1:3, 1:3); 76 + t = sol(1:3, 4); 77 + 78 + euler = tr2eul(R); 79 + x(3) = x(3) + euler(3); 80 + x(1) = x(1) + sol(1) * cos(x(3) - sol(2) * sin(x(3))); 81 + x(2) = x(2) + sol(1) * sin(x(3) + sol(2) * cos(x(3))); 82 + 83 + x_hist = [x_hist; x]; 84 + 85 + solutions = [solutions, {sol}]; 86 + matches = [matches, {match}]; 87 + end 88 + 89 + oldImage = image; 90 + oldSurf = surf; 91 + oldCamera = camera; 92 + 93 + images = [images, {image}]; 94 + surfs = [surfs; {surf}]; 95 + cameras = [cameras, {camera}]; 96 + end 97 + end 98 + 99 + % currentTransform = [1,0,0,0; 100 + % 0,1,0,0; 101 + % 0,0,1,0; 102 + % 0,0,0,1]; 103 + % scale = [1,0,0,0; 104 + % 0,1,0,0; 105 + % 0,0,1,0; 106 + % 0,0,0,1]; 107 + % x = zeros(1); 108 + % y = zeros(1); 109 + % for i = 1 : size(solutions, 2) 110 + % solutions{i} = solutions{i} * scale; 111 + % end 112 + % for i = 1 : size(solutions, 2) 113 + % x = [x, currentTransform(1, 4)]; 114 + % y = [y, currentTransform(2, 4)]; 115 + % currentTransform = currentTransform + solutions{i}; 116 + % end 117 + plot(x_hist(:,1),x_hist(:,2));
+70
Assignment5/final submission/matlab code/log-1428031739.txt
··· 1 + 0 1 0 2 + 0 1 0 3 + 0 0 0 4 + 1 1 0 5 + 1 1 0 6 + 0 0 0 7 + 0 0 pic-1428031740.jpg 8 + 0 1 0 9 + 0 1 0 10 + 0 0 0 11 + 1 1 0 12 + 1 1 0 13 + 0 0 0 14 + 0 0 pic-1428031742.jpg 15 + 0 1 0 16 + 0 1 0 17 + 0 0 0 18 + 1 1 0 19 + 1 1 0 20 + 0 0 0 21 + 0 0 pic-1428031745.jpg 22 + 0 1 0 23 + 0 1 0 24 + 0 0 0 25 + 1 1 0 26 + 1 1 0 27 + 0 0 0 28 + 0 0 pic-1428031747.jpg 29 + 0 1 0 30 + 0 1 0 31 + 0 0 0 32 + 1 1 0 33 + 1 1 0 34 + 0 0 0 35 + 0 0 pic-1428031749.jpg 36 + 0 1 0 37 + 0 1 0 38 + 0 0 0 39 + 1 1 0 40 + 1 1 0 41 + 0 0 0 42 + 0 0 pic-1428031751.jpg 43 + 0 1 0 44 + 0 1 0 45 + 0 0 0 46 + 1 1 0 47 + 1 1 0 48 + 0 0 0 49 + 0 0 pic-1428031753.jpg 50 + 0 1 0 51 + 0 1 0 52 + 0 0 0 53 + 1 1 0 54 + 1 1 0 55 + 0 0 0 56 + 0 0 pic-1428031755.jpg 57 + 0 1 0 58 + 0 1 0 59 + 0 0 0 60 + 1 1 0 61 + 1 1 0 62 + 0 0 0 63 + 0 0 pic-1428031757.jpg 64 + 0 1 0 65 + 0 1 0 66 + 0 0 0 67 + 1 1 0 68 + 1 1 0 69 + 0 0 0 70 + 0 0 pic-1428031760.jpg
Assignment5/final submission/matlab code/pic-1428031740.jpg

This is a binary file and will not be displayed.

Assignment5/final submission/matlab code/pic-1428031742.jpg

This is a binary file and will not be displayed.

Assignment5/final submission/matlab code/pic-1428031745.jpg

This is a binary file and will not be displayed.

Assignment5/final submission/matlab code/pic-1428031747.jpg

This is a binary file and will not be displayed.

Assignment5/final submission/matlab code/pic-1428031749.jpg

This is a binary file and will not be displayed.

Assignment5/final submission/matlab code/pic-1428031751.jpg

This is a binary file and will not be displayed.

Assignment5/final submission/matlab code/pic-1428031753.jpg

This is a binary file and will not be displayed.

Assignment5/final submission/matlab code/pic-1428031755.jpg

This is a binary file and will not be displayed.

Assignment5/final submission/matlab code/pic-1428031757.jpg

This is a binary file and will not be displayed.

Assignment5/final submission/matlab code/pic-1428031760.jpg

This is a binary file and will not be displayed.

Assignment5/logDataCalico.py Assignment5/final submission/logDataCalico.py
Assignment5/matlab visual odo capture.PNG Assignment5/final submission/matlab visual odo capture.PNG
Assignment5/matlab/DeterministicPath.m Assignment5/final submission/matlab code/DeterministicPath.m
Assignment5/matlab/GenericEKF.m Assignment5/final submission/matlab code/GenericEKF.m
Assignment5/matlab/GenericRangeBearingSensor.m Assignment5/final submission/matlab code/GenericRangeBearingSensor.m
Assignment5/matlab/GenericVehicle.m Assignment5/final submission/matlab code/GenericVehicle.m
Assignment5/matlab/LandmarkMap.m Assignment5/final submission/matlab code/LandmarkMap.m
Assignment5/matlab/SLAM.m Assignment5/final submission/matlab code/SLAM.m
-109
Assignment5/matlab/VisualOdo.m
··· 1 - A = zeros(500, 2); 2 - A(A == 0) = NaN; 3 - 4 - f_x = 1211.2959; 5 - f_y = 1206.00512; 6 - s = 0.0; 7 - c_x = 657.15924; 8 - c_y = 403.17667; 9 - 10 - K = [f_x, s, c_x; 11 - 0 , f_y, c_y; 12 - 0 , 0, 1]; 13 - 14 - Camera = CentralCamera('name', 'robocam', 'default'); 15 - 16 - log = fopen('log-run1.txt'); 17 - data = textscan(log, '%d %d %s'); 18 - oldImage = 0; 19 - oldSurf = 0; 20 - oldCamera = 0; 21 - imagesData = data{3}; 22 - images = cell(0); 23 - surfs = cell(0); 24 - cameras = cell(0); 25 - matches = cell(0); 26 - solutions = cell(0); 27 - x = zeros([1, 2]); 28 - x_hist = zeros(2); 29 - for i = 1 : size(imagesData, 1) 30 - test = imagesData{i}; 31 - v = [data{1}(i) 32 - data{2}(i) 33 - ]; 34 - 35 - % get motor values (Left-Right wrpt Fluke) 36 - uL=v(1); 37 - uR=v(2); 38 - 39 - scale = 39.3701; %Change it to accordingly to what you used in Assignment 3 40 - ScaledUL = double(uL)*scale; 41 - ScaledUR = double(uR)*scale; 42 - 43 - r = 1.375; 44 - L = 5.75; 45 - 46 - % calculate speed 47 - u(1) = 0.04 * r.*((ScaledUL+ScaledUR)./2); 48 - u(2) = 0.1875 * (r./L).*(ScaledUR-ScaledUL); 49 - 50 - x = x + u; 51 - x_hist = [x_hist; x]; 52 - if(~strcmp(test, '0')) 53 - image = imread(test); 54 - surf = isurf(image); 55 - camera = CentralCamera('image', image, 'default'); 56 - % figure 57 - % imshow(image); 58 - % hold on 59 - % plot(surf.u, surf.v, '*', 'color', 'red'); 60 - 61 - if(oldSurf ~= 0) 62 - match = oldSurf.match(surf, 'thresh', 4); 63 - % figure 64 - % idisp({oldImage, image}); 65 - % match.plot(); 66 - F = match.ransac(@fmatrix, 3e-2, 'verbose'); 67 - % figure 68 - % idisp({oldImage, image}); 69 - % match.inlier.plot('g'); 70 - %E = camera.E(oldCamera); 71 - E = transpose(K) * F * K; 72 - Q = [0 0 100]'; 73 - sol = camera.invE(E, Q); 74 - eulerR = tr2eul(sol(1:3, 1:3)) .* 180.0/pi; 75 - t = sol(1:3, 4); 76 - 77 - solutions = [solutions, {sol}]; 78 - matches = [matches, {match}]; 79 - end 80 - 81 - oldImage = image; 82 - oldSurf = surf; 83 - oldCamera = camera; 84 - 85 - images = [images, {image}]; 86 - surfs = [surfs; {surf}]; 87 - cameras = [cameras, {camera}]; 88 - end 89 - end 90 - 91 - currentTransform = [1,0,0,0; 92 - 0,1,0,0; 93 - 0,0,1,0; 94 - 0,0,0,1]; 95 - scale = [0.01,0,0,0; 96 - 0,0.01,0,0; 97 - 0,0,1,0; 98 - 0,0,0,1]; 99 - x = zeros(1); 100 - y = zeros(1); 101 - for i = 1 : size(solutions, 2) 102 - solutions{i} = solutions{i} * scale; 103 - end 104 - for i = 1 : size(solutions, 2) 105 - x = [x, currentTransform(1, 4)]; 106 - y = [y, currentTransform(2, 4)]; 107 - currentTransform = currentTransform * solutions{i}; 108 - end 109 - plot(x,y);
Assignment5/matlab/getRangeAndBearing.m Assignment5/final submission/matlab code/getRangeAndBearing.m
Assignment5/matlab/log-1426087262.txt Assignment5/final submission/matlab code/log-1426087262.txt
Assignment5/matlab/log-out.txt Assignment5/final submission/matlab code/log-out.txt
Assignment5/matlab/log-run1.txt Assignment5/final submission/matlab code/log-run1.txt
Assignment5/matlab/log-run2.txt Assignment5/final submission/matlab code/log-run2.txt
Assignment5/matlab/log-run3.txt Assignment5/final submission/matlab code/log-run3.txt
Assignment5/matlab/log-test (1).txt Assignment5/final submission/matlab code/log-test (1).txt
Assignment5/matlab/log-test (2).txt Assignment5/final submission/matlab code/log-test (2).txt
Assignment5/matlab/pic-1426087272.jpg Assignment5/final submission/matlab code/pic-1426087272.jpg
Assignment5/matlab/pic-1426087275.jpg Assignment5/final submission/matlab code/pic-1426087275.jpg
Assignment5/matlab/pic-1426087277.jpg Assignment5/final submission/matlab code/pic-1426087277.jpg
Assignment5/matlab/pic-1426087280.jpg Assignment5/final submission/matlab code/pic-1426087280.jpg
Assignment5/matlab/pic-1426087283.jpg Assignment5/final submission/matlab code/pic-1426087283.jpg
Assignment5/matlab/pic-1426087285.jpg Assignment5/final submission/matlab code/pic-1426087285.jpg
Assignment5/matlab/pic-1426087287.jpg Assignment5/final submission/matlab code/pic-1426087287.jpg
Assignment5/matlab/pic-1426087289.jpg Assignment5/final submission/matlab code/pic-1426087289.jpg
Assignment5/matlab/pic-1426087292.jpg Assignment5/final submission/matlab code/pic-1426087292.jpg
Assignment5/matlab/pic-1426087294.jpg Assignment5/final submission/matlab code/pic-1426087294.jpg
Assignment5/matlab/pic-1426087296.jpg Assignment5/final submission/matlab code/pic-1426087296.jpg
Assignment5/matlab/pic-1426087299.jpg Assignment5/final submission/matlab code/pic-1426087299.jpg
Assignment5/matlab/pic-1426087301.jpg Assignment5/final submission/matlab code/pic-1426087301.jpg
Assignment5/matlab/pic-1427161857.jpg Assignment5/final submission/matlab code/pic-1427161857.jpg
Assignment5/matlab/pic-1427161858.jpg Assignment5/final submission/matlab code/pic-1427161858.jpg
Assignment5/matlab/pic-1427161860.jpg Assignment5/final submission/matlab code/pic-1427161860.jpg
Assignment5/matlab/pic-1427161861.jpg Assignment5/final submission/matlab code/pic-1427161861.jpg
Assignment5/matlab/pic-1427161863.jpg Assignment5/final submission/matlab code/pic-1427161863.jpg
Assignment5/matlab/pic-1427161865.jpg Assignment5/final submission/matlab code/pic-1427161865.jpg
Assignment5/matlab/pic-1427161866.jpg Assignment5/final submission/matlab code/pic-1427161866.jpg
Assignment5/matlab/pic-1427161868.jpg Assignment5/final submission/matlab code/pic-1427161868.jpg
Assignment5/matlab/pic-1427161870.jpg Assignment5/final submission/matlab code/pic-1427161870.jpg
Assignment5/matlab/pic-1427161872.jpg Assignment5/final submission/matlab code/pic-1427161872.jpg
Assignment5/matlab/pic-1427161873.jpg Assignment5/final submission/matlab code/pic-1427161873.jpg
Assignment5/matlab/pic-1427161875.jpg Assignment5/final submission/matlab code/pic-1427161875.jpg
Assignment5/matlab/pic-1427161877.jpg Assignment5/final submission/matlab code/pic-1427161877.jpg
Assignment5/matlab/pic-1427162650.jpg Assignment5/final submission/matlab code/pic-1427162650.jpg
Assignment5/matlab/pic-1427162652.jpg Assignment5/final submission/matlab code/pic-1427162652.jpg
Assignment5/matlab/pic-1427162653.jpg Assignment5/final submission/matlab code/pic-1427162653.jpg
Assignment5/matlab/pic-1427162655.jpg Assignment5/final submission/matlab code/pic-1427162655.jpg
Assignment5/matlab/pic-1427162657.jpg Assignment5/final submission/matlab code/pic-1427162657.jpg
Assignment5/matlab/pic-1427162658.jpg Assignment5/final submission/matlab code/pic-1427162658.jpg
Assignment5/matlab/pic-1427162660.jpg Assignment5/final submission/matlab code/pic-1427162660.jpg
Assignment5/matlab/pic-1427162661.jpg Assignment5/final submission/matlab code/pic-1427162661.jpg
Assignment5/matlab/pic-1427162663.jpg Assignment5/final submission/matlab code/pic-1427162663.jpg
Assignment5/matlab/pic-1427162665.jpg Assignment5/final submission/matlab code/pic-1427162665.jpg
Assignment5/matlab/pic-1427162666.jpg Assignment5/final submission/matlab code/pic-1427162666.jpg
Assignment5/matlab/pic-1427162668.jpg Assignment5/final submission/matlab code/pic-1427162668.jpg
Assignment5/matlab/pic-1427162670.jpg Assignment5/final submission/matlab code/pic-1427162670.jpg
Assignment5/matlab/pic-1427306080.jpg Assignment5/final submission/matlab code/pic-1427306080.jpg
Assignment5/matlab/pic-1427306081.jpg Assignment5/final submission/matlab code/pic-1427306081.jpg
Assignment5/matlab/pic-1427306083.jpg Assignment5/final submission/matlab code/pic-1427306083.jpg
Assignment5/matlab/pic-1427306084.jpg Assignment5/final submission/matlab code/pic-1427306084.jpg
Assignment5/matlab/pic-1427306087.jpg Assignment5/final submission/matlab code/pic-1427306087.jpg
Assignment5/matlab/pic-1427306088.jpg Assignment5/final submission/matlab code/pic-1427306088.jpg
Assignment5/matlab/pic-1427306090.jpg Assignment5/final submission/matlab code/pic-1427306090.jpg
Assignment5/matlab/pic-1427306092.jpg Assignment5/final submission/matlab code/pic-1427306092.jpg
Assignment5/matlab/pic-1427306094.jpg Assignment5/final submission/matlab code/pic-1427306094.jpg
Assignment5/matlab/pic-1427306095.jpg Assignment5/final submission/matlab code/pic-1427306095.jpg
Assignment5/matlab/pic-1427306097.jpg Assignment5/final submission/matlab code/pic-1427306097.jpg
Assignment5/matlab/pic-1427306098.jpg Assignment5/final submission/matlab code/pic-1427306098.jpg
Assignment5/matlab/pic-1427306101.jpg Assignment5/final submission/matlab code/pic-1427306101.jpg
_.swp

This is a binary file and will not be displayed.