Пример #1
0
        public DigitalInput(int channel)
        {
            m_handle = Hal.DIOLowLevel.InitializePort(Hal.HALLowLevel.GetPort(channel), true);

            UsageReporting.Report(ResourceType.DigitalInput, channel + 1);
            SendableRegistry.Instance.AddLW(this, "DigitalInput", channel);
        }
Пример #2
0
 internal ShuffleboardInstance(NetworkTableInstance ntInstance)
 {
     m_rootTable        = ntInstance.GetTable(Shuffleboard.kBaseTableName);
     m_rootMetaTable    = m_rootTable.GetSubTable(".metadata");
     m_selectedTabEntry = m_rootMetaTable.GetEntry("Selected");
     UsageReporting.Report(ResourceType.Shuffleboard, 0);
 }
Пример #3
0
 public AnalogOutput(int channel)
 {
     Channel = channel;
     m_port  = Hal.AnalogOutputLowLevel.InitializePort(Hal.HALLowLevel.GetPort(channel));
     UsageReporting.Report(ResourceType.AnalogOutput, channel + 1);
     SendableRegistry.Instance.AddLW(this, "AnalogOutput", channel);
 }
Пример #4
0
        public AnalogTrigger(AnalogInput analogInput)
        {
            m_analogInput = analogInput ?? throw new ArgumentNullException(nameof(analogInput));
            m_port        = Hal.AnalogTriggerLowLevel.Initialize(analogInput.m_port);

            var index = Index;

            UsageReporting.Report(ResourceType.AnalogTrigger, index + 1);
            SendableRegistry.Instance.AddLW(this, "AnalogTrigger", index);
        }
Пример #5
0
        public AnalogTrigger(DutyCycle dutyCycle)
        {
            m_dutyCycle = dutyCycle ?? throw new ArgumentNullException(nameof(dutyCycle));

            m_port = Hal.AnalogTriggerLowLevel.InitializeDutyCycle(dutyCycle.m_handle);

            var index = Index;

            UsageReporting.Report(ResourceType.AnalogTrigger, index + 1);
            SendableRegistry.Instance.AddLW(this, "AnalogTrigger", index);
        }
Пример #6
0
        public PWMSparkMax(int channel) : base(channel)
        {
            SetBounds(2.003, 1.55, 1.50, 1.46, 0.999);
            PeriodMultiplier = PeriodMultiplierType.k1X;
            Speed            = 0.0;
            SetZeroLatch();

            UsageReporting.Report(ResourceType.RevSparkMaxPWM, Channel + 1);
            SendableRegistry.Instance.SetName(this, "PWMSparkMax", Channel);

            ElectricPotential.FromVolts(5.0);
            //this.SetVoltage(ElecticPotential.)
        }
Пример #7
0
 internal CommandScheduler()
 {
     UsageReporting.Report(ResourceType.Command, Instances.Command2_Scheduler);
     SendableRegistry.Instance.AddLW(this, "Scheduler");
     LiveWindow.EnabledListener = () =>
     {
         Disable();
         CancelAll();
     };
     LiveWindow.DisabledListener = () =>
     {
         Enable();
     };
 }
Пример #8
0
        public DutyCycle(IDigitalSource digitalSource)
        {
            if (digitalSource == null)
            {
                throw new ArgumentNullException(nameof(digitalSource));
            }

            m_handle = Hal.DutyCycleLowLevel.Initialize(digitalSource.PortHandleForRouting, digitalSource.AnalogTriggerTypeForRouting);

            m_source = digitalSource;
            var index = FPGAIndex;

            UsageReporting.Report(ResourceType.DutyCycle, index + 1);
            SendableRegistry.Instance.AddLW(this, "Duty Cycle", index);
        }
Пример #9
0
        public PWM(int channel)
        {
            m_channel = channel;
            m_handle  = Hal.PWMLowLevel.InitializePort(Hal.HALLowLevel.GetPort(channel));

            SetDisabled();

            Hal.PWMLowLevel.SetEliminateDeadband(m_handle, false);

            UsageReporting.Report(ResourceType.PWM, channel + 1);

            SendableRegistry.Instance.AddLW(this, "PWM", channel);

            SafetyEnabled = false;
        }
Пример #10
0
        public static void StartRobot <TRobot>() where TRobot : RobotBase, new()
        {
            int halInit = RunHALInitialization();

            if (halInit != 0)
            {
                throw new InvalidOperationException("Base Robot Functionality Failed to Initialize. Terminating");
            }

            UsageReporting.Report(ResourceType.Language, Instances.Language_DotNet, 0, WPILibVersion);

            if (MainLowLevel.HasMain())
            {
                Thread thread = new Thread(() =>
                {
                    RunRobot <TRobot>();
                    MainLowLevel.ExitMain();
                })
                {
                    Name         = "Robot Main",
                    IsBackground = true
                };
                thread.Start();
                MainLowLevel.RunMain();
                SuppressExitWarning(true);
                RobotBase?robot;
                lock (m_runMutex)
                {
                    robot = m_robotCopy;
                }

                robot?.EndCompetition();
                if (thread.Join(TimeSpan.FromSeconds(1)))
                {
                    robot?.Dispose();
                }
            }
            else
            {
                RunRobot <TRobot>();
            }
        }
