Cov txheej txheem:

Roomba MATLAB Project: 5 Kauj Ruam
Roomba MATLAB Project: 5 Kauj Ruam

Video: Roomba MATLAB Project: 5 Kauj Ruam

Video: Roomba MATLAB Project: 5 Kauj Ruam
Video: Amazing arduino project 2024, Hlis ntuj nqeg
Anonim
Roomba MATLAB Project
Roomba MATLAB Project

Txoj phiaj xwm tam sim no uas NASA muaj rau Mars rover yog rau nws los ua cov ntaub ntawv khaws cia thiab ncig ib puag ncig Mars, khaws cov av ntawm cov av coj rov qab los rau ntiaj teb kom cov kws tshawb fawb pom tau tias puas muaj ib lub neej yav dhau los hauv ntiaj chaw. Ib qho ntxiv, lub rover xa rov qab cov duab rau cov kws tshawb fawb, kom lawv tuaj yeem pab tshawb nrhiav lub rover thiab kho txhua yam teeb meem uas nws yuav muaj.

Peb pab pawg neeg lub tswv yim rau peb txoj haujlwm yog rau lub rover ua tib yam li NASA lub rover uas yuav tawm hauv ntiaj teb xyoo 2020, tab sis rau nws kuj tseem yuav qhia tawm thaj chaw thaj av. Roomba yuav tuaj yeem hnov pob tsuas thiab nres nws tus kheej ua ntej nws ntog tawm, thiab tom qab ntawd rov qab, tig, thiab hloov nws txoj hauv kev kom nws yuav tsis poob thiab raug puas tsuaj. Peb lwm lub tswv yim sib koom ua ke rau hauv peb txoj haujlwm yog rau chav tsev kom tuaj yeem tawm tswv yim tawm thaj chaw nws pom, thiab qhia cov phiaj xwm txhua lub sij hawm lub voj tiav thiab nws txoj haujlwm tau ua tiav.

Cov lus qhia no yog rau lwm tus neeg uas xav tsim tib hom lej rau lawv chav nyob.

Kauj Ruam 1: Kauj Ruam 1: Cov Ntaub Ntawv Xav Tau

Kauj Ruam 1: Cov Ntaub Ntawv Xav Tau
Kauj Ruam 1: Cov Ntaub Ntawv Xav Tau
Kauj Ruam 1: Cov Ntaub Ntawv Xav Tau
Kauj Ruam 1: Cov Ntaub Ntawv Xav Tau

Koj yuav xav tau:

  1. Ib chav
  2. MATLAB
  3. Cov ntaub ntawv no los khiav lub roomba
  4. Ib qho chaw tiaj
  5. Ib lub rooj saum npoo los ua tus "pob tsuas"

Kauj Ruam 2: Kauj Ruam 2: Teeb/Tau Txais Code rau Roomba

Kauj Ruam 2: Teeb/Tau Txais Code rau Roomba
Kauj Ruam 2: Teeb/Tau Txais Code rau Roomba

Koj lub vijtsam yuav zoo li qhov no thaum koj nkag cov ntaub ntawv.

Kauj Ruam 3: Kauj Ruam 3: Teeb Tsa Cliff Sensors/LED Teeb

Txoj cai no yuav qhia rau koj chav nyob raws nraim li cas lub kaum sab xis tig, txheeb xyuas cov ntaub ntawv roj teeb, qhia rau koj chav nyob sai npaum li cas mus, thiab tshuaj xyuas ib tus neeg los ntawm chav roomba lub koob yees duab. Nws kuj tseem yuav ceeb toom yog tias nws txheeb xyuas tus neeg, thiab nres nws tus kheej ua ntej tawm ntawm lub pob tsuas.

% sim rob.setLEDDigits ('') x = 0; y = 0; tau = 0; kev khuam siab = ; voj voog = 1; AngCorr = @(x) x + 3.059.*X.^0.4205; %Muaj nuj nqi los kho cov ces kaum thaum rob.getBatteryInfo.percent> 15 rob.setLEDDigits ('') rob.setDriveVelocity (0.1) %Mus %Txheeb Rau Tus Neeg yog AA_checkperson (rob) rob.beep kawg %Txheeb Cliff Sensor yog AA_cliffcheck (rob) rob.stop rob.setLEDDigits ('Cliff') ncua (0.5) teeb meem (voj voog) = 2; AA_cliffbeep (rob) %Back Up Thiab Tig rob.moveDistance (-. 15) rob.turnAngle (30) kawg

Kauj Ruam 4: Kauj Ruam 4: Txheeb Xyuas Cov Teeb Meem

Txoj cai no yuav tau txais roomba txhawm rau txheeb xyuas cov khoom nyob ib puag ncig nws, thiab yuav tshuaj xyuas lub pob qhov taub kom paub tseeb tias nws nres ua ntej nws ua rau nws tus kheej puas tsuaj.

%Txheeb Lub Teeb Sensor yog AA_lightcheck (rob) rob.stop rob.setLEDDigits ('Phab Ntsa') ncua (0.5) teeb meem (voj voog) = 1; %Wall AA_wallbeep (rob) %Back Up Thiab Turn rob.moveDistance (-. 15) rob.turnAngle (30) kawg %Txheeb xyuas Bump Sensor yog AA_bumpcheck (rob) rob.stop rob.setLEDDigits ('Wall') ncua (0.5) teeb meem (voj voog) = 1; %Wall AA_wallbeep (rob) %Back Up Thiab Turn rob.moveDistance (-. 15) rob.turnAngle (30) kawg %Yog tias tsis muaj yog kev zam (teeb meem) teeb meem (voj voog) = 0; elseif ntev (teeb meem) <voj voog teeb meem (voj voog) = 0; kawg

Kauj Ruam 5: Kauj Ruam 5: Plotting

Kauj ruam 5: Plotting
Kauj ruam 5: Plotting

Txoj cai no yuav qhia rau koj chav nyob rau phiaj xwm seb nws ntsib dab tsi ntawm nws txoj kev taug. Cov phiaj xwm zoo li qhov no yuav tshwm sim tom qab chav tsev so lawm.

%Tau Txais Txoj Haujlwm d = rob.getDistance; yog cycle == 1 theta (cycle) = 0; x (cycle) = d.*cosd (theta (voj voog))); % tag nrho cov kev ncig mus los hauv x y (cycle) = d.*sind (theta (cycle))); % tag nrho cov kev mus ncig hauv y lwm tus theta (voj voog) = theta (cycle-1) + rob.getAngle; x (cycle) = d.*cosd (theta (cycle)) + x (cycle-1); % tag nrho cov kev ncig mus los hauv x y (cycle) = d.*sind (theta (cycle)).*d + y (cycle-1); %tag nrho cov kev ncig mus ncig hauv y kawg %Kev tawg yog tias rob.getButtons.clean so kawg %Kev nce hauv lub voj voog = voj voog + 1; kawg rob.stop rau kuv = 1: kev hloov pauv yog qhov thaiv (i) == 1 %Cov phiaj xwm phab ntsa (x (i), y (i), 'Marker', 'xwmfab', 'MarkerEdgeColor', 'r') lwm yam kev khuam siab (i) == 2 %Cliff plot (x (i), y (i), 'Marker', 'o', 'MarkerEdgeColor', 'k') end text (.9, 0.9, sprintf ('Square = Wall) nCircle = Cliff '),' Units ',' normalized ') tuav qhov kawg % Teeb meem teeb liab thaum muaj tseeb rob.beep ncua (3) yog rob.getButtons.clean so kawg kawg % catch % rob.stop % kawg

Pom zoo: