Cov txheej txheem:

Qhov tseeb Wiimote Lub Teeb Phom rau Raspberry PI: 9 Cov Kauj Ruam (nrog Duab)
Qhov tseeb Wiimote Lub Teeb Phom rau Raspberry PI: 9 Cov Kauj Ruam (nrog Duab)

Video: Qhov tseeb Wiimote Lub Teeb Phom rau Raspberry PI: 9 Cov Kauj Ruam (nrog Duab)

Video: Qhov tseeb Wiimote Lub Teeb Phom rau Raspberry PI: 9 Cov Kauj Ruam (nrog Duab)
Video: Peb hmoob pheej muaj cov phem li no tiag 9/17/2021 2024, Kaum ib hlis
Anonim
Qhov tseeb Wiimote Lub Teeb Phom rau Raspberry PI
Qhov tseeb Wiimote Lub Teeb Phom rau Raspberry PI
Qhov tseeb Wiimote Lub Teeb Phom rau Raspberry PI
Qhov tseeb Wiimote Lub Teeb Phom rau Raspberry PI

Feem ntau, Wii Cov Chaw Taws Teeb siv los ua rab phom tsis yog qhov tseeb txaus rau kev ua si retro zoo li NES Duck Hunt, vim tias Wii Remote tsis yog qhov tseeb xaiv lub ntsiab lus hauv TV nws tau taw qhia. Nws ua tsis tau! Wii Cov Chaw Taws Teeb muaj lub koob yees duab infrared nyob rau hauv nws xub ntiag uas pom kab ntawm infrared LEDs hauv lub sensor sensor, tab sis nws tsis tuaj yeem paub deb npaum li cas (lossis nyob rau qhov twg) TV yog los ntawm lub bar lossis TV loj npaum li cas. Emulators thiab games ua haujlwm nyob ib puag ncig qhov no los ntawm kev qhia hla plaub hau lossis lwm yam kev ntsuas lub hom phiaj, tab sis qhov ntawd tsis yog qhov kev paub tseeb txog kev tua phom.

Txhawm rau ua Wii Cov Chaw Taws Teeb ua haujlwm zoo li rab phom teeb uas koj tuaj yeem pom ua ke txhawm rau xaiv lub hom phiaj hauv TV xav tau plaub lub infrared LEDs tau teeb tsa hauv ib qho qauv plaub fab uas paub (tsis yog kab ncaj) hauv tib lub dav hlau zoo li TV. Tom qab ntawd Wii Chaw Taws Teeb pom plaub lub LEDs thiab lub koob yees duab duab tuaj yeem siv los xam homography uas tso cai rau peb txiav txim siab seb lub koob yees duab tau taw qhia qhov twg.

Kho vajtse rau txoj haujlwm no yooj yim. Muaj plaub lub infrared LEDs hauv cov tsev yooj yim 3D luam tawm uas tuaj yeem ua rau sab saum toj thiab hauv qab ntawm lub tsev TV thiab ntsaws rau hauv USB them nyiaj. Ntxiv rau, yog tias koj tsis muaj Wii rab phom nyob hauv tsev, Kuv muaj cov ntawv luam yooj yim 3D thiab pom uas koj tuaj yeem txuas rau Wii Chaw Taws Teeb (txawm tias yuav txuag yas, Kuv tau ua kuv li kev sib xyaw ntawm ntoo thiab 3D luam yas).

Python-based software nyuaj rau ua dua li kho vajtse thiab tam sim no Linux nkaus xwb. Nws ntsuas cov LEDs thiab Wii Cov Chaw Taws Teeb thiab tom qab ntawd siv hom lus suav kom ua raws tus nas kiag uas ua haujlwm tau zoo heev hauv Retroarch's fceumm NES emulator (thiab tej zaum qee qhov lwm yam emulators) ntawm kuv Raspberry PI 3B+.

Khoom siv

  • Wii Chaw Taws Teeb
  • Plaub 940nm 5mm infrared LEDs
  • Qub USB cable nrog ua haujlwm hom A ntsaws
  • Raspberry PI 3 lossis lwm lub khoos phis tawj Linux nrog txhawb nqa Bluetooth
  • 3D tshuab luam ntawv thiab filament (yeem)

Kauj Ruam 1: Infrared LED Chain

