Cov txheej txheem:

Leap Motion Controlled Remote Search and Disposal Robot: 5 Kauj Ruam
Leap Motion Controlled Remote Search and Disposal Robot: 5 Kauj Ruam

Video: Leap Motion Controlled Remote Search and Disposal Robot: 5 Kauj Ruam

Video: Leap Motion Controlled Remote Search and Disposal Robot: 5 Kauj Ruam
Video: Leap Motion Controlled Remote Search and Disposal Robot using Raspberry Pi 2024, Hlis ntuj nqeg
Anonim
Image
Image

Raws li ib feem ntawm kuv nkag mus rau Leap Motion #3D Jam, Kuv zoo siab los tsim qhov kev piav tes piav taw no wireless tswj Kev Tshawb Fawb/Cawm Neeg Hlau raws li Raspberry Pi. Txoj haujlwm no qhia thiab muab piv txwv tsawg kawg ntawm kev siv wireless 3D tes taw li cas tuaj yeem siv los tswj thiab cuam tshuam nrog cov khoom ntawm lub cev.

Txij li txoj haujlwm no siv WebIOPi IoT nrov npe ntawm Raspberry Pi, nws tuaj yeem nthuav dav tau yooj yim los tswj thiab cuam tshuam feem ntau yog Sensor/Hardware/Electronics uas tuaj yeem cuam tshuam nrog Raspberry Pi.

Qee qhov xwm txheej uas kuv xav txog cov phooj ywg tsim khoom yuav siv txoj haujlwm no ua lawv lub hauv paus pib los tsim:

1. Kev Siv Tus Kheej Tus Kheej Lub Chaw Taws Teeb (Siv tej zaum muaj OWI Caj Npab thiab lwm yam)

2. Kev phais mob tej thaj chaw deb los ntawm kws kho mob

3. Kev piav tes piav taw piav qhia txog kev kos duab kos duab lossis cov ntsiab lus kev kawm

4. Infinite lwm qhov muaj peev xwm/kev sib xyaw (Kuv txwv los ntawm kuv lub tswv yim:))

Kauj ruam 1: Txheej txheem cej luam

Nkag siab txog WebIOPi Tus Qauv
Nkag siab txog WebIOPi Tus Qauv

Txoj haujlwm no tso cai rau tus neeg siv los sib tham tswj hwm Tus Neeg Hlau siv 3D tes taw los ntawm Leap Motion txuas nrog lub PC.

Raspberry Pi nyob ntawm tus neeg tsav tsheb kuj tseem muaj USB Webcam uas tso cov vis dis aus rov qab rau tus neeg siv uas tuaj yeem pom ntawm Web Browser. LeapMotion JavaScript lub tsev qiv ntawv kos rau hauv Webpage no txheej txheem tes taw thiab xa cov cim taw qhia rov qab mus rau Neeg Hlau, uas tom qab ntawd txav mus raws li.

Raspberry Pi ntawm Neeg Hlau tau teeb tsa ua Hotspot (AP hom) nrog kev pab los ntawm USB WiFi dongle txuas nrog nws. Qhov no tso cai rau peb lub PCs/Devices txuas ncaj qha rau Raspberry Pi thiab tswj ntawm lub vev xaib. Raspberry Pi kuj tseem tuaj yeem teeb tsa los ua haujlwm hauv hom neeg siv, nyob ntawm no nws txuas wirelessly mus rau WiFi Router's AP uas lub PC/Devices tau txuas nrog lawm.

Txoj haujlwm no yog ua raws WebIOPi (https://webiopi.trouch.com/) uas yog IoT moj khaum nrov rau Raspberry Pi. Los ntawm kev siv pob khoom Weaved IoT (lossis los ntawm chaw nres nkoj xa mus rau ntawm Router), Tus Neeg Hlau no tuaj yeem tswj tau nyob deb thiab/lossis tau txais cov ntaub ntawv los ntawm ib feem ntawm lub ntiaj teb.

Cov hauv qab no tau siv los tsim txoj haujlwm:

  1. Raspberry Pi B (100% rau tom ntej tau tshaj nrog Raspberry Pi B+)
  2. Logitech USB Webcam (paltry 1.3 Megapixel)
  3. L293D Tsav Tsheb Tsav IC thiab Kev Tiv Thaiv Tawm
  4. USB WiFi Dongle rau Raspberry Pi
  5. USB Power Bank rau Raspberry Pi
  6. Sab Nraud 4V/1.5A Roj teeb rau tsav Robot Motors

Kauj ruam 2: Tsim Qhov Project

Txhim kho WebIOPi, Sau Cov Cai Cai thiab teeb tsa Webcam:

Cov lus qhia teeb tsa WebIoPi, cov hauv paus ntsiab lus thiab ntau yam piv txwv muaj nyob ntawm qhov phiaj xwm nplooj ntawv no:

Txhawm rau kom tau txais LeapMotion cov haujlwm hauv lub vev xaib ua rau GPIO ua rau ntawm Raspberry Pi, peb tau siv Macros, cov ntsiab lus uas tau pom ntawm no:

Kuv kuj tau sau qee qhov pib sau tseg txog cov txheej txheem saum toj no uas tuaj yeem pom txuas nrog.

Txhim kho thiab teeb tsa Webcam

Peb tab tom siv MJPG-Streamer txhawm rau rub cov vis dis aus los ntawm Raspberry Pi rov qab mus rau Browser los ntawm USB Webcam txuas nrog ntawm Pi. Thov ua raws li teeb tsa thiab tsim cov lus qhia qhia ntawm no https://blog.miguelgrinberg.com/post/how-to-build-… kom tau MJPG-Streamer ua haujlwm ntawm Raspberry Pi.

Kho lub Raspberry Pi ua AP/Hotspot

Txhawm rau teeb tsa Raspberry Pi ua Hostpot, thov ua raws cov lus qhia hauv no: https://elinux.org/RPI-Wireless-Hotspot. Kuv teeb tsa tus IP zoo li qub ntawm Raspberry Pi li 192.168.42.1 uas yog yam peb yuav ntaus rau hauv qhov browser thaum Pi khau raj mus rau hauv AP hom.

WebIOPi, MJPG-Streamer thiab WiFi kev pabcuam hotspot tau teeb tsa kom pib ua haujlwm ntawm khau raj thiab qhov no tso cai rau peb qhib ncaj qha qhib lub Vev xaib thiab txuas rau Robot tom qab nws khau raj. Cov ntaub ntawv rc.local muaj nyob hauv repo yog siv los khiav Webcam ntawm khau raj.

Kauj Ruam 3: Ua/Qhia Cov Xov Tooj

4 GPIOs ntawm Raspberry Pi uas yog GPIO 9, 11, 23 & 24 txuas nrog L293D Tsav Tsav Tsheb IC uas tsav lub cav raws li tau txais tom qab tau txais kev thov loj los ntawm Webpage tau txais los ntawm Webiopi lub moj khaum. USB WiFi dongle thiab USB Logitech Webcam txuas nrog rau 2 USB chaw nres nkoj muaj nyob ntawm Raspberry Pi. A 5V 4000 Mah Power bank muab lub zog tseem ceeb rau Pi. Lub roj teeb 4V 1.5A Lead Acid tau siv los tsav cov Motors.

Nco tseg: Txij li qhov tso tawm ntau tshaj tam sim no ntawm lub txhab nyiaj kuv tau siv yog ntsuas 1000 Mah, Kuv yuav tsum siv cov roj teeb Lead Acid sab nraud los tsav lub cav. Yog tias koj muaj lub txhab nyiaj fais fab uas muab> = 2000Mah, koj tuaj yeem tsav lub cav ncaj qha los ntawm 5V kev tsheb nqaj hlau ntawm Pi (Kuv tsis xav kom qhov no rau lub zog tshaib plab lub zog txawm hais tias)

3 ntu tseem ceeb ntawm txoj haujlwm LeapMotion Javascript API, WebIOPi thiab MJPG-Streamer thiab lawv cov haujlwm yooj yim/teeb tsa tau piav qhia luv luv hauv qab no.

Kauj Ruam 4: Nkag Siab WebIOPi Framework

Lub ntsej muag uas tau qhia ntawm Browser tau sau rau hauv HTML (Lub npe: index.html) & Javascript thaum lub nraub qaum uas ua rau GPIOs tau sau hauv Python (Filename: script.py). Cov ncauj lus kom ntxaws ntawm kev tsim WebApp kev cai raws li WebIOPi moj khaum txuas nrog raws li sau tseg hauv Bitbucket repo.

Kev cai macros txhais hauv Python tsab ntawv tuaj yeem tshwm sim los ntawm cov ntawv HTML.

Piv txwv: webiopi (). CallMacro ("go_forward"); Qhov no yog kev cai hu mus rau macro go_forward tau hais tseg hauv Python tsab ntawv uas ua haujlwm cov txheej txheem ntawm kev tsav tsheb ob lub Motors nyob rau pem hauv ntej.

Cov npe teev npe ntawm qhov chaw uas cov ntaub ntawv khaws cia ntawm Pi tau qhia hauv daim duab txuas.

Robot nplaub tshev muaj cov sub-folders:

  • html: muaj index.html
  • nab hab sej: muaj script.py
  • mjpg-streamer-r63: muaj cov ntaub ntawv tsim thiab ua tiav kom khiav Webcam

MJPG-Streamer: Live Video kwj los ntawm USB Webcam khiav ntawm chaw nres nkoj 8080 ntawm Pi los ntawm lub neej ntawd. Txhawm rau kom pom tus kwj dej, mus rau RASPBERRYPI_IP: 8080 ntawm qhov browser tom qab tig lub Webcam.

LeapMotion Code:

Cov ntawv me me los ntawm cov piv txwv muab hauv LeapMotion SDK tau muab tso rau hauv cov ntawv index.html. LeapMotion's leap.js cov ntaub ntawv yuav tsum tau ntxiv rau hauv html nplaub tshev hauv cov phiaj xwm phiaj xwm ntawm Raspberry Pi.

Lub palmPosition parameter xa los ntawm LeapMotion tau siv los txiav txim siab qhov twg los cuam tshuam rau ntawm Raspberry Pi.

Kauj ruam 5: Khiav qhov Project

Cias hwj chim rau ntawm Raspberry Pi thiab tos kwv yees li ib pliag. Koj yuav pom qhov kub tshiab RaspberryPi qhia tawm. Txuas mus rau qhov hotspot no thiab qhib qhov IP chaw nyob zoo li no hauv qhov browser: 192.168.42.1:8000. 8000 yog qhov chaw nres nkoj pib ntawm WebIOPi.

Raspberry Pi kuj tseem tuaj yeem teeb tsa kom txuas mus rau lub network WiFi hauv zej zog raws li nyob rau hauv clien es tsis txhob tshwm sim ua tus hotspot. Tom qab ntawd koj yuav tsum txiav txim siab tus IP hloov pauv tau muab rau Raspberry Pi los ntawm Router thiab tom qab ntawd ntaus nws hauv Browser kom ua si ib puag ncig nrog Bot.

Koj tuaj yeem tawm lus yog tias koj xav tau kev pab lossis muaj lus nug txog qhov haujlwm. Zoo Siab Leaping!

Tag nrho cov lej cim tau muab txuas nrog. Koj tuaj yeem tawm lus yog tias koj xav tau kev pab nrog ib feem ntawm kev tsim lub phiaj xwm. Zoo Siab Leaping!

Pom zoo: