Merge branch 'main' into 2027

This commit is contained in:
Peter Johnson
2025-11-01 09:39:08 -07:00
61 changed files with 455 additions and 941 deletions

View File

@@ -1,19 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// THIS FILE WAS AUTO-GENERATED BY ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#include "frc/motorcontrol/DMC60.h"
#include <hal/UsageReporting.h>
using namespace frc;
DMC60::DMC60(int channel) : PWMMotorController("DMC60", channel) {
SetBounds(2.004_ms, 1.52_ms, 1.5_ms, 1.48_ms, 0.997_ms);
m_pwm.SetOutputPeriod(PWM::kOutputPeriod_5Ms);
SetSpeed(0.0);
HAL_ReportUsage("IO", GetChannel(), "DigilentDMC60");
}

View File

@@ -1,19 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// THIS FILE WAS AUTO-GENERATED BY ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#include "frc/motorcontrol/Jaguar.h"
#include <hal/UsageReporting.h>
using namespace frc;
Jaguar::Jaguar(int channel) : PWMMotorController("Jaguar", channel) {
SetBounds(2.31_ms, 1.55_ms, 1.507_ms, 1.454_ms, 0.697_ms);
m_pwm.SetOutputPeriod(PWM::kOutputPeriod_5Ms);
SetSpeed(0.0);
HAL_ReportUsage("IO", GetChannel(), "Jaguar");
}

View File

@@ -1,19 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// THIS FILE WAS AUTO-GENERATED BY ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#include "frc/motorcontrol/SD540.h"
#include <hal/UsageReporting.h>
using namespace frc;
SD540::SD540(int channel) : PWMMotorController("SD540", channel) {
SetBounds(2.05_ms, 1.55_ms, 1.5_ms, 1.44_ms, 0.94_ms);
m_pwm.SetOutputPeriod(PWM::kOutputPeriod_5Ms);
SetSpeed(0.0);
HAL_ReportUsage("IO", GetChannel(), "MindsensorsSD540");
}

View File

@@ -1,19 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// THIS FILE WAS AUTO-GENERATED BY ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#include "frc/motorcontrol/Victor.h"
#include <hal/UsageReporting.h>
using namespace frc;
Victor::Victor(int channel) : PWMMotorController("Victor", channel) {
SetBounds(2.027_ms, 1.525_ms, 1.507_ms, 1.49_ms, 1.026_ms);
m_pwm.SetOutputPeriod(PWM::kOutputPeriod_10Ms);
SetSpeed(0.0);
HAL_ReportUsage("IO", GetChannel(), "Victor");
}

View File

