/// <summary> /// Continues the process of searching for the reference locations. /// Called repeatedly by the control loop until the locations are found. /// </summary> private static void ContinueHoming() { if (!MotionController.Instance.HasFoundReference()) { return; } logger.Info("Home has been located. Zeroing references."); Thread.Sleep(250); MotionController.Instance.ZeroReference(); homingPhase = HomingPhase.Complete; status = Status.Idling; }
/// <summary> /// Initializes the device settings. /// </summary> static Hulk() { logger.Debug("Static create: Hulk"); DataController.Instance.PCReady = false; homingPhase = HomingPhase.Unhomed; mount = (ConfigurationManager.AppSettings["MountType"] == "Back") ? MountType.Back : MountType.Seat; InitializeMotionStates(); DataController.Instance.StartTasks(); InputController.AcquireJoystick(); status = Status.Initializing; }
/// <summary> /// Sets up the homing task. The task will run during subsequent rounds of the control loop, /// until the calibration is complete. /// </summary> public static void Home() { MotionCommand newMotionCommand; logger.Debug("Enter: Home()"); logger.Info("Homing."); homingPhase = HomingPhase.Seeking; newMotionCommand = new MotionCommand { outerAcceleration = HOMING_ACCELERATION, innerAcceleration = HOMING_ACCELERATION, outerVelocity = HOMING_VELOCITY, innerVelocity = HOMING_VELOCITY }; SetCommand(newMotionCommand); MotionController.Instance.FindReference(); status = Status.Homing; }
/// <summary> /// Tells the HULK to hold position. /// Used during initialization while computer-PLC communications are being established, /// and at any time for emergency stop. /// WARNING: Using as emergency stop will leave any ongoing tasks incomplete. /// </summary> public static void Hold() { logger.Debug("Enter: Hold()"); DataController.Instance.PCReady = true; Halt(); if (status == Status.Offline) { homingPhase = HomingPhase.Unhomed; } if (homingPhase == HomingPhase.Complete) { status = Status.Idling; } else { status = Status.NeedsHoming; } logger.Info("Motors online. Holding position."); }