// Constructor
 public StudentCode(Robot robot)
 {
     this.robot = robot;
     smcR = new SimpleMotorController(robot, 13); //let's say 13 is right motor on drivetrain
     smcL = new SimpleMotorController(robot, 14); //let's say 14 is left motor on drivetrain
     mm = new MicroMaestro(robot, 12);
     encL = new Encoder(robot, 0);
     encR = new Encoder(robot, 1);
     pidL = new PIDController(KP, KI, KD);
     pidR = new PIDController(KP, KI, KD);
     sDT1 = new SharpDistanceTracker(0);
     sDT2 = new SharpDistanceTracker(1);
     sDT3 = new SharpDistanceTracker(2);
     sDT4 = new SharpDistanceTracker(3);
     sDT5 = new SharpDistanceTracker(4);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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;
 }