Cov txheej txheem:

A Hearing MeArm, Google Coral TPU Accelerator Tsav: 3 Kauj Ruam
A Hearing MeArm, Google Coral TPU Accelerator Tsav: 3 Kauj Ruam

Video: A Hearing MeArm, Google Coral TPU Accelerator Tsav: 3 Kauj Ruam

Video: A Hearing MeArm, Google Coral TPU Accelerator Tsav: 3 Kauj Ruam
Video: Gesture control Robot Arm MediaPipe MeArm 2024, Hlis ntuj nqeg
Anonim
Lub Hnov MeArm, Google Coral TPU Accelerator Tsav
Lub Hnov MeArm, Google Coral TPU Accelerator Tsav
Lub Hnov MeArm, Google Coral TPU Accelerator Tsav
Lub Hnov MeArm, Google Coral TPU Accelerator Tsav
Lub Hnov MeArm, Google Coral TPU Accelerator Tsav
Lub Hnov MeArm, Google Coral TPU Accelerator Tsav
Lub Hnov MeArm, Google Coral TPU Accelerator Tsav
Lub Hnov MeArm, Google Coral TPU Accelerator Tsav

Hauv qab no kuv xav piav qhia lub suab-tswj version ntawm MeArm, me me xyz neeg hlau caj npab nrog tus tuav. Kuv tau siv MeArm Pi los ntawm MIME kev lag luam, tab sis lub kaw lus yuav tsum siv rau ib qho ntawm nws MeArm, lossis cov khoom siv zoo sib xws.

Siv Google Coral TPU Accelerator tso cai kom nrawm nrawm offline TensorFlow lub suab lees paub cov ntawv sau ntawm Raspberry Pi, thiab ntawm no tswj cov cuab yeej siv lub cev los ntawm kev hais lus, nrog lub sijhawm qis dua ib pliag.

Cov cuab yeej piav qhia ntawm no yog kev sib xyaw, thiab txuas ntxiv, ntawm cov ntsiab lus tau piav qhia hauv ob qho kev qhia yav dhau los. Nws yog kev txuas ntxiv ntawm kev siv ua ntej ntawm Google Coral lub suab tswj, Jumping Jack, tau piav qhia ntawm no thiab kev txhim kho loj heev ntawm Google AIY lub suab tswj MeArm piav qhia ntawm no.

Lub suab-tswj MeArm siv Google Voice AIY cov txheej txheem xav tau kev nkag mus online, tsis yooj yim rau kev siv, yuav tsum tau nyem lub pob kom qhib kev mloog rau lub suab xaj thiab muaj sijhawm nyob ntev. Google Coral TPU Accelerator siv tam sim no tso cai rau khiav TensorFlowLite cov qauv offline nrog qhov nrawm ntawm Raspberry Pi lossis lwm yam khoom siv Linux. Ntawm cov piv txwv hauv Google Coral Github nplooj ntawv muaj ib qho piv txwv hu ua "hnov nab" rau lub suab paub lub suab uas tuaj yeem nkag siab 140 cov kab lus tseem ceeb (Cuaj hlis 2019), uas tom qab ntawd tau teeb tsa rau tus yuam sij virtual. Sib txuas cov "keystrokes" nrog kev ua tiav ntawm qee qhov haujlwm hauv program Python ua rau nws muaj peev xwm tsim lub suab hais kom ua tswj lub cuab yeej. Tsis ntev los no kuv tau piav qhia thawj qhov kev siv, lub suab tswj lub tshuab hluav taws xob dhia lub jack. Qhov kev siv ntawm no yog qhov nyuaj me ntsis thiab tso cai tswj tag nrho plaub qhov kev pabcuam ntawm MeArm kom txav MeArm tsis tu ncua lossis muaj nws txav mus rau tus lej ua ntej haujlwm, lossis ua qee yam haujlwm nyuaj dua.

Siv cov ntawv sau ntawm no ua piv txwv, nws yuav tsum yooj yim los tsim lwm yam khoom siv tswj lub suab, piv txwv. tsheb neeg hlau lossis cov cuab yeej pabcuam pabcuam.

