/// <summary> /// Moves the specied motor the specifed way /// </summary> /// <param name="motor">The motor to move</param> /// <param name="action">The way to move the motor</param> /// <param name="speed_sp">The speed to move the motor</param> /// <param name="stop_action">The way to stop the motor</param> /// <param name="position_sp">The amount to move the motor</param> public static void MoveMotor(TachoMotor motor, MotorMoveActions action, int speed_sp = 500, string stop_action = "coast", int position_sp = 360) { switch (action) { case MotorMoveActions.run_forever: motor.run_forever(speed_sp); break; case MotorMoveActions.stop: motor.stop(stop_action); break; default: throw new NotSupportedException($"Unsupported Action: {action.ToString()}"); } }
/// <summary> /// Moves the specied motor the specifed way /// </summary> /// <param name="address">The address of the motor to move</param> /// <param name="action">The way to move the motor</param> /// <param name="speed_sp">The speed to move the motor</param> /// <param name="stop_action">The way to stop the motor</param> /// <param name="position_sp">The amount to move the motor</param> public static void MoveMotor(string address, string action, int speed_sp = 500, string stop_action = "coast", int position_sp = 360) { TachoMotor motor = MotorList[address]; switch (action) { case "run_forever": motor.run_forever(speed_sp); break; case "stop": motor.stop(stop_action); break; default: throw new NotSupportedException($"Unsupported Action: {action}"); } }