Cov txheej txheem:

Kev Pabcuam អវកាស rau Roomba: 4 Kauj Ruam
Kev Pabcuam អវកាស rau Roomba: 4 Kauj Ruam

Video: Kev Pabcuam អវកាស rau Roomba: 4 Kauj Ruam

Video: Kev Pabcuam អវកាស rau Roomba: 4 Kauj Ruam
Video: Lux tsis yog kev txhawb nqa, kev pabcuam ntawm tus tswv tsev thiab kev sib tw 2024, Hlis ntuj nqeg
Anonim
Astronaut-Pab Roomba
Astronaut-Pab Roomba

Txoj haujlwm no yog tsim los ntawm kev siv Raspberry Pi 3 ntawm lub nkoj iRobot Tsim Version 2. MATLAB tau siv los tsim cov neeg hlau kom ua raws cov lus qhia tshwj xeeb uas siv nws lub ntsuas thiab lub koob yees duab. Cov ntsuas thiab lub koob yees duab tau siv los ua cov haujlwm tshwj xeeb uas yuav ua raws tus kws tsav dav hlau thiab muab nws lub peev xwm los sib txuas lus nrog nws lub hauv paus hauv tsev yog tias muaj dab tsi tsis raug.

Kauj Ruam 1: Xav Tau Qhov

Xav Tau Qhov
Xav Tau Qhov
Xav Tau Qhov
Xav Tau Qhov
Xav Tau Qhov
Xav Tau Qhov
Xav Tau Qhov
Xav Tau Qhov

1. iRobot Tsim Version 2

IRobot Tsim yog qhov tseem ceeb tshaj plaws ntawm txoj haujlwm no vim tias nws tuaj yeem ua haujlwm tau thiab tuaj yeem ua tus sawv cev zoo rau lub dav hlau tiag tiag uas ua raws cov kws tsav dav hlau thiab pab lawv yav tom ntej

2. Raspberry Pi 3

Raspberry Pi yog lub programmable siv rau txoj haujlwm no. Cov cai tau tsim los rau Pi thiab cov version ntawm Pi txuas yog 3 (qauv B). Lwm cov phiaj xwm phiaj xwm xws li arduino tuaj yeem siv tau, txawm li cas los xij, arduino thiab feem ntau lwm cov laug cam yuav xav tau cov lej sib txawv dua li tau piav qhia hauv lwm qib

3. Raspberry Pi Lub Koob Yees Duab Module

Tsuas yog txuas txuas ntxiv mus rau Raspberry Pi xav tau rau txoj haujlwm no yog Lub Koob Yees Duab Module. Lub koob yees duab module yog ib feem tseem ceeb rau txoj haujlwm no, txij li chav nyob tsuas yog ua haujlwm raws li qhov nws pom hauv lub koob yees duab

4. MATLAB 2018a

MATLAB qhov thib ob tsis ntev los no version, 2018a, tau siv rau cov coding koom nrog hauv kev teeb tsa no. Nws yuav zoo li ntau lwm cov qauv ntawm MATLAB yuav ua haujlwm nrog qhov no txij li chav kawm programba tau nyob ib puag ncig ib ntus

Kauj ruam 2: Cov Ntaub Ntawv thiab Lub Koob Yees Duab Kho

Cov Ntaub Ntawv thiab Lub Koob Yees Duab Kho
Cov Ntaub Ntawv thiab Lub Koob Yees Duab Kho

1. Raspberry Pi thiab Lub Koob Yees Duab txuas rau chav nyob

  • Tus Pi tuaj yeem txuas rau iRobot ncaj qha nrog lub micro USB. Qhov ntawd yog txhua yam nws xav tau los npaj siv. Txawm li cas los xij, nws tau pom zoo tias nws yuav tsum tau muab tso rau ntawm chav tsev kom zoo xws li muaj nyob hauv cov duab thoob plaws qhov kev nthuav qhia kom deb li deb.
  • Lub koob yees duab muaj kev sib txuas ncaj qha rau Raspberry Pi thiab nws tau pom zoo heev tias qee yam yuav los yog ua kom tuav lub koob yees duab ncaj qha. Tsis muaj qhov taw tes tiag rau lub koob yees duab yog tias nws tsis tuaj yeem tuav hauv qhov chaw los qhia qhov uas roomba pom.

