Ejemplo n.º 1
0
 /**
  * Copy status data from the DS task for the user. This is used primarily to set digital outputs
  * on the DS.
  */
 protected void setData() {
   synchronized (m_semaphore) {
     FRCControl.setStatusData(
         getBatteryVoltage(),
         m_digitalOut,
         m_updateNumber,
         m_dashboardInUseHigh.getBytes(),
         m_dashboardInUseHigh.getBytesLength(),
         m_dashboardInUseLow.getBytes(),
         m_dashboardInUseLow.getBytesLength(),
         Semaphore.WAIT_FOREVER);
     m_dashboardInUseHigh.flush();
     m_dashboardInUseLow.flush();
   }
 }
Ejemplo n.º 2
0
  /**
   * DriverStation constructor.
   *
   * <p>The single DriverStation instance is created statically with the instance static member
   * variable.
   */
  protected DriverStation() {
    m_controlData = new FRCCommonControlData();
    m_semaphore = new Object();
    m_dataSem = new Object();

    m_dashboardInUseHigh = m_dashboardDefaultHigh = new Dashboard(m_semaphore);
    m_dashboardInUseLow = m_dashboardDefaultLow = new Dashboard(m_semaphore);

    // m_controlData is initialized in constructor FRCCommonControlData.

    m_batteryChannel = new AnalogChannel(kBatterySlot, kBatteryChannel);

    Semaphore.Options options = new Semaphore.Options();
    options.setPrioritySorted(true);
    m_packetDataAvailableSem = new Semaphore(options, false);
    FRCControl.setNewDataSem(m_packetDataAvailableSem);

    m_thread = new Thread(new DriverStationTask(this), "FRCDriverStation");
    m_thread.setPriority((Thread.NORM_PRIORITY + Thread.MAX_PRIORITY) / 2);

    m_thread.start();
  }
Ejemplo n.º 3
0
 /**
  * Copy data from the DS task for the user. If no new data exists, it will just be returned,
  * otherwise the data will be copied from the DS polling loop.
  */
 protected synchronized void getData() {
   FRCControl.getCommonControlData(m_controlData, Semaphore.WAIT_FOREVER);
   m_newControlData = true;
 }