/// <summary>
        /// Updates the status of the robot's parts with the new Xbox controller commands received.
        /// </summary>
        /// <param name="xboxController">State of the Xbox controller.</param>
        public void Update(GamepadState xboxController)
        {
            LeftDriveThrottle = Math.Max(-1.0f, Math.Min(1.0f, (xboxController.LeftStick.Clicked ? 1.0f : 0.5f) *
                       (0.5f * xboxController.LeftStick.Position.X + xboxController.LeftStick.Position.Y) +
               0.1f * (0.5f * xboxController.RightStick.Position.X + xboxController.RightStick.Position.Y)));

            RightDriveThrottle = Math.Max(-1.0f, Math.Min(1.0f, (xboxController.LeftStick.Clicked ? 1.0f : 0.5f) *
                        (-0.5f * xboxController.LeftStick.Position.X + xboxController.LeftStick.Position.Y) +
                0.1f * (-0.5f * xboxController.RightStick.Position.X + xboxController.RightStick.Position.Y)));

            armAngle = xboxController.LeftTrigger * 180.0f;
            irisAngle = xboxController.RightTrigger * 180.0f;

            isLedOn = (xboxController.A ^ isLedOn);
            Led_State = Convert.ToByte(isLedOn);
        }
        /// <summary>
        /// Initializes the BaseStation GUI.
        /// Attempts to connect to the Python server.  If successful, the GUI opens up for use.
        /// </summary>
        public BaseStationGUI()
        {
            InitializeComponent();
              //      IPModeWindow ipMode = new IPModeWindow();
            robotConnection = new UdpClient(4444);

            /*        if (ipMode.ShowDialog() != DialogResult.OK) System.Environment.Exit(0);
            else
            {
                if (ipMode.check == 1)
                {
                    getIP = new GetRobotIP(robotConnection);
                    robotIP = getIP.GetIP();
                    robotConnection.Connect(IPAddress.Parse(robotIP), 4444);
                }
                else
                {
                    robotIP = ipMode.IP;
                    robotConnection.Connect(IPAddress.Parse(robotIP), 4444);
                }
            }

            string baseip = "";
            host = Dns.GetHostEntry(Dns.GetHostName());
            foreach (IPAddress ip in host.AddressList)
            {
                if (ip.AddressFamily.ToString() == "InterNetwork")
                {
                    baseip = ip.ToString();
                }
            }

            byte[] buff = Encoding.ASCII.GetBytes(baseip);
            robotConnection.Send(buff, buff.Length);
            sensorData = new SensorData(robotIP);
            sensorData.SensorUpdate += SensorData_SensorDataUpdate; */
            commands = new KeyCommand();
            xboxController = new GamepadState(SlimDX.XInput.UserIndex.One);
            xboxController.ControllerUpdate += xboxController_ControllerUpdate;
            xcontroller = new MotorControl();
            kcontroller = new MotorControl();
              /*  ffplay = new Process();
            ffplay.StartInfo.Arguments = "http://192.168.2.29:8090/live.mpg";
            ffplay.StartInfo.FileName = "ffplay.exe";
            ffplay.Start(); */
            this.Activate();
        }