Khoom siv

  • MeArm. Siv ntawm no: MeArm Pi los ntawm MIME Industries
  • Raspberry Pi 4
  • Google Coral TPU Accelerator
  • Adafruit 16 channel servo lub kaus mom
  • qee cov jumper cables
  • yeem: capacitor rau servo lub kaus mom, txog 400 µF rau 4 servos (pom zoo los ntawm Adafruit)
  • 5-6 V qhov hluav taws xob qhov rau servo lub kaus mom. Kuv nyob ntawm no siv lub qub 6V them nyiaj, 4x AA roj teeb pob ua haujlwm ib yam nkaus
  • Microphone. Kuv siv lub qub Microsoft HD3000 webcam ua lub microphone.

Kauj ruam 1: Teeb tsa Qhov System

Teeb Qhov System
Teeb Qhov System
Teeb Qhov System
Teeb Qhov System

Rub tawm cov duab Raspian uas tau teeb tsa ua ntej rau Google Coral TPU Accelerator los ntawm Google Coral Github nplooj ntawv thiab teeb nws rau ntawm daim npav SD. Cov duab no tseem muaj tus lej sau ua piv txwv. Teeb tsa Pi raws li qhia.

Txhim kho qhov piv txwv Cov ntsiab lus ntsiab lus los ntawm Google Coral GitHub qhov chaw, yog tias tsis suav nrog hauv daim duab, thiab txhua qhov haujlwm xav tau. Txuas lub microphone rau Pi. Kuv xav kom ua si nrog "Hearing Snake" piv txwv kom ntseeg tau tias txhua yam ua haujlwm.

Rub tawm thiab teeb tsa Adafruit 16 channel lub kaus mom software, raws li tau piav qhia ntawm no. Nruab lub kaus mom thiab ua si nrog Adafruit piv txwv kom ntseeg tau tias txhua yam ua haujlwm tau zoo.

Rub tawm cov ntawv txuas nrog cov lus qhia no thiab luam lawv mus rau "Project Keyword Spotter" nplaub tshev. Cov ntawv "commands_v1_MeArm.txt" yuav tsum tau theej rau "config" subfolder.

Txuas koj MeArm cov kev pabcuam mus rau lub kaus mom hlau raws li qhia. Kuv siv chaw nres nkoj 15 rau nce/nqis, chaw nres nkoj 11 rau pem hauv ntej/thim rov qab, chaw nres nkoj 7 rau tig thiab chaw nres nkoj 3 rau tus tuav tuav.

Hauv tsab ntawv koj yuav tsum tau kho qhov min/center/max qhov tseem ceeb rau txhua qhov servo rau koj teeb tsa, Cov teeb tsa no pab kom zam kev puas tsuaj rau servos. Koj kuj tseem yuav tau hloov kho cov npe "haujlwm", "thauj 1" thiab "thauj 2" npe.

Khiav tsab ntawv. Txog tam sim no kuv tau khiav nws los ntawm IDE.

Yog tias koj xav hloov kho cov kab lus tseem ceeb uas ua rau muaj kev ua haujlwm raws li koj xav tau. Ua tiav cov npe ntawm KeyPhrases muaj nyob hauv "lab_gc2 raw.txt" cov ntaub ntawv hauv kev teeb tsa subfolder.

Lub kaw lus muaj lub sijhawm qeeb ntawm kwv yees li 1 thib ob, tab sis nyob ntawm ntau yam ntawm cov haujlwm uas tau ua. Qee qhov xwm txheej tseem ceeb yuav tsum tau rov ua dua, qhov tseeb ntawm kev lees paub tsis yog ib txwm 100%.

Kauj ruam 2: Siv Device

Yog tias txhua yam tau teeb tsa thiab tshuaj xyuas, koj tuaj yeem siv lub cuab yeej.

Ib qho kev txwv tam sim no yog qhov kev txiav txim tau muab coj rov ua dua yog tias nws tsis raug tso tseg (siv "nres game") lossis lwm qhov kev txiav txim raug muab. Ua haujlwm ntau txoj haujlwm, xws li "thauj 1" (qhia los ntawm kab lus "tso game") ib txwm ua tiav mus rau theem kawg.