2. Cov ntaub ntawv

  • Tom qab tau txais txhua yam teeb tsa thiab txuas nrog, xyuas kom tus neeg hlau rov pib dua thiab npaj mus los ntawm kev tuav lub "Spot" thiab "Dock" khawm rau 10 vib nas this ua ke.
  • Nov yog qhov uas MATLAB xub xav tau. Cov ntaub ntawv rau roomba yuav tsum tau teeb tsa ua ntej thiab txhua yam uas xav tau rau cov ntaub ntawv no yog kom khiav yog cov cai tau muab rau ntawm qhov txuas no:
  • https://ef.engr.utk.edu/ef230-2017-08//projects/ro…

Kauj Ruam 3: Pib Xeem Roomba

Muaj ntau qhov kev txheeb xyuas thawj zaug yuav tsum tau ua ntawm chav tsev kom paub tseeb tias nws ua haujlwm.

1. Nco ntsoov tias koj tau txuas nrog tib lub network WiFi zoo li chav nyob. Yog tsis muaj qhov no, koj yuav tsis txuas nrog MATLAB.

2. Tshawb nrhiav tus lej koj chav nyob tau muab rau yog li koj tuaj yeem txuas nrog rau chav nyob uas koj tau xaiv. Piv txwv li, yog tias koj chav nyob tus lej yog 30, koj yuav txuas nrog nws los ntawm ntaus ntawv roomba (30) rau hauv lub qhov rai hais kom ua hauv MATLAB.

3. Roomba tuaj yeem tswj tau los ntawm cov qauv hauv MATLAB. Piv txwv li, yog tias koj teeb koj tus lej rau roomba (30) rau qhov sib txawv 'r', tus neeg hlau tuaj yeem txav mus tom ntej nrog cov lus txib r.moveDistance (0.2, 0.1).

4. Muaj ntau cov lus txib sib txawv uas tuaj yeem sib tham rau chav nyob thiab cov no tuaj yeem pom los ntawm kev ntaus 'doc roomba' rau hauv lub qhov rai hais kom ua.

5. Cov ntsuas hluav taws xob rau lub teeb, tsoo, thiab pob zeb nyeem tau tuaj yeem nyeem tag nrho los ntawm kev siv cov lus txib pom hauv 'doc roomba' tab sis ib txoj hauv kev kom muaj qhov tsis tu ncua, cov ntawv qhia zaub mov kom pom cov ntaub ntawv sensor tuaj yeem pom los ntawm kev siv 'r.testSensors '.

6. Tom qab kuaj tag nrho cov no, cov duab khaws software ntawm tus neeg hlau tuaj yeem siv los nyeem thiab pom cov duab coj. Cov cai yooj yim rau qhov no yuav yog img = r.getImage thiab imshow (img);.

7. RGB qhov tseem ceeb ntawm daim duab tuaj yeem pom nrog cov lej red_mean = mean (mean (img (:,:, 1))));

ntsuab_mean = mean (mean (img (:,:, 2))); thiab blue_mean = mean (mean (img (:,:,, 3)));.

Kauj Ruam 4: Piv txwv MATLAB Code

Piv txwv MATLAB Code
Piv txwv MATLAB Code