@@ -1,43 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// THIS FILE WAS AUTO-GENERATED BY ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Digilent DMC 60 Motor Controller with PWM control.
*
* Note that the DMC 60 uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the DMC 60 User
* Manual available from Digilent.
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.480ms = the "low end" of the deadband range
* \li 0.997ms = full "reverse"
*/
class DMC60 : public PWMMotorController {
public:
/**
* Constructor for a DMC 60 connected via PWM.
*
* @param channel The PWM channel that the DMC 60 is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit DMC60(int channel);
DMC60(DMC60&&) = default;
DMC60& operator=(DMC60&&) = default;
};
} // namespace frc

View File

@@ -1,43 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// THIS FILE WAS AUTO-GENERATED BY ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Luminary Micro / Vex Robotics Jaguar Motor Controller with PWM control.
*
* Note that the Jaguar uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the Jaguar User
* Manual available from Luminary Micro / Vex Robotics.
*
* \li 2.310ms = full "forward"
* \li 1.550ms = the "high end" of the deadband range
* \li 1.507ms = center of the deadband range (off)
* \li 1.454ms = the "low end" of the deadband range
* \li 0.697ms = full "reverse"
*/
class Jaguar : public PWMMotorController {
public:
/**
* Constructor for a Jaguar connected via PWM.
*
* @param channel The PWM channel that the Jaguar is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit Jaguar(int channel);
Jaguar(Jaguar&&) = default;
Jaguar& operator=(Jaguar&&) = default;
};
} // namespace frc

View File

@@ -1,43 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// THIS FILE WAS AUTO-GENERATED BY ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Mindsensors SD540 Motor Controller with PWM control.
*
* Note that the SD540 uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the SD540 User
* Manual available from Mindsensors.
*
* \li 2.050ms = full "forward"
* \li 1.550ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.440ms = the "low end" of the deadband range
* \li 0.940ms = full "reverse"
*/
class SD540 : public PWMMotorController {
public:
/**
* Constructor for a SD540 connected via PWM.
*
* @param channel The PWM channel that the SD540 is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit SD540(int channel);
SD540(SD540&&) = default;
SD540& operator=(SD540&&) = default;
};
} // namespace frc

View File

@@ -1,43 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// THIS FILE WAS AUTO-GENERATED BY ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Vex Robotics Victor 888 Motor Controller with PWM control.
*
* Note that the Victor 888 uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the Victor 888 User
* Manual available from Vex Robotics.
*
* \li 2.027ms = full "forward"
* \li 1.525ms = the "high end" of the deadband range
* \li 1.507ms = center of the deadband range (off)
* \li 1.490ms = the "low end" of the deadband range
* \li 1.026ms = full "reverse"
*/
class Victor : public PWMMotorController {
public:
/**
* Constructor for a Victor 888 connected via PWM.
*
* @param channel The PWM channel that the Victor 888 is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit Victor(int channel);
Victor(Victor&&) = default;
Victor& operator=(Victor&&) = default;
};
} // namespace frc

View File

@@ -181,6 +181,10 @@ void Notifier::StartPeriodic(units::second_t period) {
UpdateAlarm();
}
void Notifier::StartPeriodic(units::hertz_t frequency) {
StartPeriodic(1 / frequency);
}
void Notifier::Stop() {
std::scoped_lock lock(m_processMutex);
m_periodic = false;

View File

@@ -88,6 +88,8 @@ TimedRobot::TimedRobot(units::second_t period) : IterativeRobotBase(period) {
HAL_ReportUsage("Framework", "TimedRobot");
}
TimedRobot::TimedRobot(units::hertz_t frequency) : TimedRobot{1 / frequency} {}
TimedRobot::~TimedRobot() {
if (m_notifier != HAL_kInvalidHandle) {
int32_t status = 0;

View File

@@ -14,6 +14,7 @@
#include <utility>
#include <hal/Types.h>
#include <units/frequency.h>
#include <units/time.h>
#include <wpi/mutex.h>
@@ -107,6 +108,17 @@ class Notifier {
*/
void StartPeriodic(units::second_t period);
/**
* Run the callback periodically with the given frequency.
*
* The user-provided callback should be written so that it completes before
* the next time it's scheduled to run.
*
* @param frequency Frequency after which to call the callback starting one
* period after the call to this method.
*/
void StartPeriodic(units::hertz_t frequency);
/**
* Stop further callback invocations.
*

View File

@@ -11,6 +11,7 @@
#include <hal/Notifier.h>
#include <hal/Types.h>
#include <units/frequency.h>
#include <units/math.h>
#include <units/time.h>
#include <wpi/priority_queue.h>
@@ -47,10 +48,17 @@ class TimedRobot : public IterativeRobotBase {
/**
* Constructor for TimedRobot.
*
* @param period Period.
* @param period The period of the robot loop function.
*/
explicit TimedRobot(units::second_t period = kDefaultPeriod);
/**
* Constructor for TimedRobot.
*
* @param frequency The frequency of the robot loop function.
*/
explicit TimedRobot(units::hertz_t frequency);
TimedRobot(TimedRobot&&) = default;
TimedRobot& operator=(TimedRobot&&) = default;