//private MicroMaestro mm; //private int timer; /// <summary> /// Main method which initializes the robot, and creates /// the radio's and student code's threads. Begins running /// the threads, and then runs the robot thread indefinitely. /// </summary> public static void Main() { // Initialize robot Robot robot = new Robot("1", "COM4"); robot.Auton(false); Master master = new Master(new StudentCode(robot)); master.RunCode(); }
/// <summary> /// Main method which initializes the robot, and starts /// it running. /// </summary> public static void Main() { // Initialize robot Robot robot = new Robot("1", "COM4"); robot.Auton(false); Debug.Print("Code loaded successfully!"); Master master = new Master(new StudentCode(robot)); master.RunCode(); }
/// <summary> /// Main method which initializes the robot, and creates /// the radio's and student code's threads. Begins running /// the threads, and then runs the robot thread indefinitely. /// </summary> public static void Main() { /*AnalogIn GyroX = new AnalogIn(AnalogIn.Pin.Ain0); AnalogIn GyroZ = new AnalogIn(AnalogIn.Pin.Ain1); AnalogIn AccelerometerX = new AnalogIn(AnalogIn.Pin.Ain2); AnalogIn AccelerometerY = new AnalogIn(AnalogIn.Pin.Ain3); AnalogIn AccelerometerZ = new AnalogIn(AnalogIn.Pin.Ain4); while (true) { Thread.Sleep(250); Debug.Print("GyroX: " + GyroX.Read()); Debug.Print("GyroZ: " + GyroZ.Read()); Debug.Print("AccelerometerX: " + AccelerometerX.Read()); Debug.Print("AccelerometerY: " + AccelerometerY.Read()); Debug.Print("AccelerometerZ: " + AccelerometerZ.Read()); }*/ // Initialize robot Robot robot = new Robot("1", "COM4");//com 4 orig. com 3 bec ause of problem on top board. robot.Auton(false); robot.student = new StudentCode(robot); // Create and set radio threads robot.rfPollThread = new Thread(robot.RunRFPoll); robot.rfPollThread.Priority = ThreadPriority.AboveNormal; robot.rfTeleThread = new Thread(robot.RunRFTele); robot.rfTeleThread.Priority = ThreadPriority.AboveNormal; // Create and set student code threads robot.studentCodeThread = new Thread(robot.RunStudent); robot.studentCodeThread.Priority = ThreadPriority.AboveNormal; robot.autonomousThread = new Thread(robot.RunAutono); robot.autonomousThread.Priority = ThreadPriority.BelowNormal; // Initialize LEDs robot.yellowLED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.IO59, false); robot.redLED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.IO60, false); // Disable Debug.EnableGCMessages(false); // Run the robot once to initialize robot.Run(); // Set robot thread priority to AboveNormal Thread.CurrentThread.Priority = ThreadPriority.AboveNormal; // Start running all the threads robot.rfPollThread.Start(); robot.rfTeleThread.Start(); robot.studentCodeThread.Start(); robot.autonomousThread.Start(); // Run robot supervisor code while (true) { robot.Run(); Thread.Sleep(ROBOT_SLEEP_TIME); } }
/// <summary> /// Main method which initializes the robot, and creates /// the radio's and student code's threads. Begins running /// the threads, and then runs the robot thread indefinitely. /// </summary> public static void Main() { // Initialize robot Robot robot = new Robot("1", "COM4"); robot.Auton(false); robot.student = new StudentCode(robot); // Create and set radio threads robot.rfPollThread = new Thread(robot.RunRFPoll); robot.rfPollThread.Priority = ThreadPriority.AboveNormal; robot.rfTeleThread = new Thread(robot.RunRFTele); robot.rfTeleThread.Priority = ThreadPriority.AboveNormal; // Create and set student code threads robot.studentCodeThread = new Thread(robot.RunStudent); robot.studentCodeThread.Priority = ThreadPriority.BelowNormal; robot.autonomousThread = new Thread(robot.RunAutono); robot.autonomousThread.Priority = ThreadPriority.BelowNormal; // Initialize LEDs robot.yellowLED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.IO59, false); robot.redLED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.IO60, false); // Disable Debug.EnableGCMessages(false); // Run the robot once to initialize robot.Run(); // Set robot thread priority to AboveNormal Thread.CurrentThread.Priority = ThreadPriority.AboveNormal; // Start running all the threads robot.studentCodeThread.Start(); robot.autonomousThread.Start(); robot.rfPollThread.Start(); robot.rfTeleThread.Start(); // Run robot supervisor code while (true) { robot.Run(); Thread.Sleep(ROBOT_SLEEP_TIME); } }