ksdflsjdfljas
Dependencies: Adafruit-16-Ch-PWM-Servo-Driver HCSR04 PID PololuQik2 QEI Sharp mbed-rtos
Fork of theRobot by
Diff: ShapeDetect.cpp
- Revision:
- 13:529323807361
- Parent:
- 12:284be46593ae
- Child:
- 14:784acd735b8c
--- a/ShapeDetect.cpp Wed Apr 02 00:30:30 2014 +0000 +++ b/ShapeDetect.cpp Wed Apr 02 03:30:48 2014 +0000 @@ -61,7 +61,7 @@ ***********************************************/ void ImageToArray(int arrayType_a){ lrf.putc('G'); - pc.printf("Capture Image\n\r"); + pc.printf("Capturing Image\n\r"); // Fill the data with values switch(arrayType_a){ @@ -209,7 +209,7 @@ void centerMass(int *xcoord, int *ycoord, int *s_area){ ImageToArray(BINARY); //printImageToFile(BINARY); - //clearBounds(); + clearBounds(); int count = 0; int sumi = 0; int sumj = 0; @@ -282,12 +282,13 @@ centerMass(&xcoord_val, &ycoord_val, &s_area_val); pc.printf("\ncentriod calculated\n\r"); - pc.printf("\nCenter of Mass is at X: %d Y: %d\n\r", xcoord_val, ycoord_val, s_area_val); - pc.printf("\nThe area of the Mass is: %d\n\r", s_area_val); - if(s_area_val > SQUARE_AREA_TRESHOLD) { + pc.printf("Center of Mass is at X: %d Y: %d\n\r", xcoord_val, ycoord_val, s_area_val); + pc.printf("The area of the Mass is: %d\n\r", s_area_val); + + if( (s_area_val > (SQUARE_AREA - AREA_TOLERANCE)) && (s_area_val < (SQUARE_AREA + AREA_TOLERANCE)) ) { pc.printf("\nSQUARE DETECTECD\n\r"); return 1; - } else if (s_area_val < TRIANGE_AREA_TRESHOLD) { + } else if ((s_area_val > (TRIANGLE_AREA - AREA_TOLERANCE)) && (s_area_val < (TRIANGELE_AREA + AREA_TOLERANCE)) ) { pc.printf("\nTRIANGLE DETECTECD\n\r"); return 2; } else { @@ -312,12 +313,6 @@ return mm_range; } -void centerCamWithTool(void){ - pc.printf("\nCENTER WITH TOOL\n\r"); - - //CODE GOES HERE - - } int get_com_x(void) {