Yog li los ntawm "tig sab xis" lub cuab yeej yuav txav mus rau hauv cov kauj ruam me me mus rau sab xis kom txog thaum nres, lossis qhov ua ntej tau txais txiaj ntsig siab tshaj plaws. "pib game", "game tom ntej" lossis "start_video" yuav pib ua qhov kev txav chaw uas tau hais tseg los ntawm cov npe uas muaj kev teeb tsa rau txhua qhov kev pabcuam ntawm ib qib. "kev sib tw ua si" yuav ua rau lub cuab yeej dhia los ntawm ib qib mus rau lwm qhov, khaws cia los ntawm cov npe chaw.

Raws li koj tuaj yeem pom hauv cov vis dis aus nrog, Kuv tau tsim lub diabolo zoo li cov khoom los ntawm LEGO uas tuaj yeem khaws tau los ntawm MeArm thiab raug thauj los ntawm ib qhov chaw mus rau lwm qhov los ntawm kev teeb tsa ua ntej. Koj tuaj yeem txiav txim siab koj tus kheej lub luag haujlwm los ntawm kev hloov kho cov npe 'thauj 1' lossis 'thauj 2'.

Kauj ruam 3: Tsab Ntawv

Cov ntawv sau tseg ntawm no yog kev hloov pauv ntawm "Hnov Snake" piv txwv los ntawm "Project Keyword Spotter". Qhov piv txwv tau raug tshem tawm mus rau qhov tsawg kawg, tom qab ntawd ib feem rau kev tsav tsheb servos tau ntxiv, raws li software thiab piv txwv muab rau Adafruit servo lub kaus mom.

Tsab ntawv tsis tau ua kom zoo dua tam sim no. Siv ntawm koj tus kheej txoj kev pheej hmoo, xav tias dawb los hloov kho thiab ua kom zoo dua.

Ntxiv rau tsab ntawv nab nab muaj cov lus txib-cov ntaub ntawv thiab siv cov ntawv lo-cov ntaub ntawv. Muab nws tso rau hauv config-subfolder.

Raws li tau hais ua ntej, ntau qhov kev hloov pauv ntawm qhov ntsuas yuav xav tau hloov kho tsab ntawv rau koj tshwj xeeb MeArm lossis qee yam khoom siv.

# Copyright 2019 Google LLC#