Пример #11
0
        public AnalogGyro(AnalogInput input, int center = 0, double offset = 0)
        {
            m_analogInput = input ?? throw new ArgumentNullException(nameof(input));

            m_gyroHandle = Hal.AnalogGyroLowLevel.Initialize(input.m_port);

            Hal.AnalogGyroLowLevel.Setup(m_gyroHandle);

            UsageReporting.Report(ResourceType.Gyro, m_analogInput.Channel + 1);
            SendableRegistry.Instance.AddLW(this, "AnalogGyro", m_analogInput.Channel);

            if (center != 0 || offset != 0)
            {
                Hal.AnalogGyroLowLevel.SetParameters(m_gyroHandle, DefaultVoltsPerDegreePerSecond, offset, center);
                Reset();
            }
            else
            {
                Calibrate();
            }
        }
Пример #12
0
 public DigitalGlitchFilter()
 {
     lock (m_mutex)
     {
         int index = 0;
         while (m_filterAllocated[index] && index < m_filterAllocated.Length)
         {
             index++;
         }
         if (index != m_filterAllocated.Length)
         {
             m_channelIndex           = index;
             m_filterAllocated[index] = true;
             UsageReporting.Report(ResourceType.DigitalGlitchFilter, m_channelIndex + 1);
             SendableRegistry.Instance.AddLW(this, "DigitalGlitchFilter", index);
         }
         else
         {
             throw new InvalidOperationException("Out of filters");
         }
     }
 }
Пример #13
0
 public AddressableLED(int port)
 {
     m_pwmHandle = Hal.PWMLowLevel.InitializePort(Hal.HALLowLevel.GetPort(port));
     m_handle    = Hal.AddressableLEDLowLevel.Initialize(m_pwmHandle);
     UsageReporting.Report(ResourceType.AddressableLEDs, port + 1);
 }
Пример #14
0
 public AnalogAccelerometer(AnalogInput analogInput)
 {
     m_analogInput = analogInput ?? throw new ArgumentNullException(nameof(analogInput));
     UsageReporting.Report(ResourceType.Accelerometer, analogInput.Channel + 1);
     SendableRegistry.Instance.AddLW(this, "Accelerometer", analogInput.Channel);
 }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string alias = null;

                if (Request.QueryString["Alias"] != null)
                {
                    alias = Request.QueryString["Alias"];
                }
                else
                {
                    alias = Context.User.Identity.Name;
                    alias = alias.Substring(alias.IndexOf('\\') + 1);
                }

                UserAliasLabel.Text = alias;

                UserTodayLabel.Text = UsageReporting.GetUserUsage(alias, UsagePeriod.Today).TotalHours + " hours";
                UserWeekLabel.Text  = UsageReporting.GetUserUsage(alias, UsagePeriod.Week).TotalHours + " hours";
                UserTotalLabel.Text = UsageReporting.GetUserUsage(alias, UsagePeriod.Total).TotalHours + " hours";

                int inCount = 0, outCount = 0, percentage = 0;

                TeamUsageSummary teamSummary = UsageReporting.GetTeamUsageForUser(alias, UsagePeriod.Today);

                if (teamSummary != null)
                {
                    //this.PumAliasLabel.Text = teamSummary.PumAlias;

                    //this.TeamTodayAverageLabel.Text = teamSummary.AverageHours.ToString("#.0");
                    //this.TeamTodayHoursLabel.Text = teamSummary.TotalHours.ToString();
                    //this.TeamTodayParticipationLabel.Text = teamSummary.ParticipationRate.ToString() + "% (" + teamSummary.InCount.ToString() + " / " + teamSummary.TeamCount.ToString() + ")";

                    //teamSummary = UsageReporting.GetTeamUsageForUser(alias, UsagePeriod.Week);
                    //this.TeamWeekAverageLabel.Text = teamSummary.AverageHours.ToString("#.0");
                    //this.TeamWeekHoursLabel.Text = teamSummary.TotalHours.ToString();
                    //this.TeamWeekParticipationLabel.Text = teamSummary.ParticipationRate.ToString() + "% (" + teamSummary.InCount.ToString() + " / " + teamSummary.TeamCount.ToString() + ")";

                    //teamSummary = UsageReporting.GetTeamUsageForUser(alias, UsagePeriod.Total);
                    //this.TeamTotalAverageLabel.Text = teamSummary.AverageHours.ToString("#.0");
                    //this.TeamTotalHoursLabel.Text = teamSummary.TotalHours.ToString();
                    //this.TeamTotalParticipationLabel.Text = teamSummary.ParticipationRate.ToString() + "% (" + teamSummary.InCount.ToString() + " / " + teamSummary.TeamCount.ToString() + ")";
                }

                individualDataGrid.DataSource =
                    UsageReporting.GetUserSummaries(
                        (UsagePeriod)Enum.Parse(typeof(UsagePeriod), IndividualPeriodDropDown.SelectedItem.Text));

                DataBind();

                if (IsPostBack == false)
                {
                    ViewState["SortExpression"] = "ParticipationRate";
                    ViewState["SortAscending"]  = false;
                }

                SortTeams();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
Пример #16
0
 static SmartDashboard()
 {
     UsageReporting.Report(ResourceType.SmartDashboard, 0);
 }