[wpilib] Pregenerate PWM motor controllers (#6742)

Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
This commit is contained in:
PJ Reiniger
2024-06-18 10:43:08 -04:00
committed by GitHub
parent 66c0abb732
commit b6bd798f9e
49 changed files with 790 additions and 271 deletions

View File

@@ -34,6 +34,8 @@ jobs:
run: ./wpimath/generate_numbers.py && ./wpimath/generate_quickbuf.py --quickbuf_plugin=protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
- name: Run HIDs
run: ./wpilibj/generate_hids.py && ./wpilibc/generate_hids.py && ./wpilibNewCommands/generate_hids.py
- name: Run PWM Controllers
run: ./wpilibj/generate_pwm_motor_controllers.py && ./wpilibc/generate_pwm_motor_controllers.py
- name: Add untracked files to index so they count as changes
run: git add -A
- name: Check output

View File

@@ -0,0 +1,101 @@
#!/usr/bin/env python3
# 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.
import argparse
import json
import sys
import os
from typing import Dict, Any
from pathlib import Path
from jinja2 import Environment, FileSystemLoader
from jinja2.environment import Template
def render_template(
template: Template, output_dir: Path, filename: str, controller: Dict[str, Any]
):
output_dir.mkdir(parents=True, exist_ok=True)
output_file = output_dir / filename
output_file.write_text(template.render(controller), encoding="utf-8")
def generate_cpp_headers(
output_root: Path, template_root: Path, pwm_motor_controllers: Dict[str, Any]
):
header_template_root = template_root / "main/native/include/frc/motorcontroller"
env = Environment(
loader=FileSystemLoader(header_template_root),
autoescape=False,
keep_trailing_newline=True,
)
root_path = output_root / "main/native/include/frc/motorcontrol"
template = env.get_template("pwm_motor_controller.h.jinja")
for controller in pwm_motor_controllers:
controller_name = os.path.basename(f"{controller['name']}.h")
render_template(template, root_path, controller_name, controller)
def generate_cpp_sources(output_root, template_root, pwm_motor_controllers):
cpp_template_root = str(template_root / "main/native/cpp/motorcontroller")
env = Environment(
loader=FileSystemLoader(cpp_template_root),
autoescape=False,
keep_trailing_newline=True,
)
root_path = output_root / "main/native/cpp/motorcontrol"
template = env.get_template("pwm_motor_controller.cpp.jinja")
for controller in pwm_motor_controllers:
controller_name = os.path.basename(f"{controller['name']}.cpp")
render_template(template, root_path, controller_name, controller)
def generate_pwm_motor_controllers(
output_root: Path, template_root: Path, schema_root: Path
):
with (schema_root / "pwm_motor_controllers.json").open(encoding="utf-8") as f:
controllers = json.load(f)
generate_cpp_headers(output_root, template_root, controllers)
generate_cpp_sources(output_root, template_root, controllers)
def main(argv):
script_path = Path(__file__).resolve()
dirname = script_path.parent
parser = argparse.ArgumentParser()
parser.add_argument(
"--output_directory",
help="Optional. If set, will output the generated files to this directory, otherwise it will use a path relative to the script",
default=dirname / "src/generated",
type=Path,
)
parser.add_argument(
"--schema_root",
help="Optional. If set, will use this directory as the root for discovering the pwm controller schema",
default=dirname / "../wpilibj/src/generate",
type=Path,
)
parser.add_argument(
"--template_root",
help="Optional. If set, will use this directory as the root for the jinja templates",
default=dirname / "src/generate",
type=Path,
)
args = parser.parse_args(argv)
generate_pwm_motor_controllers(
args.output_directory, args.template_root, args.schema_root
)
if __name__ == "__main__":
main(sys.argv[1:])

View File

@@ -0,0 +1,20 @@
// 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/{{ name }}.h"
#include <hal/FRCUsageReporting.h>
using namespace frc;
{{ name }}::{{ name }}(int channel) : PWMMotorController("{{ name }}", channel) {
m_pwm.SetBounds({{ pulse_width_ms.max }}_ms, {{ pulse_width_ms.deadbandMax }}_ms, {{ pulse_width_ms.center }}_ms, {{ pulse_width_ms.deadbandMin }}_ms, {{ pulse_width_ms.min }}_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_{{ PeriodMultiplier | default("1", true)}}X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_{{ ResourceName }}, GetChannel() + 1);
}

View File

@@ -0,0 +1,43 @@
// 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 {
/**
* {{ Manufacturer }} {{ DisplayName }} Motor Controller with PWM control.
*
* Note that the {{ DisplayName }} 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 {{ DisplayName }} User
* Manual available from {{ Manufacturer }}.
*
* \li {{ "{:.3f}".format(pulse_width_ms.max) }}ms = full "forward"
* \li {{ "{:.3f}".format(pulse_width_ms.deadbandMax) }}ms = the "high end" of the deadband range
* \li {{ "{:.3f}".format(pulse_width_ms.center) }}ms = center of the deadband range (off)
* \li {{ "{:.3f}".format(pulse_width_ms.deadbandMin) }}ms = the "low end" of the deadband range
* \li {{ "{:.3f}".format(pulse_width_ms.min) }}ms = full "reverse"
*/
class {{ name }} : public PWMMotorController {
public:
/**
* Constructor for a {{ DisplayName }} connected via PWM.
*
* @param channel The PWM channel that the {{ DisplayName }} is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit {{ name }}(int channel);
{{ name }}({{ name }}&&) = default;
{{ name }}& operator=({{ name }}&&) = default;
};
} // namespace frc

View File

@@ -2,6 +2,8 @@
// 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/FRCUsageReporting.h>
@@ -9,7 +11,7 @@
using namespace frc;
DMC60::DMC60(int channel) : PWMMotorController("DMC60", channel) {
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.5_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -2,6 +2,8 @@
// 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/FRCUsageReporting.h>

View File

@@ -2,19 +2,19 @@
// 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/PWMSparkFlex.h"
#include <hal/FRCUsageReporting.h>
using namespace frc;
PWMSparkFlex::PWMSparkFlex(int channel)
: PWMMotorController("PWMSparkFlex", channel) {
m_pwm.SetBounds(2.003_ms, 1.55_ms, 1.50_ms, 1.46_ms, 0.999_ms);
PWMSparkFlex::PWMSparkFlex(int channel) : PWMMotorController("PWMSparkFlex", channel) {
m_pwm.SetBounds(2.003_ms, 1.55_ms, 1.5_ms, 1.46_ms, 0.999_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_RevSparkFlexPWM,
GetChannel() + 1);
HAL_Report(HALUsageReporting::kResourceType_RevSparkFlexPWM, GetChannel() + 1);
}

View File

@@ -2,15 +2,16 @@
// 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/PWMSparkMax.h"
#include <hal/FRCUsageReporting.h>
using namespace frc;
PWMSparkMax::PWMSparkMax(int channel)
: PWMMotorController("PWMSparkMax", channel) {
m_pwm.SetBounds(2.003_ms, 1.55_ms, 1.50_ms, 1.46_ms, 0.999_ms);
PWMSparkMax::PWMSparkMax(int channel) : PWMMotorController("PWMSparkMax", channel) {
m_pwm.SetBounds(2.003_ms, 1.55_ms, 1.5_ms, 1.46_ms, 0.999_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -2,15 +2,16 @@
// 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/PWMTalonFX.h"
#include <hal/FRCUsageReporting.h>
using namespace frc;
PWMTalonFX::PWMTalonFX(int channel)
: PWMMotorController("PWMTalonFX", channel) {
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
PWMTalonFX::PWMTalonFX(int channel) : PWMMotorController("PWMTalonFX", channel) {
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.5_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -2,15 +2,16 @@
// 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/PWMTalonSRX.h"
#include <hal/FRCUsageReporting.h>
using namespace frc;
PWMTalonSRX::PWMTalonSRX(int channel)
: PWMMotorController("PWMTalonSRX", channel) {
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
PWMTalonSRX::PWMTalonSRX(int channel) : PWMMotorController("PWMTalonSRX", channel) {
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.5_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -2,6 +2,8 @@
// 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/PWMVenom.h"
#include <hal/FRCUsageReporting.h>
@@ -9,7 +11,7 @@
using namespace frc;
PWMVenom::PWMVenom(int channel) : PWMMotorController("PWMVenom", channel) {
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.5_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -2,15 +2,16 @@
// 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/PWMVictorSPX.h"
#include <hal/FRCUsageReporting.h>
using namespace frc;
PWMVictorSPX::PWMVictorSPX(int channel)
: PWMMotorController("PWMVictorSPX", channel) {
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
PWMVictorSPX::PWMVictorSPX(int channel) : PWMMotorController("PWMVictorSPX", channel) {
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.5_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -2,6 +2,8 @@
// 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/FRCUsageReporting.h>
@@ -9,11 +11,10 @@
using namespace frc;
SD540::SD540(int channel) : PWMMotorController("SD540", channel) {
m_pwm.SetBounds(2.05_ms, 1.55_ms, 1.50_ms, 1.44_ms, 0.94_ms);
m_pwm.SetBounds(2.05_ms, 1.55_ms, 1.5_ms, 1.44_ms, 0.94_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_MindsensorsSD540,
GetChannel() + 1);
HAL_Report(HALUsageReporting::kResourceType_MindsensorsSD540, GetChannel() + 1);
}

View File

@@ -2,6 +2,8 @@
// 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/Spark.h"
#include <hal/FRCUsageReporting.h>
@@ -9,7 +11,7 @@
using namespace frc;
Spark::Spark(int channel) : PWMMotorController("Spark", channel) {
m_pwm.SetBounds(2.003_ms, 1.55_ms, 1.50_ms, 1.46_ms, 0.999_ms);
m_pwm.SetBounds(2.003_ms, 1.55_ms, 1.5_ms, 1.46_ms, 0.999_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -2,6 +2,8 @@
// 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/Talon.h"
#include <hal/FRCUsageReporting.h>

View File

@@ -2,6 +2,8 @@
// 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/FRCUsageReporting.h>

View File

@@ -2,6 +2,8 @@
// 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/VictorSP.h"
#include <hal/FRCUsageReporting.h>
@@ -9,7 +11,7 @@
using namespace frc;
VictorSP::VictorSP(int channel) : PWMMotorController("VictorSP", channel) {
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.50_ms, 1.48_ms, 0.997_ms);
m_pwm.SetBounds(2.004_ms, 1.52_ms, 1.5_ms, 1.48_ms, 0.997_ms);
m_pwm.SetPeriodMultiplier(PWM::kPeriodMultiplier_1X);
m_pwm.SetSpeed(0.0);
m_pwm.SetZeroLatch();

View File

@@ -2,6 +2,8 @@
// 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"
@@ -9,7 +11,7 @@
namespace frc {
/**
* Digilent DMC 60 Motor %Controller.
* 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
@@ -27,7 +29,7 @@ namespace frc {
class DMC60 : public PWMMotorController {
public:
/**
* Constructor for a Digilent DMC 60.
* 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

View File

@@ -2,6 +2,8 @@
// 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"
@@ -9,14 +11,14 @@
namespace frc {
/**
* Luminary Micro / Vex Robotics Jaguar Motor %Controller with PWM control.
* 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
* Vex.
* 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

View File

@@ -2,6 +2,8 @@
// 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"
@@ -9,7 +11,7 @@
namespace frc {
/**
* REV Robotics SPARK Flex Motor %Controller.
* REV Robotics SPARK Flex Motor Controller with PWM control.
*
* Note that the SPARK Flex uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
@@ -27,7 +29,7 @@ namespace frc {
class PWMSparkFlex : public PWMMotorController {
public:
/**
* Constructor for a SPARK Flex.
* Constructor for a SPARK Flex connected via PWM.
*
* @param channel The PWM channel that the SPARK Flex is attached to. 0-9 are
* on-board, 10-19 are on the MXP port

View File

@@ -2,6 +2,8 @@
// 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"
@@ -9,7 +11,7 @@
namespace frc {
/**
* REV Robotics SPARK MAX Motor %Controller.
* REV Robotics SPARK MAX Motor Controller with PWM control.
*
* Note that the SPARK MAX uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
@@ -27,7 +29,7 @@ namespace frc {
class PWMSparkMax : public PWMMotorController {
public:
/**
* Constructor for a SPARK MAX.
* Constructor for a SPARK MAX connected via PWM.
*
* @param channel The PWM channel that the SPARK MAX is attached to. 0-9 are
* on-board, 10-19 are on the MXP port

View File

@@ -2,6 +2,8 @@
// 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"
@@ -9,15 +11,14 @@
namespace frc {
/**
* Cross the Road Electronics (CTRE) %Talon FX Motor %Controller with PWM
* control.
* Cross the Road Electronics (CTRE) Talon FX Motor Controller with PWM control.
*
* Note that the %Talon FX uses the following bounds for PWM values. These
* Note that the Talon FX 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 %Talon FX User
* Manual available from Cross The Road Electronics.
* recommended. The calibration procedure can be found in the Talon FX User
* Manual available from Cross the Road Electronics (CTRE).
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
@@ -28,9 +29,9 @@ namespace frc {
class PWMTalonFX : public PWMMotorController {
public:
/**
* Construct a %Talon FX connected via PWM.
* Constructor for a Talon FX connected via PWM.
*
* @param channel The PWM channel that the %Talon FX is attached to. 0-9 are
* @param channel The PWM channel that the Talon FX is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit PWMTalonFX(int channel);

View File

@@ -2,6 +2,8 @@
// 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"
@@ -9,15 +11,14 @@
namespace frc {
/**
* Cross the Road Electronics (CTRE) %Talon SRX Motor %Controller with PWM
* control.
* Cross the Road Electronics (CTRE) Talon SRX Motor Controller with PWM control.
*
* Note that the %Talon SRX uses the following bounds for PWM values. These
* Note that the Talon SRX 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 %Talon SRX User
* Manual available from Cross The Road Electronics.
* recommended. The calibration procedure can be found in the Talon SRX User
* Manual available from Cross the Road Electronics (CTRE).
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
@@ -28,9 +29,9 @@ namespace frc {
class PWMTalonSRX : public PWMMotorController {
public:
/**
* Construct a %Talon SRX connected via PWM.
* Constructor for a Talon SRX connected via PWM.
*
* @param channel The PWM channel that the %Talon SRX is attached to. 0-9 are
* @param channel The PWM channel that the Talon SRX is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit PWMTalonSRX(int channel);

View File

@@ -2,6 +2,8 @@
// 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"
@@ -9,13 +11,14 @@
namespace frc {
/**
* Playing with Fusion Venom Smart Motor with PWM control.
* Playing with Fusion Venom Motor Controller with PWM control.
*
* Note that the Venom 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.
* recommended. The calibration procedure can be found in the Venom User
* Manual available from Playing with Fusion.
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
@@ -26,7 +29,7 @@ namespace frc {
class PWMVenom : public PWMMotorController {
public:
/**
* Construct a Venom connected via PWM.
* Constructor for a Venom connected via PWM.
*
* @param channel The PWM channel that the Venom is attached to. 0-9 are
* on-board, 10-19 are on the MXP port

View File

@@ -2,6 +2,8 @@
// 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"
@@ -9,15 +11,14 @@
namespace frc {
/**
* Cross the Road Electronics (CTRE) %Victor SPX Motor %Controller with PWM
* control.
* Cross the Road Electronics (CTRE) Victor SPX Motor Controller with PWM control.
*
* Note that the %Victor SPX uses the following bounds for PWM values. These
* Note that the Victor SPX 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 SPX User
* Manual available from Cross The Road Electronics.
* recommended. The calibration procedure can be found in the Victor SPX User
* Manual available from Cross the Road Electronics (CTRE).
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
@@ -28,10 +29,10 @@ namespace frc {
class PWMVictorSPX : public PWMMotorController {
public:
/**
* Construct a %Victor SPX connected via PWM.
* Constructor for a Victor SPX connected via PWM.
*
* @param channel The PWM channel that the %Victor SPX is attached to. 0-9
* are on-board, 10-19 are on the MXP port
* @param channel The PWM channel that the Victor SPX is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit PWMVictorSPX(int channel);

View File

@@ -0,0 +1,43 @@
// 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

@@ -2,6 +2,8 @@
// 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"
@@ -9,14 +11,14 @@
namespace frc {
/**
* REV Robotics SPARK Motor %Controller.
* REV Robotics SPARK Motor Controller with PWM control.
*
* Note that the SPARK 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 SPARK User Manual available
* from REV Robotics.
* Note that the SPARK 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 SPARK User
* Manual available from REV Robotics.
*
* \li 2.003ms = full "forward"
* \li 1.550ms = the "high end" of the deadband range
@@ -27,7 +29,7 @@ namespace frc {
class Spark : public PWMMotorController {
public:
/**
* Constructor for a SPARK.
* Constructor for a SPARK connected via PWM.
*
* @param channel The PWM channel that the SPARK is attached to. 0-9 are
* on-board, 10-19 are on the MXP port

View File

@@ -0,0 +1,43 @@
// 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 {
/**
* Cross the Road Electronics (CTRE) Talon Motor Controller with PWM control.
*
* Note that the Talon 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 Talon User
* Manual available from Cross the Road Electronics (CTRE).
*
* \li 2.037ms = full "forward"
* \li 1.539ms = the "high end" of the deadband range
* \li 1.513ms = center of the deadband range (off)
* \li 1.487ms = the "low end" of the deadband range
* \li 0.989ms = full "reverse"
*/
class Talon : public PWMMotorController {
public:
/**
* Constructor for a Talon connected via PWM.
*
* @param channel The PWM channel that the Talon is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit Talon(int channel);
Talon(Talon&&) = default;
Talon& operator=(Talon&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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

@@ -2,6 +2,8 @@
// 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"
@@ -9,14 +11,14 @@
namespace frc {
/**
* Vex Robotics %Victor SP Motor %Controller.
* Vex Robotics Victor SP Motor Controller with PWM control.
*
* Note that the %Victor SP uses the following bounds for PWM values. These
* Note that the Victor SP 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 SP User
* Manual available from Vex.
* recommended. The calibration procedure can be found in the Victor SP User
* Manual available from Vex Robotics.
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
@@ -27,7 +29,7 @@ namespace frc {
class VictorSP : public PWMMotorController {
public:
/**
* Constructor for a %Victor SP.
* Constructor for a Victor SP connected via PWM.
*
* @param channel The PWM channel that the Victor SP is attached to. 0-9 are
* on-board, 10-19 are on the MXP port

View File

@@ -1,41 +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.
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Mindsensors SD540 Motor %Controller.
*
* 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.05ms = full "forward"
* \li 1.55ms = the "high end" of the deadband range
* \li 1.50ms = center of the deadband range (off)
* \li 1.44ms = the "low end" of the deadband range
* \li 0.94ms = full "reverse"
*/
class SD540 : public PWMMotorController {
public:
/**
* Constructor for a SD540.
*
* @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,41 +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.
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Cross the Road Electronics (CTRE) %Talon and %Talon SR Motor %Controller.
*
* Note that the %Talon 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 %Talon User Manual available
* from CTRE.
*
* \li 2.037ms = full "forward"
* \li 1.539ms = the "high end" of the deadband range
* \li 1.513ms = center of the deadband range (off)
* \li 1.487ms = the "low end" of the deadband range
* \li 0.989ms = full "reverse"
*/
class Talon : public PWMMotorController {
public:
/**
* Constructor for a %Talon (original or %Talon SR).
*
* @param channel The PWM channel number that the %Talon is attached to. 0-9
* are on-board, 10-19 are on the MXP port
*/
explicit Talon(int channel);
Talon(Talon&&) = default;
Talon& operator=(Talon&&) = default;
};
} // namespace frc

View File

@@ -1,45 +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.
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Vex Robotics %Victor 888 Motor %Controller.
*
* The Vex Robotics %Victor 884 Motor %Controller can also be used with this
* class but may need to be calibrated per the Victor 884 user manual.
*
* Note that the %Victor uses the following bounds for PWM values. These
* values were determined empirically and optimized for the %Victor 888. These
* values should work reasonably well for %Victor 884 controllers as well 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 884 User
* Manual available from Vex.
*
* \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.
*
* @param channel The PWM channel number that the %Victor 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

@@ -0,0 +1,66 @@
#!/usr/bin/env python3
# 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.
import argparse
import json
import sys
from pathlib import Path
from typing import Dict, Any
from jinja2 import Environment, FileSystemLoader
from jinja2.environment import Template
def render_template(
template: Template, output_dir: Path, filename: str, controller: Dict[str, Any]
):
output_dir.mkdir(parents=True, exist_ok=True)
output_file = output_dir / filename
output_file.write_text(template.render(controller), encoding="utf-8")
def generate_pwm_motor_controllers(output_root, template_root):
with (template_root / "pwm_motor_controllers.json").open(encoding="utf-8") as f:
controllers = json.load(f)
env = Environment(
loader=FileSystemLoader(str(template_root)),
autoescape=False,
keep_trailing_newline=True,
)
root_path = Path(output_root) / "main/java/edu/wpi/first/wpilibj/motorcontrol"
template = env.get_template("pwm_motor_controller.java.jinja")
for controller in controllers:
controller_name = f"{controller['name']}.java"
render_template(template, root_path, controller_name, controller)
def main(argv):
script_path = Path(__file__).resolve()
dirname = script_path.parent
parser = argparse.ArgumentParser()
parser.add_argument(
"--output_directory",
help="Optional. If set, will output the generated files to this directory, otherwise it will use a path relative to the script",
default=dirname / "src/generated",
type=Path,
)
parser.add_argument(
"--template_root",
help="Optional. If set, will use this directory as the root for the jinja templates",
default=dirname / "src/generate",
type=Path,
)
args = parser.parse_args(argv)
generate_pwm_motor_controllers(args.output_directory, args.template_root)
if __name__ == "__main__":
main(sys.argv[1:])

View File

@@ -0,0 +1,48 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* {{ Manufacturer }} {{ DisplayName }} Motor Controller.
*
* <p>Note that the {{ DisplayName }} 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 {{ DisplayName }} User Manual available from
* {{ Manufacturer }}.
*
* <ul>
* <li>{{ "{:.3f}".format(pulse_width_ms.max) }}ms = full "forward"
* <li>{{ "{:.3f}".format(pulse_width_ms.deadbandMax) }}ms = the "high end" of the deadband range
* <li>{{ "{:.3f}".format(pulse_width_ms.center) }}ms = center of the deadband range (off)
* <li>{{ "{:.3f}".format(pulse_width_ms.deadbandMin) }}ms = the "low end" of the deadband range
* <li>{{ "{:.3f}".format(pulse_width_ms.min) }}ms = full "reverse"
* </ul>
*/
public class {{ name }} extends PWMMotorController {
/**
* Constructor.
*
* @param channel The PWM channel that the {{ DisplayName }} is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public {{ name }}(final int channel) {
super("{{ name }}", channel);
m_pwm.setBoundsMicroseconds({{ (pulse_width_ms.max * 1000) | int }}, {{ (pulse_width_ms.deadbandMax * 1000) | int }}, {{ (pulse_width_ms.center * 1000) | int }}, {{ (pulse_width_ms.deadbandMin * 1000) | int }}, {{ (pulse_width_ms.min * 1000) | int }});
m_pwm.setPeriodMultiplier(PWM.PeriodMultiplier.k{{ PeriodMultiplier | default("1", true)}}X);
m_pwm.setSpeed(0.0);
m_pwm.setZeroLatch();
HAL.report(tResourceType.kResourceType_{{ ResourceName }}, getChannel() + 1);
}
}

View File

@@ -0,0 +1,172 @@
[
{
"name": "DMC60",
"Manufacturer": "Digilent",
"DisplayName": "DMC 60",
"ResourceName": "DigilentDMC60",
"pulse_width_ms": {
"max": 2.004,
"deadbandMax": 1.520,
"center": 1.500,
"deadbandMin": 1.480,
"min": 0.997
}
},
{
"name": "Jaguar",
"Manufacturer": "Luminary Micro / Vex Robotics",
"DisplayName": "Jaguar",
"ResourceName": "Jaguar",
"pulse_width_ms": {
"max": 2.310,
"deadbandMax": 1.550,
"center": 1.507,
"deadbandMin": 1.454,
"min": 0.697
}
},
{
"name": "PWMSparkFlex",
"Manufacturer": "REV Robotics",
"DisplayName": "SPARK Flex",
"ResourceName": "RevSparkFlexPWM",
"pulse_width_ms": {
"max": 2.003,
"deadbandMax": 1.550,
"center": 1.500,
"deadbandMin": 1.460,
"min": 0.999
}
},
{
"name": "PWMSparkMax",
"Manufacturer": "REV Robotics",
"DisplayName": "SPARK MAX",
"ResourceName": "RevSparkMaxPWM",
"pulse_width_ms": {
"max": 2.003,
"deadbandMax": 1.550,
"center": 1.500,
"deadbandMin": 1.460,
"min": 0.999
}
},
{
"name": "PWMTalonFX",
"Manufacturer": "Cross the Road Electronics (CTRE)",
"DisplayName": "Talon FX",
"ResourceName": "TalonFX",
"pulse_width_ms": {
"max": 2.004,
"deadbandMax": 1.520,
"center": 1.500,
"deadbandMin": 1.480,
"min": 0.997
}
},
{
"name": "PWMTalonSRX",
"Manufacturer": "Cross the Road Electronics (CTRE)",
"DisplayName": "Talon SRX",
"ResourceName": "PWMTalonSRX",
"pulse_width_ms": {
"max": 2.004,
"deadbandMax": 1.520,
"center": 1.500,
"deadbandMin": 1.480,
"min": 0.997
}
},
{
"name": "PWMVenom",
"Manufacturer": "Playing with Fusion",
"DisplayName": "Venom",
"ResourceName": "FusionVenom",
"pulse_width_ms": {
"max": 2.004,
"deadbandMax": 1.520,
"center": 1.500,
"deadbandMin": 1.480,
"min": 0.997
}
},
{
"name": "PWMVictorSPX",
"Manufacturer": "Cross the Road Electronics (CTRE)",
"DisplayName": "Victor SPX",
"ResourceName": "PWMVictorSPX",
"pulse_width_ms": {
"max": 2.004,
"deadbandMax": 1.520,
"center": 1.500,
"deadbandMin": 1.480,
"min": 0.997
}
},
{
"name": "SD540",
"Manufacturer": "Mindsensors",
"DisplayName": "SD540",
"ResourceName": "MindsensorsSD540",
"pulse_width_ms": {
"max": 2.05,
"deadbandMax": 1.55,
"center": 1.50,
"deadbandMin": 1.44,
"min": 0.94
}
},
{
"name": "Spark",
"Manufacturer": "REV Robotics",
"DisplayName": "SPARK",
"ResourceName": "RevSPARK",
"pulse_width_ms": {
"max": 2.003,
"deadbandMax": 1.550,
"center": 1.500,
"deadbandMin": 1.460,
"min": 0.999
}
},
{
"name": "Talon",
"Manufacturer": "Cross the Road Electronics (CTRE)",
"DisplayName": "Talon",
"ResourceName": "Talon",
"pulse_width_ms": {
"max": 2.037,
"deadbandMax": 1.539,
"center": 1.513,
"deadbandMin": 1.487,
"min": 0.989
}
},
{
"name": "Victor",
"Manufacturer": "Vex Robotics",
"DisplayName": "Victor 888",
"ResourceName": "Victor",
"PeriodMultiplier": 2,
"pulse_width_ms": {
"max": 2.027,
"deadbandMax": 1.525,
"center": 1.507,
"deadbandMin": 1.490,
"min": 1.026
}
},
{
"name": "VictorSP",
"Manufacturer": "Vex Robotics",
"DisplayName": "Victor SP",
"ResourceName": "VictorSP",
"pulse_width_ms": {
"max": 2.004,
"deadbandMax": 1.520,
"center": 1.500,
"deadbandMin": 1.480,
"min": 0.997
}
}
]

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -11,7 +13,7 @@ import edu.wpi.first.wpilibj.PWM;
/**
* Digilent DMC 60 Motor Controller.
*
* <p>Note that the DMC uses the following bounds for PWM values. These values should work
* <p>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
@@ -29,8 +31,8 @@ public class DMC60 extends PWMMotorController {
/**
* Constructor.
*
* @param channel The PWM channel that the DMC60 is attached to. 0-9 are on-board, 10-19 are on
* the MXP port
* @param channel The PWM channel that the DMC 60 is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public DMC60(final int channel) {

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -9,12 +11,13 @@ import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Texas Instruments / Vex Robotics Jaguar Motor Controller as a PWM device.
* Luminary Micro / Vex Robotics Jaguar Motor Controller.
*
* <p>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 Vex.
* recommended. The calibration procedure can be found in the Jaguar User Manual available from
* Luminary Micro / Vex Robotics.
*
* <ul>
* <li>2.310ms = full "forward"
@@ -28,8 +31,8 @@ public class Jaguar extends PWMMotorController {
/**
* Constructor.
*
* @param channel The PWM channel that the Jaguar is attached to. 0-9 are on-board, 10-19 are on
* the MXP port
* @param channel The PWM channel that the Jaguar is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public Jaguar(final int channel) {

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -9,7 +11,7 @@ import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* REV Robotics SPARK Flex Motor Controller with PWM control.
* REV Robotics SPARK Flex Motor Controller.
*
* <p>Note that the SPARK Flex 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
@@ -27,9 +29,10 @@ import edu.wpi.first.wpilibj.PWM;
*/
public class PWMSparkFlex extends PWMMotorController {
/**
* Common initialization code called by all constructors.
* Constructor.
*
* @param channel The PWM channel number. 0-9 are on-board, 10-19 are on the MXP port
* @param channel The PWM channel that the SPARK Flex is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public PWMSparkFlex(final int channel) {

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -9,7 +11,7 @@ import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* REV Robotics SPARK MAX Motor Controller with PWM control.
* REV Robotics SPARK MAX Motor Controller.
*
* <p>Note that the SPARK MAX 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
@@ -27,9 +29,10 @@ import edu.wpi.first.wpilibj.PWM;
*/
public class PWMSparkMax extends PWMMotorController {
/**
* Common initialization code called by all constructors.
* Constructor.
*
* @param channel The PWM channel number. 0-9 are on-board, 10-19 are on the MXP port
* @param channel The PWM channel that the SPARK MAX is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public PWMSparkMax(final int channel) {

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -9,13 +11,13 @@ import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Cross the Road Electronics (CTRE) Talon FX Motor Controller with PWM control.
* Cross the Road Electronics (CTRE) Talon FX Motor Controller.
*
* <p>Note that the TalonFX uses the following bounds for PWM values. These values should work
* <p>Note that the Talon FX 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 TalonFX User Manual available from
* CTRE.
* recommended. The calibration procedure can be found in the Talon FX User Manual available from
* Cross the Road Electronics (CTRE).
*
* <ul>
* <li>2.004ms = full "forward"
@@ -27,10 +29,10 @@ import edu.wpi.first.wpilibj.PWM;
*/
public class PWMTalonFX extends PWMMotorController {
/**
* Constructor for a TalonFX connected via PWM.
* Constructor.
*
* @param channel The PWM channel that the Talon FX is attached to. 0-9 are on-board, 10-19 are on
* the MXP port
* @param channel The PWM channel that the Talon FX is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public PWMTalonFX(final int channel) {

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -9,13 +11,13 @@ import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Cross the Road Electronics (CTRE) Talon SRX Motor Controller with PWM control.
* Cross the Road Electronics (CTRE) Talon SRX Motor Controller.
*
* <p>Note that the TalonSRX uses the following bounds for PWM values. These values should work
* <p>Note that the Talon SRX 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 TalonSRX User Manual available from
* CTRE.
* recommended. The calibration procedure can be found in the Talon SRX User Manual available from
* Cross the Road Electronics (CTRE).
*
* <ul>
* <li>2.004ms = full "forward"
@@ -27,10 +29,10 @@ import edu.wpi.first.wpilibj.PWM;
*/
public class PWMTalonSRX extends PWMMotorController {
/**
* Constructor for a TalonSRX connected via PWM.
* Constructor.
*
* @param channel The PWM channel that the Talon SRX is attached to. 0-9 are on-board, 10-19 are
* on the MXP port
* @param channel The PWM channel that the Talon SRX is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public PWMTalonSRX(final int channel) {

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -9,12 +11,13 @@ import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Playing with Fusion Venom Smart Motor with PWM control.
* Playing with Fusion Venom Motor Controller.
*
* <p>Note that the Venom 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.
* recommended. The calibration procedure can be found in the Venom User Manual available from
* Playing with Fusion.
*
* <ul>
* <li>2.004ms = full "forward"
@@ -26,10 +29,10 @@ import edu.wpi.first.wpilibj.PWM;
*/
public class PWMVenom extends PWMMotorController {
/**
* Constructor for a Venom connected via PWM.
* Constructor.
*
* @param channel The PWM channel that the Venom is attached to. 0-9 are on-board, 10-19 are on
* the MXP port
* @param channel The PWM channel that the Venom is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public PWMVenom(final int channel) {

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -9,13 +11,13 @@ import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Cross the Road Electronics (CTRE) Victor SPX Motor Controller with PWM control.
* Cross the Road Electronics (CTRE) Victor SPX Motor Controller.
*
* <p>Note that the Victor SPX 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 SPX User Manual available from
* CTRE.
* Cross the Road Electronics (CTRE).
*
* <ul>
* <li>2.004ms = full "forward"
@@ -27,9 +29,9 @@ import edu.wpi.first.wpilibj.PWM;
*/
public class PWMVictorSPX extends PWMMotorController {
/**
* Constructor for a Victor SPX connected via PWM.
* Constructor.
*
* @param channel The PWM channel that the PWMVictorSPX is attached to. 0-9 are on-board, 10-19
* @param channel The PWM channel that the Victor SPX is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -18,19 +20,19 @@ import edu.wpi.first.wpilibj.PWM;
* Mindsensors.
*
* <ul>
* <li>2.05ms = full "forward"
* <li>1.55ms = the "high end" of the deadband range
* <li>1.50ms = center of the deadband range (off)
* <li>1.44ms = the "low end" of the deadband range
* <li>0.94ms = full "reverse"
* <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"
* </ul>
*/
public class SD540 extends PWMMotorController {
/**
* Constructor.
*
* @param channel The PWM channel that the SD540 is attached to. 0-9 are on-board, 10-19 are on
* the MXP port
* @param channel The PWM channel that the SD540 is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public SD540(final int channel) {

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -14,8 +16,8 @@ import edu.wpi.first.wpilibj.PWM;
* <p>Note that the SPARK 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 Spark User Manual available from REV
* Robotics.
* recommended. The calibration procedure can be found in the SPARK User Manual available from
* REV Robotics.
*
* <ul>
* <li>2.003ms = full "forward"
@@ -29,8 +31,8 @@ public class Spark extends PWMMotorController {
/**
* Constructor.
*
* @param channel The PWM channel that the SPARK is attached to. 0-9 are on-board, 10-19 are on
* the MXP port
* @param channel The PWM channel that the SPARK is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public Spark(final int channel) {

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -9,12 +11,13 @@ import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Cross the Road Electronics (CTRE) Talon and Talon SR Motor Controller.
* Cross the Road Electronics (CTRE) Talon Motor Controller.
*
* <p>Note that the Talon 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 Talon User Manual available from CTRE.
* recommended. The calibration procedure can be found in the Talon User Manual available from
* Cross the Road Electronics (CTRE).
*
* <ul>
* <li>2.037ms = full "forward"
@@ -26,10 +29,10 @@ import edu.wpi.first.wpilibj.PWM;
*/
public class Talon extends PWMMotorController {
/**
* Constructor for a Talon (original or Talon SR).
* Constructor.
*
* @param channel The PWM channel that the Talon is attached to. 0-9 are on-board, 10-19 are on
* the MXP port
* @param channel The PWM channel that the Talon is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public Talon(final int channel) {

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -9,16 +11,13 @@ import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* VEX Robotics Victor 888 Motor Controller The Vex Robotics Victor 884 Motor Controller can also be
* used with this class but may need to be calibrated per the Victor 884 user manual.
* Vex Robotics Victor 888 Motor Controller.
*
* <p>Note that the Victor uses the following bounds for PWM values. These values were determined
* empirically and optimized for the Victor 888. These values should work reasonably well for Victor
* 884 controllers also 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 884 User Manual available from VEX Robotics:
* <a
* href="http://content.vexrobotics.com/docs/ifi-v884-users-manual-9-25-06.pdf">http://content.vexrobotics.com/docs/ifi-v884-users-manual-9-25-06.pdf</a>
* <p>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.
*
* <ul>
* <li>2.027ms = full "forward"
@@ -32,8 +31,8 @@ public class Victor extends PWMMotorController {
/**
* Constructor.
*
* @param channel The PWM channel that the Victor is attached to. 0-9 are on-board, 10-19 are on
* the MXP port
* @param channel The PWM channel that the Victor 888 is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public Victor(final int channel) {

View File

@@ -2,6 +2,8 @@
// 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 ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
@@ -9,13 +11,13 @@ import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* VEX Robotics Victor SP Motor Controller.
* Vex Robotics Victor SP Motor Controller.
*
* <p>Note that the VictorSP uses the following bounds for PWM values. These values should work
* <p>Note that the Victor SP 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 VictorSP User Manual available from
* CTRE.
* recommended. The calibration procedure can be found in the Victor SP User Manual available from
* Vex Robotics.
*
* <ul>
* <li>2.004ms = full "forward"
@@ -29,8 +31,8 @@ public class VictorSP extends PWMMotorController {
/**
* Constructor.
*
* @param channel The PWM channel that the VictorSP is attached to. 0-9 are on-board, 10-19 are on
* the MXP port
* @param channel The PWM channel that the Victor SP is attached to. 0-9 are on-board, 10-19
* are on the MXP port
*/
@SuppressWarnings("this-escape")
public VictorSP(final int channel) {