# Muaj ntawv tso cai raws li Apache License, Version 2.0 ("License"); # koj yuav tsis siv cov ntawv no tshwj tsis yog ua raws li Daim Ntawv Tso Cai. # Koj tuaj yeem tau txais daim ntawv tso cai ntawm # # href = "https://www.apache.org/licenses/LICENSE-2.0" href = "https://www.apache.org/licenses/LICENSE-2.0" https://www.apache.org/licenses/LICENSE-2.0 # # Tshwj tsis yog xav tau los ntawm txoj cai lij choj lossis pom zoo sau ntawv, software # faib raws li Daim Ntawv Tso Cai tau faib rau ntawm "AS IS" BASIS, #Tsis muaj kev lav phib xaub lossis xwm txheej ntawm YUAV KIND, hais tawm lossis cuam tshuam. # Saib Daim Ntawv Tso Cai rau cov lus tshwj xeeb tswj hwm kev tso cai thiab # cov kev txwv hauv qab Daim Ntawv Tso Cai. # thawj qhov "hnov_snake" tus lej tau hloov kho rau kev siv rau MeArm los ntawm Dr H. Cov kev pabcuam ntawm MeArm (MIME kev lag luam) tau txuas rau cov chaw nres nkoj 3, 7, 11 thiab 15 ntawm lub kaus mom. Yog xav paub ntxiv thov saib ntawm "Hearing MeArm" Qhia. Cov lus txib: "txoj haujlwm x", x = 0 txog 9, txav lub cuab yeej mus rau txoj haujlwm uas tau npaj ua ntej. "txav/nce mus", "txav/nqis mus", "mus/tig mus rau tom ntej", "mus/tig rov qab", "tig/mus rau sab laug" thiab "tig/mus rau sab xis" ua rau qeeb qeeb, ib theem zuj zus ntawm kev txav mus los kev taw qhia, "nres game" nres qhov kev txav mus los. "qhib tab" thiab "kaw tab" qhib lossis kaw tus tuav. "pib yees duab" evokes lub cuab yeej mus ua raws li kev txiav txim ua ntej ntawm txoj haujlwm, txhais los ntawm cov npe 'txoj haujlwm'. "kev sib tw ua si" ua rau muaj kev hloov pauv ntawm kev txav mus los, "nres game" xaus nws. "game game" pib lwm qhov kev txav ua ntej tau teev tseg los ntawm daim ntawv 'thauj 1', "kev ua si tom ntej" kev rov ua haujlwm tau ua tiav ua ntej los ntawm 'thauj 2' Siv ntawm koj tus kheej txoj kev pheej hmoo. '' 'los ntawm _future_ ntshuam meej_import los ntawm _future_ ntshuam faib los ntawm _future_ ntshuam print_function ntshuam ntshuam ntshuam os los ntawm kev xaiv ntshuam randint los ntawm xov ntshuam ntshuam ntshuam sijhawm los ntawm edgetpu.basic.basic_engine ntshuam BasicEngine ntshuam qauv ntshuam pygame los ntawm pygame.locals ntshuam * ntshuam kab los ntawm random import Randrange los ntawm adafruit_servokit ntshuam ServoKit ntshuam pawg thawj coj saib busio ntshuam adafruit_pca9685 lub sijhawm ntshuam i2c = busio. I2C (board. SCL, board. SDA) lub kaus mom = adafruit_pca9685. PCA9685 (i2c) hat.frequency = 60 khoom = ServoKit (raws = 16) # teeb tus naj npawb ntawm cov channel # kit.servo [0].actuation_range = 160 # kit.servo [0].set_pulse_width_range (1000, 2000) # min, nruab nrab thiab qhov siab tshaj up_l = 145 # servo nce/nqis: nce md_l = 95 dn_l = 45 up_r = 135 # servo rau pem hauv ntej/rov qab md_r = 90 dn_r = 50 ri_t = 30 # tig caj npab sab xis lossis sab laug: txoj haujlwm sab xis md_t = 90 # tig caj npab sab xis lossis sab laug: txoj haujlwm nruab nrab le_t = 150 op_g = 65 # tuav tuav md_g = 90 # gripper centered cl _g = 130 # gripper kaw vert = 15 # tus naj npawb ntawm qhov chaw nres nkoj servo, servo nce/nqis forw = 11 # tus naj npawb ntawm chaw nres nkoj servo, rau pem hauv ntej/rov qab txav servo tig = 7 # chaw nres nkoj servo rau tig servo tuav = 3 # servo chaw nres nkoj rau tuav servo #list ntawm caj npab teeb tsa rau cuaj txoj haujlwm = [(md_l, md_r, md_t, op_g), (up_l, md_r, ri_t, op_g), (up_l, md_r, md_t, cl_g), (up_l, md_r, le_t, cl_g)), (md_l, md_r, md_t, op_g), (md_l, md_r, md_t, md_g), (md_l, md_r, md_t, cl_g), (dn_l, dn_r, ri_t, op_g), (dn_l, dn, mn,), (dn_l, dn_r, le_t, md_g)] # txhais 10 txoj haujlwm hauv paus, qhia los ntawm cov lej 0-9 # cov txheej txheem thauj khoom [vert/forward/turn/grip] transport1 = [(140, 70, 65, op_g), (110, 50, 65, op_g), (65, 50, 65, op_g), (65, 70, 65, cl_g), (120, 70, 65, cl_g), #get khoom (100, 70, 135, cl_g)), (100, 80, 135, cl_g), (100, 80, 135, md_g), (100, 80, 135, op_g), (140, 70, 135, op_g), (140, 70, 90, op_g), (140, 70, 65, op_g)]

