示例#1
0
        /// <summary>
        ///   Initializes a new instance of the
        ///   <see cref="StudentPiER.StudentCode"/> class.
        /// </summary>
        /// <param name='robot'>
        ///   The Robot to associate with this StudentCode
        /// </param>
        public StudentCode(Robot robot)
        {
            this.robot = robot;
            this.stopwatch = new Stopwatch();
            this.stopwatch.Start();
            this.useRfid = true;
            if (this.useRfid)
            {
                this.rfid = new Rfid(robot);
            }
            this.leftMotor = new GrizzlyBear(robot, Watson.Motor.M0);
            this.rightMotor = new GrizzlyBear(robot, Watson.Motor.M1);
            this.sonar = new AnalogSonarDistanceSensor(robot, Watson.Analog.A5);

            this.leftEncoder = new GrizzlyEncoder(1, leftMotor, robot);
            this.rightEncoder = new GrizzlyEncoder(1, rightMotor, robot);
        }
示例#2
0
 /// <summary>
 ///   Initializes a new instance of the
 ///   <see cref="StudentPiER.StudentCode"/> class.
 /// </summary>
 /// <param name='robot'>
 ///   The Robot to associate with this StudentCode
 /// </param>
 public StudentCode(Robot robot)
 {
     Debug.Print("hello");
     this.robot = robot;
     this.stopwatch = new Stopwatch();
     this.stopwatch.Start();
     this.useRfid = true;
     if (this.useRfid)
     {
         this.rfid = new Rfid(robot);
     }
     this.leftMotor = new GrizzlyBear(robot, Watson.Motor.M0);
     this.rightMotor = new GrizzlyBear(robot, Watson.Motor.M1);
     this.gearbox = new GrizzlyBear(robot, Watson.Motor.M2, 0, 100, true);
     this.sonar = new AnalogSonarDistanceSensor(robot, Watson.Analog.A5);
     this.doorController = new MicroMaestro(robot, 12);
     this.motorDoor = new ServoMotor(robot, doorController,0,2400,9600);
     this.leftEncoder = new GrizzlyEncoder(10, leftMotor, robot);
     this.rightEncoder = new GrizzlyEncoder(10, rightMotor, robot);
 }
示例#3
0
 //for hopper delay
 //private Boolean dump;
 //private Boolean notDump;
 //For stage 3 autonomous
 //private int n;
 /// <summary>
 ///   Initializes a new instance of the
 ///   <see cref="StudentPiER.StudentCode"/> class.
 /// </summary>
 /// <param name='robot'>
 ///   The Robot to associate with this StudentCode
 /// </param>
 public StudentCode(Robot robot)
 {
     this.robot = robot;
     this.stopwatch = new Stopwatch();
     this.stopwatch.Start();
     this.useRfid = false;
     /*if (this.useRfid)
     {
         this.rfid = new Rfid(robot);
     }*/
     this.leftMotor = new GrizzlyBear(robot, Watson.Motor.M0);
     this.rightMotor = new GrizzlyBear(robot, Watson.Motor.M1);
     this.conveyorBeltMotor = new GrizzlyBear(robot, Watson.Motor.M3);
     this.hopperMotor = new GrizzlyBear(robot, Watson.Motor.M2);
     this.sonar = new AnalogSonarDistanceSensor(robot, Watson.Analog.A5);
     this.leftEncoder = new GrizzlyEncoder(Step, this.leftMotor, this.robot);
     this.rightEncoder = new GrizzlyEncoder(Step, this.rightMotor, this.robot);
     this.servoSwitch = new DigitalLimitSwitch(robot, Watson.Digital.D1);
     this.autonomousSwitch = new DigitalLimitSwitch(robot, Watson.Digital.D3);
     this.StartTime = true;
     this.mm = new MicroMaestro(robot, 12);
     this.servo0 = new ServoMotor(robot, mm, 0, 500, 2000);
     //this.dump = true;
     //this.notDump = false;
     //this.n = 0;
 }