Infrared LED saw
Infrared LED saw
Infrared LED saw
Infrared LED saw

Tau txais lub qub USB cable nrog hom ua haujlwm A txiv neej lub qhov (feem ntau yog kuv lub xov tooj them cov xov hluav taws xob tawg ntawm lub micro USB kawg, yog li kuv muaj cov xov tooj tseem tshuav nrog ua haujlwm hom A txiv neej lub qhov)) Qhov tseeb, nws txawm tias yog cov ntaub ntawv xov tooj yog tawg tsuav yog cov kab fais fab ua haujlwm. Txiav lwm qhov kawg. Hauv txoj kev xav, txoj kab liab yuav tsum yog +5V thiab cov dub yuav tsum yog hauv av, tab sis txheeb xyuas nws nrog lub ntsuas cua (ntsaws nws rau hauv lub charger, thiab tom qab ntawd txheeb xyuas qhov hluav taws xob ntawm cov xov tooj liab thiab dub).

Txij li infrared LEDs muaj nyob ib ncig ntawm 1.2-1.3V qhov hluav taws xob poob, Kuv tsuas yog siv plaub ntawm lawv hauv kab txuas rau USB cable. Ua kom ntseeg tau tias cov xov hlau uas koj siv tau ntev txaus uas koj tuaj yeem tso LEDs hauv qab ntawm TV thiab ob sab saum toj, nrog qhov tsim nyog ntawm qhov chaw kab rov tav ntawm LEDs (li 10 ntiv tes lossis ntau dua).

Ntau qhov tseeb los ua lub voj LED:

  • solder qhov rho tawm sab (cathode, luv dua ceg, nrog ntug tiaj) ntawm thawj LED mus rau +5V USB xaim
  • koom nrog ib sab ntxiv ntawm thawj LED (anode, ntev dua ceg, nrog puag ncig) mus rau sab qis ntawm ob LED
  • rov ua dua los koom nrog LED thib ob mus rau qhov thib peb thiab thib peb mus rau plaub
  • tom qab ntawd txuas sab ntxiv ntawm plaub LED nrog xaim rau hauv av USB xaim.

Txhawm rau ua kom cov khoom zoo dua qub, koj tuaj yeem siv cov cua sov ntsws thaum koj ua qhov sib txuas. Txwv tsis pub, siv daim kab xev hluav taws xob kom tsis txhob luv.

Xyuas kom koj tsis muaj cov hluav taws xob luv. Tom qab ntawd ntsaws nws rau hauv USB them nyiaj thiab kuaj xyuas tias nws tau tso lub teeb pom kev deb los ntawm kev saib cov LEDs nrog lub xov tooj lub koob yees duab. (Ntau lub koob yees duab hauv xov tooj yog lub teeb pom kev zoo infrared.)

Kauj ruam 2: Txuas rau TV

Txuas rau TV
Txuas rau TV
Txuas rau TV
Txuas rau TV
Txuas rau TV
Txuas rau TV

Tam sim no, txuas ob lub LEDs rau sab hauv qab ntawm TV thiab ob qho rau sab saud. Kab nrug kab rov tav yuav tsum yog kaum ntiv tes. Yog tias nws ntau dhau, koj yuav muaj teeb meem nrog Wii Lub Koob Yees Duab Lub Koob Yees Duab saib pom lawv txhua tus. Tab sis yog tias lawv nyob ze dhau, tom qab ntawd kuv qhov kev xav geometric hais tias koj yuav muaj qhov ua tau qis dua.

Txog kev sim, Kuv tau kaw cov LEDs nrog cov kab xev hluav taws xob, thiab tom qab ntawd txuas mus tas li, Kuv tsim thiab luam tawm plaub qhov me me zoo nkauj me me (cov ntaub ntawv nyob ntawm no) uas kuv kub glued rau TV. Koj yuav tsum ua kom cov LEDs nyob ze rau lub dav hlau ntawm TV saib raws li koj tuaj yeem ua tau, yam tsis muaj lub ntsej muag thaiv lawv los ntawm qhov chaw uas koj yuav tua.

Kauj ruam 3: Nruab Software

