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(); }
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(); }
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; } }
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; }
public DriverStationStateChangedArgs(DriverStationState st, bool torobot) { state = st; robot = torobot; }