Esempio n. 1
0
 public static bool addressUpdater()
 {
     try
     {
         ConnectorOne.pi1Ip = SettingsModule.getPi1Ip();
         RoverConsole.ArcEyeContent("pi1Ip : " + pi1Ip.ToString());
         ConnectorOne.pi1Port1 = Convert.ToInt32(SettingsModule.getPi1Port1());
         RoverConsole.ArcEyeContent("pi1Port1 : " + pi1Port1.ToString());
         ConnectorOne.pi1Port2 = Convert.ToInt32(SettingsModule.getPi1Port2());
         RoverConsole.ArcEyeContent("pi1Port2 : " + pi1Port2.ToString());
         ConnectorOne.pi2Ip = SettingsModule.getPi2Ip();
         RoverConsole.ArcEyeContent("pi2Ip : " + pi2Ip.ToString());
         ConnectorOne.pi2Port1 = Convert.ToInt32(SettingsModule.getPi2Port1());
         RoverConsole.ArcEyeContent("pi2Port1 : " + pi2Port1.ToString());
         ConnectorOne.pi2Port2 = Convert.ToInt32(SettingsModule.getPi2Port2());
         RoverConsole.ArcEyeContent("pi2Port2 : " + pi2Port2.ToString());
         ConnectorOne.pi3Ip = SettingsModule.getPi3Ip();
         RoverConsole.ArcEyeContent("pi3Ip : " + pi3Ip.ToString());
         ConnectorOne.pi3Port1 = Convert.ToInt32(SettingsModule.getPi3Port1());
         RoverConsole.ArcEyeContent("pi3Port1 : " + pi3Port1.ToString());
         ConnectorOne.pi3Port2 = Convert.ToInt32(SettingsModule.getPi3Port2());
         RoverConsole.ArcEyeContent("pi3Port2 : " + pi3Port2.ToString());
         RoverConsole.ArcEyeAiContent("IP PORT ASSIGN SUCCESSFULL ... !!!");
         return(true);
     }
     catch (Exception ex)
     {
         RoverConsole.ArcEyeAiContent(ex.ToString());
         return(false);
     }
 }
Esempio n. 2
0
 private void joystick_lst_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         foreach (var deviceInstance in directInput.GetDevices(DeviceType.Joystick, DeviceEnumerationFlags.AllDevices))
         {
             joystickGuid = deviceInstance.InstanceGuid;
             _RoverMovement.joystick_lst.Items.Add(joystickGuid);
         }
         if (joystickGuid == System.Guid.Empty)
         {
             RoverConsole.ArcEyeContentThreadSafe("No Joystick Found.");
             RoverConsole.ArcEyeAiContentThreadSafe("Press The Reload Button To Search Again");
             _RoverMovement.joystick_lst.IsEnabled = false;
         }
         else
         {
             RoverConsole.ArcEyeAiContentThreadSafe("Joystick Found.");
             _RoverMovement.initialize_btn.IsEnabled = true;
             _RoverMovement.joystick_lst.IsEnabled   = true;
         }
     }
     catch (Exception ex)
     {
         RoverConsole.ArcEyeAiContent(ex.ToString());
     }
 }
Esempio n. 3
0
 public static void pi1Port2AddressUpdater()
 {
     try
     {
         ConnectorOne.pi1Ip = SettingsModule.getPi1Ip();
         RoverConsole.ArcEyeContent("pi1Ip : " + pi1Ip.ToString());
         ConnectorOne.pi1Port2 = Convert.ToInt32(SettingsModule.getPi1Port2());
         RoverConsole.ArcEyeContent("pi1Port2 : " + pi1Port2.ToString());
         RoverConsole.ArcEyeAiContent("PI1 IP PORT2 ASSIGN SUCCESSFULL ... !!!");
     }
     catch (Exception ex)
     {
         RoverConsole.ArcEyeAiContent(ex.ToString());
     }
 }