Tam sim no lub software yog Linux nkaus xwb. Cov teeb tsa hauv qab no yog tsim los rau Raspberry PI 3 nrog Raspbian Stretch. Lwm lub tshuab Linux yuav xav tau qee qhov kev hloov pauv. Ntawm cov qauv ua ntej koj yuav xav tau Bluetooth dongle thiab koj yuav tsum tau ua qhov no los ntawm kab lus hais ib yam nkaus:

sudo tau-apt nruab bluetooth

Kauj ruam A: udev

Tom ntej no, tsim cov ntawv hauv /etc/udev/rules.d/wiimote.rules uas muaj ib kab nkaus xwb:

KERNEL == "uinput", QAUV = "0666"

Koj tuaj yeem ua qhov ntawd, piv txwv li, nrog tus kws kho ntawv lossis sau cov hauv qab no ntawm kab lus hais kom ua:

sudo sh -c 'ncha KERNEL == / "uinput \", MODE = / "0666 \"> /etc/udev/rules.d/wiimote.rules'

Thiab ces rov pib dua udev:

sudo /etc/init.d/udev rov pib dua

Kauj ruam B: cwiid

Tom ntej no, koj yuav xav tau kuv pob cwiid hloov kho. Nov nws tau txais plaub hau me ntsis raws li qhov koj xav tau los tsim nws ntawm koj li Raspberry PI, tab sis kuv yuav tsum lees txim tias kuv tau poob ntawm cov pob uas koj xav tau los teeb tsa kom nws ua haujlwm. Muaj peb txoj hauv kev los ua qhov no.

Kev Xaiv B1: Tsim koj tus kheej

cd ~ ib

git clone https://github.com/arpruss/cwiid-1 autoconf./configure ua -C libcwiid sudo ua -C libcwiid nruab ua -C nab hab sej ua -C nab hab sej nruab

Hmoov tsis zoo, muaj lub sijhawm zoo uas koj tab tom ploj ib pawg ntawm cov khoom xav tau los tsim qhov no, thiab./configure yuav yws. Koj tuaj yeem saib txhua yam nws yws txog thiab khiav sudo apt nruab rau ntawm lawv.

Kev xaiv B2: Siv kuv qhov binaries

cd ~ ib

wget https://github.com/arpruss/cwiid-1/releases/download/0.0.1/cwiid-rpi.tar.gz tar zxvf cwiid-rpi.tar.gz cd cwiid sudo ua nruab

Kauj Ruam C: cov tsev qiv ntawv nab hab sej

Thaum kawg, tau txais cov khoom txhawb nqa rau kuv tsab ntawv foob pob hluav taws:

sudo pip3 nruab uinput numpy pygame opencv-sej

sudo apt-tau nruab libatlas-base-dev sudo apt-tau nruab libjasper-dev sudo apt-tau nruab libqtgui4 sudo apt-tau nruab python3-pyqt5

Kauj Ruam D: lightgun.py

Thaum kawg, tau txais kuv tsab ntawv ceeb toom nab nab:

cd ~ ib

git clone

Yog tias txhua yam tau mus zoo, tam sim no koj muaj ~/lightgun.py uas koj tuaj yeem siv los ntsuas lub teeb nrig.

Kauj Ruam 4: Calibration Tshooj I: Nruab Lub Koob Yees Duab

Calibration Tshooj I: Nruab Lub Koob Yees Duab
Calibration Tshooj I: Nruab Lub Koob Yees Duab
Calibration Tshooj I: Nruab Lub Koob Yees Duab
Calibration Tshooj I: Nruab Lub Koob Yees Duab
Calibration Tshooj I: Nruab Lub Koob Yees Duab
Calibration Tshooj I: Nruab Lub Koob Yees Duab

Muaj ob txoj hauv kev los ntsuas. Thawj qhov yog ntsuas qhov nruab nrab ntawm lub koob yees duab ntawm txhua Wiimote. Qhov no yuav tsum siv lub koob yees duab txhawm rau coj ob daim duab ntawm LEDs ib puag ncig koj lub vijtsam TV, ib qho nrog cov chaw taws teeb sab xis sab xis thiab lwm qhov nrog nws rov qab-down.

