Peihsun Yeh
/
ECE4180FinalV4
CarlsenBot working
Embed:
(wiki syntax)
Show/hide line numbers
notes.h
00001 /* 00002 while(motor_x1.ticks < pos){ 00003 spd = (((float)pos-(float)motor_x1.ticks))/pos; 00004 spd*=0.6; 00005 if(spd < 0.2) spd = 0.2 00006 ; 00007 motor_x1.speed(spd); 00008 motor_x2.speed(spd); 00009 pc.printf("Ticks: %d, speed: %f\n", motor_x1.ticks, spd); 00010 wait(0.001); 00011 motor_x1.speed(0); 00012 } 00013 */ 00014 /* 00015 wait(0.5); 00016 while(motor_x1.ticks != pos){ 00017 if(motor_x1.ticks > pos) spd = -0.2; 00018 else spd = 0.2; 00019 motor_x1.speed(spd); 00020 motor_x2.speed(spd); 00021 pc.printf("Ticks: %d, speed: %f\n", motor_x1.ticks, spd); 00022 wait(0.01); 00023 motor_x1.speed(0); 00024 motor_x2.speed(0); 00025 } 00026 */ 00027 00028 //something here 00029 00030 /* 00031 //set coordinates given for testing (numOfSquares for testing only) 00032 numOfSquaresX = 1; 00033 numOfSquaresY = 1; 00034 00035 //when actually recieveing data, change numOfSquares to srcX 00036 sourceX = numOfSquaresX * 210 - clawLocationX; 00037 sourceY = numOfSquaresY * 181 - clawLocationY; 00038 00039 moveX(sourceX); 00040 moveY(sourceY); 00041 wait(1); 00042 claw = OPEN; 00043 wait(1); 00044 moveZ(0.49); 00045 claw = CLOSE; 00046 wait(1); 00047 moveZ(0.36); 00048 00049 //need to set clawLocation here 00050 00051 //set coordinates given for testing (numOfSquares for testing only) 00052 numOfSquaresX = 2; 00053 numOfSquaresY = 1; 00054 00055 //when actually recieveing data, change numOfSquares to destX 00056 destinationX = numOfSquaresX * 210 - clawLocationX; 00057 destinationY = numOfSquaresY * 181 - clawLocationY; 00058 00059 moveX(destinationX); 00060 moveY(destinationY); 00061 wait(1); 00062 moveZ(0.49); 00063 wait(1); 00064 claw = OPEN; 00065 wait(1); 00066 moveZ(0.36); 00067 */ 00068 //need to set clawLocation here again 00069 00070 /* 00071 // test program (opens claw, picks up piece below, and moves to new destination) 00072 claw = OPEN; 00073 wait(1); 00074 moveZ(0.49); 00075 claw = CLOSE; 00076 wait(1); 00077 moveZ(0.36); 00078 moveX(210); //210 per one square of X 00079 moveY(181); //181 per one square of Y 00080 wait(1); 00081 moveZ(0.49); 00082 wait(1); 00083 claw = OPEN; 00084 wait(1); 00085 moveZ(0.36); 00086 */
Generated on Wed Jul 13 2022 18:02:43 by 1.7.2