Esempio n. 4
0
 private void fst_initialize_btn_Click(object sender, RoutedEventArgs e)
 {
     _RoverMovement.joystick_lst.Items.Clear();
     joystickGuid = Guid.Empty;
     RoverConsole.ArcEyeContentThreadSafe("Initializing fast Joystick Initializing process.");
     try
     {
         foreach (var deviceInstance in directInput.GetDevices(DeviceType.Joystick, DeviceEnumerationFlags.AllDevices))
         {
             joystickGuid = deviceInstance.InstanceGuid;
             _RoverMovement.joystick_lst.Items.Add(joystickGuid);
         }
         if (joystickGuid == System.Guid.Empty)
         {
             RoverConsole.ArcEyeContentThreadSafe("No Joystick Found.");
             RoverConsole.ArcEyeAiContentThreadSafe("Fast Initializing Process Failed.");
         }
         else
         {
             RoverConsole.ArcEyeAiContentThreadSafe("Joystick Found.");
             _RoverMovement.initialize_btn.IsEnabled = true;
             _RoverMovement.joystick_lst.IsEnabled   = true;
             Joystick joystick = new Joystick(directInput, (Guid)_RoverMovement.joystick_lst.Items[0]);
             RoverConsole.ArcEyeContentThreadSafe("Joystick initialization successful.");
             _RoverMovement.initialize_btn.IsEnabled     = false;
             _RoverMovement.joystick_lst.IsEnabled       = false;
             _RoverMovement.rld_btn.IsEnabled            = false;
             _RoverMovement.fst_initialize_btn.IsEnabled = false;
             Thread joystickInputHandlerThread = new Thread(() => joystickInputHandler(joystick));
             joystickInputHandlerThread.IsBackground = true;
             joystickInputHandlerThread.Start();
             _RoverMovement.joystck_pnl.IsExpanded = true;
         }
     }
     catch (Exception ex)
     {
         RoverConsole.ArcEyeAiContent(ex.ToString());
     }
 }
Esempio n. 5
0
 public static void RoveArmStatusUpdater(MotorName motorName, HandMovement handMovement)
 {
     try
     {
         RoverConsole.ArcEyeAiContent("Uploading Rover Arm Command : Motor Name-" + motorName.ToString() + ", Hand Movement-" + handMovement.ToString());
         pi1Port2SwSender.AutoFlush = true;
         pi1Port2SwSender.Write(Convert.ToString(Convert.ToInt32(motorName)) + "," + Convert.ToInt32(handMovement));
         RoverConsole.ArcEyeAiContent("Command Uploaded to Pi1 via port2");
         if (ConnectorOne.pi1Port2ConnectedStatusEvent != null)
         {
             ConnectorOne.pi1Port2ConnectedStatusEvent(new object(), new EventArgs());
         }
     }
     catch (Exception ex)
     {
         RoverConsole.ArcEyeAiContentThreadSafe(ex.ToString());
         RoverConsole.ArcEyeAiContentThreadSafe("Trying To Reconnect");
         if (ConnectorOne.pi1Port2DisconnectedStatusEvent != null)
         {
             ConnectorOne.pi1Port2DisconnectedStatusEvent(new object(), new EventArgs());
         }
     }
 }
Esempio n. 6
0
 public static void RoverMovementStatusUpdater(RoverAndArmRoverMovement roverMovement, double pwm)
 {
     try
     {
         RoverConsole.ArcEyeAiContent("Uploading Rover Movement Command : Direction-" + roverMovement.ToString() + ", Speed-" + pwm.ToString());
         pi1Port1SwSender.AutoFlush = true;
         pi1Port1SwSender.Write(Convert.ToString(Convert.ToInt32(roverMovement)) + "," + Convert.ToString(pwm));
         RoverConsole.ArcEyeAiContent("Command Uploaded to Pi1 via port1");
         if (ConnectorOne.pi1Port1ConnectedStatusEvent != null)
         {
             ConnectorOne.pi1Port1ConnectedStatusEvent(new object(), new EventArgs());
         }
     }
     catch (Exception ex)
     {
         RoverConsole.ArcEyeAiContentThreadSafe(ex.ToString());
         RoverConsole.ArcEyeAiContentThreadSafe("Trying To Reconnect");
         if (ConnectorOne.pi1Port1DisconnectedStatusEvent != null)
         {
             ConnectorOne.pi1Port1DisconnectedStatusEvent(new object(), new EventArgs());
         }
     }
 }
Esempio n. 7
0
 public void RoverMovementStatusUpdater(RoverAndArmRoverMovement roverMovement, double pwm)
 {
     RoverConsole.ArcEyeAiContent("Rover Movement Command : Direction-" + roverMovement.ToString() + ", Speed-" + pwm.ToString());
     ConnectorOne.RoverMovementStatusUpdater(roverMovement, pwm);
 }