private static void UserChecker() { while (true) { var users = User.AllLoggedIn(); foreach (var user in users) { if (Processes.ContainsKey(user)) { continue; } var proc = ProcessHandler.CreateImpersonatedClientEXE("FOGUserService.exe", "", user); proc.Start(); Processes.Add(user, proc); } var loggedOff = users.Except(Processes.Keys); foreach (var user in loggedOff) { Processes[user].Kill(); Processes[user].Dispose(); Processes.Remove(user); } Thread.Sleep(5 * 1000); } }
private static void ShutdownNotification(dynamic data) { Log.Entry("Service", "Prompting user"); string jsonData = JsonConvert.SerializeObject(data); ProcessHandler.RunClientEXE("FOGShutdownGUI.exe", Transform.EncodeBase64(jsonData), false); }
public static void BeginUpdate() { try { UserServiceSpawner.Stop(); //Create updating.info which will warn any sub-processes currently initializing that they should halt File.WriteAllText(Path.Combine(Settings.Location, "updating.info"), "foobar"); //Give time for any sub-processes that may be in the middle of initializing and missed the updating.info file so they can recieve the update pipe notice Thread.Sleep(1000); //Notify all FOG sub processes that an update is about to occur dynamic json = new JObject(); json.action = "start"; Bus.Emit(Bus.Channel.Update, json, true); //Kill any FOG sub processes still running after the notification KillSubProcesses(); //Launch the updater Log.Entry(LogName, "Spawning update helper"); ProcessHandler.RunClientEXE(Path.Combine("tmp", "FOGUpdateHelper.exe"), $"\"{Log.FilePath}\"", false); } catch (Exception ex) { Log.Error(LogName, "Unable to perform update"); Log.Error(LogName, ex); } }
private void btnStartStop_Click(object sender, EventArgs e) { //suport for calls from other threads if (InvokeRequired) { Invoke((MethodInvoker)(() => btnStartStop_Click(sender, e))); } else { if (ProcessHandler.IsRunning) { ProcessHandler.StopServer(); } else { if (!(ParentForm is MainForm)) { return; //check if the parent form is a mainform } MainForm parentForm = (MainForm)ParentForm; Starter starter = (Starter)parentForm.GetRequiredAddon(RequiredAddon.Starter); // Get the starter addon starter.LaunchServerFromTab(); // Launch with tab settings } } }
/// <summary> /// Starts a process with or without Admin /// </summary> /// <param name="path">Path of process to start</param> /// <param name="elevated">Whether the process should start elevated or not</param> /// <param name="args">Arguments to pass into the program</param> public static bool StartProgram(string path, bool elevated, string args) { var retStatus = true; if (!elevated && IsAdministrator) { // Set working directory Directory.SetCurrentDirectory(Path.GetDirectoryName(path) ?? Directory.GetCurrentDirectory()); var res = ProcessHandler.TryRunAsDesktopUser(path, args); // Reset working dir Directory.SetCurrentDirectory(UserDataFolder); } else { try { ProcessHandler.StartProgram(path, elevated, args); } catch (Exception e) { WriteToLog($"Failed to start process {path} due to error.", e); retStatus = false; } } Directory.SetCurrentDirectory(UserDataFolder); return(retStatus); }
private static int RunSLMGR(params string[] args) { var slmgrLoc = Path.Combine(Environment.SystemDirectory, "slmgr.vbs"); var procArg = $@"/B /Nologo {slmgrLoc} {string.Join(" ", args)}"; return(ProcessHandler.Run("cscript", procArg)); }
private void BtnStartStopClick(object sender, EventArgs e) { //suport for calls from other threads if (InvokeRequired) { Invoke((MethodInvoker)(() => BtnStartStopClick(sender, e))); } else { if (ProcessHandler.IsRunning) { if (ProcessHandler.Server.IsLocal) { ProcessHandler.StopServer(); // stop running server } else { ProcessHandler.StopServerProcess(); // stop the running process without stopping the server } } else { Starter.StartServer(); // Launch with tab settings } } }
static void testGetWindowRect(ProcessHandler process) { Console.WriteLine("getting rect"); var result = process.GetRect(); Console.WriteLine("result: {0}", result); }
public void UnHook() { if (m_Hooked) { ProcessHandler curproc = ProcessHandler.CurrentProcess; StreamHandler sh = new StreamHandler(curproc); if (original_address == 0) { sh.Position = m_Address; sh.Write(copied_instructions, 0, copied_instructions.Length); } else if (m_VtblHook) { sh.Position = m_Address; sh.Write <uint>(original_address); } else { CallRelative cr = new CallRelative((int)original_address); cr.Write(sh, (int)m_Address); } m_Hooks.Remove(m_Address); m_Hooked = false; } }
public TestComponent(ProcessType processTypeIn, TestComponentSocket socketIn, bool readOn, bool writeOn, bool exportOn) { if (processTypeIn == ProcessType.NULL || socketIn == null) { Debug.WriteLine("TestComponent > INVALID CONSTRUCTOR PARAMS"); return; } socket = socketIn; processType = processTypeIn; processHandler = new ProcessHandler(processType); InitializeComponent(); loadLogo(processType); if (!readOn) { readButton.Visibility = Visibility.Hidden; } if (!writeOn) { writeButton.Visibility = Visibility.Hidden; } if (!exportOn) { exportButton.Visibility = Visibility.Hidden; } }
public void RestartRadeonSoftware() { try { StaticViewModel.AddLogMessage("Restarting Radeon Software Host Services"); StaticViewModel.IsLoading = true; RadeonSoftwareCli(CNCMD_RESTART); //Wait for services to start back up ProcessHandler radeonSoftwareProcess = new ProcessHandler(_cnDir.FullName + "RadeonSoftware.exe"); radeonSoftwareProcess.WaitForProcessToStart(30); StaticViewModel.AddLogMessage("Restarted Radeon Software Host Services"); } catch (Exception ex) { StaticViewModel.AddLogMessage(ex, "Failed to restart Radeon Software Host Services"); } finally { LoadOrRefresh(); StaticViewModel.IsLoading = false; } }
public void WaitForProcessToEnd_NotRunning() { ProcessHandler processHandler = new ProcessHandler(@"C:\Windows\System32\tracert.exe"); processHandler.WaitForProcessToEnd(5); Assert.That(processHandler.IsProcessRunning(), Is.False); }
private void HandleProcess(ProcessHandler handler) { if (handler != null) { handler(); } }
public static void Main() { User aUser = new User("George"); ProcessHandler ph = new ProcessHandler(aUser.Process); ph("Wake Up!"); }
private void AllStart(object sender, EventArgs e) { IntPtr ipt = ProcessHandler.GetMyWindow(nowPId); OutLog("目前控制句柄 " + ipt.ToString("x8")); bot.Start(); }
private IClient BuildClient(ProcessHandler onprocess, ThreadHandler onthread) { Client curclient; //- inject our assembly into the client process (where an instance of the Client class is created! Injection.Inject(onprocess, onthread, Assembly.GetExecutingAssembly(), typeof(InjectedProcess)); //- create a proxy to the remote client object curclient = (Client)Server.GetObject(typeof(Client), (int)onprocess.PID); //- wait for server to become available System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); while ((!IsValid(curclient) && (sw.ElapsedMilliseconds < 1000))) { Thread.Sleep(0); } sw.Stop(); if (IsValid(curclient)) { return(curclient.ActualClient); } else { return(null); } }
public void NullEmptyRun() { Assert.Throws <ArgumentException>(() => ProcessHandler.Run(null, "", true)); Assert.Throws <ArgumentNullException>(() => ProcessHandler.Run("a", null, true)); Assert.Throws <ArgumentException>(() => ProcessHandler.Run(null, "", true)); Assert.Throws <ArgumentException>(() => ProcessHandler.Run("", "", true)); }
private void コマンドプロンプトCToolStripMenuItem_Click(object sender, EventArgs e) { if (File.Exists(this.linkFilePath)) { ProcessHandler.Run_Cmd(this.linkFilePath); } }
/// <summary> /// Handle a commandsent event from the textbox and redirect it to the server /// </summary> /// <param name="text"></param> private static void HandleCommandSent(string text) { if (ProcessHandler.IsRunning) { ProcessHandler.SendInput(text); } }
public static void RegisterHandler(int Header, ProcessHandler Handler) { if (!Handlers.ContainsKey(Header)) { Handlers.Add(Header, Handler); } }
public bool RegisterComputer(DataContracts.HostnameChanger msg) { var returnCode = ProcessHandler.Run("/bin/bash", $"{Path.Combine(Settings.Location, "osxbind.sh")} {msg.ADDom} {msg.ADUser} {msg.ADPass} {msg.ADOU}"); return(returnCode == 0); }
public bool Install() { if (Directory.Exists(GetLocation())) { Uninstall(); } if (!Directory.Exists("/opt/")) { Directory.CreateDirectory("/opt/"); ProcessHandler.Run("chown", "root:root /opt/"); ProcessHandler.Run("chmod", "0755 /opt/"); } Helper.ExtractFiles("/opt/", GetLocation()); var logLocation = Path.Combine(GetLocation(), "fog.log"); if (!File.Exists(logLocation)) { File.Create(logLocation); } ProcessHandler.Run("chmod", "755 " + logLocation); Helper.ExtractResource("FOG.Scripts.control.sh", Path.Combine(GetLocation(), "control.sh"), true); ProcessHandler.Run("chmod", "755 " + Path.Combine(GetLocation(), "control.sh")); return(AddControlScripts()); }
/// <summary> /// Remove (Delete) this plugin /// </summary> public void Remove(bool forceRefresh = true) { if (!ProcessHandler.RequestServerStop()) { return; } if (Directory.Exists(Fl.Location(RequestFile.Plugindir) + Name)) { switch ( MetroMessageBox.Show(null, "This folder seems to be associated with the " + Name + " plugin." + '\n' + "Do you want to delete this folder?", "Delete plugin folder", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) { case DialogResult.Cancel: return; case DialogResult.Yes: Directory.Delete(Fl.Location(RequestFile.Plugindir) + Name); break; case DialogResult.No: break; } } File.Delete(Path); if (forceRefresh) { InstalledPluginManager.RefreshAllInstalledPluginsAsync(); } }
public void StopRadeonSoftware() { try { StaticViewModel.AddLogMessage("Stopping Radeon Software Host Services"); StaticViewModel.IsLoading = true; RadeonSoftwareCli(CNCMD_EXIT); //The command to stop the services does not wait for them to fully end ProcessHandler hostProcess = new ProcessHandler(_cnDir.FullName + "AMDRSServ.exe"); hostProcess.WaitForProcessToEnd(30); ProcessHandler radeonSoftwareProcess = new ProcessHandler(_cnDir.FullName + "RadeonSoftware.exe"); radeonSoftwareProcess.WaitForProcessToEnd(30); StaticViewModel.AddLogMessage("Stopped Radeon Software Host Services"); } catch (Exception ex) { StaticViewModel.AddLogMessage(ex, "Failed to stop Radeon Software Host Services"); } finally { LoadOrRefresh(); StaticViewModel.IsLoading = false; } }
//encryption patch public static void PatchEncryption() { ProcessHandler us = ProcessHandler.CurrentProcess; int curtarget; JmpRelative jrel; asmInstruction curins; us.Position = UOCallibration.Callibrations[(uint)UOCallibration.CallibratedFeatures.sendcryptpatchpos]; curins = disassembler.disassemble(us); curtarget = (int)curins.ReadAddressOperand(); jrel = new JmpRelative(curtarget); jrel.Write(us, (int)curins.Address); us.Position = UOCallibration.Callibrations[(uint)UOCallibration.CallibratedFeatures.recvcryptpatchpos]; curins = disassembler.disassemble(us); curtarget = (int)curins.ReadAddressOperand(); jrel = new JmpRelative(curtarget); jrel.Write(us, (int)curins.Address); us.Position = (int)UOCallibration.Callibrations[(uint)UOCallibration.CallibratedFeatures.SendCryptPatchPos2]; curins = disassembler.disassemble(us); curtarget = (int)curins.ReadAddressOperand(); jrel = new JmpRelative(curtarget); jrel.Write(us, (int)curins.Address); }
private void エクスプローラEToolStripMenuItem_Click(object sender, EventArgs e) { if (File.Exists(this.linkFilePath)) { ProcessHandler.Run_Explorer(this.linkFilePath); } }
public bool Uninstall() { if (Directory.Exists(GetLocation())) { // Check if an upgrade is underway if (Settings.Location.Contains(GetLocation())) { var filePaths = Directory.GetFiles(GetLocation(), "*", SearchOption.TopDirectoryOnly); foreach (var filePath in filePaths.Where(filePath => !filePath.ToLower().EndsWith("fog.log"))) { File.Delete(filePath); } // OSX .app programs are actually directories var trayApp = Path.Combine(GetLocation(), "OSX-FOG-TRAY.app"); if (Directory.Exists(trayApp)) { Directory.Delete(trayApp, true); } } else { Directory.Delete(GetLocation(), true); } } ProcessHandler.Run("launchctl", "unload -w /Library/LaunchDaemons/org.freeghost.daemon.plist"); ProcessHandler.Run("launchctl", "unload -w /Library/LaunchAgents/org.freeghost.useragent.plist"); File.Delete("/Library/LaunchAgents/com.freeghost.useragent.plist"); File.Delete("/Library/LaunchDaemons/com.freeghost.daemon.plist"); return(true); }
public static void Callibrate(ProcessHandler clientprocess) { uint entrypoint; Stack <string> errstack = new Stack <string>(); asmInstruction curinsn = null; asmChunk curchunk = null; entrypoint = clientprocess.MainModule.EntryPointAddress; if ((entrypoint == 0) || (entrypoint == 0xFFFFFFFF)) { throw new Exception("Failed to obtain entrypoint address!"); } clientprocess.Position = (long)entrypoint; if (System.IO.File.Exists("Callibrations.xml")) { CallibrationFile.Load("Callibrations.xml"); } else//fall back to the embedded callibrations { CallibrationFile.Load(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("UOAIBasic.Callibrations.xml")); } if (!ActionList.actionlists["ActionList1"].ExecuteActionList(clientprocess, Callibrations, ref curchunk, ref curinsn, errstack)) { throw BuildCallibrationException(errstack); } }
public static void Main() { Machine aMachine = new Machine("computer"); ProcessHandler ph = new ProcessHandler(aMachine.Process); ph("compile"); }
/// <summary> /// 4 exit codes: /// /// 0 is clean exit /// 1 is move to metro /// 2 is move to forms /// 3 is failed process upstart /// null is unspecified error /// </summary> private static void HandleTypeOfWindowSystem() { ShowSplashScreen(); int?result = null; while (result != 0 || result == 3) { if (result == null) { result = ProcessHandler.StartProcess("SSS_Windows_Forms.exe"); } else if (result == 1) { result = ProcessHandler.StartProcess("SSS_Materials_Design_Forms.exe"); } else if (result == 2) { result = ProcessHandler.StartProcess("SSS_Windows_Forms.exe"); } if (result == 0) { Application.Exit(); Environment.Exit(0);//for extreme prejudice } } }
public static ProcessHandler getInstance() { if (ProcessHandler.instance == null) { ProcessHandler.instance = new ProcessHandler(); } return ProcessHandler.instance; }
private void ProcessStarting() { string versionString = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.VersionLabel.Text = versionString; ParameterAccessor.Instance.Read(Application.ExecutablePath); this.traceListener.SetDestination(ParameterAccessor.Instance.Trace.Address, ParameterAccessor.Instance.Trace.Port); Tracer.WriteHigh(TraceGroup.GUI, null, "starting"); if (RobotApplications.repair == ParameterAccessor.Instance.RobotApplication) { this.TitleLabel.Text = " CIRRIS XR"; this.FrontSealantReserviorPanel.Visible = true; this.RearSealantReserviorPanel.Visible = true; this.DrillMainPanel.Visible = true; this.InspectionPanel.Top = this.DrillMainPanel.Top; this.InspectionPanel.Left = this.DrillMainPanel.Left; this.InspectionPanel.Visible = false; ParameterAccessor.Instance.FrontDrill.ExtendedDistance.OperationalValue = 0; ParameterAccessor.Instance.FrontDrill.RotationSpeed.OperationalValue = 0; ParameterAccessor.Instance.RearDrill.ExtendedDistance.OperationalValue = 0; ParameterAccessor.Instance.RearDrill.RotationSpeed.OperationalValue = 0; this.RobotCamera6Button.Visible = true; this.RobotCamera11Button.Visible = true; this.RobotCamera2Button.Text = "RFF DRILL"; this.RobotCamera6Button.Text = "FFF DRILL"; this.RobotCamera10Button.Text = "LOWER FORWARD"; this.RobotCamera9Button.Text = "RRF DRILL"; this.RobotCamera11Button.Text = "FRF DRILL"; this.RobotCamera12Button.Text = "LOWER BACK"; this.RobotCamera2Button.Camera = CameraLocations.robotRffDrill; this.RobotCamera6Button.Camera = CameraLocations.robotFffDrill; this.RobotCamera10Button.Camera = CameraLocations.robotLowerForward; this.RobotCamera9Button.Camera = CameraLocations.robotRrfDrill; this.RobotCamera11Button.Camera = CameraLocations.robotFrfDrill; this.RobotCamera12Button.Camera = CameraLocations.robotLowerBack; } if (RobotApplications.inspect == ParameterAccessor.Instance.RobotApplication) { this.TitleLabel.Text = " CIRRIS XI"; this.FrontSealantReserviorPanel.Visible = false; this.RearSealantReserviorPanel.Visible = false; this.DrillMainPanel.Visible = false; this.DrillManualPanel.Visible = false; this.SealantMainPanel.Visible = false; this.SealantManualPanel.Visible = false; this.BodyDrillButton.Text = ""; this.BodyDrillButton.Enabled = false; this.InspectionPanel.Top = this.DrillMainPanel.Top; this.InspectionPanel.Left = this.DrillMainPanel.Left; this.InspectionPanel.Visible = true; this.RobotCamera6Button.Visible = false; this.RobotCamera11Button.Visible = false; this.RobotCamera2Button.Text = "LOWER BACK"; this.RobotCamera10Button.Text = "LOWER FORWARD"; this.RobotCamera9Button.Text = "SENSOR ARM"; this.RobotCamera12Button.Text = "SENSOR BAY"; this.RobotCamera2Button.Camera = CameraLocations.robotLowerBack; this.RobotCamera10Button.Camera = CameraLocations.robotLowerForward; this.RobotCamera9Button.Camera = CameraLocations.robotSensorArm; this.RobotCamera12Button.Camera = CameraLocations.robotSensorBay; } this.indicatorFlasher = false; this.feederFastSelected = true; this.feederPreviousRequest = 0; this.feederNonManualMode = FeederModes.off; this.FeederSpeedToggleButton.OptionASelected = this.feederFastSelected; this.FeederManualPanel.Visible = false; this.FeederManulDisplayButton.Text = "SHOW MANUAL"; this.FeederSpeedToggleButton.Visible = true; this.FeederSpeedValueButton.ValueText = this.GetValueText(ParameterAccessor.Instance.FeederManualSpeed); this.UpdateFeederControls(); this.ReelCalibrateToButton.ValueText = this.GetValueText(ParameterAccessor.Instance.ReelCalibrationDistance); this.ReelManualCalibrateToButton.ValueText = this.GetValueText(ParameterAccessor.Instance.ReelCalibrationDistance); this.ReelCalibrateToButton.Enabled = false; this.ReelShowManualButton.Enabled = true; this.ReelManualDirectionToggleButton.OptionASelected = true; this.ReelManualDirectionToggleButton.Enabled = true; this.ReelSetupButton.Enabled = true; this.ReelManualSetupButton.Enabled = true; this.ReelManualHideButton.Enabled = true; this.UpdateReelControls(); this.ReelManualPanel.Visible = false; if (MovementForwardControls.current == ParameterAccessor.Instance.ReelMotionMode) { this.ReelManualValueTextPanel.ValueText = this.GetValueText(ParameterAccessor.Instance.ReelManualCurrent); this.ReelManualDirectionToggleButton.Text = "TORQUE DIRECTION"; this.ReelValuePromptLabel.Text = "SET CURRENT"; } else { this.ReelManualValueTextPanel.ValueText = this.GetValueText(ParameterAccessor.Instance.ReelManualSpeed); this.ReelManualDirectionToggleButton.Text = "SPEED DIRECTION"; this.ReelValuePromptLabel.Text = "SET SPEED"; } this.movementFastSelected = true; this.movementNonManualMode = MovementModes.off; this.movementNonManualForwardMode = MovementForwardModes.normalAxial; this.MotorManualJogDistanceValueButton.ValueText = this.GetValueText(ParameterAccessor.Instance.MovementMotorManualJogDistance); this.MotorManualMoveSpeedValueButton.ValueText = this.GetValueText(ParameterAccessor.Instance.MovementMotorManualMoveSpeed); this.MovementSpeedToggleButton.OptionASelected = this.movementFastSelected; this.MovementManulPanel.Visible = false; this.MovementManaulDisplayButton.Text = "SHOW MANUAL"; this.MovementSpeedToggleButton.Visible = true; this.UpdateMovementControls(); #region Drill/Sealant Controls if (RobotApplications.repair == ParameterAccessor.Instance.RobotApplication) { this.toolLocation = (false != ParameterAccessor.Instance.FrontToolSelected) ? ToolLocations.front : ToolLocations.rear; this.SetDrillSelection(this.toolLocation); this.DrillManulDisplayButton.Text = "SHOW MANUAL"; this.DrillMainPanel.Visible = true; this.DrillManualPanel.Visible = false; this.drillManualVisible = false; this.drillManualActivated = false; NicBotComm.Instance.SetPumpSpeed(this.toolLocation, 0); this.SealantManulDisplayButton.Text = "SHOW MANUAL"; this.SealantMainPanel.Visible = false; this.SealantManualPanel.Visible = false; this.pumpManualVisible = false; this.pumpManualActivated = false; this.SealantManualModeToggleButton.OptionASelected = false; this.DrillMainPanel.Focus(); } #endregion #region Sensor Controls if (RobotApplications.inspect == ParameterAccessor.Instance.RobotApplication) { this.sensorThicknessPending = false; this.newThicknessReading = false; this.sensorStressPending = false; this.newStressReading = false; this.sensorDirection = Directions.north; double latitude = ParameterAccessor.Instance.Latitude; if (double.IsNaN(latitude) == false) { this.SensorLatitudeTextPanel.ValueText = latitude.ToString("N4"); } else { this.SensorLatitudeTextPanel.ValueText = "---"; } double longitude = ParameterAccessor.Instance.Longitude; if (double.IsNaN(longitude) == false) { this.SensorLongitudeTextPanel.ValueText = longitude.ToString("N4"); } else { this.SensorLongitudeTextPanel.ValueText = "---"; } this.SensorDirectionTextPanel.ValueText = this.sensorDirection.ToString().ToUpper(); this.SensorDirectionTextPanel.BackColor = Color.FromArgb(51, 51, 51); this.SensorDirectionTextPanel.Enabled = true; this.SensorDisplacementTextPanel.ValueText = "---"; this.SensorGpsDateTextPanel.ValueText = "---"; this.SensorGpsTimeTextPanel.ValueText = "---"; this.SensorThicknessAcquireButton.Enabled = true; this.SensorThicknessReadingTextPanel.ValueText = ""; this.SensorStressAcquireButton.Enabled = true; this.SensorStressReadingTextPanel.ValueText = ""; if (0 != ParameterAccessor.Instance.LocationServer.Port) { LocationServer.Instance.Start(ParameterAccessor.Instance.LocationServer.Address, ParameterAccessor.Instance.LocationServer.Port); } } #endregion #region Camera Controls this.RobotCamera1Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera1Button.Camera); this.RobotCamera2Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera2Button.Camera); this.RobotCamera3Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera3Button.Camera); this.RobotCamera4Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera4Button.Camera); this.RobotCamera5Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera5Button.Camera); this.RobotCamera6Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera6Button.Camera); this.RobotCamera7Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera7Button.Camera); this.RobotCamera8Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera8Button.Camera); this.RobotCamera9Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera9Button.Camera); this.RobotCamera10Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera10Button.Camera); this.RobotCamera11Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera11Button.Camera); this.RobotCamera12Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.RobotCamera12Button.Camera); this.LaunchCamera1Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.LaunchCamera1Button.Camera); this.LaunchCamera2Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.LaunchCamera2Button.Camera); this.LaunchCamera3Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.LaunchCamera3Button.Camera); this.LaunchCamera4Button.CenterLevel = (int)ParameterAccessor.Instance.GetLightLevel(this.LaunchCamera4Button.Camera); this.ClearCameraSelects(this.RobotCamera1Button); this.ClearCameraSelects(this.RobotCamera2Button); this.ClearCameraSelects(this.RobotCamera3Button); this.ClearCameraSelects(this.RobotCamera4Button); this.ClearCameraSelects(this.RobotCamera5Button); this.ClearCameraSelects(this.RobotCamera6Button); this.ClearCameraSelects(this.RobotCamera7Button); this.ClearCameraSelects(this.RobotCamera8Button); this.ClearCameraSelects(this.RobotCamera9Button); this.ClearCameraSelects(this.RobotCamera10Button); this.ClearCameraSelects(this.RobotCamera11Button); this.ClearCameraSelects(this.RobotCamera12Button); this.ClearCameraSelects(this.LaunchCamera1Button); this.ClearCameraSelects(this.LaunchCamera2Button); this.ClearCameraSelects(this.LaunchCamera3Button); this.ClearCameraSelects(this.LaunchCamera4Button); this.cameraSelectMode = CameraSelectModes.none; this.UpdateCameraHoldEnable(); this.UpdateCameraSelectorColor(); this.selectedLaunchCameraButton = null; this.selectedRobotCameraAButton = null; this.selectedRobotCameraBButton = null; this.UpdateCameraHoldEnable(); #endregion NicBotComm.Instance.Start(); ParameterAccessor.Instance.FrontDrill.ExtendedDistance.OperationalValue = ParameterAccessor.Instance.FrontDrill.ExtendedDistance.MinimumValue; // todo remove ParameterAccessor.Instance.FrontDrill.RotationSpeed.OperationalValue = ParameterAccessor.Instance.FrontDrill.RotationSpeed.MinimumValue; // todo remove ParameterAccessor.Instance.RearDrill.ExtendedDistance.OperationalValue = ParameterAccessor.Instance.RearDrill.ExtendedDistance.MinimumValue; // todo remove ParameterAccessor.Instance.RearDrill.RotationSpeed.OperationalValue = ParameterAccessor.Instance.RearDrill.RotationSpeed.MinimumValue; // todo remove this.SystemStatusTextBox.Text = "starting"; this.SystemStatusTextBox.BackColor = Color.Yellow; this.UpdateTimer.Interval = 100; this.Process = this.ProcessWaitComm; }
private void ProcessStart() { this.processStopped = false; this.UpdateTimer.Interval = 1; this.Process = this.ProcessShow; }
private void ProcessExecution() { this.indicatorFlasher = !this.indicatorFlasher; TruckCommBus.Instance.Service(); RobotCommBus.Instance.Service(); #region System Status string systemStatus = null; if (null != Joystick.Instance.FaultReason) { systemStatus = "joystick missing"; } else { systemStatus = NicBotComm.Instance.GetStatus(); } if (null == systemStatus) { this.SystemStatusTextBox.Text = "ready"; this.SystemStatusTextBox.BackColor = Color.LimeGreen; } else { this.SystemStatusTextBox.Text = systemStatus; this.SystemStatusTextBox.BackColor = Color.Red; } #endregion #region Status (Main Air, Total Currents, Sealant Reserved) double nitrogenPressure1Reading = NicBotComm.Instance.GetNitrogenPressureReading1(); if (double.IsNaN(nitrogenPressure1Reading) == false) { this.NitrogenPressure1TextPanel.ValueText = this.GetValueText(nitrogenPressure1Reading, ParameterAccessor.Instance.NitrogenPressureConversionUnit); this.SetCautionPanel(nitrogenPressure1Reading, ParameterAccessor.Instance.NitrogenPressureCaution, this.NitrogenPressure1TextPanel); } else { this.NitrogenPressure1TextPanel.ValueText = "---"; } double nitrogenPressure2Reading = NicBotComm.Instance.GetNitrogenPressureReading2(); if (double.IsNaN(nitrogenPressure2Reading) == false) { this.NitrogenPressure2TextPanel.ValueText = this.GetValueText(nitrogenPressure2Reading, ParameterAccessor.Instance.NitrogenPressureConversionUnit); this.SetCautionPanel(nitrogenPressure2Reading, ParameterAccessor.Instance.NitrogenPressureCaution, this.NitrogenPressure2TextPanel); } else { this.NitrogenPressure2TextPanel.ValueText = "---"; } double robotTotalCurrentReading = NicBotComm.Instance.GetRobotTotalCurrentReading(); if (double.IsNaN(robotTotalCurrentReading) == false) { this.RobotTotalCurrentTextPanel.ValueText = this.GetValueText(robotTotalCurrentReading, ParameterAccessor.Instance.RobotTotalCurrentConversionUnit); } else { this.RobotTotalCurrentTextPanel.ValueText = "---"; } double launchTotalCurrentReading = NicBotComm.Instance.GetLaunchTotalCurrentReading(); if (double.IsNaN(launchTotalCurrentReading) == false) { this.LaunchTotalCurrentTextPanel.ValueText = this.GetValueText(launchTotalCurrentReading, ParameterAccessor.Instance.LaunchTotalCurrentConversionUnit); } else { this.LaunchTotalCurrentTextPanel.ValueText = "---"; } if (RobotApplications.repair == ParameterAccessor.Instance.RobotApplication) { double frontReserviourWeightReading = NicBotComm.Instance.GetReserviorWeightReading(ToolLocations.front); if (double.IsNaN(frontReserviourWeightReading) == false) { frontReserviourWeightReading *= 1000; this.FrontSealantReserviorWeightTextPanel.ValueText = this.GetValueText(frontReserviourWeightReading, "N0", "g"); double frontReserviourVolumeReading = frontReserviourWeightReading / ParameterAccessor.Instance.FrontPump.SealantWeight.OperationalValue; this.FrontSealantReserviorVolumeTextPanel.ValueText = this.GetValueText(frontReserviourVolumeReading, "N0", "mL"); } else { this.FrontSealantReserviorWeightTextPanel.ValueText = "---"; this.FrontSealantReserviorVolumeTextPanel.ValueText = "---"; } double rearReserviourWeightReading = NicBotComm.Instance.GetReserviorWeightReading(ToolLocations.rear); if (double.IsNaN(rearReserviourWeightReading) == false) { rearReserviourWeightReading *= 1000; this.RearSealantReserviorWeightTextPanel.ValueText = this.GetValueText(rearReserviourWeightReading, "N0", "g"); double rearReserviourVolumeReading = rearReserviourWeightReading / ParameterAccessor.Instance.RearPump.SealantWeight.OperationalValue; this.RearSealantReserviorVolumeTextPanel.ValueText = this.GetValueText(rearReserviourVolumeReading, "N0", "mL"); } else { this.RearSealantReserviorWeightTextPanel.ValueText = "---"; this.RearSealantReserviorVolumeTextPanel.ValueText = "---"; } } #endregion #region Reel string reelActualValueText = ""; DirectionalValuePanel.Directions reelActualDirection = DirectionalValuePanel.Directions.Idle; bool reelDisplayLockIndicators = NicBotComm.Instance.GetReelInLockMode(); bool reelDisplayCurrent = NicBotComm.Instance.GetReelInCurrentMode(); if (false != reelDisplayCurrent) { double reelCurrent = NicBotComm.Instance.GetReelCurrent(); double reelDisplayValue = Math.Abs(reelCurrent); if (reelDisplayValue < ParameterAccessor.Instance.ReelReverseCurrent.StepValue) { reelCurrent = 0; reelDisplayValue = 0; this.ReelLockButton.Enabled = true; } else { this.ReelLockButton.Enabled = reelDisplayLockIndicators; } if ((0 == reelCurrent) || (false != reelDisplayLockIndicators)) { reelActualDirection = DirectionalValuePanel.Directions.Idle; } else if (reelCurrent > 0) { reelActualDirection = DirectionalValuePanel.Directions.Forward; } else if (reelCurrent < 0) { reelActualDirection = DirectionalValuePanel.Directions.Reverse; } reelActualValueText = this.GetValueText(reelDisplayValue, ParameterAccessor.Instance.ReelReverseCurrent); } else { double reelSpeed = NicBotComm.Instance.GetReelSpeed(); double reelDisplayValue = Math.Abs(reelSpeed); if (reelDisplayValue < ParameterAccessor.Instance.ReelReverseSpeed.StepValue) { reelSpeed = 0; reelDisplayValue = 0; this.ReelLockButton.Enabled = true; } else { this.ReelLockButton.Enabled = false; } if ((0 == reelSpeed) || (false != reelDisplayLockIndicators)) { reelActualDirection = DirectionalValuePanel.Directions.Idle; } else if (reelSpeed > 0) { reelActualDirection = DirectionalValuePanel.Directions.Forward; } else if (reelSpeed < 0) { reelActualDirection = DirectionalValuePanel.Directions.Reverse; } reelActualValueText = this.GetValueText(reelDisplayValue, ParameterAccessor.Instance.ReelReverseSpeed); } this.ReelActualValuePanel.Direction = reelActualDirection; this.ReelActualValuePanel.ValueText = reelActualValueText; double reelTotalDistance = NicBotComm.Instance.GetReelTotalDistance(); string reelTotalText = this.GetValueText(reelTotalDistance, ParameterAccessor.Instance.ReelDistance); this.ReelTotalTextPanel.ValueText = reelTotalText; VideoStampOsd.Instance.SetPipeDisplacementText(reelTotalText); double reelTripDistance = NicBotComm.Instance.GetReelTripDistance(); this.ReelTripTextPanel.ValueText = this.GetValueText(reelTripDistance, ParameterAccessor.Instance.ReelDistance); #endregion #region Feeder string feederActualValueText = ""; DirectionalValuePanel.Directions feederActualDirection = DirectionalValuePanel.Directions.Idle; bool feederDisplayLockMode = NicBotComm.Instance.GetFeederInLockMode(); if (false == feederDisplayLockMode) { double feederVelocity = NicBotComm.Instance.GetFeederVelocity(); double feederSpeedValue = Math.Abs(feederVelocity); if (feederSpeedValue < ParameterAccessor.Instance.FeederMaxSpeed.StepValue) { feederVelocity = 0; feederSpeedValue = 0; this.FeederLockButton.Enabled = true; } else { this.FeederLockButton.Enabled = false; } if (feederVelocity > 0) { feederActualDirection = DirectionalValuePanel.Directions.Forward; } else if (feederVelocity < 0) { feederActualDirection = DirectionalValuePanel.Directions.Reverse; } else { feederActualDirection = DirectionalValuePanel.Directions.Idle; } feederActualValueText = this.GetValueText(feederSpeedValue, ParameterAccessor.Instance.FeederMaxSpeed); } else { double feederLockCurrent = NicBotComm.Instance.GetFeederLockCurrent(); feederActualValueText = this.GetValueText(feederLockCurrent, ParameterAccessor.Instance.FeederLockCurrent); } this.FeederActualValuePanel.Direction = feederActualDirection; this.FeederActualValuePanel.ValueText = feederActualValueText; #if false // feeder clamp undefined bool feederClampRequest = NicBotComm.Instance.GetFeederClampSetPoint(); bool feederClampActual = NicBotComm.Instance.GetFeederClamp(); string feederClampStatus = ""; if (feederClampRequest == feederClampActual) { if (false == feederClampRequest) { feederClampStatus = "CLAMP GRABBING"; } else { feederClampStatus = "CLAMP RELEASING"; } } else if (false != feederClampActual) { feederClampStatus = "CLAMP HELD"; } else { feederClampStatus = "CLAMP RELEASED"; } this.FeederClampSetupButton.Text = feederClampStatus; #endif double maximumFeederCurrent = 0.0; double feederCurrent = 0; feederCurrent = NicBotComm.Instance.GetTopFrontFeederCurrent(); maximumFeederCurrent = (feederCurrent > maximumFeederCurrent) ? feederCurrent : maximumFeederCurrent; this.TopFrontFeederCurrentTextPanel.ValueText = this.GetValueText(feederCurrent, "N2", "A"); feederCurrent = NicBotComm.Instance.GetTopRearFeederCurrent(); maximumFeederCurrent = (feederCurrent > maximumFeederCurrent) ? feederCurrent : maximumFeederCurrent; this.TopRearFeederCurrentTextPanel.ValueText = this.GetValueText(feederCurrent, "N2", "A"); feederCurrent = NicBotComm.Instance.GetBottomFrontFeederCurrent(); maximumFeederCurrent = (feederCurrent > maximumFeederCurrent) ? feederCurrent : maximumFeederCurrent; this.BottomFrontFeederCurrentTextPanel.ValueText = this.GetValueText(feederCurrent, "N2", "A"); feederCurrent = NicBotComm.Instance.GetBottomRearFeederCurrent(); maximumFeederCurrent = (feederCurrent > maximumFeederCurrent) ? feederCurrent : maximumFeederCurrent; this.BottomRearFeederCurrentTextPanel.ValueText = this.GetValueText(feederCurrent, "N2", "A"); this.SetCautionPanel(maximumFeederCurrent, ParameterAccessor.Instance.FeederCurrentCaution, this.FeederCurrentIndicatorTextBox); #endregion #region Guide Color moveFlashColor = (false != indicatorFlasher) ? Color.FromArgb(190, 255, 50) : Color.FromArgb(32, 32, 32); if (NicBotComm.Instance.GuideAtExtendLimit(GuideLocations.left) != false) { this.GuideExtendLeftButton.LeftColor = Color.FromArgb(190, 255, 50); } else if (NicBotComm.Instance.GetGuideDirection(GuideLocations.left) == GuideDirections.extend) { this.GuideExtendLeftButton.LeftColor = moveFlashColor; } else { this.GuideExtendLeftButton.LeftColor = Color.FromArgb(32, 32, 32); } if (NicBotComm.Instance.GuideAtRetractLimit(GuideLocations.left) != false) { this.GuideRetractLeftButton.LeftColor = Color.FromArgb(190, 255, 50); } else if (NicBotComm.Instance.GetGuideDirection(GuideLocations.left) == GuideDirections.retract) { this.GuideRetractLeftButton.LeftColor = moveFlashColor; } else { this.GuideRetractLeftButton.LeftColor = Color.FromArgb(32, 32, 32); } if (NicBotComm.Instance.GuideAtExtendLimit(GuideLocations.right) != false) { this.GuideExtendRightButton.RightColor = Color.FromArgb(190, 255, 50); } else if (NicBotComm.Instance.GetGuideDirection(GuideLocations.right) == GuideDirections.extend) { this.GuideExtendRightButton.RightColor = moveFlashColor; } else { this.GuideExtendRightButton.RightColor = Color.FromArgb(32, 32, 32); } if (NicBotComm.Instance.GuideAtRetractLimit(GuideLocations.right) != false) { this.GuideRetractRightButton.RightColor = Color.FromArgb(190, 255, 50); } else if (NicBotComm.Instance.GetGuideDirection(GuideLocations.right) == GuideDirections.retract) { this.GuideRetractRightButton.RightColor = moveFlashColor; } else { this.GuideRetractRightButton.RightColor = Color.FromArgb(32, 32, 32); } #endregion #region Joystick and Movement Joystick.Instance.Update(); if (false != Joystick.Instance.Valid) { #region Y Axis Movement int yAxis = (int)(((Joystick.Instance.YAxis) - 32768) * -1); bool movementReverse = false; bool movementForward = false; int joystickDeadBand = ParameterAccessor.Instance.JoystickDeadband; int joystickRange; int yAxisPrevious = yAxis; if (yAxis > joystickDeadBand) { this.MovementSpeedToggleButton.Enabled = false; yAxis -= joystickDeadBand; joystickRange = (32768 - joystickDeadBand); } else if (yAxis < -joystickDeadBand) { this.MovementSpeedToggleButton.Enabled = false; yAxis += joystickDeadBand; joystickRange = (32767 - joystickDeadBand); } else { this.MovementSpeedToggleButton.Enabled = true; yAxis = 0; joystickRange = 1; } if (yAxis < 0) { movementReverse = true; movementForward = false; } else if (yAxis > 0) { movementReverse = false; movementForward = true; } // Tracer.WriteHigh(TraceGroup.GUI, "", "joystick {0} {1}", yAxisPrevious, yAxis); // todo add joystick group double movementScale = (false != this.movementFastSelected) ? 1.0 : ParameterAccessor.Instance.MovementMotorLowSpeedScale.OperationalValue / 100; double movementRequest = movementScale * yAxis / joystickRange; bool movementTriggered = Joystick.Instance.Button1Pressed; NicBotComm.Instance.SetMovementRequest(movementRequest, movementTriggered); bool movementActivated = NicBotComm.Instance.GetMovementActivated(); double movementRequestValue = 0; ValueParameter movementParameter = null; NicBotComm.Instance.GetMovementRequestValues(ref movementParameter, ref movementRequestValue); if (false != this.MovementMoveButton.Enabled) { double movementDisplayValue = Math.Abs(movementRequestValue); this.MovementMoveButton.LeftArrowVisible = movementReverse; this.MovementMoveButton.RightArrowVisible = movementForward; this.MovementMoveButton.ValueForeColor = (false != movementActivated) ? Color.White : Color.FromKnownColor(KnownColor.ControlDarkDark); this.MovementMoveButton.ValueText = this.GetValueText(movementDisplayValue, movementParameter); } else { this.MovementMoveButton.LeftArrowVisible = false; this.MovementMoveButton.RightArrowVisible = false; this.MovementMoveButton.ValueForeColor = Color.FromKnownColor(KnownColor.ControlDarkDark); this.MovementMoveButton.ValueText = this.GetValueText(0, movementParameter); } double movementValue = NicBotComm.Instance.GetMovementValue(); double movementStatusDisplayValue = Math.Abs(movementValue); if (movementStatusDisplayValue < movementParameter.StepValue) { movementValue = 0; movementStatusDisplayValue = 0; } if (movementValue > 0) { this.MotorStatusDirectionalValuePanel.Direction = DirectionalValuePanel.Directions.Forward; } else if (movementValue < 0) { this.MotorStatusDirectionalValuePanel.Direction = DirectionalValuePanel.Directions.Reverse; } else { this.MotorStatusDirectionalValuePanel.Direction = DirectionalValuePanel.Directions.Idle; } this.MotorStatusDirectionalValuePanel.ValueText = this.GetValueText(movementStatusDisplayValue, movementParameter); #endregion #region Trottle Axis Feeder int joystickThrottle = (int)(65535 - Joystick.Instance.Throttle); double feederRequest = 0; bool feederAutomaticTracking = this.GetAutomaticFeederTracking(); if (false != feederAutomaticTracking) { feederRequest = movementRequestValue * ParameterAccessor.Instance.FeederTrackingCalibration.OperationalValue / 100; } else { double feederMaxSpeed = (false != this.feederFastSelected) ? ParameterAccessor.Instance.FeederMaxSpeed.OperationalValue : (ParameterAccessor.Instance.FeederMaxSpeed.OperationalValue * ParameterAccessor.Instance.FeederLowSpeedScale.OperationalValue / 100); feederRequest = feederMaxSpeed * joystickThrottle / 65535; if (false != movementReverse) { feederRequest *= -1; } } bool directionSelected = (false != movementReverse) || (false != movementForward); bool feederMoveEnabled = false; if ((NicBotComm.Instance.GetFeederMode() == FeederModes.move) && (false == this.FeederManualPanel.Visible) && (false != movementActivated)) { feederMoveEnabled = true; } if (false != this.FeederMoveButton.Enabled) { double feederDisplayValue = Math.Abs(feederRequest); this.FeederMoveButton.LeftArrowVisible = movementReverse; this.FeederMoveButton.RightArrowVisible = movementForward; this.FeederMoveButton.ValueForeColor = (false != feederMoveEnabled) ? Color.White : Color.FromKnownColor(KnownColor.ControlDarkDark); this.FeederMoveButton.ValueText = this.GetValueText(feederDisplayValue, ParameterAccessor.Instance.FeederMaxSpeed); } else { this.FeederMoveButton.LeftArrowVisible = false; this.FeederMoveButton.RightArrowVisible = false; this.FeederMoveButton.ValueForeColor = Color.FromKnownColor(KnownColor.ControlDarkDark); this.FeederMoveButton.ValueText = this.GetValueText(0, ParameterAccessor.Instance.FeederMaxSpeed); } if (false != feederMoveEnabled) { if (feederRequest != this.feederPreviousRequest) { this.feederPreviousRequest = feederRequest; NicBotComm.Instance.SetFeederVelocity(feederRequest); } } else { if (0 != this.feederPreviousRequest) { this.feederPreviousRequest = 0; NicBotComm.Instance.SetFeederVelocity(0); } } #endregion } double maximumMovementCurrent = 0; double movementCurrent = 0; movementCurrent = NicBotComm.Instance.GetTopFrontMovementCurrent(); maximumFeederCurrent = (movementCurrent > maximumMovementCurrent) ? movementCurrent : maximumMovementCurrent; this.TopFrontMovementMotorCurrentTextPanel.ValueText = this.GetValueText(movementCurrent, "N2", "A"); movementCurrent = NicBotComm.Instance.GetTopRearMovementCurrent(); maximumMovementCurrent = (movementCurrent > maximumMovementCurrent) ? movementCurrent : maximumMovementCurrent; this.TopRearMovementMotorCurrentTextPanel.ValueText = this.GetValueText(movementCurrent, "N2", "A"); movementCurrent = NicBotComm.Instance.GetBottomFrontMovementCurrent(); maximumMovementCurrent = (movementCurrent > maximumMovementCurrent) ? movementCurrent : maximumMovementCurrent; this.BottomFrontMovementMotorCurrentTextPanel.ValueText = this.GetValueText(movementCurrent, "N2", "A"); movementCurrent = NicBotComm.Instance.GetBottomRearMovementCurrent(); maximumMovementCurrent = (movementCurrent > maximumMovementCurrent) ? movementCurrent : maximumMovementCurrent; this.BottomRearMovementMotorCurrentTextPanel.ValueText = this.GetValueText(movementCurrent, "N2", "A"); this.SetCautionPanel(maximumMovementCurrent, ParameterAccessor.Instance.MovementCurrentCaution, this.MovementCurrentIndciatorTextBox); double maximumMovementTemperature = 0; double movementTemperature = 0; movementTemperature = NicBotComm.Instance.GetTopFrontMovementTemperature(); maximumMovementTemperature = (movementTemperature > maximumMovementTemperature) ? movementTemperature : maximumMovementTemperature; this.TopFrontMovementMotorTemperatureTextPanel.ValueText = this.GetValueText(movementTemperature, "N1", "°C"); movementTemperature = NicBotComm.Instance.GetTopRearMovementTemperature(); maximumMovementTemperature = (movementTemperature > maximumMovementTemperature) ? movementTemperature : maximumMovementTemperature; this.TopRearMovementMotorTemperatureTextPanel.ValueText = this.GetValueText(movementTemperature, "N1", "°C"); movementTemperature = NicBotComm.Instance.GetBottomFrontMovementTemperature(); maximumMovementTemperature = (movementTemperature > maximumMovementTemperature) ? movementTemperature : maximumMovementTemperature; this.BottomFrontMovementMotorTemperatureTextPanel.ValueText = this.GetValueText(movementTemperature, "N1", "°C"); movementTemperature = NicBotComm.Instance.GetBottomRearMovementTemperature(); maximumMovementTemperature = (movementTemperature > maximumMovementTemperature) ? movementTemperature : maximumMovementTemperature; this.BottomRearMovementMotorTemperatureTextPanel.ValueText = this.GetValueText(movementTemperature, "N1", "°C"); this.SetCautionPanel(maximumMovementTemperature, ParameterAccessor.Instance.MovementTemperatureCaution, this.MovementTemperatureIndicatorTextBox); #endregion #region Index Position #endregion #region Robot Status this.UpdateBodyControls(); this.UpdatePipePositionDisplay(); #endregion #region Drill Status if (RobotApplications.repair == ParameterAccessor.Instance.RobotApplication) { double drillIndexSetPoint = NicBotComm.Instance.GetDrillIndexSetPoint(this.toolLocation) * -1; double actualDrillIndexPosition = NicBotComm.Instance.GetDrillIndexPosition(this.toolLocation) * -1; bool atRetractionLimit = (0 == actualDrillIndexPosition) ? true : false; double drillOriginOffset = NicBotComm.Instance.GetDrillOriginOffset(this.toolLocation); if (double.IsNaN(drillOriginOffset) == false) { drillIndexSetPoint += drillOriginOffset; actualDrillIndexPosition += drillOriginOffset; this.OriginSetLightTextBox.BackColor = Color.Black; this.DrillMoveToOriginButton.Enabled = true; } else { this.OriginSetLightTextBox.BackColor = Color.Red; this.DrillMoveToOriginButton.Enabled = false; } this.DrillExtendedActualValuePanel.ValueText = this.GetValueText(actualDrillIndexPosition, ParameterAccessor.Instance.FrontDrill.ExtendedDistance); this.DrillExtendedSetPointValuePanel.ValueText = this.GetValueText(drillIndexSetPoint, ParameterAccessor.Instance.FrontDrill.ExtendedDistance); this.DrillRotationActualSpeedValuePanel.ValueText = this.GetValueText(NicBotComm.Instance.GetDrillRotationSpeed(this.toolLocation), ParameterAccessor.Instance.FrontDrill.RotationSpeed); if (false != atRetractionLimit) { this.RetractionLimitLightTextBox.BackColor = Color.Yellow; this.DrillSealModeButton.Enabled = true; } else { this.RetractionLimitLightTextBox.BackColor = Color.Black; this.DrillSealModeButton.Enabled = false; } this.DrillErrorLightTextBox.BackColor = (NicBotComm.Instance.GetDrillError(this.toolLocation) != false) ? Color.Red : Color.Black; this.UpdateDrillControls(); } #endregion #region Sealant and Nozzle Status if (RobotApplications.repair == ParameterAccessor.Instance.RobotApplication) { bool nozzleExtended = NicBotComm.Instance.GetNozzleExtended(this.toolLocation); bool pumpSetPointActive = NicBotComm.Instance.GetPumpActivity(this.toolLocation); PumpAutoStates pumpAutoState = NicBotComm.Instance.GetPumpAutoState(this.toolLocation); bool nozzleError = (false != pumpSetPointActive) && (PumpAutoStates.running != pumpAutoState) && (false == nozzleExtended); this.SealantNozzlePositionTextPanel.BackColor = (false == nozzleError) ? Color.FromArgb(51, 51, 51) : Color.Red; this.SealantNozzlePositionTextPanel.ValueText = (false != nozzleExtended) ? "EXTENDED" : "RETRACTED"; this.SealantNozzleToggleButton.OptionASelected = nozzleExtended; PumpParameters pumpParameters = (ToolLocations.front == this.toolLocation) ? ParameterAccessor.Instance.FrontPump : ParameterAccessor.Instance.RearPump; double sealantReserviorReading = NicBotComm.Instance.GetReserviorWeightReading(this.toolLocation); if (double.IsNaN(sealantReserviorReading) == false) { sealantReserviorReading *= 1000; this.SealantReserviorTextPanel.ValueText = this.GetValueText(sealantReserviorReading, "N0", "g"); } else { this.SealantReserviorTextPanel.ValueText = "---"; } double pumpVolumePerMinute = NicBotComm.Instance.GetPumpVolumePerSecond(this.toolLocation) * 60; this.SealantFlowRateTextPanel.ValueText = this.GetValueText((int)pumpVolumePerMinute, "mL/M"); double pumpPressureReading = NicBotComm.Instance.GetPumpPressureReading(this.toolLocation); double pumpVolumeMeasure = NicBotComm.Instance.GetPumpVolumeMeasure(this.toolLocation); double pumpSpeedReading = NicBotComm.Instance.GetPumpSpeedReading(this.toolLocation); this.SealantActualPressureValuePanel.ValueText = this.GetValueText(pumpPressureReading, pumpParameters.MaximumPressure); this.SealantActualVolumeValuePanel.ValueText = this.GetValueText(pumpVolumeMeasure, pumpParameters.MaximumVolume); this.SealantActualSpeedValuePanel.ValueText = this.GetValueText(pumpSpeedReading, pumpParameters.MaximumSpeed); this.SealantActualVolumeValuePanel.ValueText = this.GetValueText(pumpVolumeMeasure, pumpParameters.MaximumVolume); PumpModes pumpMode = NicBotComm.Instance.GetPumpMode(this.toolLocation); double pumpSetPoint = NicBotComm.Instance.GetPumpSetPoint(this.toolLocation); if (PumpModes.pressure == pumpMode) { this.SealantPressureSetPointValuePanel.ForeColor = (false != pumpSetPointActive) ? Color.White : Color.Gray; this.SealantPressureSetPointValuePanel.ValueText = this.GetValueText(pumpSetPoint, pumpParameters.MaximumPressure); this.SealantVolumeSetPointValuePanel.ForeColor = Color.Black; this.SealantSpeedSetPointValuePanel.ForeColor = Color.Black; } else if (PumpModes.volume == pumpMode) { this.SealantVolumeSetPointValuePanel.ForeColor = (false != pumpSetPointActive) ? Color.White : Color.Gray; this.SealantVolumeSetPointValuePanel.ValueText = this.GetValueText(pumpSetPoint, pumpParameters.MaximumVolume); this.SealantPressureSetPointValuePanel.ForeColor = Color.Black; this.SealantSpeedSetPointValuePanel.ForeColor = Color.Black; } else if (PumpModes.speed == pumpMode) { PumpDirections pumpDirection = NicBotComm.Instance.GetPumpDirection(this.toolLocation); double pumpDisplaySetPoint = (PumpDirections.forward == pumpDirection) ? pumpSetPoint : -pumpSetPoint; this.SealantSpeedSetPointValuePanel.ForeColor = (false != pumpSetPointActive) ? Color.White : Color.Gray; this.SealantSpeedSetPointValuePanel.ValueText = this.GetValueText(pumpDisplaySetPoint, pumpParameters.MaximumSpeed); this.SealantPressureSetPointValuePanel.ForeColor = Color.Black; this.SealantVolumeSetPointValuePanel.ForeColor = Color.Black; } this.UpdateSealantControls(); } #endregion #region Sensor Status if (RobotApplications.inspect == ParameterAccessor.Instance.RobotApplication) { double latitude = NicBotComm.Instance.GetGpsLatitude(); if (double.IsNaN(latitude) == false) { ParameterAccessor.Instance.Latitude = latitude; this.SensorLatitudeTextPanel.ValueText = latitude.ToString("N4"); } double longitude = NicBotComm.Instance.GetGpsLongitude(); if (double.IsNaN(latitude) == false) { ParameterAccessor.Instance.Longitude = longitude; this.SensorLongitudeTextPanel.ValueText = longitude.ToString("N4"); } DateTime dateTime = NicBotComm.Instance.GetGpsTime(); if (dateTime.Year < 2000) { dateTime = DateTime.UtcNow; } this.SensorGpsDateTextPanel.ValueText = string.Format("{0:D2}-{1:D2}-{2:D4}", dateTime.Month, dateTime.Day, dateTime.Year); this.SensorGpsTimeTextPanel.ValueText = string.Format("{0:D2}:{1:D2}:{2:D2}", dateTime.Hour, dateTime.Minute, dateTime.Second); bool readingEnabled = true; if ((double.IsNaN(ParameterAccessor.Instance.Latitude) != false) || (double.IsNaN(ParameterAccessor.Instance.Longitude) != false) || (this.sensorDirection == Directions.unknown)) { readingEnabled = false; } bool thicknessReadingEnabled = (NicBotComm.Instance.GetThicknessReadingEnabled() && readingEnabled); bool stressReadingEnabled = (NicBotComm.Instance.GetStressReadingEnabled() && readingEnabled); double sensorDisplacement = NicBotComm.Instance.GetReelTotalDistance() * 100; this.SensorDisplacementTextPanel.ValueText = this.GetValueText(sensorDisplacement, "N0", "cm"); if (false != this.sensorThicknessPending) { if (NicBotComm.Instance.GetThicknessReadingPending() == false) { this.sensorThicknessPending = false; this.SensorThicknessAcquireButton.Enabled = thicknessReadingEnabled; double thicknessReading = NicBotComm.Instance.GetThicknessReading(); if (double.IsNaN(thicknessReading) == false) { double reading = thicknessReading * ParameterAccessor.Instance.ThicknessConversionUnit.OperationalValue; this.SensorThicknessReadingTextPanel.ValueText = this.GetValueText(reading, ParameterAccessor.Instance.ThicknessConversionUnit); } else { this.SensorThicknessReadingTextPanel.ValueText = "---"; } } } else { this.SensorThicknessAcquireButton.Enabled = thicknessReadingEnabled; } if (false != this.newThicknessReading) { this.newThicknessReading = false; double reading = this.thicknessReading * ParameterAccessor.Instance.ThicknessConversionUnit.OperationalValue; this.SensorThicknessReadingTextPanel.ValueText = this.GetValueText(reading, ParameterAccessor.Instance.ThicknessConversionUnit); } if (false != this.sensorStressPending) { if (NicBotComm.Instance.GetStressReadingPending() == false) { this.sensorStressPending = false; this.SensorStressAcquireButton.Enabled = stressReadingEnabled; double stressReading = NicBotComm.Instance.GetStressReading(); if (double.IsNaN(stressReading) == false) { double reading = stressReading * ParameterAccessor.Instance.StressConversionUnit.OperationalValue; this.SensorStressReadingTextPanel.ValueText = this.GetValueText(reading, ParameterAccessor.Instance.StressConversionUnit); } else { this.SensorStressReadingTextPanel.ValueText = "---"; } } } else { this.SensorStressAcquireButton.Enabled = stressReadingEnabled; } if (false != this.newStressReading) { this.newStressReading = false; double reading = this.stressReading * ParameterAccessor.Instance.StressConversionUnit.OperationalValue; this.SensorStressReadingTextPanel.ValueText = this.GetValueText(reading, ParameterAccessor.Instance.StressConversionUnit); } if (false == this.SensorDirectionTextPanel.Enabled) { if ((false == this.sensorThicknessPending) && (false == this.sensorStressPending)) { this.SensorDirectionTextPanel.Enabled = true; } } } #endregion if (false != this.processStopNeeded) { this.processStopNeeded = false; this.Process = this.ProcessStopping; } }
private void ProcessWaitComm() { if (false != NicBotComm.Instance.Running) { this.AssignLaunchCamera(this.LaunchCamera1Button); this.AssignRobotCameraA(this.RobotCamera8Button); this.AssignRobotCameraB(this.RobotCamera1Button); this.UpdateBodyControls(); this.UpdateMovementControls(); this.UpdateSealantControls(); Tracer.WriteHigh(TraceGroup.GUI, null, "started"); this.Process = this.ProcessExecution; } }
private void ProcessWaitCommStop() { if (false == NicBotComm.Instance.Running) { LocationServer.Instance.Stop(); ParameterAccessor.Instance.FrontToolSelected = (ToolLocations.front == this.toolLocation) ? true : false; ParameterAccessor.Instance.Write(Application.ExecutablePath); Tracer.WriteHigh(TraceGroup.GUI, null, "stopped"); this.Process = this.ProcessCommStopped; } }
private void ProcessStopping() { this.SystemStatusTextBox.Text = "stopping"; this.SystemStatusTextBox.BackColor = Color.Yellow; Tracer.WriteHigh(TraceGroup.GUI, null, "stopping"); NicBotComm.Instance.Stop(); this.Process = this.ProcessWaitCommStop; }
private void ProcessCommStopped() { this.processStopped = true; if (false != this.processExitNeeded) { this.Process = this.ProcessExit; } else { this.Process = this.ProcessStart; } }
private void MainForm_Shown(object sender, EventArgs e) { this.Process = this.ProcessStart; this.UpdateTimer.Interval = 1; this.UpdateTimer.Enabled = true; #if false this.PopupTransparentPanel.Top = this.Top; this.PopupTransparentPanel.Left = this.Left; this.PopupTransparentPanel.BringToFront(); this.PopupTransparentPanel.Height = this.Height; this.PopupTransparentPanel.Width = this.Width-30; this.PopupTransparentPanel.Visible = false; #endif }
/// <summary> /// This method has the common code of two other methods, which differed in only one /// function call. /// </summary> /// <param name="ph">The delegate, which has the chosen function</param> /// <returns>The required object</returns> private object FetchObject(ProcessHandler ph) { if (RequiresDuplication()) { // process the object return ph(NextTree()); } // test above then fetch return base.NextTree(); }
private void StartTest() { bool result = true; Tracer.WriteMedium(TraceGroup.TEST, "", "test start"); this.completionCause = null; this.startTime = DateTime.Now; // set to give valid start time if (this.testParameters.RunTime > 1) { this.loadChangePerSecond = (this.testParameters.WheelStopLoad - this.testParameters.WheelStartLoad) / (this.testParameters.RunTime - 1); } else { this.loadChangePerSecond = 0; } if (false != result) { result = this.CreateLogFile(); if (false == result) { this.completionCause = "log creation failure"; } } if (false != result) { this.Log("DYNO TEST"); this.Log(" - producer heartbeat time = {0}", this.setupParameters.ProducerHeartbeatTime); this.Log(" - consumer heartbeat time = {0}", this.setupParameters.ConsumerHeartbeatTime); this.Log(" - uut RPM to speed = {0:0.000}", this.setupParameters.UutRpmToSpeed); this.Log(" - body RPM to speed = {0:0.000}", this.setupParameters.BodyRpmToSpeed); this.Log(" - analog IO volts to supply current: slope = {0:0.000}", this.setupParameters.AnalogIoVoltsToSupplyAmpsSlope); this.Log(" - analog IO volts to supply current: offset = {0:0.000}", this.setupParameters.AnalogIoVoltsToSupplyAmpsOffset); this.Log(" - analog IO volts to load pounds = {0:0.000}", this.setupParameters.AnalogIoVoltsToLoadPounds); this.Log(" - wheel start load = {0}", this.testParameters.WheelStartLoad); this.Log(" - wheel end load = {0}", this.testParameters.WheelStopLoad); this.Log(" - wheel speed = {0}", this.testParameters.WheelSpeed); this.Log(" - time limit = {0}", this.testParameters.RunTime); this.Log(" - current limit = {0}", this.testParameters.CurrentLimit); this.Log(" - thermal limit = {0}", this.testParameters.ThermalLimit); this.Log(" - slippage limit = {0}", this.testParameters.SlippageLimit); result = this.StartBus(); } if (false != result) { Tracer.WriteMedium(TraceGroup.TEST, "", "enable setup voltage"); this.digitalIo.SetOutput(0x01); double powerUpDelay = 3; Tracer.WriteHigh(TraceGroup.TEST, "", "wait {0} seconds", powerUpDelay); this.stateTimeLimit = this.currentTime.AddSeconds(powerUpDelay); this.Process = this.WaitSetupPowerUp; } else { this.Process = this.CompleteTest; } }
private void ProcessShow() { this.NitrogenPressure1TextPanel.ValueText = ""; this.NitrogenPressure2TextPanel.ValueText = ""; this.ReelTotalTextPanel.ValueText = ""; this.ReelTripTextPanel.ValueText = ""; this.ReelActualValuePanel.ValueText = ""; this.FeederActualValuePanel.ValueText = ""; this.FeederMoveButton.ValueText = ""; this.FeederCurrentIndicatorTextBox.BackColor = Color.Black; this.TopFrontFeederCurrentTextPanel.ValueText = ""; this.TopRearFeederCurrentTextPanel.ValueText = ""; this.BottomFrontFeederCurrentTextPanel.ValueText = ""; this.BottomRearFeederCurrentTextPanel.ValueText = ""; this.MotorStatusDirectionalValuePanel.ValueText = ""; this.MovementMoveButton.ValueText = ""; this.TopFrontMovementMotorCurrentTextPanel.ValueText = ""; this.MovementCurrentIndciatorTextBox.BackColor = Color.Black; this.MovementTemperatureIndicatorTextBox.BackColor = Color.Black; this.TopRearMovementMotorCurrentTextPanel.ValueText = ""; this.BottomFrontMovementMotorCurrentTextPanel.ValueText = ""; this.BottomRearMovementMotorCurrentTextPanel.ValueText = ""; this.TopFrontMovementMotorTemperatureTextPanel.ValueText = ""; this.TopRearMovementMotorTemperatureTextPanel.ValueText = ""; this.BottomFrontMovementMotorTemperatureTextPanel.ValueText = ""; this.BottomRearMovementMotorTemperatureTextPanel.ValueText = ""; this.DrillExtendedActualValuePanel.ValueText = ""; this.DrillExtendedSetPointValuePanel.ValueText = ""; this.DrillRotationActualSpeedValuePanel.ValueText = ""; this.DrillRotaionSetPointSpeedValuePanel.ValueText = ""; this.SealantReserviorTextPanel.ValueText = ""; this.SealantFlowRateTextPanel.ValueText = ""; this.SealantActualPressureValuePanel.ValueText = ""; this.SealantActualVolumeValuePanel.ValueText = ""; this.SealantActualSpeedValuePanel.ValueText = ""; this.SensorPipePositionTextPanel.ValueText = ""; this.SensorLatitudeTextPanel.ValueText = ""; this.SensorLongitudeTextPanel.ValueText = ""; this.SensorGpsDateTextPanel.ValueText = ""; this.SensorGpsTimeTextPanel.ValueText = ""; this.SensorDisplacementTextPanel.ValueText = ""; this.UpdateTimer.Interval = 1; this.Process = this.ProcessStarting; }
private void RunTest() { TimeSpan totalRunSpan = currentTime - this.startTime; if (totalRunSpan.TotalSeconds >= this.secondLimit) { this.LogData(); if (this.secondLimit < this.testParameters.RunTime) { this.RampLoad(); } this.secondLimit += 1.0; } if (null == this.completionCause) { if (null != this.uut.FaultReason) { this.completionCause = "uut " + this.uut.FaultReason; } else if (null != this.encoder.FaultReason) { this.completionCause = this.encoder.Name + " " + this.encoder.FaultReason; } else if (null != this.digitalIo.FaultReason) { this.completionCause = this.digitalIo.Name + " " + this.digitalIo.FaultReason; } else if (null != this.analogIo.FaultReason) { this.completionCause = this.analogIo.Name + " " + this.analogIo.FaultReason; } } if (null != this.completionCause) { this.Process = this.CompleteTest; } else if (false != completeEarly) { this.Process = this.CompleteTest; this.completionCause = "user abort"; } else if (totalRunSpan.TotalSeconds >= this.testParameters.RunTime) { this.Process = this.CompleteTest; this.completionCause = "time limit exceeded"; } }
private void TestProcess() { this.Process = this.StartTest; for (; execute; ) { this.currentTime = DateTime.Now; this.Process(); Thread.Sleep(1); } this.StopBus(); this.CloseLogFile(); Tracer.WriteMedium(TraceGroup.TEST, "", "test stop"); this.Complete(); }
private void WaitSetupPowerUp() { if (this.currentTime > this.stateTimeLimit) { this.startTime = this.currentTime; this.lastLoadSetPoint = 0; this.slippageCount = 0; this.RampLoad(); int requestedRpm = (int)(this.testParameters.WheelSpeed * this.setupParameters.UutRpmToSpeed); Tracer.WriteMedium(TraceGroup.TEST, "", "uut speed={0}, rpm={1}", this.testParameters.WheelSpeed, requestedRpm); this.uut.SetMode(UlcRoboticsNicbotWheel.Modes.velocity); this.uut.SetVelocity(requestedRpm); this.startTime = DateTime.Now; this.secondLimit = 1.0; this.lastEncoderTime = this.startTime; this.lastEncoderRotations = this.encoder.Rotations; this.Log(" - UUT name = \"{0}\"", this.uut.DeviceName); this.Log(" - UUT version = \"{0}\"", this.uut.DeviceVersion); this.Log(" - start = {0:D2}-{1:D2}-{2:D2} {3:D2}:{4:D2}:{5:D2}", this.startTime.Month, this.startTime.Day, this.startTime.Year, this.startTime.Hour, this.startTime.Minute, this.startTime.Second); string title = string.Format("{0,12}, {1,12}, {2,12}, {3,14}, {4,12}, {5,12}, {6,11}, {7,9}", "TIME", "LOAD", "MOTOR-SPEED", "MOTOR-CURRENT", "TEMPERATURE", "EXT-CURRENT", "BODY-SPEED", "SLIPPAGE"); this.Log(title); this.SetTitle(" " + title); this.Process = this.RunTest; } else if (false != completeEarly) { this.Process = this.CompleteTest; this.completionCause = "user abort"; } }
private void CompleteTest() { Tracer.WriteMedium(TraceGroup.TEST, "", "stop uut"); this.uut.SetVelocity(0); Tracer.WriteMedium(TraceGroup.TEST, "", "disable load voltage"); this.analogIo.SetOutput(0, 0); Tracer.WriteMedium(TraceGroup.TEST, "", "disable setup voltage"); this.digitalIo.SetOutput(0x00); this.Log("END"); TimeSpan ts = DateTime.Now - this.startTime; this.Log(" - completion cause = {0}", this.completionCause); this.Log(" - runtime = {0:0.0}", ts.TotalSeconds); Tracer.WriteMedium(TraceGroup.TEST, "", "test complete"); this.execute = false; this.Process = this.TestDone; }