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); }
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); }
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); }
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); }
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); }
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.) }
internal CommandScheduler() { UsageReporting.Report(ResourceType.Command, Instances.Command2_Scheduler); SendableRegistry.Instance.AddLW(this, "Scheduler"); LiveWindow.EnabledListener = () => { Disable(); CancelAll(); }; LiveWindow.DisabledListener = () => { Enable(); }; }
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); }
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; }
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>(); } }
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(); } }
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"); } } }
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); }
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); }
static SmartDashboard() { UsageReporting.Report(ResourceType.SmartDashboard, 0); }