/// <summary> /// Initialisiert den Antrieb des Roboters /// </summary> /// /// <param name="runMode">der gewünschte Run-Mode (Real/Virtual)</param> public Drive(RunMode runMode) { if (!Constants.IsWinCE) runMode = RunMode.Virtual; this.runMode = runMode; this.disposed = false; // Antrieb initialisieren if (this.runMode == RunMode.Real) { this.driveCtrl = new DriveCtrlHW(Constants.IODriveCtrl); this.motorCtrlLeft = new MotorCtrlHW(Constants.IOMotorCtrlLeft); this.motorCtrlRight = new MotorCtrlHW(Constants.IOMotorCtrlRight); } else { this.driveCtrl = new DriveCtrlSim(); this.motorCtrlLeft = new MotorCtrlSim(); this.motorCtrlRight = new MotorCtrlSim(); } // Beschleunigung festlegen this.motorCtrlLeft.Acceleration = 10f; this.motorCtrlRight.Acceleration = 10f; // Prozess-Thread erzeugen und starten this.thread = new Thread(RunTracks); this.thread.IsBackground = true; this.thread.Priority = ThreadPriority.Highest; this.thread.Start(); }
public Form1() { InitializeComponent(); // Initialisierung DriveCtrl-Objekt driveCtrl = new RobotCtrl.DriveCtrl(RobotCtrl.Constants.IODriveCtrl); // Initialisierung MotorCtrl_Left-Objekt motorCtrlLeft = new RobotCtrl.MotorCtrl(RobotCtrl.Constants.IOMotorCtrlLeft); // Initialisierung MotorCtrl_Right-Objekt motorCtrlRight = new RobotCtrl.MotorCtrl(RobotCtrl.Constants.IOMotorCtrlRight); // DriveCtrl-Objekt wird dem DriveCtlrView-Objekt übergeben driveCtrView.DriveCtrl = driveCtrl; // MotorCtrlLeft-Objekt wird dem MotorCtrlViewLeft-Objekt übergeben motorCtrViewLeft.MotorCtrl = motorCtrlLeft; // MotorCtrlRight-Objekt wird dem MotorCtrlViewRight-Objekt übergeben motorCtrlViewRight.MotorCtrl = motorCtrlRight; }
/// <summary> /// Initialisiert den Antrieb des Roboters /// </summary> /// /// <param name="runMode">der gewünschte Run-Mode (Real/Virtual)</param> public Drive() { this.disposed = false; // Antrieb initialisieren this.driveCtrl = new DriveCtrl(Constants.IODriveCtrl); this.motorCtrlLeft = new MotorCtrl(Constants.IOMotorCtrlLeft); this.motorCtrlRight = new MotorCtrl(Constants.IOMotorCtrlRight); // Beschleunigung festlegen this.motorCtrlLeft.Acceleration = 10f; this.motorCtrlRight.Acceleration = 10f; // Prozess-Thread erzeugen und starten this.thread = new Thread(RunTracks); this.thread.IsBackground = true; this.thread.Priority = ThreadPriority.Highest; this.thread.Start(); }