Cov txheej txheem:

Piano Vuas Ua Si Neeg Hlau Caj Npab: 5 Kauj Ruam
Piano Vuas Ua Si Neeg Hlau Caj Npab: 5 Kauj Ruam

Video: Piano Vuas Ua Si Neeg Hlau Caj Npab: 5 Kauj Ruam

Video: Piano Vuas Ua Si Neeg Hlau Caj Npab: 5 Kauj Ruam
Video: Sib Hawm Dhau (Time Passed) Music Video by: Deeda/Dib Xwb 2024, Kaum ib hlis
Anonim
Piano Vuas Ua Si Neeg Hlau Caj Npab
Piano Vuas Ua Si Neeg Hlau Caj Npab

Cov pab pawg tau tsim los ntawm 2 Automation Engineers los ntawm UCN, uas tau los nrog lub tswv yim ci ntsa iab uas peb tau mob siab ua thiab txhim kho. Lub tswv yim yog ua raws ntawm Arduino pawg tswj hwm lub caj npab neeg hlau. Pawg Arduino yog lub hlwb ntawm kev ua haujlwm thiab tom qab ntawd tus ua haujlwm ntawm kev ua haujlwm, Robotic caj npab, yuav ua qhov nws xav tau. Cov lus piav qhia ntxaws ntxiv yuav tuaj tom qab.

Kauj Ruam 1: Cov Khoom Siv

Khoom siv
Khoom siv

Neeg hlau caj npab:

Phantomx Pincher Robot Arm Kit Maek II (https://learn.trossenrobotics.com/38-interbotix-ro…)

Software rau tus neeg hlau- https://www.arduino.cc/en/Main/OldSoftwareRelease… Xim lub koob yees duab:

CMUcam5 Pixy lub koob yees duab - (https://charmedlabs.com/default/pixy-cmucam5/)

Software - PixyMon (https://cmucam.org/projects/cmucam5/wiki/Install_PixyMon_on_Windows_Vista_7_8)

Kauj Ruam 2: Teeb Arduino

Arduino teeb tsa
Arduino teeb tsa

Koj tuaj yeem pom teeb tsa ntawm lub rooj tsavxwm ntawm no, uas yooj yim heev.

Ntawm sab laug yog Lub Hwj Huam Fais Fab.

Qhov nruab nrab yog rau thawj servo, uas yog tom qab txuas nrog rau lwm lub servos, servo los ntawm servo.

Hauv qab ib qho yog qhov uas peb tswj hwm lub rooj tsavxwm los ntawm PC lossis Laptop, uas muaj USB nkag mus rau lwm qhov kawg.

Kauj Ruam 3: Qhov Kev Kawm Kawg

||| PROGRAM |||

#suav nrog

#include #include "poses.h" #include // Pixy Library #include

#define POSECOUNT 5

BioloidController bioloid = BioloidController (1000000);

const int SERVOCOUNT = 5; tus id; koj pos; boolean IDCheck; boolean RunCheck;

teeb tsa tsis muaj dab tsi () {pinMode (0, OUTPUT); ax12SetRegister2 (1, 32, 50); // teeb tsa tus lej sib koom 1 sau npe 32 kom nrawm 50. ax12SetRegister2 (2, 32, 50); // teeb tsa tus lej sib koom 2 sau npe 32 kom nrawm 50. ax12SetRegister2 (3, 32, 50); // teeb tsa tus lej sib koom 3 sau npe 32 kom nrawm dua 50. ax12SetRegister2 (4, 32, 50); // teeb tsa tus lej sib koom 4 sau npe 32 kom nrawm 50. ax12SetRegister2 (5, 32, 100); // teeb tsa tus lej sib koom 5 sau npe 32 kom nrawm 100. // initialize variables id = 1; pos = 0; IDCheck = 1; RunCheck = 0; // qhib qhov chaw nres nkoj Serial.begin (9600); ncua (500); Serial.println ("#############################" Serial.println ("Tsim Kev Sib Txuas Lus.");

// Txheeb xyuas Lipo Roj Teeb Voltage CheckVoltage ();

// Luam theej duab Servos, xa txoj haujlwm MoveTest (); MoveHome (); MenuOptions (); RunCheck = 1; }

void loop () {// nyeem lub sensor: int inByte = Serial.read ();

hloov (inByte) {

rooj plaub '1': MovePose1 (); tawg;

rooj plaub '2': MovePose2 (); tawg; rooj plaub '3': MovePose3 (); tawg;

rooj plaub '4': MovePose4 (); tawg;

rooj plaub '5': MoveHome (); tawg; rooj plaub '6': Lob (); tawg;

rooj plaub '7': LEDTest (); tawg;

rooj plaub '8': RelaxServos (); tawg; }}

void CheckVoltage () {// tos, tom qab ntawv xyuas qhov hluav taws xob (LiPO kev nyab xeeb) ntab voltage = (ax12GetRegister (1, AX_PRESENT_VOLTAGE, 1)) / 10.0; Serial.println ("#############################" Serial.print ("Qhov System Voltage:"); Serial.print (qhov hluav taws xob); Serial.println ("volts."); yog (voltage 10.0) {Serial.println ("Voltage levels nominal."); } yog (RunCheck == 1) {MenuOptions (); } Serial.println ("############################" }

void MoveHome () {ncua (100); // pom zoo ncua bioloid.loadPose (Tsev); // thauj cov pose los ntawm FLASH, mus rau nextPose tsis bioloid.readPose (); // nyeem hauv cov haujlwm tam sim no rau curPose tsis Serial.println ("############################" Serial.println ("Tsiv servos rau txoj haujlwm hauv tsev"); Serial.println ("#############################" ncua (1000); bioloid.interpolateSetup (1000); // teeb tsa rau kev txhais lus los ntawm tam sim no-> tom ntej no ntau dua 1/2 thib ob thaum (bioloid.interpolating> 0) {// ua qhov no thaum peb tseem tsis tau mus txog peb qhov tshiab tsim bioloid.interpolateStep (); // txav servos, yog tias tsim nyog. ncua (3); } yog (RunCheck == 1) {MenuOptions (); }}

void MovePose1 () {ncua (100); // pom zoo ncua sijhawm bioloid.loadPose (Pose1); // thauj cov pose los ntawm FLASH, mus rau nextPose tsis bioloid.readPose (); // nyeem hauv cov haujlwm tam sim no rau curPose tsis Serial.println ("############################" Serial.println ("Tsiv servos rau txoj haujlwm thib 1"); Serial.println ("#############################" ncua (1000); bioloid.interpolateSetup (1000); // teeb tsa rau kev txhais lus los ntawm tam sim no-> tom ntej no ntau dua 1/2 ib pliag thaum (bioloid.interpolating> 0) {// ua qhov no thaum peb tseem tsis tau mus txog peb qhov tshiab tsim bioloid.interpolateStep (); // txav servos, yog tias tsim nyog. ncua (3); } SetPosition (3, 291); // teeb tsa txoj haujlwm ntawm kev sib koom 3 rau '0' ncua (100); // tos rau kev sib koom txav mus yog (RunCheck == 1) {MenuOptions (); }}

void MovePose2 () {ncua (100); // pom zoo ncua bioloid.loadPose (Pose2); // thauj cov pose los ntawm FLASH, mus rau nextPose tsis bioloid.readPose (); // nyeem hauv cov haujlwm tam sim no rau curPose tsis Serial.println ("############################" Serial.println ("Tsiv servos rau txoj haujlwm thib ob"); Serial.println ("#############################" ncua (1000); bioloid.interpolateSetup (1000); // teeb tsa rau kev txhais lus los ntawm tam sim no-> tom ntej no ntau dua 1/2 ib pliag thaum (bioloid.interpolating> 0) {// ua qhov no thaum peb tseem tsis tau mus txog peb qhov tshiab tsim bioloid.interpolateStep (); // txav servos, yog tias tsim nyog. ncua (3); } SetPosition (3, 291); // teeb tsa txoj haujlwm ntawm kev sib koom 3 rau '0' ncua (100); // tos rau kev sib koom txav mus yog (RunCheck == 1) {MenuOptions (); }} void MovePose3 () {ncua (100); // pom zoo ncua sijhawm bioloid.loadPose (Pose3); // thauj cov pose los ntawm FLASH, mus rau nextPose tsis bioloid.readPose (); // nyeem hauv cov haujlwm tam sim no rau curPose tsis Serial.println ("############################" Serial.println ("Tsiv servos rau txoj haujlwm thib 3"); Serial.println ("#############################" ncua (1000); bioloid.interpolateSetup (1000); // teeb tsa rau kev txhais lus los ntawm tam sim no-> tom ntej no ntau dua 1/2 ib pliag thaum (bioloid.interpolating> 0) {// ua qhov no thaum peb tseem tsis tau mus txog peb qhov tshiab tsim bioloid.interpolateStep (); // txav servos, yog tias tsim nyog. ncua (3); } SetPosition (3, 291); // teeb tsa txoj haujlwm ntawm kev sib koom 3 rau '0' ncua (100); // tos kom sib koom txav mus yog (RunCheck == 1) {MenuOptions (); }}

void MovePose4 () {ncua (100); // pom zoo ncua bioloid.loadPose (Pose4); // thauj cov pose los ntawm FLASH, mus rau nextPose tsis bioloid.readPose (); // nyeem hauv cov haujlwm tam sim no rau curPose tsis Serial.println ("############################" Serial.println ("Tsiv servos rau txoj haujlwm thib 4"); Serial.println ("#############################" ncua (1000); bioloid.interpolateSetup (1000); // teeb tsa rau kev txhais lus los ntawm tam sim no-> tom ntej no ntau dua 1/2 ib pliag thaum (bioloid.interpolating> 0) {// ua qhov no thaum peb tseem tsis tau mus txog peb qhov tshiab tsim bioloid.interpolateStep (); // txav servos, yog tias tsim nyog. ncua (3); } SetPosition (3, 291); // teeb tsa txoj haujlwm ntawm kev sib koom 3 rau '0' ncua (100); // tos kom sib koom txav mus yog (RunCheck == 1) {MenuOptions (); }}

void MoveTest () {Serial.println ("#############################" Serial.println ("Initializing Movement Sign Test"); Serial.println ("#############################" ncua (500); id = 1; pos = 512; thaum (id <= SERVOCOUNT) {Serial.print ("Tsiv Servo ID:"); Serial.println (id);

thaum (pos> = 312) {SetPosition (id, pos); pos = pos--; ncua (10); }

thaum (pos <= 512) {SetPosition (id, pos); pos = pos ++; ncua (10); }

// iterate rau tom ntej servo ID id = id ++;

} yog (RunCheck == 1) {MenuOptions (); }}

void MenuOptions () {Serial.println ("#############################" Serial.println ("Thov sau qhov kev xaiv 1-5 kom rov ntsuas tus kheej dua."); Serial.println ("1) Txoj Haujlwm 1"); Serial.println ("2) Txoj Haujlwm Thib Ob"); Serial.println ("3) Txoj Haujlwm thib 3"); Serial.println ("4) Txoj Haujlwm 4"); Serial.println ("5) Txoj Haujlwm Hauv Tsev"); Serial.println ("6) Txheeb Xyuas Qhov System Voltage"); Serial.println ("7) Ua LED Test"); Serial.println ("8) Relax Servos"); Serial.println ("#############################" }

khoob khoob RelaxServos () {id = 1; Serial.println ("#############################" Serial.println ("Relaxing Servos."); Serial.println ("#############################" thaum (id <= SERVOCOUNT) {So (id); id = (id ++)%SERVOCOUNT; ncua (50); } yog (RunCheck == 1) {MenuOptions (); }}

void LEDTest () {id = 1; Serial.println ("#############################" Serial.println ("Khiav LED Test"); Serial.println ("#############################" thaum (id <= SERVOCOUNT) {ax12SetRegister (id, 25, 1); Serial.print ("LED ON - Servo ID:"); Serial.println (id); ncua (3000); ax12SetRegister (id, 25, 0); Serial.print ("LED OFF - Servo ID:"); Serial.println (id); ncua (3000); id = id ++; } yog (RunCheck == 1) {MenuOptions (); }}

void Grab () {SetPosition (5, 800); // teeb tsa txoj haujlwm ntawm kev sib koom tes 1 txog '0' ncua (100); // tos kom sib koom txav mus

}

Peb tau ua raws peb txoj haujlwm ntawm cov tuam txhab tsim khoom PincherTest program nrog qee qhov kev hloov pauv loj hauv rooj plaub ntawm kev tso chaw. Peb siv poses.h rau tus neeg hlau kom muaj txoj haujlwm nyob hauv kev nco. Ua ntej tshaj plaws peb tau sim tsim peb cov caj npab ua si nrog Pixycam kom tsis siv neeg, tab sis vim teeb pom kev me me thiab teeb meem ntawm lub vijtsam, qhov ntawd tsis tuaj yeem tshwm sim. Tus neeg hlau muaj txoj haujlwm hauv tsev yooj yim, tom qab rub tawm qhov program, nws yuav sim txhua qhov kev pabcuam pom hauv tus neeg hlau. Peb tau teeb tsa cov poses rau 1-4 khawm, yog li nws yuav yooj yim kom nco qab. Xav tias dawb siv qhov program.

Kauj Ruam 4: Daim vis dis aus qhia

Kauj Ruam 5: Xaus

Hauv kev xaus, tus neeg hlau yog qhov haujlwm me me lom zem rau peb thiab lom zem thiing los ua si ib puag ncig thiab sim nrog. Kuv txhawb koj kom sim nws thiab kho nws ib yam.

Pom zoo: