Cov txheej txheem:

Garden Helper Roomba Bot: 8 Kauj Ruam
Garden Helper Roomba Bot: 8 Kauj Ruam

Video: Garden Helper Roomba Bot: 8 Kauj Ruam

Video: Garden Helper Roomba Bot: 8 Kauj Ruam
Video: You’re welcome 😚 #Roomba #maintenance 2024, Kaum ib hlis
Anonim
Garden Helper Roomba Bot
Garden Helper Roomba Bot

Kiara Myers, Ahmad Alghadeer, thiab Madison Tippet

Lub Hom Phiaj:

Cov lus qhia no yuav qhia koj yuav ua li cas rau program Roomba Bot, siv MATLAB, txhawm rau taug kev los ntawm lub vaj, kuaj pom cov txiv hmab txiv ntoo/zaub zoo li cov txiv hmab txiv ntoo uas tau siav txaus kom tau khaws raws qhov loj me. Tus neeg hlau no tseem xa email rau koj, ceeb toom rau koj tias muaj pes tsawg lub txiv hmab txiv ntoo tau npaj tau khaws thiab txoj hauv kev uas nws tau mus.

Nta:

  • Siv lub teeb pom kev zoo txhawm rau txheeb xyuas phab ntsa thiab tig me ntsis kom tsis txhob tsoo lawv
  • Siv lub pob tsoo txhawm rau txhawm rau txhawm rau cuam tshuam txoj haujlwm thaum nws tsoo pob zeb thaum kawg ntawm lub vaj
  • Siv cov duab ua kom pom lub voj voog hauv vaj thiab tom qab txiav txim siab nws lub vojvoog
  • Siv cov pob zeb ntsuas kom pom daim kab xev xim uas qhia tias muaj txiv hmab txiv ntoo nyob

Kauj Ruam 1: Cov Ntaub Ntawv thiab Cov Khoom Siv:

  • Ib lub Laptop
  • NTSE 2017
  • Roomba Vaccum Nqus Tsev
  • Raspberry Pi
  • Ntoo Thaiv
  • Ntawv Dawb
  • Ntawv Dub
  • Cov kab xev xim/daim kab xev nyias nyias ntawm cov ntawv dawb
  • Pob Zeb Loj

Kauj ruam 2:

Kauj Ruam 3: Sib Sau Koj Lub Vaj

Sib dhos Koj
Sib dhos Koj
  1. Coj koj daim ntawv dub thiab txiav lub voj voos ntawm ntau qhov sib txawv
  2. Xev cov voj dub no rau ntawm daim ntawv dawb loj

    Qhov sib txawv no yuav tsim nyog thaum kuaj pom txiv hmab txiv ntoo

  3. Siv koj cov ntoo thaiv los tsim txoj hauv kev zoo li lub tiaj ua si hauv vaj rau koj tus neeg hlau kom taug kev

    Peb xaiv txoj hauv kev zoo li U raws li daim duab saum toj no

  4. Qhov kawg ntawm koj lub vaj ntxiv pob zeb lossis lub qhov rooj lossis lwm yam khoom rau koj tus neeg hlau kom paub nws ua tiav
  5. Kaw koj daim ntawv dawb nrog lub voj voos mus rau ntawm phab ntsa vaj

    Peb siv cov thoob los xev nws vim tias peb cov phab ntsa luv dhau rau lub koob yees duab

  6. Muab daim kab xev dawb/daim kab xev nyias nyias ntawm daim ntawv xim rau hauv av pem hauv ntej ntawm txiv hmab txiv ntoo

Kauj Ruam 4: Sau Txoj Cai

Navigating Lub Vaj

Siv Bump Sensors: Txhawm rau ua haujlwm, peb tso cov coding nyob rau hauv ib pliag nqe lus uas tig los ntawm ntau yam yog cov lus hais txog kom txog thaum cov cai tau tawg. Yog tias ib qho ntawm lub tsoo raug tsoo, nws yuav ua rau lawv tus nqi sib npaug qhov tseeb (uas hauv Boolean yog tus nqi ntawm 1). Ib daim ntawv yog siv los ua txhaum txoj cai thaum ib qho ntawm lawv qhov txiaj ntsig sib npaug 1.