Txhawm rau zam kev nyem cov nyees khawm thaum koj tso Wii Chaw Taws Teeb rau ntawm nws xub ntiag, thiab txhawm rau ua kom Wii Cov Chaw Taws Teeb muaj qhov ua tau zoo ib yam, koj tuaj yeem luam tawm 3D cov cuab yeej ntsuas qhov kuv suav nrog ntawm no. Koj xav tau yam uas yog 10.5mm tuab uas koj tuaj yeem tso rau hauv Wii Chaw Taws Teeb thaum nws nyob ntawm nws xub ntiag. Kuv yeej tau siv qee cov plywood kom txuag tau yas.

Qhib koj lub LEDs thiab xyuas kom tseeb tias koj Raspberry PI lossis lwm lub khoos phis tawj tau tso tawm hauv TV. Txuas cov keyboard (qhov no yuav tsis ua haujlwm dhau ssh) lossis siv VNC. Tom qab ntawd khiav:

python3 ~/lightgun/lightgun.py -M

Yog tias txhua yam mus tau zoo, koj yuav tau txais lub vijtsam puv puv thov kom koj nias 1+2 ntawm Wii Remote. Ua li ntawd. Teeb yuav ci ntawm Wii Chaw Taws Teeb, thiab tom qab ntawd teeb 1 thiab 4 yuav nyob twj ywm. Koj tseem yuav pom ib lub duab plaub ntsuab me me nyob rau sab saum toj ntawm lub vijtsam, nrog saib los ntawm Wii Lub Koob Yees Duab Lub Koob Yees Duab. Taw tes rau Wii Chaw Taws Teeb ntawm LEDs thiab yog tias txhua yam mus tau zoo, koj yuav pom plaub LEDs, suav tus lej 1 txog 4.

Tam sim no koj yuav tsum nrhiav qhov tawv nqaij nrog lub ntsej muag ntse, zoo li lub rooj kas fes, uas koj tuaj yeem taw tes rau ntawm lub vijtsam TV thiab uas tuaj yeem tso cai rau Wii Chaw Taws Teeb kom pom txhua lub LEDs nrog Wii Cov Chaw Taws Teeb ua ke tiv thaiv ntug. Pib los ntawm kev teeb tsa Wii Chaw Taws Teeb sab xis, nrog Cov Chaw Taws Teeb nyob sab xis tiv thaiv ntug ntug, ua kom ntseeg tau tias tag nrho plaub lub LED tau pom. Tom qab ntawd nyem SPACE ntawm koj cov keyboard (lossis txuas Nunchuck thiab nias C yog tias yooj yim dua). Tom qab ntawd koj yuav raug ceeb toom kom tig lub Wii Remote. Tam sim no, xyuas kom nws nce siab 10.5 hli nce los ntawm koj qhov chaw, siv cov cuab yeej ntsuas lossis lwm yam ntxiv, thiab nyob ze rau tib qhov chaw ib yam li ua ntej (piv txwv li, ua raws li ib sab ntawm koj sab). Nias SPACE dua.

Yog tias txhua yam mus tau zoo, tam sim no koj yuav mus rau kauj ruam calibration LED. Yup, qhov no nyuaj! Tab sis koj yuav muaj lub teeb pom kev zoo heev. Qhov ntawd tsuas yog tus nqi.

Nco tseg: Yog tias zoo li kuv koj muaj Wii nyob hauv TV, Wii yuav tsum tau muab tua rau ob qhov laj thawj: ua ntej, yog tias Wii tau qhib, nws yuav txuas rau Wiimote thiab, thib ob, lub ntsuas hluav taws xob lub teeb liab LEDs yuav cuam tshuam nrog txoj haujlwm no. Rau qhov laj thawj zoo sib xws, thaum koj siv Wii nws yog lub tswv yim zoo kom tshem lub LEDs ncig TV.

Kauj Ruam 5: Calibration Kauj Ruam II: LEDs

Calibration Step II: LEDs
Calibration Step II: LEDs
Calibration Step II: LEDs
Calibration Step II: LEDs

Tam sim no koj yuav tsum qhia lub software qhov twg LEDs nyob ib puag ncig TV lub ntug. Koj yuav pom lub vijtsam ntsuas ntsuas pom plaub tus xub, ib qho ntawm lawv tau xaiv (ci) thiab peb ntawm lawv tau tsaus xim, nyob ib ncig ntawm ntug TV. Koj siv +/- los hloov pauv tus xub uas koj tab tom kho.