Txog tam sim no, tam sim no koj tau npaj los siv lub ntsuas cua thiab siv cov duab software los tsim koj tus kheej kiv ntawm Human-Assisting Prototype Mars Rover. Peb qhov piv txwv yog ua raws tus kws tsav dav hlau los ntawm kev taug cov xim dawb thiab txav mus rau nws. Tus neeg hlau yuav beep yog tias nws lub ntsuas ntsuas tau nyeem cov txiaj ntsig siab kom tus neeg ya dav hlau tuaj yeem rov pib dua tus neeg hlau yog tias nws raug daig lossis mus thiab khaws nws thiab rov pib dua yog tias nws tau daig ntawm pob tsuas. Txawm li cas los xij, nws tsuas yog nyeem cov yuam kev no tsuav nws pom dawb. Tsis muaj peev xwm pom cov xim dawb, tus neeg hlau yuav nkag mus yuam kev hom. Nws yog phiaj xwm xa ob hom sib txawv ntawm email rov qab mus rau lub hauv paus tsev nyob ntawm qhov nws pom. Yog tias nws pom daim tawv nqaij xim ntawm tus neeg ya saum ntuj ceeb tsheej, qhov pom tseeb tsis zoo, yog li nws yuav ceeb toom hauv tsev yog tias tus neeg ya dav hlau muaj tawv nqaij qhia pom nrog ua haujlwm tsis raug. Lwm cov lus tau npaj yog tias tus neeg ya saum ntuj tsuas ploj ntawm qhov pom. Yog tias tsis muaj xim dawb lossis tawv nqaij qhia rau lub koob yees duab, tus neeg hlau yuav tig ib ncig thiab xa lwm qhov, tab sis txawv email. Cov duab nyob qhov twg roomba tsis tuaj yeem pom tus neeg ya saum ntuj yuav xa nrog cov lus hauv email. Cov cai rau peb tes num tau qhia hauv qab no:

rau kuv = 1:.1: 3 img = r.getImage; duab (img) red_mean = mean (mean (img (:,:,, 1)))); ntsuab_mean = mean (mean (img (:,:, 2))); blue_mean = mean (txhais (img (:,:, 3))); yog red_mean> 110 && red_mean 110 && blue_mean 110 && green_mean0 || tsoo.left> 0 || bump.front> 0 r.beep () r.beep () r.beep () r.stop elseif cliff.left <10 || cliff.leftFront <10 || cliff.rightFront <10 || pob tsuas.right700 || light.leftFront> 700 || light.leftCenter> 700 || light.rightCenter> 700 || light.rightFront> 700 || light.right> 700 r.beep () r.beep () r.beep () r.beep () r.beep () r.stop lwm yam rau kuv = 1: 2 r.moveDistance (0.2, 0.1) r. setDriveVelocity (.3,.2) r.stop kawg qhov kawg yog ntsuab_mean <35 && blue_mean <35 %cov xim tawv nqaij qhia (xav tau hloov kho raws li tus neeg tsav tsheb daim tawv nqaij xim) r.beep (); r.peb (); r.peb (); xa = '[email protected]'; %xa email uas qhia kev nplua tawm psswd = 'yog'; tus tswv = 'smtp.gmail.com'; chaw nres nkoj = '465'; emailto = '[email protected]'; m_subject = 'ntsiab lus'; m_text = 'xeem'; setpref ('Internet', 'E_mail', xa ntawv); setpref ('Internet', 'SMTP_Server', tus tswv tsev); setpref ('Internet', 'SMTP_Username', xa ntawv); setpref ('Internet', 'SMTP_Password', psswd); 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 (emailto, 'Pab!', 'Lub dav hlau ya dav hlau tau tawm!', img); kawg yog red_mean 135 || ntsuab_mean 135 || blue_mean 135 rau j = 1: 2 %yog tias tsis tuaj yeem pom dawb los ntawm tus neeg hlau r.turnAngle (360) xa = '[email protected]'; psswd = 'yog'; tus tswv = 'smtp.gmail.com'; chaw nres nkoj = '465'; emailto = '[email protected]'; m_subject = 'ntsiab lus'; m_text = 'xeem'; setpref ('Internet', 'E_mail', xa ntawv); setpref ('Internet', 'SMTP_Server', tus tswv tsev); setpref ('Internet', 'SMTP_Username', xa ntawv); setpref ('Internet', 'SMTP_Password', psswd); 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 (emailto, 'Pab!', 'Tsis pom tus neeg ya dav hlau!', img); r.stop kawg kawg kawg

Pom tseeb nws tsis meej ntawm no, tab sis nws yuav tsum tau tshem tawm ib zaug theej. Lo lus zais thiab email rau qhov no yuav tsum tau muab los ntawm cov uas ua txoj haujlwm no pom tseeb.

Txawm li cas los xij, peb qhov piv txwv tsuas yog ib qho ntawm ntau txoj hauv kev los cuam tshuam nrog cov neeg hlau no kom nws haum rau txhua tus. Muaj ntau yam sib txawv uas yuav tsum tau ua, uas koj tuaj yeem haum rau koj tus kheej.

Pom zoo: