Beispiel #1
0
 private void stopRobot()
 {   // Send stop request to robot
     drive.SetDriveRequest request = new drive.SetDriveRequest();
     request.LeftPower  = 0.0;
     request.RightPower = 0.0;
     _nxtDrivePort.DriveDistance(request);
 }
Beispiel #2
0
 private void Reverse()
 {   // Send reverse request to robot
     drive.SetDriveRequest request = new drive.SetDriveRequest();
     request.LeftPower  = -drivePower;
     request.RightPower = -drivePower;
     _nxtDrivePort.DriveDistance(request);
     currentDirection = Direction.REVERSE;
 }
Beispiel #3
0
 private void driveStraight()
 {   // Send request to robot to drive straight
     drive.SetDriveRequest request = new drive.SetDriveRequest();
     request.LeftPower  = drivePower;
     request.RightPower = drivePower;
     _nxtDrivePort.DriveDistance(request);
     currentDirection = Direction.STRAIGHT;
     Console.WriteLine("Driving straight");
 }
Beispiel #4
0
 private void turnLeftOnSpot(int degrees)
 {   // Turn robot left by the specified degree value
     drive.SetDriveRequest request = new drive.SetDriveRequest();
     request.LeftPower  = -turnPower;
     request.RightPower = turnPower;
     request.LeftStopAtRotationDegrees  = degrees;
     request.RightStopAtRotationDegrees = degrees;
     _nxtDrivePort.DriveDistance(request);
 }
 //___________________________________STOP MOTORS___________________________________
 private void stopMotors()
 {
     //Console.WriteLine("STOP MOTORS");
     drive.SetDriveRequest request = new drive.SetDriveRequest();
     request.LeftPower = 0.0;
     request.RightPower = 0.0;
     _nxtDrivePort.DriveDistance(request);
 }
 //___________________________________MOVE FORWARD___________________________________
 private void moveForward()
 {
     //Console.WriteLine("Moving Forward!");
     request = new drive.SetDriveRequest();
     request.LeftPower = 0.10;
     request.RightPower = 0.10;
     _nxtDrivePort.DriveDistance(request);
 }
        private void buttonsHandler(buttons.ButtonsUpdate notification)
        {
            if (notification.Body.PressedRight == true) //IF button pressed ------ MOVE FORWARD -------
            {
                if (colour == "Black" && colour2 == "White2")
                {
                    drive.SetDriveRequest request2 = new drive.SetDriveRequest();
                    request2.LeftPower = 0.10;
                    request2.RightPower = 0.10;
                    _nxtDrivePort.DriveDistance(request2);
                    trackingOn = true;

                    hitBlue = false;
                    hitGreen = false;
                    hitYellow = false;
                    hitRED = false;
                }
            }

            if (notification.Body.PressedLeft == true)
            {
                //Stop the robot
                drive.SetDriveRequest request2 = new drive.SetDriveRequest();
                request2.LeftPower = 0;
                request2.RightPower = 0;
                _nxtDrivePort.DriveDistance(request2);
                trackingOn = false;
                MAIN_Timer.Enabled  = false;
                Delay_Forward.Enabled = false;
                Timer3500.Enabled = false;
            }
        }
        //___________________________________BLIND FORWARD___________________________________
        private void BlindForward()
        {
            Console.WriteLine("Blindly moving!");
            request = new drive.SetDriveRequest();
            request.LeftPower = 0.09;
            request.RightPower = 0.09;
            _nxtDrivePort.DriveDistance(request);

            if (Delay_Forward.Enabled == false)
            {
                Delay_Forward.Enabled = true;
            }   //1.8 sec
        }
 //___________________________________STOP MOTORS___________________________________
 private void stopMotors()
 {
     drive.SetDriveRequest request = new drive.SetDriveRequest();
     request.LeftPower = 0.0;
     request.RightPower = 0.0;
     _nxtDrivePort.DriveDistance(request);
 }
 //___________________________________MOVE FORWARD___________________________________
 private void moveForward()
 {
     request = new drive.SetDriveRequest();
     request.LeftPower = 0.10;
     request.RightPower = 0.10;
     _nxtDrivePort.DriveDistance(request);
 }