void Camera::moveKeyboard()
{
	// you may change key controls for the interactive
	// camera controls here, make sure you document your changes
	// in your README file

	if (Fl::event_key('w'))
		moveForward(+0.05);
	if (Fl::event_key('s'))
		moveForward(-0.05);
	if (Fl::event_key('a'))
		moveSideways(-0.05);
	if (Fl::event_key('d'))
		moveSideways(+0.05);
	if (Fl::event_key(FL_Up))
		moveVertical(+0.05);
	if (Fl::event_key(FL_Down))
		moveVertical(-0.05);
	if (Fl::event_key(FL_Left))
		rotateYaw(+0.05);
	if (Fl::event_key(FL_Right))
		rotateYaw(-0.05);
	if (Fl::event_key(FL_Page_Up))
		rotatePitch(+0.05);
	if (Fl::event_key(FL_Page_Down))
		rotatePitch(-0.05);
}
Beispiel #2
0
task main()
{
    direction_t dir;

    initializeRobot();

    // Wait for the beginning of autonomous phase.
    waitForStart();

    servo[IRServo] = IRUP;

    // Move forward a predetermined amount.
    moveForwardToWhiteLine(38);

    // Move until the robot is entirely on the platform
    moveForward(4, 50);

    turn(-41, 5);

    moveSideways(LEFT, 5, 50);

    // dir = lookForIRBeacon();

    /*
     * Center on the line.
     */
    /*
    switch (dir) {
    	case RIGHT:
    		lookForWhiteLine(RIGHT);
    		break;
    	case LEFT:
        case NO_DIR:
    		lookForWhiteLine(LEFT);
    		break;
    	default:
    }
    */

    eraseDisplay();

    dir = whereIsTheBeacon();

    /*
     * Take a reading of the compass so
     * that we can rotate back to it's heading
     * if we rotate off the platform
     */
    markHeading();

    /*
     * Find the middle peg
     */
    lookForWhiteLine(RIGHT);
    findPeg();

    switch (dir) {
    case NO_DIR:
        // lookForWhiteLine(RIGHT);
        break;
    case RIGHT:
        //lookForWhiteLine(RIGHT);
        moveForwardHalf(1, 40);
        moveSideways(RIGHT, 30, 60);
        lookForWhiteLine(RIGHT);
        //alignToPeg(LEFT);
        findPeg();
        break;
    case LEFT:
        moveForwardHalf(1, 40);
        moveSideways(LEFT, 30, 60);
        //moveForwardHalf(2, 40);
        lookForWhiteLine(LEFT);
        //alignToPeg(RIGHT);
        findPeg();
        break;
    }

    // alignToPeg();

    placeRing(dir);

    while (true)
    {}
}