thauj 2 = [(140, 70, 65, op_g), (140, 70, 135, op_g), (95, 70, 135, op_g), (95, 80, 135, op_g), (95, 80, 135, cl_g), (110, 70, 135, cl_g), (110, 70, 65, cl_g), (70, 70, 65, cl_g), (70, 70, 65, op_g), (80, 50, 65, op_g)]

dance1 = (0, 8, 7, 4, 1, 2, 3, 6, 9, 8, 5, 2, 1, 4, 7, 8, 9, 6, 3, 2, 0) # a "seev cev"

#txav MeArm rau Zero txoj haujlwm xwm txheej = [md_l, md_r, md_t, md_g] kit.servo [vert].angle = xwm txheej [0] kit.servo [forw].angle = xwm txheej [1] kit.servo [tig]. angle = status [2] kit.servo [grip].angle = status [3] print (status) class Controler (object): #Callback function def _init _ (self, q): self._q = q def callback (tus kheej, hais kom ua): self._q.put (hais kom ua) chav App: def _init _ (self): self._running = True def on_init (self): pygame.init () self.game_started = True self._running = True return True def on_event (tus kheej, xwm txheej): yog event.type == pygame. QUIT: self._running = Cuav def MeArmPos (tus kheej, tus yuam sij): # tsav MeArm rau txoj haujlwm ua ntej, lo lus tseem ceeb: "txoj haujlwm x" qhov tseem ceeb = int (yawm sij) p = txoj hauj lwm [qhov tseem ceeb] a = p [0] b = p [1] c = p [2] d = p [3] print ("Txoj haujlwm:", qhov tseem ceeb, "vert/forw/tig/tuav:", a, "/", b, "/", c, "/", d, "degrees") xwm txheej = [a, b, c, d] # cov ntaub ntawv tam sim no luam tawm (xwm txheej) # sys.stdout.write ("Txoj haujlwm: ", qhov tseem ceeb," sab laug/sab xis: ", a,"/", b," degree ") kit.servo [vert].angle = kit.servo [forw].angle = b kit.servo [tig].angle = c kit.servo [tuav].angle = d time.sleep (0.5) def DancingMeArm (tus kheej): # tswj MeArm seev cev, lo lus tseem ceeb: "start_video" dnce = dance1 sp = (len (dnce)) rau r hauv thaj tsam (sp): #dance txiav txim ntawm txoj haujlwm, cov kauj ruam dc = dnce [r] p = txoj haujlwm [dc] a = p [0] b = p [1] c = p [2] d = p [3] kit.servo [vert].angle = kit.servo [forw].angle = b kit.servo [tig].angle = c kit.servo [tuav].angle = d time.sleep (1) # teeb tsa qhov nrawm ntawm lub sijhawm txav chaw. Pw tsaug zog (0.5) # so ntawm qhov kawg ntawm cov txheej txheem def TransMeArm1 (tus kheej): # tswj MeArm thauj 1, lo lus tseem ceeb: "tso game" tr1 = transport1 sp = (len (tr1)) #suav cov lej ntawm cov qib rau r hauv ntau (sp): #mus rau ib qib twg p = tr1 [r] a = p [0] b = p [1] c = p [2] d = p [3] cov khoom siv. servo [vert].angle = kit.servo [forw].angle = b kit.servo [tig].angle = c kit.servo [tuav].angle = d print (p) time.sleep (1) # poob lawm nrawm ntawm kev txav sijhawm.s pw (0.5) def TransMeArm2 (tus kheej): # tswj MeArm seev cev, lo lus tseem ceeb: "kev ua si tom ntej" tr2 = thauj2 sp = (len (tr2)) rau r hauv thaj tsam (sp): #dance txiav txim ntawm txoj haujlwm, cov kauj ruam sp p = tr2 [r] a = p [0] b = p [1] c = p [2] d = p [3] kit.servo [vert].angle = a kit.servo [forw].angle = b kit.servo [tig].angle = c kit.servo [tuav].angle = d print (p) time.sleep (1) # teeb tsa nrawm ntawm lub sijhawm txav mus.s pw (0.5)) def RandomMoves (tus kheej): # jumps randomly ntawm txoj haujlwm ua ntej, lo lus tseem ceeb: "random game" dr = randrange (9) #randomly xaiv txoj haujlwm p = txoj haujlwm [dr] # nyeem txoj haujlwm tsis ua a = p [0] b = p [1] c = p [2] d = p [3] kit.servo [vert].angle = kit.servo [forw].angle = b kit.servo [tig].angle = c kit.servo [tuav].angle = d time.sleep (1) # teeb tsa qhov nrawm ntawm kev txav txav MoveUp (tus kheej): # nqa tus tuav hauv cov kauj ruam me u0 = xwm txheej [0] # nyeem tam sim no u1 = u0 + 5 # ntxiv x degrees yog (u1 > up_l): # ntsuas yog tias tsis pub dhau min/max tsis u1 = up_l # txwv tsis pub teev rau min/max tus nqi kit.servo [vert].angle = u1 # txav servo status [0] = u1 # kho qhov xwm txheej tus nqi luam tawm (" nce ", xwm txheej) sijhawm.sleep (1) # teeb tsa qhov nrawm def MoveDown (tus kheej): d 0 = xwm txheej [0] d1 = d0 - 5 #minus x degrees yog (d1 up_r): f1 = up_r kit.servo [forw].angle = f1 # txav servo status [1] = f1 print ("rau pem hauv ntej", xwm txheej) time.sleep (1) def MoveBack (tus kheej): b0 = xwm txheej [1] b1 = b0 - 5 #minus x degrees yog (b1 le_t): l1 = le_t kit.servo [tig].angle = l1 # txav servo xwm txheej [2] = l1 luam ("sab laug", xwm txheej) sijhawm.sleep (0.2) def MoveRight (tus kheej): r0 = xwm txheej [2] r1 = r0 - 2 #minus x degrees yog (r1 <ri_t): r1 = ri_t kit.servo [tig].angle = r1 # txav servo xwm txheej [2] = r1 luam tawm ("txoj cai", xwm txheej) sijhawm.sleep (0.2) def OpenGrip (tus kheej): kit.servo [tuav].angle = op_g # teeb tuav rau "qhib" txoj haujlwm: "qhib_tab" sijhawm.sleep (0.5) xwm txheej [3] = op_g def CloseGrip (tus kheej): kit.servo [tuav].angle = cl_g # teeb tsa rau "kaw" txoj haujlwm: " close_tab "time.sleep (0.5) xwm txheej [3] = cl_g def StopMove (tus kheej): # tsis muaj dab tsi, tab sis nres kev txav txav (" nres ", xwm txheej) sijhawm.sleep (0.25) def spotter (tus kheej, args): cav = BasicEngine (args.model_file) mic = args.mic yog args.mic Yog Tsis Muaj Lwm yam int (args.mic) model.classify_audio (mic, engine, labels_file = "config/labels_gc2.raw.txt", commands_file = "config/commands_v1_MeArm.txt", dectection_callback = self._controler.callback, sample_rate_hz = int (args.sample_rate_hz), num_frames int (args.num_frames_hop)) def on_execute (self, args): yog tsis self.on_init (): self._running = False q = model.get_queue () self._controler = Controler (q) yog tsis args.debug_keyboard: t = Xov (phiaj = self.spotter, args = (args,)) t.daemon = Tseeb t.start () yam = -1 thaum tus kheej._running: pygame.event.pump () yog args.debug_keyboard: yawm sij = pygame.key.get_pressed () lwm tus: sim: new_item = q.get (Tseeb, 0.1) tshwj tsis yog kab ntawv. Empty: new_item = Tsis muaj yog tias new_item tsis yog Tsis muaj: item = new_item if (args.debug_keyboard and keys [pygame. K_ESCAPE]) lossis yam khoom == "nres": self._running = Cuav # yog (args.debug_keyboard thiab cov yuam sij [pygame. K_SPACE]) lossis khoom == "mus": # self. MeArmPos (7) # yog (args.debug_keyboard thiab cov yuam sij [pygame. K_RIGHT]) lossis khoom == "txoj cai": # tig sab xis tus kheej. MoveRight () yog (args.debug_ke yboard thiab cov yuam sij [pygame. K_LEFT]) lossis khoom == "sab laug": # tig sab laug tus kheej. MoveLeft () yog (args.debug_keyboard thiab cov yuam sij [pygame. K_UP]) lossis khoom == "nce": self. MoveUp () yog (args.debug_keyboard thiab cov yuam sij [pygame. K_DOWN]) lossis cov khoom == "nqis": tus kheej. MoveDown () yog (args.debug_keyboard thiab cov yuam sij [pygame. K_B]) lossis khoom == "b": # rov qab tus kheej. MoveBack () yog (args.debug_keyboard thiab cov yuam sij [pygame. K_F]) lossis khoom == "f": # forwards self. MoveForw () yog (args.debug_keyboard thiab cov yuam sij [pygame. K_O]) lossis khoom == "o": # qhib tuav: self. OpenGrip () yog (args.debug_keyboard thiab cov yuam sij [pygame. K_C]) lossis khoom == "c": # kaw tuav: self. CloseGrip () yog (args.debug_keyboard thiab cov yuam sij [pygame. K_S]) lossis khoom == "s": # nres kev txav chaw: "start_game" self. StopMove () yog (args.debug_keyboard thiab yuam sij [pygame. K_0]) lossis khoom == "0": self. MeArmPos (0) yog (args.debug_keyboard thiab cov yuam sij [pygame. K_1]) lossis khoom == "1": self. MeArmPos (1) yog (args.debug_keyboard thiab yawm sij [pygame. K_2]) lossis khoom == "2": self. MeArmPos (2) yog (args.debug_keyboard thiab cov yuam sij [pygame. K_3]) lossis nws em == "3": self. MeArmPos (3) yog (args.debug_keyboard thiab cov yuam sij [pygame. K_4]) lossis khoom == "4": self. MeArmPos (4) yog (args.debug_keyboard thiab yawm sij [pygame. K_5]) lossis khoom == "5": self. MeArmPos (5) yog (args.debug_keyboard thiab cov yuam sij [pygame. K_6]) lossis khoom == "6": self. MeArmPos (6) yog (args.debug_keyboard thiab tuav [pygame. K_7]) lossis khoom == "7": self. MeArmPos (7) yog (args.debug_keyboard thiab cov yuam sij [pygame. K_8]) lossis khoom == "8": self. MeArmPos (8) yog (args.debug_keyboard thiab cov yuam sij [pygame. K_9]) lossis khoom == "9": self. MeArmPos (9) yog (args.debug_keyboard thiab cov yuam sij [pygame. K_a]) lossis khoom == "d": self. DancingMeArm () #dance MeArm, ntawm "next_game" yog (args.debug_keyboard thiab cov yuam sij [pygame. K_r]) lossis cov khoom == "r": self. RandomMoves () #kev ua las voos "random game" yog (args.debug_keyboard thiab cov yuam sij [pygame. K_j]) lossis khoom == "j": self. TransMeArm1 () # thauj khoom: "lunch_game" yog (args.debug_keyboard thiab yuam sij [pygame. K_k]) lossis khoom == "k": self. TransMeArm2 () # thauj cov khoom thim rov qab: "next_game" '' 'yog (args.debug_keyboard thiab yuam sij [pygame. K_l]) lossis khoom == "l": tus kheej. JumpingJack2 (1) #LED ntsais "phiaj" "'' sijhawm.sleep (0.05) self.on_cleanup () yog _name_ == '_main_': parser = argparse. ArgumentParser () parser.add_argument ('-debug_keyboard', pab = 'Siv cov keyboard los tswj MeArm.', ua = 'store_true', default = False) model.add_model_flags (parser) args = parser.parse_args () the_app = App () the_app.on_execute (args)

Pom zoo: