Esempio n. 1
0
        public const int ROBOT_OUT_PORT = 1150;             // Data from robot to driver station
        #endregion

        #region public constructors
        public DriverStationNetworkConnection(string addr, DriverStationState st)
        {
            m_address = addr;
            m_dsstate = st;
            m_dsstate.StateChanged += DriverStationStateChanged;
            m_listener              = new UdpClient(ROBOT_OUT_PORT);
            m_sender = new UdpClient(ROBOT_IN_PORT);
            m_sender.Connect(addr, ROBOT_IN_PORT);
            m_last_comms_lock = new object();
        }
Esempio n. 2
0
        public JoystickManager(DriverStationState st)
        {
            m_state     = st;
            m_di        = new DirectInput();
            m_joysticks = new Dictionary <int, Joystick>();

            SearchForJoysticks();

            m_monitor = true;
            m_thread  = new Thread(new ThreadStart(MonitorJoysticks));
            m_thread.Start();
        }
Esempio n. 3
0
        private void StateChanged(DriverStationState st)
        {
            m_comms.Red = !st.Communications;
            m_robot.Red = !st.HasRobotCode;

            if (st.Communications && st.HasRobotCode)
            {
                m_mode.Enabled    = true;
                m_control.Enabled = true;
            }
            else
            {
                m_mode.Enabled    = false;
                m_control.Enabled = false;
            }
        }
Esempio n. 4
0
        public Form1()
        {
            m_state        = new DriverStationState();
            m_joystick_mgr = new JoystickManager(m_state);
            InitializeComponent();
            m_disabled.Checked = true;
            m_auto.Checked     = true;

            m_state.StateChanged += StateChanged;
            m_state.Connected    += RobotConnected;

            if (m_joystick_mgr.Count > 0)
            {
                m_joysticks.Red = false;
            }

            m_mode.Enabled    = false;
            m_control.Enabled = false;

            m_automode.ValueChanged += AutoModeValueChanged;
            m_servo.ValueChanged    += AutoModeValueChanged;
        }
Esempio n. 5
0
 public DriverStationStateChangedArgs(DriverStationState st, bool torobot)
 {
     state = st;
     robot = torobot;
 }