Ejemplo n.º 1
0
void initializeRobot(){
	calibrateGyro();
	nMotorEncoder[liftLeft] = 0;		//reset encoder
	hook(true);			//reset servos
	gate(false);
	banana(false);
	//RESET SERVOS
	return;
}
Ejemplo n.º 2
0
int
main(void){
    if(setjmp(buf))
        printf("back in main\n");
    else {
        printf("first time through\n");
        banana();
    }
    return 0;
}
TEST(StringPieceTest, PiecesHaveCorrectSortOrderUtf8) {
    std::string testing("testing");
    std::string banana("banana");
    std::string car("car");

    EXPECT_TRUE(StringPiece(testing) > banana);
    EXPECT_TRUE(StringPiece(testing) > car);
    EXPECT_TRUE(StringPiece(banana) < testing);
    EXPECT_TRUE(StringPiece(banana) < car);
    EXPECT_TRUE(StringPiece(car) < testing);
    EXPECT_TRUE(StringPiece(car) > banana);
}
TEST(StringPieceTest, PiecesHaveCorrectSortOrder) {
    std::u16string testing(u"testing");
    std::u16string banana(u"banana");
    std::u16string car(u"car");

    EXPECT_TRUE(StringPiece16(testing) > banana);
    EXPECT_TRUE(StringPiece16(testing) > car);
    EXPECT_TRUE(StringPiece16(banana) < testing);
    EXPECT_TRUE(StringPiece16(banana) < car);
    EXPECT_TRUE(StringPiece16(car) < testing);
    EXPECT_TRUE(StringPiece16(car) > banana);
}
Ejemplo n.º 5
0
int main ()
{
	if(setjmp(buf))
	   printf("back in main\n");
	else
	{
		printf("first time through\n");
		banana();
	}
	system("pause"); 
	return 0;
} 
Ejemplo n.º 6
0
static void
signature_tests(struct sshkey *k, struct sshkey *bad)
{
	u_char i, buf[2049];
	size_t lens[] = {
		1, 2, 7, 8, 9, 15, 16, 17, 31, 32, 33, 127, 128, 129,
		255, 256, 257, 1023, 1024, 1025, 2047, 2048, 2049
	};

	for (i = 0; i < (sizeof(lens)/sizeof(lens[0])); i++) {
		test_subtest_info("%s key, banana length %zu",
		    sshkey_type(k), lens[i]);
		banana(buf, lens[i]);
		signature_test(k, bad, buf, lens[i]);
	}
}
Ejemplo n.º 7
0
task main()
{
	int a = 0;
	int j = 0;
	int k = 0;
	initializeRobot();
	//waitForStart();
	banana(false);
	while(true){
		sonarvalue = USreadDist(Sonar);
		writeDebugStreamLine("sonar = %d", sonarvalue);
		if(sonarvalue == 255){
			//Diagonal center console
			a++;
			writeDebugStreamLine("a = %d", a);
			if(a > 10){
				writeDebugStreamLine("Diagonal, %d", sonarvalue);
				autoDiag();
				wait1Msec(2000);
				break;
			}
			//The ultrasonic sensor cannot detect diagonal surfaces - therefore, it returns 255 as its default value.

		}else if(abs(sonarvalue) < 118 && abs(sonarvalue) != 0){
			//goal is straight ahead
			j++;
			writeDebugStreamLine("j = %d", j);
			if(j > 5){
				writeDebugStreamLine("Ahead, %d", sonarvalue);
				autoStraight();
				break;
			}
		}else if(abs(sonarvalue) >= 118){
			//goal is sideways
			k++;
			writeDebugStreamLine("k = %d", k);
			if(k > 5){
				writeDebugStreamLine("Sideways, %d", sonarvalue);
				autoHoriz();
				break;
			}
		}
	}
}
void
CAGBananaExample::draw(IGrafPort& port)
{
        // Start with an IGArea defining the left side of the banana.
        IGArea banana(IGEllipse2D(IGRect2D(0,48,192,240)));

        // Remove a large ellipse to define the right side of the banana.
        banana -= IGEllipse2D(IGRect2D(32,0,224,288));

        // Chop off the ends.
        banana *= IGRect2D(0,64,64,216);

        // Fix the stem.
        IGArea end(IGEllipse2D(IGRect2D(16,48,56,104)));
        end.transformBy(IGrafMatrix(38, IGPoint2D(56,48)));
        banana -= end;

        // Draw the result.
        port.draw(banana, IFillAndFrameBundle(kDefaultFillColor, kDefaultFrameColor, kDefaultPenWidth));
}
int main(int argc, char* argv[])
{
	//if we would like to calibrate our filter values, set to true.
	bool calibrationMode = true;
	
	//Matrix to store each frame of the webcam feed
	Mat cameraFeed;
	Mat threshold;
	Mat HSV;

	if(calibrationMode){
		//create slider bars for HSV filtering
		createTrackbars();
	}
	//video capture object to acquire webcam feed
	VideoCapture capture;
	//open capture object at location zero (default location for webcam)
	capture.open(0);
	//set height and width of capture frame
	capture.set(CV_CAP_PROP_FRAME_WIDTH,FRAME_WIDTH);
	capture.set(CV_CAP_PROP_FRAME_HEIGHT,FRAME_HEIGHT);
	//start an infinite loop where webcam feed is copied to cameraFeed matrix
	//all of our operations will be performed within this loop
	while(1){
		//store image to matrix
		capture.read(cameraFeed);
		//convert frame from BGR to HSV colorspace
		cvtColor(cameraFeed,HSV,COLOR_BGR2HSV);

		if(calibrationMode==true){
		//if in calibration mode, we track objects based on the HSV slider values.
		cvtColor(cameraFeed,HSV,COLOR_BGR2HSV);
		inRange(HSV,Scalar(H_MIN,S_MIN,V_MIN),Scalar(H_MAX,S_MAX,V_MAX),threshold);
		morphOps(threshold);
		imshow(windowName2,threshold);
		trackFilteredObject(threshold,HSV,cameraFeed);
		}else{
		//create some temp fruit objects so that
		//we can use their member functions/information
		Fruit apple("apple"), banana("banana"), cherry("cherry");

		
		//first find apples
		cvtColor(cameraFeed,HSV,COLOR_BGR2HSV);
		inRange(HSV,apple.getHSVmin(),apple.getHSVmax(),threshold);
		morphOps(threshold);
		trackFilteredObject(apple,threshold,HSV,cameraFeed);
		//then bananas
		cvtColor(cameraFeed,HSV,COLOR_BGR2HSV);
		inRange(HSV,banana.getHSVmin(),banana.getHSVmax(),threshold);
		morphOps(threshold);
		trackFilteredObject(banana,threshold,HSV,cameraFeed);
		//then cherries
		cvtColor(cameraFeed,HSV,COLOR_BGR2HSV);
		inRange(HSV,cherry.getHSVmin(),cherry.getHSVmax(),threshold);
		morphOps(threshold);
		trackFilteredObject(cherry,threshold,HSV,cameraFeed);



		}

		//show frames 
		//imshow(windowName2,threshold);

		imshow(windowName,cameraFeed);
		//imshow(windowName1,HSV);


		//delay 30ms so that screen can refresh.
		//image will not appear without this waitKey() command
		waitKey(30);
	}






	return 0;
}
Ejemplo n.º 10
0
void test2()
{
  INFO("FAT32", "Remounting disk.");

  CHECKSERT(not disk->empty(), "Disk not empty");
  CHECKSERT(disk->dev().size() == SIZE / 512, "Disk size is %llu bytes", SIZE);

  disk->init_fs(disk->MBR,
  [] (fs::error_t err, auto& fs)
  {
    CHECKSERT(not err, "Filesystem mounted on VBR1");

    fs.stat(shallow_banana,
    [] (auto err, const auto& ent) {
      INFO("FAT32", "Shallow banana");

      CHECKSERT(not err, "Stat %s", shallow_banana.c_str());

      CHECKSERT(ent.is_valid(), "Stat file in root dir");
      CHECKSERT(ent.is_file(), "Entity is file");
      CHECKSERT(!ent.is_dir(), "Entity is not directory");
      CHECKSERT(ent.name() == "banana.txt", "Name is 'banana.txt'");
      is_done();
    });

    fs.read_file(shallow_banana,
    [] (fs::error_t err, fs::buffer_t buf)
    {
      INFO("FAT32", "Read file");
      if (err) {
        printf("Read error: %s\n", err.to_string().c_str());
      }
      CHECKSERT(not err, "read_file: Read %s asynchronously", shallow_banana.c_str());
      printf("%s\n", internal_banana.c_str());
      std::string banana((const char*) buf->data(), buf->size());
      CHECKSERT(banana == internal_banana, "Correct shallow banana");
      is_done();
    });

    fs.stat(deep_banana,
    [] (auto err, const auto& ent) {
      INFO("FAT32", "Deep banana");
      auto& fs = disk->fs();
      CHECKSERT(not err, "Stat %s", deep_banana.c_str());
      CHECKSERT(ent.is_valid(), "Stat file in deep dir");
      CHECKSERT(ent.is_file(), "Entity is file");
      CHECKSERT(!ent.is_dir(), "Entity is not directory");

      CHECKSERT(ent.name() == "banana.txt", "Name is 'banana.txt'");

      // asynch file reading test
      fs.read(ent, 0, ent.size(),
      [] (fs::error_t err, fs::buffer_t buf)
      {
        INFO("FAT32", "Read inside stat");
        CHECKSERT(not err, "read: Read %s asynchronously", deep_banana.c_str());

        std::string banana((const char*) buf->data(), buf->size());
        CHECKSERT(banana == internal_banana, "Correct deep fried banana");
        is_done();
      });
    });

  });
}