Rau txhua ntawm plaub tus xib xub nyob ib ncig ntawm ntug, ua li no:

  1. nias sab laug/sab xis ntawm Wiimote kom txav cov xub kom txog thaum lawv taw qhia kom raug raws li koj tuaj yeem ua rau LED sib xws;
  2. nias nce/nqis ntawm Wiimote txhawm rau hloov xub xub kom txog thaum qhov xub xub sib phim qhov nrug nruab nrab ntawm LED thiab ntug ntawm TV saib; hauv lwm lo lus, qhov ntev ntawm xub yuav tsum sib npaug ntawm qhov deb ntawm qhov taw qhia xub mus rau LED.

Thaum koj plaub tus xub yog qhov raug (thiab tej zaum tseem ntxov dua) koj yuav pom lub ntsej muag liab thaum koj taw tes rau Wiimote ntawm lub vijtsam. Koj tuaj yeem tshawb xyuas tias qhov no yog qhov nws yuav tsum yog. (Nco ntsoov tias koj yuav tsum nyob deb deb kom deb li deb uas Wiimote tuaj yeem pom txhua lub LEDs. Nws tseem ceeb heev uas yuav tsum tsis muaj lwm qhov chaw ntawm infrared hauv qhov pom kev. Kuv ib zaug muaj teeb meem vim tshav ntuj pom tawm ntawm lub taub hau ntsia hlau ntawm TV sawv.)

Thaum kawg, muaj tus xub thib tsib, uas tsuas yog tshwm sim thaum koj nias + los ntawm plaub lub xub xub LED lossis - los ntawm thawj (thiab nws los ntawm lub neej ntawd muaj xoom ntev, yog li nws tsuas yog pixel). Cov xub no hloov kho nyob deb npaum li cas saum lub koob yees duab ntawm Wii Remote lub koob txhaj tshuaj yuav raug sau npe. Qhov teeb meem yog qhov no: koj yuav pom nyob rau sab saum toj ntawm Wii Chaw Taws Teeb. Tab sis lub koob yees duab tau nyob qee qhov deb hauv qab qhov saum toj no, hauv nruab nrab ntawm cov duab plaub dub nyob rau pem hauv ntej ntawm Wii Chaw Taws Teeb. Yog tias peb sau npe txhaj tshuaj qhov twg lub koob yees duab tau taw qhia, lawv yuav raug sau npe txog 8 hli hauv qab sab saum toj ntawm Wii Chaw Taws Teeb. Koj tuaj yeem tshawb xyuas qhov no los ntawm kev ceeb toom tias thaum koj pom raws saum toj kawg nkaus, qhov nruab nrab ntawm cov plaub hau plaub hau tau zais los ntawm lub koob yees duab.

Koj tuaj yeem nyob nrog qhov no, lossis koj tuaj yeem loj hlob tus xub thib tsib no rau software kho qhov kev txhaj tshuaj nrog rau sab saum toj ntawm Wii Chaw Taws Teeb, lossis koj tuaj yeem kho cov ntawv 3D luam tawm rau cov hlau pom kom them nyiaj rau qhov no (tab sis cov nyiaj yuav tsuas ua haujlwm rau ib qho tshwj xeeb nrug rau TV). Kuv tau mus rau qhov software sib dhos kuv tus kheej.

Nias HOME ntawm Wii Chaw Taws Teeb kom tawm qhov ntsuas thiab khaws tag nrho cov ntaub ntawv mus rau ~/.wiilightgun phau ntawv teev npe.

Kauj Ruam 6: Xeem thiab Siv

Kuaj thiab Siv
Kuaj thiab Siv
Kuaj thiab Siv
Kuaj thiab Siv
Kuaj thiab Siv
Kuaj thiab Siv

Tej zaum koj yuav xav sim koj rab phom lub teeb tam sim no. Tsuas yog khiav hauv lub davhlau ya nyob twg emulator (lossis tsab ntawv):

python3 ~/lightgun/lightgun.py -t

Koj yuav tsum tau nyem 1+2 cov nyees khawm tib lub sijhawm, thiab tom qab ntawd yog tias txhua yam mus tau zoo, tsuav yog lightgun.py tab tom ua haujlwm, lub teeb nrig yuav ua raws li ob-khawm nas kiag. Lub pob ua yog nas khawm 1, thiab A khawm yog nas khawm 2. Nias ctrl-c kom tawm mus.