Siv Cliff Sensors: Tsis pub dhau lub sijhawm hais qhia, peb siv daim ntawv qhia yog hais qhia rau Roomba thaum nws tuaj txog ntawm qhov chaw cog. Roomba pom cov kab xev xim hauv pem teb los ntawm kev tshuaj xyuas qhov pib ntawm liab uas lub pob zeb ntsuas pom tuaj. Yog tias lub pob zeb sab laug lossis sab xis pom cov xim uas muaj lub hauv paus ntau dua li hauv av, tom qab ntawd nws yuav tso tus neeg hlau rau 2 vib nas this (siv ncua kev hais kom ua). Lub sijhawm 2 vib nas this no, Roomba yuav coj thiab tso saib daim duab ntawm cov txiv hmab txiv ntoo. Siv cov imfindcircles ua hauv kev hais kom ua, teeb tsa ntau yam rau koj lub voj voog, thiab koj Roomba yuav pom koj li txiv hmab txiv ntoo.

Siv Kev Ua Duab: Tsis pub dhau daim ntawv hais tias, peb ntxiv lwm qhov yog cov lus hais tias: yog lub vojvoog pom, radii3, ntau dua lossis sib npaug rau peb qhov tsawg kawg nkaus xav tau ntawm cov txiv hmab txiv ntoo siav, r1 (koj txiav txim siab qhov no), tom qab ntawd suav thiab tso saib Roomba muaj pes tsawg tus txiv hmab txiv ntoo tau npaj thiab tig mus txuas ntxiv los ntawm lub vaj. Yog tsis yog, tig mus txuas ntxiv los ntawm lub vaj. Nco tseg: koj yuav xav tau kho lub kaum sab xis uas koj tig vim tias txhua Roomba txawv

Siv Lub Teeb Bumpers: Hauv lwm qhov yog cov lus tshaj tawm, lub teeb tsoo lub teeb raug tshuaj xyuas kom ntseeg tau tias tsis muaj leej twg dhau los ua qhov loj dua li peb tau txiav txim siab. Yog tias sab laug, sab xis, sab laug, sab xis, sab laug, lossis sab pem hauv ntej lub teeb pom kev zoo mus siab dua qhov pib, tom qab ntawd Roomba yuav tig me ntsis hauv lub kaum ntse ntse kom tsis txhob tsoo phab ntsa. Yog li ntawd, nrhiav kev tshawb nrhiav.

Tus so ntawm txoj cai tau siv los npaj txoj hauv kev los ntawm Roomba thiab tom qab ntawd xa cov txiaj ntsig rau koj tus email

Kauj Ruam 5: Luam Cov Cai

Lub Hom Phiaj: Raws li lawv qhov ntau thiab tsawg, chav nyob yuav mus hla lub vaj thiab paub qhov txawv zaub/txiv hmab txiv ntoo uas tau npaj yuav khaws. % Cov tswv yim: Lub teeb pom kev zoo, Lub pob zeb sensor, Lub pob tsoo lub ntsej muag, duab los ntawm lub koob yees duab % Cov Lus Tso Tawm: Thaum twg lub teeb pom kev zoo ntau dua qhov pib lub chav tsev yuav tig thiab thaij duab, nrov nrov yog lub vojvoog ntawm % zaub/txiv hmab txiv ntoo nyob nruab nrab ntawm qhov tshwj xeeb. Txoj cai tawg thaum roomba tsoo mus rau % yam khoom, xa tus kws tsav dav hlau email txog ntau npaum li cas txiv hmab txiv ntoo tau npaj yuav % khaws thiab daim duab qhia chaw ntawm roomba lub zog. % Kev Siv: Yog thiab thaum nqe lus, npaj cov lus txib, email code los ntawm MATLAB

k = 0 ib

tic ua

timerVal = tic

thaum muaj tseeb

v =.2; % tshaj tawm r.setDriveVelocity (v, v);% roomba mus rau tom ntej L = r.getLightBumpers; LC = L.leftCenter; Rr = L. yog; Lf = L.left; RC = L.rightCenter; LF = L.leftFront; RF = L.rightFront; Q = 75; % pib. RTH = 30; %Qhov pib liab liab RTL = 10; %Qhov pib liab tsawg B = r.getBumpers S = r.getCliffSensors; r1 = 24; r3 = 10; PL1 = 1800; yog S.leftFront> PL1 || S.rightFront> PL1 % pom tias cov xim hauv av yog siab dua qhov pib r.stop ncua (2) elapsedTime = toc (timerVal-2) tic timerVal = tic % ncua rau 2 vib nas this img = r.getImage; %thaij duab imshow (img)%tso duab [chaw nyob 3, radii3] = imfindcircles (img, [30 50], 'ObjectPolarity', 'tsaus ntuj', 'Rhiab', 0.9); h = viscircles (chaw 3, radii3); %saib rau cov vojvoog ntawm w/hauv cov kab tshwj xeeb hauv cov duab yog radii3> = r1 T = 1 k = k+1 dist1 = 0.2., tom qab ntawd Roomba suav cov txiv no lwm yam radii3 <= r3 T = 0 lwm T = 0 dist2 = 0.2.*elapsedTime %Yog tsis yog, nws tsis suav cov txiv ntoo kawg

yog T == 1 r.setLEDDigits (num2str (k)) r.beep r.beep r.beep r.turnAngle (78) %Yog tias pom txiv hmab txiv ntoo, tom qab ntawd tso tus lej ntawm Roomba, %ua suab nrov, thiab tig elseif T == 2 r.turnAngle (78) %Yog pom 2 txiv hmab txiv ntoo, ces tig mus txuas ntxiv los ntawm %vaj lwm yam r.turnAngle (78) %Yog tias tsis pom txiv hmab txiv ntoo, tom qab ntawd tig mus txuas ntxiv los ntawm %vaj tsev kawg yog LC> Q r.stop r.turnAngle (-7) elseif RC> Q r.stop r.turnAngle (7) elseif LF> Q r.stop r.turnAngle (-7) elseif RF> Q r.stop r. turnAngle (7) elseif Lf> Q r.stop r.turnAngle (-7) elseif Rr> Q r.stop r.turnAngle (7) kawg %Yog tias ib qho ntawm lub teeb tsoo lub teeb pom kev zoo mus siab dua qhov pib, ces %Roomba yuav tig me ntsis raws qhov tsim nyog kom tsis txhob %tsoo phab ntsa

yog B.right == 1 || B.left == 1 || B. front == 1 dist3 = 0.2.*ElapsedTime r.stop r.beep ('F#*2, F#*2, c, F#*2, F#*2') r.turnAngle (360) %Yog tias muaj bumbers raug ntaus, tom qab ntawd roomba ua suab nrov, tig ib ncig, %thiab ua txhaum txoj cai

tawg kawg

kawg tawg (0.533, 0, '^') tuav ntawm tawg (0.533, dist1, '<') tuav ntawm tawg (-dist2, dist1, 'v') tuav ntawm tawg (-dist2, 0, 'd') saveas (gcf, 'Movement.png')

kmsg = num2str (k) mail = '[email protected]' password = 'Srsora123#' host = 'smtp.gmail.com' chaw nres nkoj = '465'

setpref ('Internet', 'E_mail', xa ntawv); setpref ('Internet', 'SMTP_Server', tus tswv) cov khoom = java.lang. System.getProperties; props.setProperty ('mail.smtp.user', xa ntawv); props.setProperty ('mail.smtp.host', tus tswv tsev); props.setProperty ('mail.smtp.port', chaw nres nkoj); props.setProperty ('mail.smtp.starttls.enable', 'tseeb'); props.setProperty ('mail.smtp.debug', 'tseeb'); props.setProperty ('mail.smtp.auth', 'tseeb'); props.setProperty ('mail.smtp.socketFactory.port', chaw nres nkoj); props.setProperty ('mail.smtp.socketFactory.class', 'javax.net.ssl. SSLSocketFactory'); props.setProperty ('mail.smtp.socketFactory.fallback', 'cuav'); xa email (xa ntawv, 'Nyob zoo Astronaut! Muaj ntau yam txiv hmab txiv ntoo hauv lub vaj', kmsg, {'movement.png'})

Pom zoo: