private void SetCameraWindowMode(CalibrationMode mode) { _viewModel.Mode = mode; switch (mode) { case CalibrationMode.ShowNotCalibrated: _viewModel.CalibrationResult = null; _viewModel.Samples.Clear(); ActionButton.Content = "Find Corners"; ShowResultSection(false); Flyout.IsOpen = true; CollectedCount.Visibility = Visibility.Collapsed; break; case CalibrationMode.CollectingSamples: ActionButton.Content = "Stop"; CollectedCount.Visibility = Visibility.Visible; break; case CalibrationMode.ReadyCalibrating: ActionButton.Content = "Calibrate"; CollectedCount.Visibility = Visibility.Collapsed; break; case CalibrationMode.Calibrating: Calibrate(); SetImageWindowMode(CalibrationMode.ShowCalibrated); break; case CalibrationMode.ShowCalibrated: ActionButton.Content = "Recalibrate"; CopySettings(); ShowResultSection(true); break; } }
private void SetImageWindowMode(CalibrationMode mode) { _viewModel.Mode = mode; switch (mode) { case CalibrationMode.CollectingSamples: _viewModel.CalibrationResult = null; ActionButton.Content = "Find Corners"; Flyout.IsOpen = true; ShowResultSection(false); LoadImages(); break; case CalibrationMode.ReadyCalibrating: FindChessboardCornersOnSamples(); ActionButton.Content = "Calibrate"; break; case CalibrationMode.Calibrating: Calibrate(); SetImageWindowMode(CalibrationMode.ShowCalibrated); break; case CalibrationMode.ShowCalibrated: ActionButton.Content = "Recalibrate"; CopySettings(); ShowResultSection(true); break; } }
/// <summary> /// Loads calibration settings /// </summary> public void LoadValues() { calibrationPoints = new Point[2]; calibrationPoints[0] = CalibrationSettings.Instance().CALIBRATION_POINT_A; calibrationPoints[1] = CalibrationSettings.Instance().CALIBRATION_POINT_C; if (calibrationPoints[0].X != calibrationPoints[1].X && calibrationPoints[0].Y != calibrationPoints[1].Y) { pointCounter = 2; rotation = CalibrationSettings.Instance().CALIBRATION_ROTATION; perspective = CalibrationSettings.Instance().CALIBRATION_PERSPECTIVE; if (perspective != 1) { perspectiveRadio.IsChecked = true; mode = CalibrationMode.PERSPECTIVE; } else { mode = CalibrationMode.RECTANGLE; rectangleRadio.IsChecked = true; } DrawPoint((int)calibrationPoints[0].X, (int)calibrationPoints[0].Y, 0); DrawPoint((int)calibrationPoints[1].X, (int)calibrationPoints[1].Y, 1); CreateLines(); } CaptureImage(); }
public void IControlUpdate() { manager.modeStringEnum = GameManager.ModeString.Main_Menu; if (control.AL()) { CalibrationMode.Instance().SetupMode(); } }
public bool Equals(CalibrationMode other) { return (zone_size == other.zone_size && max_zones_count == other.max_zones_count && considered_zones_count == other.considered_zones_count && update_period_ms == other.update_period_ms && multidimension_calibration_type == other.multidimension_calibration_type && multi_dimensions_detalization == other.multi_dimensions_detalization); }
/// <summary> /// Change of the mode /// </summary> private void rectangleRadio_Checked(object sender, RoutedEventArgs e) { // pokud byl predchozi mod perspective ,musime zacit odznova if (mode == CalibrationMode.PERSPECTIVE) { resetBut_Click(null, null); } this.mode = CalibrationMode.RECTANGLE; perspective = 1; }
//----------------------- Calibration routines -----------------------// public int EnterCalibrationMode(CalibrationMode calMode) { UInt64 frame; frame = (UInt32)calMode; frame <<= 8; frame |= (byte)ParamEnum.EnterCalibration; int status = CTRE.Native.CAN.Send(PARAM_SET | _deviceId, frame, 5, 0); return(status); }
public static CalibrationMode Instance() { if (instance == null) { instance = new CalibrationMode(); manager = SL.Get <GameManager>(); control = SL.Get <IVRControl>(); shared = SL.Get <WorldBuilderMain>(); } return(instance); }
/// <summary> /// /// </summary> /// <param name="calibrationMode"></param> /// <param name="delta"></param> public void Calibrate(CalibrationMode calibrationMode, object calibrationObj) { switch (calibrationMode) { case CalibrationMode.TachoCountPerStep: CalibrateForTachoCountPerStep(calibrationObj); break; case CalibrationMode.DistancePerStep: CalibrateForDistancePerStep(calibrationObj); break; } }
public bool Equals(CalibrationMode other) { return (zone_size == other.zone_size && max_zones_count == other.max_zones_count && considered_zones_count == other.considered_zones_count && size_of_opaque_sector_in_percents == other.size_of_opaque_sector_in_percents && shade_thickness_in_pixels == other.shade_thickness_in_pixels && considered_zones_count_v1 == other.considered_zones_count_v1 && correction_fade_out_distance == other.correction_fade_out_distance && algorithm == other.algorithm && additional_dimensions_configuration.Equals(other.additional_dimensions_configuration)); }
/* static */ public string ToString(CalibrationMode cm) { string retval = "Unknown"; switch (cm) { case CalibrationMode.BootTareGyroAccel: return("BootTareGyroAccel"); case CalibrationMode.Temperature: return("Temperature"); case CalibrationMode.Magnetometer12Pt: return("Magnetometer12Pt"); case CalibrationMode.Magnetometer360: return("Magnetometer360"); case CalibrationMode.Accelerometer: return("Accelerometer"); } return(retval); }
void Start() { KeyboardMode.Hook(); int i = Application.dataPath.LastIndexOf("/"); Globals.WORLDPATH = Application.dataPath.Substring(0, i) + "/Worlds/"; Directory.CreateDirectory(Globals.WORLDPATH); Globals.BACKUPS = Application.dataPath.Substring(0, i) + "/BackupFiles/"; Directory.CreateDirectory(Globals.BACKUPS); Globals.BUNDLEPATH = Application.dataPath.Substring(0, i) + "/ArtPacks/"; Directory.CreateDirectory(Globals.BUNDLEPATH); Globals.TEMPFOLDER = Application.dataPath.Substring(0, i) + "/DWTemp/"; Directory.CreateDirectory(Globals.TEMPFOLDER); Globals.TODPATH = Application.dataPath.Substring(0, i) + "/tod2.tbl"; Globals.LEGACYPATH = Application.dataPath.Substring(0, i) + "/all.tbl"; Globals.FAVPATH = Application.dataPath.Substring(0, i) + "/dw.fav"; favorites = TODV2.LoadGeneric <List <int> >(Globals.FAVPATH); if (favorites == default(List <int>)) { favorites = new List <int>(); } if (Application.isEditor) { AssetBundleCreateRequest a = AssetBundleManager.Polygon_Adventure; } else { AssetBundleManager.Prewarm(); } SL.Add <GameManager>(this); SL.Add <Keyboard>(keyboard); hmd = rig.GetComponent <IVRHmd>(); hmd.Init(); SL.Add <IVRHmd>(hmd); control = rig.GetComponent <IVRControl>(); control.Init(this); SL.Add <IVRControl>(control); poserWidget.SetActive(false); if (control.GetControlStyle() == ControlerStyle.ViveWand) { lb1 = "Down"; lb2 = "Up"; rb1 = "Down"; rb2 = "Up"; } else if (control.GetControlStyle() == ControlerStyle.RiftTouch) { lb1 = "X"; lb2 = "Y"; rb1 = "A"; rb2 = "B"; } activeFM.Init(this); SL.Add <FileManagerV2>(activeFM); SetPrefs(); DeactivateStarter(); mode = WorldBuilderMain.Instance(); if (startPoint.position == Vector3.zero) { CalibrationMode.Instance().SetupMode(); } else { TitleScreenMode.Instance().SetupMode(); } }
/** * Get the status of the current (or previousley complete) calibration. * @param statusToFill */ public ErrorCode GetGeneralStatus(GeneralStatus statusToFill) { ErrorCode errCode = (ErrorCode)ReceiveCAN(COND_STATUS_1 | (int)_baseArbId); byte b3 = (byte)(_cache >> 0x18); byte b5 = (byte)(_cache >> 0x28); byte iCurrMode = (byte)((b5 >> 4) & 0xF); CalibrationMode currentMode = (CalibrationMode)(iCurrMode); /* shift up bottom nibble, and back down with sign-extension */ int calibrationErr = b5 & 0xF; calibrationErr <<= (32 - 4); calibrationErr >>= (32 - 4); int noMotionBiasCount = (byte)(_cache >> 0x24) & 0xF; int tempCompensationCount = (byte)(_cache >> 0x20) & 0xF; int upTimSec = (byte)(_cache >> 0x38); statusToFill.currentMode = currentMode; statusToFill.calibrationError = calibrationErr; statusToFill.bCalIsBooting = ((b3 & 1) == 1); statusToFill.state = GetState((int)errCode, _cache); statusToFill.tempC = (float)GetTemp(_cache); statusToFill.noMotionBiasCount = noMotionBiasCount; statusToFill.tempCompensationCount = tempCompensationCount; statusToFill.upTimeSec = upTimSec; statusToFill.lastError = errCode; /* build description string */ if (errCode != 0) { // same as NoComm statusToFill.description = "Status frame was not received, check wired connections and web-based config."; } else if (statusToFill.bCalIsBooting) { statusToFill.description = "Pigeon is boot-caling to properly bias accel and gyro. Do not move Pigeon. When finished biasing, calibration mode will start."; } else if (statusToFill.state == PigeonState.UserCalibration) { /* mode specific descriptions */ switch (currentMode) { case CalibrationMode.BootTareGyroAccel: statusToFill.description = "Boot-Calibration: Gyro and Accelerometer are being biased."; break; case CalibrationMode.Temperature: statusToFill.description = "Temperature-Calibration: Pigeon is collecting temp data and will finish when temp range is reached. Do not move Pigeon."; break; case CalibrationMode.Magnetometer12Pt: statusToFill.description = "Magnetometer Level 1 calibration: Orient the Pigeon PCB in the 12 positions documented in the User's Manual."; break; case CalibrationMode.Magnetometer360: statusToFill.description = "Magnetometer Level 2 calibration: Spin robot slowly in 360' fashion. "; break; case CalibrationMode.Accelerometer: statusToFill.description = "Accelerometer Calibration: Pigeon PCB must be placed on a level source. Follow User's Guide for how to level surfacee. "; break; } } else if (statusToFill.state == PigeonState.Ready) { /* definitely not doing anything cal-related. So just instrument the motion driver state */ statusToFill.description = "Pigeon is running normally. Last CAL error code was "; statusToFill.description += calibrationErr; statusToFill.description += "."; } else if (statusToFill.state == PigeonState.Initializing) { /* definitely not doing anything cal-related. So just instrument the motion driver state */ statusToFill.description = "Pigeon is boot-caling to properly bias accel and gyro. Do not move Pigeon."; } else { statusToFill.description = "Not enough data to determine status."; } return(SetLastError(errCode)); }
//----------------------- Calibration routines -----------------------// public ErrorCode EnterCalibrationMode(CalibrationMode calMode, int timeoutMs) { ErrorCode errCode = ConfigSetWrapper(ParamEnum.eEnterCalibration, (int)calMode, timeoutMs); return(SetLastError(errCode)); }
/// <summary> /// Change of the mode /// </summary> private void perspectiveRadio_Checked(object sender, RoutedEventArgs e) { this.mode = CalibrationMode.PERSPECTIVE; }
void ctrl_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.D0: // 0 calibrationMode = CalibrationMode.CLEAR; break; case Keys.D1: calibrationMode = CalibrationMode.CALIBRATION; break; case Keys.D2: // 2 calibrationMode = CalibrationMode.MEASUREMENT; break; case Keys.D6: colorMode = (colorMode == ColorMode.GRAYSCALE) ? ColorMode.COLOR : ColorMode.GRAYSCALE; contextLabelColor.Description = (colorMode == ColorMode.GRAYSCALE) ? Resources.Color : Resources.Grayscale; break; case Keys.Up: case Keys.Down: // Arrow Up Down this.panelButton.Visible = (panelTemperatute.Visible) ? true : false; this.panelTemperatute.Visible = (panelButton.Visible) ? false : true; if (panelButton.Visible) { contextLabelColor.Description = (colorMode == ColorMode.GRAYSCALE) ? Resources.Color : Resources.Grayscale; contextLabelStop.Description = measurementProgress ? Resources.Stop : " " + Resources.Start; contextLabelStop.Number = measurementProgress ? "*" : "En"; } break; case (Keys)190: if (measurementProgress) { timer.Enabled = false; measurementProgress = false; contextLabelStop.Description = " " + Resources.Start; contextLabelStop.Number = "En"; } break; case Keys.Enter: if (!timer.Enabled && !measurementProgress && !firstMeasurementProgress) { timer.Enabled = true; measurementProgress = true; labelStart.Text = Resources.Stop + ": *"; } break; case Keys.Escape: if (m_helpControl.Visible) { m_helpControl.Visible = false; this.m_helpControl.Focus(); if (measurementProgress) { timer.Enabled = true; } break; } exitThermalImagerPage(); break; case Keys.A: timer.Enabled = false; GetHelp(sender); break; } }
// ----------------------- Calibration routines -----------------------// /** * Enters the Calbration mode. See the Pigeon IMU documentation for More * information on Calibration. * * @param calMode Calibration to execute * @param timeoutMs * Timeout value in ms. If nonzero, function will wait for * config success and report an error if it times out. * If zero, no blocking or checking is performed. * @return Error Code generated by function. 0 indicates no error. */ public ErrorCode EnterCalibrationMode(CalibrationMode calMode, int timeoutMs) { ErrorCode retval = _ll.EnterCalibrationMode(calMode, timeoutMs); return(retval); }
public void ReturnToLastMode() { mode = CalibrationMode.Instance(); }
private void ProcessMessage(ref uOSC.Message message) { //メッセージアドレスがない、あるいはメッセージがない不正な形式の場合は処理しない if (message.address == null || message.values == null) { StatusMessage = "Bad message."; return; } if (message.address == "/VMC/Ext/OK" && (message.values[0] is int)) { Available = (int)message.values[0]; if (Available == 0) { StatusMessage = "Waiting for [Load VRM]"; } else { StatusMessage = "OK"; } //V2.5 キャリブレーション状態 if ((message.values[1] is int) && (message.values[2] is int)) { calibrationState = (CalibrationState)message.values[1]; calibrationMode = (CalibrationMode)message.values[2]; } } //データ送信時刻 else if (message.address == "/VMC/Ext/T" && (message.values[0] is float)) { time = (float)message.values[0]; } //V2.4 受信情報 else if (message.address == "/VMC/Ext/Rcv" && (message.values[0] is int) && (message.values[1] is int)) { ReceiveEnable = (int)message.values[0] != 0; ReceivePort = (int)message.values[1]; } //V2.4 背景色情報 else if (message.address == "/VMC/Ext/Setting/Color" && (message.values[0] is float) && (message.values[1] is float) && (message.values[2] is float) && (message.values[3] is float)) { backgroundColor = new Color((float)message.values[0], (float)message.values[1], (float)message.values[2], (float)message.values[3]); } //V2.4 ウィンドウ情報 else if (message.address == "/VMC/Ext/Setting/Win" && (message.values[0] is int) && (message.values[1] is int) && (message.values[2] is int) && (message.values[3] is int)) { IsTopMost = (int)message.values[0] != 0; IsTransparent = (int)message.values[1] != 0; WindowClickThrough = (int)message.values[2] != 0; HideBorder = (int)message.values[3] != 0; } //V2.5 読み込み済み設定ファイルパス情報 else if (message.address == "/VMC/Ext/Config" && (message.values[0] is string)) { LoadedConfigPath = (string)message.values[0]; } }
private void Awake() { _appStateBroker = AppStateBroker.Instance; AutoTest = AutoTest_External; #if !UNITY_EDITOR DevMode = false; #endif //Debug msg binding Observable .EveryUpdate() .Select(_ => TargetLane) .DistinctUntilChanged() .Subscribe(_ => { TargetLane_External = _; }).AddTo(gameObject); Observable .EveryUpdate() .Select(_ => TargetObject) .DistinctUntilChanged() .Subscribe(_ => { TargetObject_External = _; }).AddTo(gameObject); //to reset ResetApp .Where(b => b) .Take(1) .Subscribe(x => { ResetApp.Value = false; AppStateBroker.Instance.ComOutGoingStream.OnNext("{state:30}"); Observable.Timer(TimeSpan.FromSeconds(1f)) .Subscribe(_ => SceneManager.LoadScene(SceneManager.GetActiveScene().name)) .AddTo(gameObject); }) .AddTo(gameObject); //to clibration CalibrationMode .Where(b => b) .Take(1) .Subscribe(x => { CalibrationMode.Value = false; AppStateBroker.Instance.ComOutGoingStream.OnNext("{state:30}"); Observable.Timer(TimeSpan.FromSeconds(1f)) .Subscribe(_ => SceneManager.LoadScene(Open4thLane?"MainScene_4Lane_Cal":"MainScene_3Lane_Cal")) .AddTo(gameObject); }) .AddTo(gameObject); //to main game GameMode .Where(b => b) .Take(1) .Subscribe(x => { GameMode.Value = false; AppStateBroker.Instance.ComOutGoingStream.OnNext("{state:30}"); Observable.Timer(TimeSpan.FromSeconds(1f)) .Subscribe(_ => { SceneManager.LoadScene(Open4thLane ? "MainScene_4Lane" : "MainScene_3Lane"); }) .AddTo(gameObject); }) .AddTo(gameObject); //auto test if (AutoTest) { DebugOutputObjects.SetActive(true); ManualTeamSelectAllowed = ManualTeamSelectAllowedExternal = false; Observable.EveryUpdate().Select(_ => TestCount).Subscribe(x => { DubugOutput.text = x.ToString(); ThrowAllowed.gameObject.SetActive(TestCount % 2 != 0); }).AddTo(gameObject); _appStateBroker .CurrentRound .Subscribe(round => { switch (round) { case Rounds.Idle: Observable.Timer(TimeSpan.FromSeconds(2f)) .Take(1) .Subscribe(_ => { var len = Open4thLane ? 4 : 3; for (int i = 0; i < len; i++) { var client = new ORTCPEventParams(); var team = AutoTestIndexProvider.GetTeamIndex(); client.message = "{\"state\":10,\"station_id\":" + i + ",\"team\":" + team + "}"; _appStateBroker.ComReceivingStream.OnNext(client); } DelayedSanp(); }).AddTo(gameObject); break; case Rounds.R1: case Rounds.R2: case Rounds.R3: DelayedSanp(); break; case Rounds.Finish: DelayedSanp(); TestCount++; Debug.LogFormat("[{0}] Testing Count : {1}", name, TestCount); break; } }) .AddTo(gameObject); } else { DebugOutputObjects.SetActive(false); } }