Tam sim no koj tsuas yog xav tau teeb tsa koj tus emulators thiab/lossis kev ua si kom ua haujlwm nrog nas kiag li. Hmoov tsis zoo, qhov ntawd tsis tas yuav yog qhov yooj yim.

Ib qhov lom zem uas koj yuav sim yog kuv tus qauv ntawm iminurnamez's duck-duck-shoot:

cd ~ ib

git clone https://github.com/arpruss/duck-duck-shoot cd os-duck-shoot nab nab play_game.py

Txog NES kev ua si, Kuv siv libretro fceumm core hauv Retroarch. Mus rau Cov Ntawv Qhia Xaiv, thiab teeb tsa Zapper los ua lub vijtsam kov. (Kho nws li nas tsis ua haujlwm tiag tiag, raws li fceumm cia siab tias muaj kev txheeb ze-txav ntau dua li tsis muaj txoj haujlwm nas.)

Yog tias koj pib koj cov kev ua si nrog tsab ntawv, koj tuaj yeem hloov kho qhov uas pib ua si lossis tus emulator hais:

python3 ~/lightgun/lightgun.py -t -B 30 "hais kom pib game"

Tom qab ntawd thawj 30 vib nas this ntawm qhov kev ua si (yog li -B 30 qhov kev xaiv), koj tuaj yeem txuas koj lub teeb nrig los ntawm kev tuav 1+2.

Los ntawm txoj kev, tsab ntawv lightgun.py kuj tseem tuaj yeem siv rau dav dav Wii Kev twv txiaj nrog Retroarch. Tsuas yog ntxiv qhov -o kev xaiv thiab lub zog ua haujlwm lub zog yuav raug muab tua, thiab hloov Wii Chaw Taws Teeb yuav ua haujlwm ntsug, nrog peb lub khawm ua 1, 2 thiab B feem. Muaj lwm yam Retroarch cuam tshuam txog kev ua haujlwm hauv lightgun.py daim ntawv qhia uas koj yuav pom los ntawm kev nyeem cov cai. Piv txwv li, qhov rho tawm qhov tseem ceeb ua haujlwm hloov pauv, thiab ua ke nrog dpad tswj kev txuag thiab thauj khoom (nce/nqis = hloov pauv tus lej; sab laug = rov qab; txoj cai = txuag).

Kauj Ruam 7: Rab Phom thiab Aiming

Phom Handle thiab Aiming
Phom Handle thiab Aiming
Phom Handle thiab Aiming
Phom Handle thiab Aiming
Phom Handle thiab Aiming
Phom Handle thiab Aiming

Koj tuaj yeem siv Wii Chaw Taws Teeb los ntawm nws tus kheej ua rab phom, pom sab saum toj. Koj tseem tuaj yeem yuav ib qho ntawm cov phom phom coj mus muag rau nws. Tab sis vim tias thawj Wii Chaw Taws Teeb tsis muaj peev xwm siv los ua rab phom pom tau, cov ntaub ntawv zoo li tsis tuaj nrog cov hlau pom, thiab cov hlau pom zoo txhim kho qhov tseeb.

Kuv tsim qhov yooj yim peb-ntu 3D-tshuab luam ntawv: swb-ntawm tus tuav uas zaum tom qab lub ntsuas (yog li nws zoo li me ntsis zoo li Star Trek Original Series phaser), thiab swb-rau qhov pom. Cov ntawv luam tau nyob ntawm no. Yog tias koj xav txuag cov yas ntawm tus nqi ntoo, koj kuj tuaj yeem ua qhov kuv tau ua thiab tsis txhob luam tawm tag nrho cov tuav, luam tawm tsuas yog ib feem uas tuav Wiimote, thiab txiav tawm ib qho ntoo thiab ntsia hlau rau.

Txhawm rau pom, tsom koj lub qhov muag ntawm qhov pom. Teem lub xub ntiag pom sab nraub qaum ntawm lub nraub qaum pom kom lub qhov cua nyob ntawm ib qho twg yog qhov sib npaug thiab tag nrho peb lub pob tawm mus zoo ib yam. Tom qab ntawd kho qhov nruab nrab ntawm lub hom phiaj nrog rau sab saum toj ntawm pob.

Nco tseg: Qhov siab ntawm pob ua tsis zoo ib yam, nrog rau lub xub ntiag pom lub pob tw qis dua, txhawm rau txhawm rau txhawm rau txhawm rau qhov siab ntawm qhov pom pob lawv tus kheej thaum koj pom nrog lawv nyob ntawm qhov deb ntawm 2.5 meters (kuv nyob deb rau TV). Yog tias koj muaj qhov sib txawv sib txawv hauv TV, koj tuaj yeem tso qhov ntawd rau hauv OpenSCAD cov ntaub ntawv. Qhov kev hloov kho no yuav qis dua li lub tshuab luam ntawv, txawm li cas los xij. Tsis tas li, yog tias koj tsis tau ua qhov hloov kho ntsug hauv software, koj tuaj yeem ntxiv qee qhov kev hloov pauv ntxiv rau qhov pom hauv software los ntawm kev teeb tsa ntxivSightAdjust to something around -8 (in millimeters).

Kauj Ruam 8: Calibration III (Tsis teb los tau): Kev Kho Kom Zoo

Yog tias koj xav tau ntau dua qhov tseeb, koj tuaj yeem khiav:

python3 ~/lightgun/lightgun.py -d

(rau demo) thiab ua tib zoo saib seb qhov pom sib haum nrog cov plaub hau hla. Yog tias lawv tsis ua, tawm thiab hloov kho tus kheej ~/.wiilightgun/wiimotecalibration, thiab kho qhov x thiab y tswj ntawm lub koob yees duab nruab nrab me ntsis los kho qhov pom. Piv txwv li, kuv rab phom tau tua me ntsis rau sab xis, yog li kuv tau xaus qhov hloov pauv x ntawm 529 txog 525. Txhua tus lej yuav zoo li txawv.

Kauj Ruam 9: Cov Ntawv Ntxiv: Cov Txheej Txheem

Cov ntawv txuas ntxiv: Algorithm
Cov ntawv txuas ntxiv: Algorithm

Tus nas emulation code ua haujlwm ntxhib raws li hauv qab no.

  • Txheej txheem khawm nias.
  • Tau txais cov ntaub ntawv los ntawm lub koob yees duab thiab kho kom haum rau lub koob yees duab nruab nrab.
  • Yog tias tsawg dua peb LEDs pom hauv lub koob yees duab:

    Khaws nas kawg

  • Yog tias peb lossis plaub LEDs pom:

    • Siv Wiimote cov ntaub ntawv ntsuas qhov ntsuas kom tau txais Wiimote kev taw qhia thiab txheeb xyuas qhov twg lub koob yees duab LED zoo sib xws rau lub cev LED.
    • Yog tias pom plaub LEDs:

      • Xam homography ntawm cov duab LED lub koob yees duab thiab cov chaw LED (hauv kev tshuaj xyuas lub vijtsam).
      • Siv homography los xam qhov chaw ntawm lub vijtsam sib raug rau nruab nrab ntawm lub koob yees duab ntawm qhov pom.
      • Ua Y-hloov kho kom haum rau nruab nrab ntawm rab phom phom virtual hauv qab qhov pom kab. Qhov no yog me ntsis kludgy algorithm tab sis nws ua haujlwm.
      • Teem tus nas txoj haujlwm rau qhov kho qhov screen.
    • Yog tias peb pom LEDs:

      • Siv OpenCV los daws qhov teeb meem P3P ntawm cov duab LED lub koob yees duab thiab qhov chaw LED lub cev. Qhov no tsim kom muaj plaub qhov kev daws teeb meem.
      • Yog ua tiav:

        • Yog tias peb muaj kev suav qhov chaw ua tiav yav dhau los, xaiv qhov kev daws teeb meem uas ua rau LED ploj mus ze rau qhov kawg pom lossis suav qhov chaw ntawm LED ntawd.
        • Yog tias peb tsis muaj kev suav qhov chaw ua tiav yav dhau los, xaiv qhov kev daws teeb meem uas kwv yees zoo tshaj plaws ntawm lub ntsuas qhov ntsuas.
        • Siv qhov kev daws teeb meem zoo tshaj los xam qhov plaub LED yuav tsum mus qhov twg.
        • Ua tus so raws li plaub plaub LED rooj plaub.
      • Yog tias tsis ua tiav:

        Khaws nas kawg

Pom zoo: