mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[examples] Use PWMSparkMax instead of PWMVictorSPX (#3156)
This accurately reflects the motor controllers that are distributed in the Kit of Parts.
This commit is contained in:
committed by
GitHub
parent
69e8d0b65d
commit
be0ce99007
@@ -3,7 +3,7 @@
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
* Runs the motors with arcade steering.
|
||||
*/
|
||||
class Robot : public frc::TimedRobot {
|
||||
frc::PWMVictorSPX m_leftMotor{0};
|
||||
frc::PWMVictorSPX m_rightMotor{1};
|
||||
frc::PWMSparkMax m_leftMotor{0};
|
||||
frc::PWMSparkMax m_rightMotor{1};
|
||||
frc::DifferentialDrive m_robotDrive{m_leftMotor, m_rightMotor};
|
||||
frc::Joystick m_stick{0};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <frc/GenericHID.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/XboxController.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
@@ -13,8 +13,8 @@
|
||||
* Runs the motors with split arcade steering and an Xbox controller.
|
||||
*/
|
||||
class Robot : public frc::TimedRobot {
|
||||
frc::PWMVictorSPX m_leftMotor{0};
|
||||
frc::PWMVictorSPX m_rightMotor{1};
|
||||
frc::PWMSparkMax m_leftMotor{0};
|
||||
frc::PWMSparkMax m_rightMotor{1};
|
||||
frc::DifferentialDrive m_robotDrive{m_leftMotor, m_rightMotor};
|
||||
frc::XboxController m_driverController{0};
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/controller/ArmFeedforward.h>
|
||||
#include <frc2/command/ProfiledPIDSubsystem.h>
|
||||
#include <units/angle.h>
|
||||
@@ -24,7 +24,7 @@ class ArmSubsystem : public frc2::ProfiledPIDSubsystem<units::radians> {
|
||||
units::radian_t GetMeasurement() override;
|
||||
|
||||
private:
|
||||
frc::PWMVictorSPX m_motor;
|
||||
frc::PWMSparkMax m_motor;
|
||||
frc::Encoder m_encoder;
|
||||
frc::ArmFeedforward m_feedforward;
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
#include <frc2/command/SubsystemBase.h>
|
||||
@@ -70,10 +70,10 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
// declared private and exposed only through public methods.
|
||||
|
||||
// The motor controllers
|
||||
frc::PWMVictorSPX m_left1;
|
||||
frc::PWMVictorSPX m_left2;
|
||||
frc::PWMVictorSPX m_right1;
|
||||
frc::PWMVictorSPX m_right2;
|
||||
frc::PWMSparkMax m_left1;
|
||||
frc::PWMSparkMax m_left2;
|
||||
frc::PWMSparkMax m_right1;
|
||||
frc::PWMSparkMax m_right2;
|
||||
|
||||
// The motors on the left side of the drive
|
||||
frc::SpeedControllerGroup m_leftMotors{m_left1, m_left2};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
#include <frc2/command/SubsystemBase.h>
|
||||
@@ -70,10 +70,10 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
// declared private and exposed only through public methods.
|
||||
|
||||
// The motor controllers
|
||||
frc::PWMVictorSPX m_left1;
|
||||
frc::PWMVictorSPX m_left2;
|
||||
frc::PWMVictorSPX m_right1;
|
||||
frc::PWMVictorSPX m_right2;
|
||||
frc::PWMSparkMax m_left1;
|
||||
frc::PWMSparkMax m_left2;
|
||||
frc::PWMSparkMax m_right1;
|
||||
frc::PWMSparkMax m_right2;
|
||||
|
||||
// The motors on the left side of the drive
|
||||
frc::SpeedControllerGroup m_leftMotors{m_left1, m_left2};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/GenericHID.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/RobotController.h>
|
||||
#include <frc/StateSpaceUtil.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
@@ -43,7 +43,7 @@ class Robot : public frc::TimedRobot {
|
||||
// Standard classes for controlling our arm
|
||||
frc2::PIDController m_controller{kArmKp, 0, 0};
|
||||
frc::Encoder m_encoder{kEncoderAChannel, kEncoderBChannel};
|
||||
frc::PWMVictorSPX m_motor{kMotorPort};
|
||||
frc::PWMSparkMax m_motor{kMotorPort};
|
||||
frc::Joystick m_joystick{kJoystickPort};
|
||||
|
||||
// Simulation classes help us simulate what's going on, including gravity.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/controller/PIDController.h>
|
||||
#include <frc/controller/SimpleMotorFeedforward.h>
|
||||
@@ -52,10 +52,10 @@ class Drivetrain {
|
||||
static constexpr double kWheelRadius = 0.0508; // meters
|
||||
static constexpr int kEncoderResolution = 4096;
|
||||
|
||||
frc::PWMVictorSPX m_leftLeader{1};
|
||||
frc::PWMVictorSPX m_leftFollower{2};
|
||||
frc::PWMVictorSPX m_rightLeader{3};
|
||||
frc::PWMVictorSPX m_rightFollower{4};
|
||||
frc::PWMSparkMax m_leftLeader{1};
|
||||
frc::PWMSparkMax m_leftFollower{2};
|
||||
frc::PWMSparkMax m_rightLeader{3};
|
||||
frc::PWMSparkMax m_rightFollower{4};
|
||||
|
||||
frc::SpeedControllerGroup m_leftGroup{m_leftLeader, m_leftFollower};
|
||||
frc::SpeedControllerGroup m_rightGroup{m_rightLeader, m_rightFollower};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/controller/PIDController.h>
|
||||
#include <frc/controller/SimpleMotorFeedforward.h>
|
||||
@@ -52,10 +52,10 @@ class Drivetrain {
|
||||
static constexpr units::meter_t kWheelRadius = 0.0508_m;
|
||||
static constexpr int kEncoderResolution = 4096;
|
||||
|
||||
frc::PWMVictorSPX m_leftLeader{1};
|
||||
frc::PWMVictorSPX m_leftFollower{2};
|
||||
frc::PWMVictorSPX m_rightLeader{3};
|
||||
frc::PWMVictorSPX m_rightFollower{4};
|
||||
frc::PWMSparkMax m_leftLeader{1};
|
||||
frc::PWMSparkMax m_leftFollower{2};
|
||||
frc::PWMSparkMax m_rightLeader{3};
|
||||
frc::PWMSparkMax m_rightFollower{4};
|
||||
|
||||
frc::SpeedControllerGroup m_leftGroup{m_leftLeader, m_leftFollower};
|
||||
frc::SpeedControllerGroup m_rightGroup{m_rightLeader, m_rightFollower};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/controller/ProfiledPIDController.h>
|
||||
#include <frc/trajectory/TrapezoidProfile.h>
|
||||
@@ -37,7 +37,7 @@ class Robot : public frc::TimedRobot {
|
||||
private:
|
||||
frc::Joystick m_joystick{1};
|
||||
frc::Encoder m_encoder{1, 2};
|
||||
frc::PWMVictorSPX m_motor{1};
|
||||
frc::PWMSparkMax m_motor{1};
|
||||
|
||||
// Create a PID controller whose setpoint's change is subject to maximum
|
||||
// velocity and acceleration constraints.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/GenericHID.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/RobotController.h>
|
||||
#include <frc/StateSpaceUtil.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
@@ -48,7 +48,7 @@ class Robot : public frc::TimedRobot {
|
||||
// Standard classes for controlling our elevator
|
||||
frc2::PIDController m_controller{kElevatorKp, 0, 0};
|
||||
frc::Encoder m_encoder{kEncoderAChannel, kEncoderBChannel};
|
||||
frc::PWMVictorSPX m_motor{kMotorPort};
|
||||
frc::PWMSparkMax m_motor{kMotorPort};
|
||||
frc::Joystick m_joystick{kJoystickPort};
|
||||
|
||||
// Simulation classes help us simulate what's going on, including gravity.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
#include <frc2/command/SubsystemBase.h>
|
||||
@@ -70,10 +70,10 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
// declared private and exposed only through public methods.
|
||||
|
||||
// The motor controllers
|
||||
frc::PWMVictorSPX m_left1;
|
||||
frc::PWMVictorSPX m_left2;
|
||||
frc::PWMVictorSPX m_right1;
|
||||
frc::PWMVictorSPX m_right2;
|
||||
frc::PWMSparkMax m_left1;
|
||||
frc::PWMSparkMax m_left2;
|
||||
frc::PWMSparkMax m_right1;
|
||||
frc::PWMSparkMax m_right2;
|
||||
|
||||
// The motors on the left side of the drive
|
||||
frc::SpeedControllerGroup m_leftMotors{m_left1, m_left2};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/controller/SimpleMotorFeedforward.h>
|
||||
#include <frc2/command/PIDSubsystem.h>
|
||||
#include <units/angle.h>
|
||||
@@ -25,8 +25,8 @@ class ShooterSubsystem : public frc2::PIDSubsystem {
|
||||
void StopFeeder();
|
||||
|
||||
private:
|
||||
frc::PWMVictorSPX m_shooterMotor;
|
||||
frc::PWMVictorSPX m_feederMotor;
|
||||
frc::PWMSparkMax m_shooterMotor;
|
||||
frc::PWMSparkMax m_feederMotor;
|
||||
frc::Encoder m_shooterEncoder;
|
||||
frc::SimpleMotorFeedforward<units::turns> m_shooterFeedforward;
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/DigitalInput.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc2/command/SubsystemBase.h>
|
||||
|
||||
/**
|
||||
@@ -50,6 +50,6 @@ class Claw : public frc2::SubsystemBase {
|
||||
void Periodic() override;
|
||||
|
||||
private:
|
||||
frc::PWMVictorSPX m_motor{7};
|
||||
frc::PWMSparkMax m_motor{7};
|
||||
frc::DigitalInput m_contact{5};
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/AnalogInput.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
#include <frc2/command/SubsystemBase.h>
|
||||
@@ -64,12 +64,12 @@ class DriveTrain : public frc2::SubsystemBase {
|
||||
void Periodic() override;
|
||||
|
||||
private:
|
||||
frc::PWMVictorSPX m_frontLeft{1};
|
||||
frc::PWMVictorSPX m_rearLeft{2};
|
||||
frc::PWMSparkMax m_frontLeft{1};
|
||||
frc::PWMSparkMax m_rearLeft{2};
|
||||
frc::SpeedControllerGroup m_left{m_frontLeft, m_rearLeft};
|
||||
|
||||
frc::PWMVictorSPX m_frontRight{3};
|
||||
frc::PWMVictorSPX m_rearRight{4};
|
||||
frc::PWMSparkMax m_frontRight{3};
|
||||
frc::PWMSparkMax m_rearRight{4};
|
||||
frc::SpeedControllerGroup m_right{m_frontRight, m_rearRight};
|
||||
|
||||
frc::DifferentialDrive m_robotDrive{m_left, m_right};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/AnalogPotentiometer.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc2/command/PIDSubsystem.h>
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ class Elevator : public frc2::PIDSubsystem {
|
||||
void Periodic() override;
|
||||
|
||||
private:
|
||||
frc::PWMVictorSPX m_motor{5};
|
||||
frc::PWMSparkMax m_motor{5};
|
||||
double m_setpoint = 0;
|
||||
|
||||
// Conversion value of potentiometer varies between the real world and
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/AnalogPotentiometer.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc2/command/PIDSubsystem.h>
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ class Wrist : public frc2::PIDSubsystem {
|
||||
void Periodic() override;
|
||||
|
||||
private:
|
||||
frc::PWMVictorSPX m_motor{6};
|
||||
frc::PWMSparkMax m_motor{6};
|
||||
double m_setpoint = 0;
|
||||
|
||||
// Conversion value of potentiometer varies between the real world and
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/Timer.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
@@ -45,8 +45,8 @@ class Robot : public frc::TimedRobot {
|
||||
|
||||
private:
|
||||
// Robot drive system
|
||||
frc::PWMVictorSPX m_left{0};
|
||||
frc::PWMVictorSPX m_right{1};
|
||||
frc::PWMSparkMax m_left{0};
|
||||
frc::PWMSparkMax m_right{1};
|
||||
frc::DifferentialDrive m_robotDrive{m_left, m_right};
|
||||
|
||||
frc::Joystick m_stick{0};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
|
||||
@@ -44,8 +44,8 @@ class Robot : public frc::TimedRobot {
|
||||
static constexpr int kGyroPort = 0;
|
||||
static constexpr int kJoystickPort = 0;
|
||||
|
||||
frc::PWMVictorSPX m_left{kLeftMotorPort};
|
||||
frc::PWMVictorSPX m_right{kRightMotorPort};
|
||||
frc::PWMSparkMax m_left{kLeftMotorPort};
|
||||
frc::PWMSparkMax m_right{kRightMotorPort};
|
||||
frc::DifferentialDrive m_robotDrive{m_left, m_right};
|
||||
|
||||
frc::AnalogGyro m_gyro{kGyroPort};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/ADXRS450_Gyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
#include <frc2/command/SubsystemBase.h>
|
||||
@@ -86,10 +86,10 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
// declared private and exposed only through public methods.
|
||||
|
||||
// The motor controllers
|
||||
frc::PWMVictorSPX m_left1;
|
||||
frc::PWMVictorSPX m_left2;
|
||||
frc::PWMVictorSPX m_right1;
|
||||
frc::PWMVictorSPX m_right2;
|
||||
frc::PWMSparkMax m_left1;
|
||||
frc::PWMSparkMax m_left2;
|
||||
frc::PWMSparkMax m_right1;
|
||||
frc::PWMSparkMax m_right2;
|
||||
|
||||
// The motors on the left side of the drive
|
||||
frc::SpeedControllerGroup m_leftMotors{m_left1, m_left2};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/MecanumDrive.h>
|
||||
|
||||
@@ -44,10 +44,10 @@ class Robot : public frc::TimedRobot {
|
||||
static constexpr int kGyroPort = 0;
|
||||
static constexpr int kJoystickPort = 0;
|
||||
|
||||
frc::PWMVictorSPX m_frontLeft{kFrontLeftMotorPort};
|
||||
frc::PWMVictorSPX m_rearLeft{kRearLeftMotorPort};
|
||||
frc::PWMVictorSPX m_frontRight{kFrontRightMotorPort};
|
||||
frc::PWMVictorSPX m_rearRight{kRearRightMotorPort};
|
||||
frc::PWMSparkMax m_frontLeft{kFrontLeftMotorPort};
|
||||
frc::PWMSparkMax m_rearLeft{kRearLeftMotorPort};
|
||||
frc::PWMSparkMax m_frontRight{kFrontRightMotorPort};
|
||||
frc::PWMSparkMax m_rearRight{kRearRightMotorPort};
|
||||
frc::MecanumDrive m_robotDrive{m_frontLeft, m_rearLeft, m_frontRight,
|
||||
m_rearRight};
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
#include <frc2/command/SubsystemBase.h>
|
||||
@@ -70,10 +70,10 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
// declared private and exposed only through public methods.
|
||||
|
||||
// The motor controllers
|
||||
frc::PWMVictorSPX m_left1;
|
||||
frc::PWMVictorSPX m_left2;
|
||||
frc::PWMVictorSPX m_right1;
|
||||
frc::PWMVictorSPX m_right2;
|
||||
frc::PWMSparkMax m_left1;
|
||||
frc::PWMSparkMax m_left2;
|
||||
frc::PWMSparkMax m_right1;
|
||||
frc::PWMSparkMax m_right2;
|
||||
|
||||
// The motors on the left side of the drive
|
||||
frc::SpeedControllerGroup m_leftMotors{m_left1, m_left2};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
#include <frc2/command/SubsystemBase.h>
|
||||
@@ -70,10 +70,10 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
// declared private and exposed only through public methods.
|
||||
|
||||
// The motor controllers
|
||||
frc::PWMVictorSPX m_left1;
|
||||
frc::PWMVictorSPX m_left2;
|
||||
frc::PWMVictorSPX m_right1;
|
||||
frc::PWMVictorSPX m_right2;
|
||||
frc::PWMSparkMax m_left1;
|
||||
frc::PWMSparkMax m_left2;
|
||||
frc::PWMSparkMax m_right1;
|
||||
frc::PWMSparkMax m_right2;
|
||||
|
||||
// The motors on the left side of the drive
|
||||
frc::SpeedControllerGroup m_leftMotors{m_left1, m_left2};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/controller/PIDController.h>
|
||||
#include <frc/controller/SimpleMotorFeedforward.h>
|
||||
#include <frc/geometry/Translation2d.h>
|
||||
@@ -35,10 +35,10 @@ class Drivetrain {
|
||||
wpi::math::pi}; // 1/2 rotation per second
|
||||
|
||||
private:
|
||||
frc::PWMVictorSPX m_frontLeftMotor{1};
|
||||
frc::PWMVictorSPX m_frontRightMotor{2};
|
||||
frc::PWMVictorSPX m_backLeftMotor{3};
|
||||
frc::PWMVictorSPX m_backRightMotor{4};
|
||||
frc::PWMSparkMax m_frontLeftMotor{1};
|
||||
frc::PWMSparkMax m_frontRightMotor{2};
|
||||
frc::PWMSparkMax m_backLeftMotor{3};
|
||||
frc::PWMSparkMax m_backRightMotor{4};
|
||||
|
||||
frc::Encoder m_frontLeftEncoder{0, 1};
|
||||
frc::Encoder m_frontRightEncoder{2, 3};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/ADXRS450_Gyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/drive/MecanumDrive.h>
|
||||
#include <frc/geometry/Pose2d.h>
|
||||
#include <frc/geometry/Rotation2d.h>
|
||||
@@ -135,10 +135,10 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
// declared private and exposed only through public methods.
|
||||
|
||||
// The motor controllers
|
||||
frc::PWMVictorSPX m_frontLeft;
|
||||
frc::PWMVictorSPX m_rearLeft;
|
||||
frc::PWMVictorSPX m_frontRight;
|
||||
frc::PWMVictorSPX m_rearRight;
|
||||
frc::PWMSparkMax m_frontLeft;
|
||||
frc::PWMSparkMax m_rearLeft;
|
||||
frc::PWMSparkMax m_frontRight;
|
||||
frc::PWMSparkMax m_rearRight;
|
||||
|
||||
// The robot's drive
|
||||
frc::MecanumDrive m_drive{m_frontLeft, m_rearLeft, m_frontRight, m_rearRight};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/MecanumDrive.h>
|
||||
|
||||
@@ -35,10 +35,10 @@ class Robot : public frc::TimedRobot {
|
||||
|
||||
static constexpr int kJoystickChannel = 0;
|
||||
|
||||
frc::PWMVictorSPX m_frontLeft{kFrontLeftChannel};
|
||||
frc::PWMVictorSPX m_rearLeft{kRearLeftChannel};
|
||||
frc::PWMVictorSPX m_frontRight{kFrontRightChannel};
|
||||
frc::PWMVictorSPX m_rearRight{kRearRightChannel};
|
||||
frc::PWMSparkMax m_frontLeft{kFrontLeftChannel};
|
||||
frc::PWMSparkMax m_rearLeft{kRearLeftChannel};
|
||||
frc::PWMSparkMax m_frontRight{kFrontRightChannel};
|
||||
frc::PWMSparkMax m_rearRight{kRearRightChannel};
|
||||
frc::MecanumDrive m_robotDrive{m_frontLeft, m_rearLeft, m_frontRight,
|
||||
m_rearRight};
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ frc::MecanumDriveWheelSpeeds Drivetrain::GetCurrentState() const {
|
||||
|
||||
void Drivetrain::SetSpeeds(const frc::MecanumDriveWheelSpeeds& wheelSpeeds) {
|
||||
std::function<void(units::meters_per_second_t, const frc::Encoder&,
|
||||
frc2::PIDController&, frc::PWMVictorSPX&)>
|
||||
frc2::PIDController&, frc::PWMSparkMax&)>
|
||||
calcAndSetSpeeds =
|
||||
[&m_feedforward = m_feedforward](units::meters_per_second_t speed,
|
||||
const auto& encoder,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/controller/PIDController.h>
|
||||
#include <frc/controller/SimpleMotorFeedforward.h>
|
||||
#include <frc/estimator/MecanumDrivePoseEstimator.h>
|
||||
@@ -35,10 +35,10 @@ class Drivetrain {
|
||||
wpi::math::pi}; // 1/2 rotation per second
|
||||
|
||||
private:
|
||||
frc::PWMVictorSPX m_frontLeftMotor{1};
|
||||
frc::PWMVictorSPX m_frontRightMotor{2};
|
||||
frc::PWMVictorSPX m_backLeftMotor{3};
|
||||
frc::PWMVictorSPX m_backRightMotor{4};
|
||||
frc::PWMSparkMax m_frontLeftMotor{1};
|
||||
frc::PWMSparkMax m_frontRightMotor{2};
|
||||
frc::PWMSparkMax m_backLeftMotor{3};
|
||||
frc::PWMSparkMax m_backRightMotor{4};
|
||||
|
||||
frc::Encoder m_frontLeftEncoder{0, 1};
|
||||
frc::Encoder m_frontRightEncoder{2, 3};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ class Robot : public frc::TimedRobot {
|
||||
|
||||
private:
|
||||
frc::Joystick m_stick{0};
|
||||
frc::PWMVictorSPX m_motor{0};
|
||||
frc::PWMSparkMax m_motor{0};
|
||||
};
|
||||
|
||||
#ifndef RUNNING_FRC_TESTS
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/smartdashboard/SmartDashboard.h>
|
||||
#include <wpi/math>
|
||||
@@ -40,7 +40,7 @@ class Robot : public frc::TimedRobot {
|
||||
|
||||
private:
|
||||
frc::Joystick m_stick{0};
|
||||
frc::PWMVictorSPX m_motor{0};
|
||||
frc::PWMSparkMax m_motor{0};
|
||||
frc::Encoder m_encoder{0, 1};
|
||||
};
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/DigitalInput.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/Solenoid.h>
|
||||
#include <frc/commands/Subsystem.h>
|
||||
|
||||
@@ -66,7 +66,7 @@ class Collector : public frc::Subsystem {
|
||||
|
||||
private:
|
||||
// Subsystem devices
|
||||
frc::PWMVictorSPX m_rollerMotor{6};
|
||||
frc::PWMSparkMax m_rollerMotor{6};
|
||||
frc::DigitalInput m_ballDetector{10};
|
||||
frc::Solenoid m_piston{1};
|
||||
frc::DigitalInput m_openDetector{6};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/commands/Subsystem.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
@@ -60,12 +60,12 @@ class DriveTrain : public frc::Subsystem {
|
||||
|
||||
private:
|
||||
// Subsystem devices
|
||||
frc::PWMVictorSPX m_frontLeftCIM{1};
|
||||
frc::PWMVictorSPX m_rearLeftCIM{2};
|
||||
frc::PWMSparkMax m_frontLeftCIM{1};
|
||||
frc::PWMSparkMax m_rearLeftCIM{2};
|
||||
frc::SpeedControllerGroup m_leftCIMs{m_frontLeftCIM, m_rearLeftCIM};
|
||||
|
||||
frc::PWMVictorSPX m_frontRightCIM{3};
|
||||
frc::PWMVictorSPX m_rearRightCIM{4};
|
||||
frc::PWMSparkMax m_frontRightCIM{3};
|
||||
frc::PWMSparkMax m_rearRightCIM{4};
|
||||
frc::SpeedControllerGroup m_rightCIMs{m_frontRightCIM, m_rearRightCIM};
|
||||
|
||||
frc::DifferentialDrive m_robotDrive{m_leftCIMs, m_rightCIMs};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/AnalogPotentiometer.h>
|
||||
#include <frc/DigitalInput.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/commands/PIDSubsystem.h>
|
||||
|
||||
/**
|
||||
@@ -67,5 +67,5 @@ class Pivot : public frc::PIDSubsystem {
|
||||
frc::AnalogPotentiometer m_pot{1};
|
||||
|
||||
// Motor to move the pivot
|
||||
frc::PWMVictorSPX m_motor{5};
|
||||
frc::PWMSparkMax m_motor{5};
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/AnalogInput.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/controller/PIDController.h>
|
||||
|
||||
@@ -62,7 +62,7 @@ class Robot : public frc::TimedRobot {
|
||||
|
||||
frc::AnalogInput m_potentiometer{kPotChannel};
|
||||
frc::Joystick m_joystick{kJoystickChannel};
|
||||
frc::PWMVictorSPX m_elevatorMotor{kMotorChannel};
|
||||
frc::PWMSparkMax m_elevatorMotor{kMotorChannel};
|
||||
|
||||
frc2::PIDController m_pidController{kP, kI, kD};
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/ADXRS450_Gyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
#include <frc/geometry/Pose2d.h>
|
||||
@@ -117,10 +117,10 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
// declared private and exposed only through public methods.
|
||||
|
||||
// The motor controllers
|
||||
frc::PWMVictorSPX m_left1;
|
||||
frc::PWMVictorSPX m_left2;
|
||||
frc::PWMVictorSPX m_right1;
|
||||
frc::PWMVictorSPX m_right2;
|
||||
frc::PWMSparkMax m_left1;
|
||||
frc::PWMSparkMax m_left2;
|
||||
frc::PWMSparkMax m_right1;
|
||||
frc::PWMSparkMax m_right2;
|
||||
|
||||
// The motors on the left side of the drive
|
||||
frc::SpeedControllerGroup m_leftMotors{m_left1, m_left2};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/controller/PIDController.h>
|
||||
#include <frc/controller/SimpleMotorFeedforward.h>
|
||||
@@ -52,10 +52,10 @@ class Drivetrain {
|
||||
static constexpr double kWheelRadius = 0.0508; // meters
|
||||
static constexpr int kEncoderResolution = 4096;
|
||||
|
||||
frc::PWMVictorSPX m_leftLeader{1};
|
||||
frc::PWMVictorSPX m_leftFollower{2};
|
||||
frc::PWMVictorSPX m_rightLeader{3};
|
||||
frc::PWMVictorSPX m_rightFollower{4};
|
||||
frc::PWMSparkMax m_leftLeader{1};
|
||||
frc::PWMSparkMax m_leftFollower{2};
|
||||
frc::PWMSparkMax m_rightLeader{3};
|
||||
frc::PWMSparkMax m_rightFollower{4};
|
||||
|
||||
frc::SpeedControllerGroup m_leftGroup{m_leftLeader, m_leftFollower};
|
||||
frc::SpeedControllerGroup m_rightGroup{m_rightLeader, m_rightFollower};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <frc/AnalogPotentiometer.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
#include <frc/shuffleboard/Shuffleboard.h>
|
||||
@@ -61,9 +61,9 @@ class Robot : public frc::TimedRobot {
|
||||
}
|
||||
|
||||
private:
|
||||
frc::PWMVictorSPX m_left{0};
|
||||
frc::PWMVictorSPX m_right{1};
|
||||
frc::PWMVictorSPX m_elevatorMotor{2};
|
||||
frc::PWMSparkMax m_left{0};
|
||||
frc::PWMSparkMax m_right{1};
|
||||
frc::PWMSparkMax m_elevatorMotor{2};
|
||||
|
||||
frc::DifferentialDrive m_robotDrive{m_left, m_right};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/controller/PIDController.h>
|
||||
#include <frc/controller/SimpleMotorFeedforward.h>
|
||||
@@ -68,10 +68,10 @@ class Drivetrain {
|
||||
static constexpr double kWheelRadius = 0.0508; // meters
|
||||
static constexpr int kEncoderResolution = 4096;
|
||||
|
||||
frc::PWMVictorSPX m_leftLeader{1};
|
||||
frc::PWMVictorSPX m_leftFollower{2};
|
||||
frc::PWMVictorSPX m_rightLeader{3};
|
||||
frc::PWMVictorSPX m_rightFollower{4};
|
||||
frc::PWMSparkMax m_leftLeader{1};
|
||||
frc::PWMSparkMax m_leftFollower{2};
|
||||
frc::PWMSparkMax m_rightLeader{3};
|
||||
frc::PWMSparkMax m_rightFollower{4};
|
||||
|
||||
frc::SpeedControllerGroup m_leftGroup{m_leftLeader, m_leftFollower};
|
||||
frc::SpeedControllerGroup m_rightGroup{m_rightLeader, m_rightFollower};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/GenericHID.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/StateSpaceUtil.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/XboxController.h>
|
||||
@@ -84,7 +84,7 @@ class Robot : public frc::TimedRobot {
|
||||
// An encoder set up to measure arm position in radians per second.
|
||||
frc::Encoder m_encoder{kEncoderAChannel, kEncoderBChannel};
|
||||
|
||||
frc::PWMVictorSPX m_motor{kMotorPort};
|
||||
frc::PWMSparkMax m_motor{kMotorPort};
|
||||
frc::XboxController m_joystick{kJoystickPort};
|
||||
|
||||
frc::TrapezoidProfile<units::radians>::Constraints m_constraints{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/ADXRS450_Gyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/SpeedControllerGroup.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
#include <frc/geometry/Pose2d.h>
|
||||
@@ -128,10 +128,10 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
// declared private and exposed only through public methods.
|
||||
|
||||
// The motor controllers
|
||||
frc::PWMVictorSPX m_left1{DriveConstants::kLeftMotor1Port};
|
||||
frc::PWMVictorSPX m_left2{DriveConstants::kLeftMotor2Port};
|
||||
frc::PWMVictorSPX m_right1{DriveConstants::kRightMotor1Port};
|
||||
frc::PWMVictorSPX m_right2{DriveConstants::kRightMotor2Port};
|
||||
frc::PWMSparkMax m_left1{DriveConstants::kLeftMotor1Port};
|
||||
frc::PWMSparkMax m_left2{DriveConstants::kLeftMotor2Port};
|
||||
frc::PWMSparkMax m_right1{DriveConstants::kRightMotor1Port};
|
||||
frc::PWMSparkMax m_right2{DriveConstants::kRightMotor2Port};
|
||||
|
||||
// The motors on the left side of the drive
|
||||
frc::SpeedControllerGroup m_leftMotors{m_left1, m_left2};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/GenericHID.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/StateSpaceUtil.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/XboxController.h>
|
||||
@@ -81,7 +81,7 @@ class Robot : public frc::TimedRobot {
|
||||
// An encoder set up to measure elevator height in meters.
|
||||
frc::Encoder m_encoder{kEncoderAChannel, kEncoderBChannel};
|
||||
|
||||
frc::PWMVictorSPX m_motor{kMotorPort};
|
||||
frc::PWMSparkMax m_motor{kMotorPort};
|
||||
frc::XboxController m_joystick{kJoystickPort};
|
||||
|
||||
frc::TrapezoidProfile<units::meters>::Constraints m_constraints{3_fps,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <frc/DriverStation.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/GenericHID.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/StateSpaceUtil.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/XboxController.h>
|
||||
@@ -77,7 +77,7 @@ class Robot : public frc::TimedRobot {
|
||||
// An encoder set up to measure flywheel velocity in radians per second.
|
||||
frc::Encoder m_encoder{kEncoderAChannel, kEncoderBChannel};
|
||||
|
||||
frc::PWMVictorSPX m_motor{kMotorPort};
|
||||
frc::PWMSparkMax m_motor{kMotorPort};
|
||||
frc::XboxController m_joystick{kJoystickPort};
|
||||
|
||||
public:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <frc/DriverStation.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/GenericHID.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/StateSpaceUtil.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/XboxController.h>
|
||||
@@ -78,7 +78,7 @@ class Robot : public frc::TimedRobot {
|
||||
// An encoder set up to measure flywheel velocity in radians per second.
|
||||
frc::Encoder m_encoder{kEncoderAChannel, kEncoderBChannel};
|
||||
|
||||
frc::PWMVictorSPX m_motor{kMotorPort};
|
||||
frc::PWMSparkMax m_motor{kMotorPort};
|
||||
frc::XboxController m_joystick{kJoystickPort};
|
||||
|
||||
public:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/controller/PIDController.h>
|
||||
#include <frc/controller/ProfiledPIDController.h>
|
||||
#include <frc/controller/SimpleMotorFeedforward.h>
|
||||
@@ -31,8 +31,8 @@ class SwerveModule {
|
||||
static constexpr auto kModuleMaxAngularAcceleration =
|
||||
wpi::math::pi * 2_rad_per_s / 1_s; // radians per second^2
|
||||
|
||||
frc::PWMVictorSPX m_driveMotor;
|
||||
frc::PWMVictorSPX m_turningMotor;
|
||||
frc::PWMSparkMax m_driveMotor;
|
||||
frc::PWMSparkMax m_turningMotor;
|
||||
|
||||
frc::Encoder m_driveEncoder{0, 1};
|
||||
frc::Encoder m_turningEncoder{2, 3};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc/ADXRS450_Gyro.h>
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/drive/MecanumDrive.h>
|
||||
#include <frc/geometry/Pose2d.h>
|
||||
#include <frc/geometry/Rotation2d.h>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/controller/PIDController.h>
|
||||
#include <frc/controller/ProfiledPIDController.h>
|
||||
#include <frc/controller/SimpleMotorFeedforward.h>
|
||||
@@ -31,8 +31,8 @@ class SwerveModule {
|
||||
static constexpr auto kModuleMaxAngularAcceleration =
|
||||
wpi::math::pi * 2_rad_per_s / 1_s; // radians per second^2
|
||||
|
||||
frc::PWMVictorSPX m_driveMotor;
|
||||
frc::PWMVictorSPX m_turningMotor;
|
||||
frc::PWMSparkMax m_driveMotor;
|
||||
frc::PWMSparkMax m_turningMotor;
|
||||
|
||||
frc::Encoder m_driveEncoder{0, 1};
|
||||
frc::Encoder m_turningEncoder{2, 3};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <frc/GenericHID.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/XboxController.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
@@ -13,8 +13,8 @@
|
||||
* Runs the motors with tank steering and an Xbox controller.
|
||||
*/
|
||||
class Robot : public frc::TimedRobot {
|
||||
frc::PWMVictorSPX m_leftMotor{0};
|
||||
frc::PWMVictorSPX m_rightMotor{1};
|
||||
frc::PWMSparkMax m_leftMotor{0};
|
||||
frc::PWMSparkMax m_rightMotor{1};
|
||||
frc::DifferentialDrive m_robotDrive{m_leftMotor, m_rightMotor};
|
||||
frc::XboxController m_driverController{0};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <frc/AnalogInput.h>
|
||||
#include <frc/MedianFilter.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
|
||||
@@ -49,8 +49,8 @@ class Robot : public frc::TimedRobot {
|
||||
|
||||
frc::AnalogInput m_ultrasonic{kUltrasonicPort};
|
||||
|
||||
frc::PWMVictorSPX m_left{kLeftMotorPort};
|
||||
frc::PWMVictorSPX m_right{kRightMotorPort};
|
||||
frc::PWMSparkMax m_left{kLeftMotorPort};
|
||||
frc::PWMSparkMax m_right{kRightMotorPort};
|
||||
frc::DifferentialDrive m_robotDrive{m_left, m_right};
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <frc/AnalogInput.h>
|
||||
#include <frc/MedianFilter.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/PWMSparkMax.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/controller/PIDController.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
@@ -55,8 +55,8 @@ class Robot : public frc::TimedRobot {
|
||||
|
||||
frc::AnalogInput m_ultrasonic{kUltrasonicPort};
|
||||
|
||||
frc::PWMVictorSPX m_left{kLeftMotorPort};
|
||||
frc::PWMVictorSPX m_right{kRightMotorPort};
|
||||
frc::PWMSparkMax m_left{kLeftMotorPort};
|
||||
frc::PWMSparkMax m_right{kRightMotorPort};
|
||||
frc::DifferentialDrive m_robotDrive{m_left, m_right};
|
||||
|
||||
frc2::PIDController m_pidController{kP, kI, kD};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.arcadedrive;
|
||||
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
|
||||
@@ -14,8 +14,8 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
* arcade steering.
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
private final PWMVictorSPX m_leftMotor = new PWMVictorSPX(0);
|
||||
private final PWMVictorSPX m_rightMotor = new PWMVictorSPX(1);
|
||||
private final PWMSparkMax m_leftMotor = new PWMSparkMax(0);
|
||||
private final PWMSparkMax m_rightMotor = new PWMSparkMax(1);
|
||||
private final DifferentialDrive m_robotDrive = new DifferentialDrive(m_leftMotor, m_rightMotor);
|
||||
private final Joystick m_stick = new Joystick(0);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.arcadedrivexboxcontroller;
|
||||
|
||||
import edu.wpi.first.wpilibj.GenericHID.Hand;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.XboxController;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
@@ -15,8 +15,8 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
* arcade steering and an Xbox controller.
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
private final PWMVictorSPX m_leftMotor = new PWMVictorSPX(0);
|
||||
private final PWMVictorSPX m_rightMotor = new PWMVictorSPX(1);
|
||||
private final PWMSparkMax m_leftMotor = new PWMSparkMax(0);
|
||||
private final PWMSparkMax m_rightMotor = new PWMSparkMax(1);
|
||||
private final DifferentialDrive m_robotDrive = new DifferentialDrive(m_leftMotor, m_rightMotor);
|
||||
private final XboxController m_driverController = new XboxController(0);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.armbot.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.controller.ArmFeedforward;
|
||||
import edu.wpi.first.wpilibj.controller.ProfiledPIDController;
|
||||
import edu.wpi.first.wpilibj.examples.armbot.Constants.ArmConstants;
|
||||
@@ -14,7 +14,7 @@ import edu.wpi.first.wpilibj2.command.ProfiledPIDSubsystem;
|
||||
|
||||
/** A robot arm subsystem that moves with a motion profile. */
|
||||
public class ArmSubsystem extends ProfiledPIDSubsystem {
|
||||
private final PWMVictorSPX m_motor = new PWMVictorSPX(ArmConstants.kMotorPort);
|
||||
private final PWMSparkMax m_motor = new PWMSparkMax(ArmConstants.kMotorPort);
|
||||
private final Encoder m_encoder =
|
||||
new Encoder(ArmConstants.kEncoderPorts[0], ArmConstants.kEncoderPorts[1]);
|
||||
private final ArmFeedforward m_feedforward =
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.armbot.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import edu.wpi.first.wpilibj.examples.armbot.Constants.DriveConstants;
|
||||
@@ -15,14 +15,14 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
// The motors on the left side of the drive.
|
||||
private final SpeedControllerGroup m_leftMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor2Port));
|
||||
|
||||
// The motors on the right side of the drive.
|
||||
private final SpeedControllerGroup m_rightMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kRightMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kRightMotor2Port));
|
||||
|
||||
// The robot's drive
|
||||
private final DifferentialDrive m_drive = new DifferentialDrive(m_leftMotors, m_rightMotors);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.armbotoffboard.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import edu.wpi.first.wpilibj.examples.armbotoffboard.Constants.DriveConstants;
|
||||
@@ -15,14 +15,14 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
// The motors on the left side of the drive.
|
||||
private final SpeedControllerGroup m_leftMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor2Port));
|
||||
|
||||
// The motors on the right side of the drive.
|
||||
private final SpeedControllerGroup m_rightMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kRightMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kRightMotor2Port));
|
||||
|
||||
// The robot's drive
|
||||
private final DifferentialDrive m_drive = new DifferentialDrive(m_leftMotors, m_rightMotors);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.armsimulation;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.RobotController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
@@ -38,7 +38,7 @@ public class Robot extends TimedRobot {
|
||||
// Standard classes for controlling our elevator
|
||||
private final PIDController m_controller = new PIDController(kArmKp, 0, 0);
|
||||
private final Encoder m_encoder = new Encoder(kEncoderAChannel, kEncoderBChannel);
|
||||
private final PWMVictorSPX m_motor = new PWMVictorSPX(kMotorPort);
|
||||
private final PWMSparkMax m_motor = new PWMSparkMax(kMotorPort);
|
||||
private final Joystick m_joystick = new Joystick(kJoystickPort);
|
||||
|
||||
// Simulation classes help us simulate what's going on, including gravity.
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.differentialdrivebot;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
@@ -25,10 +25,10 @@ public class Drivetrain {
|
||||
private static final double kWheelRadius = 0.0508; // meters
|
||||
private static final int kEncoderResolution = 4096;
|
||||
|
||||
private final SpeedController m_leftLeader = new PWMVictorSPX(1);
|
||||
private final SpeedController m_leftFollower = new PWMVictorSPX(2);
|
||||
private final SpeedController m_rightLeader = new PWMVictorSPX(3);
|
||||
private final SpeedController m_rightFollower = new PWMVictorSPX(4);
|
||||
private final SpeedController m_leftLeader = new PWMSparkMax(1);
|
||||
private final SpeedController m_leftFollower = new PWMSparkMax(2);
|
||||
private final SpeedController m_rightLeader = new PWMSparkMax(3);
|
||||
private final SpeedController m_rightFollower = new PWMSparkMax(4);
|
||||
|
||||
private final Encoder m_leftEncoder = new Encoder(0, 1);
|
||||
private final Encoder m_rightEncoder = new Encoder(2, 3);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.differentialdriveposeestimator;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
@@ -30,10 +30,10 @@ public class Drivetrain {
|
||||
private static final double kWheelRadius = 0.0508; // meters
|
||||
private static final int kEncoderResolution = 4096;
|
||||
|
||||
private final SpeedController m_leftLeader = new PWMVictorSPX(1);
|
||||
private final SpeedController m_leftFollower = new PWMVictorSPX(2);
|
||||
private final SpeedController m_rightLeader = new PWMVictorSPX(3);
|
||||
private final SpeedController m_rightFollower = new PWMVictorSPX(4);
|
||||
private final SpeedController m_leftLeader = new PWMSparkMax(1);
|
||||
private final SpeedController m_leftFollower = new PWMSparkMax(2);
|
||||
private final SpeedController m_rightLeader = new PWMSparkMax(3);
|
||||
private final SpeedController m_rightFollower = new PWMSparkMax(4);
|
||||
|
||||
private final Encoder m_leftEncoder = new Encoder(0, 1);
|
||||
private final Encoder m_rightEncoder = new Encoder(2, 3);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.elevatorprofiledpid;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.controller.ProfiledPIDController;
|
||||
@@ -17,7 +17,7 @@ public class Robot extends TimedRobot {
|
||||
|
||||
private final Joystick m_joystick = new Joystick(1);
|
||||
private final Encoder m_encoder = new Encoder(1, 2);
|
||||
private final SpeedController m_motor = new PWMVictorSPX(1);
|
||||
private final SpeedController m_motor = new PWMSparkMax(1);
|
||||
|
||||
// Create a PID controller whose setpoint's change is subject to maximum
|
||||
// velocity and acceleration constraints.
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.elevatorsimulation;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.RobotController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
@@ -43,7 +43,7 @@ public class Robot extends TimedRobot {
|
||||
// Standard classes for controlling our elevator
|
||||
private final PIDController m_controller = new PIDController(kElevatorKp, 0, 0);
|
||||
private final Encoder m_encoder = new Encoder(kEncoderAChannel, kEncoderBChannel);
|
||||
private final PWMVictorSPX m_motor = new PWMVictorSPX(kMotorPort);
|
||||
private final PWMSparkMax m_motor = new PWMSparkMax(kMotorPort);
|
||||
private final Joystick m_joystick = new Joystick(kJoystickPort);
|
||||
|
||||
// Simulation classes help us simulate what's going on, including gravity.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.frisbeebot.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import edu.wpi.first.wpilibj.examples.frisbeebot.Constants.DriveConstants;
|
||||
@@ -15,14 +15,14 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
// The motors on the left side of the drive.
|
||||
private final SpeedControllerGroup m_leftMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor2Port));
|
||||
|
||||
// The motors on the right side of the drive.
|
||||
private final SpeedControllerGroup m_rightMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kRightMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kRightMotor2Port));
|
||||
|
||||
// The robot's drive
|
||||
private final DifferentialDrive m_drive = new DifferentialDrive(m_leftMotors, m_rightMotors);
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
package edu.wpi.first.wpilibj.examples.frisbeebot.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
import edu.wpi.first.wpilibj.controller.SimpleMotorFeedforward;
|
||||
import edu.wpi.first.wpilibj.examples.frisbeebot.Constants.ShooterConstants;
|
||||
import edu.wpi.first.wpilibj2.command.PIDSubsystem;
|
||||
|
||||
public class ShooterSubsystem extends PIDSubsystem {
|
||||
private final PWMVictorSPX m_shooterMotor = new PWMVictorSPX(ShooterConstants.kShooterMotorPort);
|
||||
private final PWMVictorSPX m_feederMotor = new PWMVictorSPX(ShooterConstants.kFeederMotorPort);
|
||||
private final PWMSparkMax m_shooterMotor = new PWMSparkMax(ShooterConstants.kShooterMotorPort);
|
||||
private final PWMSparkMax m_feederMotor = new PWMSparkMax(ShooterConstants.kFeederMotorPort);
|
||||
private final Encoder m_shooterEncoder =
|
||||
new Encoder(
|
||||
ShooterConstants.kEncoderPorts[0],
|
||||
|
||||
@@ -7,7 +7,7 @@ package edu.wpi.first.wpilibj.examples.gearsbot.subsystems;
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
import edu.wpi.first.wpilibj.AnalogInput;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
@@ -21,10 +21,10 @@ public class DriveTrain extends SubsystemBase {
|
||||
* These include four drive motors, a left and right encoder and a gyro.
|
||||
*/
|
||||
private final SpeedController m_leftMotor =
|
||||
new SpeedControllerGroup(new PWMVictorSPX(0), new PWMVictorSPX(1));
|
||||
new SpeedControllerGroup(new PWMSparkMax(0), new PWMSparkMax(1));
|
||||
|
||||
private final SpeedController m_rightMotor =
|
||||
new SpeedControllerGroup(new PWMVictorSPX(2), new PWMVictorSPX(3));
|
||||
new SpeedControllerGroup(new PWMSparkMax(2), new PWMSparkMax(3));
|
||||
|
||||
private final DifferentialDrive m_drive = new DifferentialDrive(m_leftMotor, m_rightMotor);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.gettingstarted;
|
||||
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
@@ -18,7 +18,7 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
private final DifferentialDrive m_robotDrive =
|
||||
new DifferentialDrive(new PWMVictorSPX(0), new PWMVictorSPX(1));
|
||||
new DifferentialDrive(new PWMSparkMax(0), new PWMSparkMax(1));
|
||||
private final Joystick m_stick = new Joystick(0);
|
||||
private final Timer m_timer = new Timer();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.gyro;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class Robot extends TimedRobot {
|
||||
private static final int kJoystickPort = 0;
|
||||
|
||||
private final DifferentialDrive m_myRobot =
|
||||
new DifferentialDrive(new PWMVictorSPX(kLeftMotorPort), new PWMVictorSPX(kRightMotorPort));
|
||||
new DifferentialDrive(new PWMSparkMax(kLeftMotorPort), new PWMSparkMax(kRightMotorPort));
|
||||
private final AnalogGyro m_gyro = new AnalogGyro(kGyroPort);
|
||||
private final Joystick m_joystick = new Joystick(kJoystickPort);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.gyrodrivecommands.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.ADXRS450_Gyro;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import edu.wpi.first.wpilibj.examples.gyrodrivecommands.Constants.DriveConstants;
|
||||
@@ -17,14 +17,14 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
// The motors on the left side of the drive.
|
||||
private final SpeedControllerGroup m_leftMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor2Port));
|
||||
|
||||
// The motors on the right side of the drive.
|
||||
private final SpeedControllerGroup m_rightMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kRightMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kRightMotor2Port));
|
||||
|
||||
// The robot's drive
|
||||
private final DifferentialDrive m_drive = new DifferentialDrive(m_leftMotors, m_rightMotors);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.gyromecanum;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.MecanumDrive;
|
||||
|
||||
@@ -32,10 +32,10 @@ public class Robot extends TimedRobot {
|
||||
|
||||
@Override
|
||||
public void robotInit() {
|
||||
PWMVictorSPX frontLeft = new PWMVictorSPX(kFrontLeftChannel);
|
||||
PWMVictorSPX rearLeft = new PWMVictorSPX(kRearLeftChannel);
|
||||
PWMVictorSPX frontRight = new PWMVictorSPX(kFrontRightChannel);
|
||||
PWMVictorSPX rearRight = new PWMVictorSPX(kRearRightChannel);
|
||||
PWMSparkMax frontLeft = new PWMSparkMax(kFrontLeftChannel);
|
||||
PWMSparkMax rearLeft = new PWMSparkMax(kRearLeftChannel);
|
||||
PWMSparkMax frontRight = new PWMSparkMax(kFrontRightChannel);
|
||||
PWMSparkMax rearRight = new PWMSparkMax(kRearRightChannel);
|
||||
|
||||
// Invert the left side motors.
|
||||
// You may need to change or remove this to match your robot.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.hatchbotinlined.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import edu.wpi.first.wpilibj.examples.hatchbotinlined.Constants.DriveConstants;
|
||||
@@ -15,14 +15,14 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
// The motors on the left side of the drive.
|
||||
private final SpeedControllerGroup m_leftMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor2Port));
|
||||
|
||||
// The motors on the right side of the drive.
|
||||
private final SpeedControllerGroup m_rightMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kRightMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kRightMotor2Port));
|
||||
|
||||
// The robot's drive
|
||||
private final DifferentialDrive m_drive = new DifferentialDrive(m_leftMotors, m_rightMotors);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.hatchbottraditional.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import edu.wpi.first.wpilibj.examples.hatchbottraditional.Constants.DriveConstants;
|
||||
@@ -15,14 +15,14 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
// The motors on the left side of the drive.
|
||||
private final SpeedControllerGroup m_leftMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor2Port));
|
||||
|
||||
// The motors on the right side of the drive.
|
||||
private final SpeedControllerGroup m_rightMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kRightMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kRightMotor2Port));
|
||||
|
||||
// The robot's drive
|
||||
private final DifferentialDrive m_drive = new DifferentialDrive(m_leftMotors, m_rightMotors);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.mecanumbot;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
import edu.wpi.first.wpilibj.controller.SimpleMotorFeedforward;
|
||||
@@ -22,10 +22,10 @@ public class Drivetrain {
|
||||
public static final double kMaxSpeed = 3.0; // 3 meters per second
|
||||
public static final double kMaxAngularSpeed = Math.PI; // 1/2 rotation per second
|
||||
|
||||
private final SpeedController m_frontLeftMotor = new PWMVictorSPX(1);
|
||||
private final SpeedController m_frontRightMotor = new PWMVictorSPX(2);
|
||||
private final SpeedController m_backLeftMotor = new PWMVictorSPX(3);
|
||||
private final SpeedController m_backRightMotor = new PWMVictorSPX(4);
|
||||
private final SpeedController m_frontLeftMotor = new PWMSparkMax(1);
|
||||
private final SpeedController m_frontRightMotor = new PWMSparkMax(2);
|
||||
private final SpeedController m_backLeftMotor = new PWMSparkMax(3);
|
||||
private final SpeedController m_backRightMotor = new PWMSparkMax(4);
|
||||
|
||||
private final Encoder m_frontLeftEncoder = new Encoder(0, 1);
|
||||
private final Encoder m_frontRightEncoder = new Encoder(2, 3);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.mecanumcontrollercommand.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.ADXRS450_Gyro;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.drive.MecanumDrive;
|
||||
import edu.wpi.first.wpilibj.examples.mecanumcontrollercommand.Constants.DriveConstants;
|
||||
import edu.wpi.first.wpilibj.geometry.Pose2d;
|
||||
@@ -17,10 +17,10 @@ import edu.wpi.first.wpilibj.kinematics.MecanumDriveWheelSpeeds;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class DriveSubsystem extends SubsystemBase {
|
||||
private final PWMVictorSPX m_frontLeft = new PWMVictorSPX(DriveConstants.kFrontLeftMotorPort);
|
||||
private final PWMVictorSPX m_rearLeft = new PWMVictorSPX(DriveConstants.kRearLeftMotorPort);
|
||||
private final PWMVictorSPX m_frontRight = new PWMVictorSPX(DriveConstants.kFrontRightMotorPort);
|
||||
private final PWMVictorSPX m_rearRight = new PWMVictorSPX(DriveConstants.kRearRightMotorPort);
|
||||
private final PWMSparkMax m_frontLeft = new PWMSparkMax(DriveConstants.kFrontLeftMotorPort);
|
||||
private final PWMSparkMax m_rearLeft = new PWMSparkMax(DriveConstants.kRearLeftMotorPort);
|
||||
private final PWMSparkMax m_frontRight = new PWMSparkMax(DriveConstants.kFrontRightMotorPort);
|
||||
private final PWMSparkMax m_rearRight = new PWMSparkMax(DriveConstants.kRearRightMotorPort);
|
||||
|
||||
private final MecanumDrive m_drive =
|
||||
new MecanumDrive(m_frontLeft, m_rearLeft, m_frontRight, m_rearRight);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.mecanumdrive;
|
||||
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.MecanumDrive;
|
||||
|
||||
@@ -23,10 +23,10 @@ public class Robot extends TimedRobot {
|
||||
|
||||
@Override
|
||||
public void robotInit() {
|
||||
PWMVictorSPX frontLeft = new PWMVictorSPX(kFrontLeftChannel);
|
||||
PWMVictorSPX rearLeft = new PWMVictorSPX(kRearLeftChannel);
|
||||
PWMVictorSPX frontRight = new PWMVictorSPX(kFrontRightChannel);
|
||||
PWMVictorSPX rearRight = new PWMVictorSPX(kRearRightChannel);
|
||||
PWMSparkMax frontLeft = new PWMSparkMax(kFrontLeftChannel);
|
||||
PWMSparkMax rearLeft = new PWMSparkMax(kRearLeftChannel);
|
||||
PWMSparkMax frontRight = new PWMSparkMax(kFrontRightChannel);
|
||||
PWMSparkMax rearRight = new PWMSparkMax(kRearRightChannel);
|
||||
|
||||
// Invert the left side motors.
|
||||
// You may need to change or remove this to match your robot.
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.mecanumdriveposeestimator;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
@@ -27,10 +27,10 @@ public class Drivetrain {
|
||||
public static final double kMaxSpeed = 3.0; // 3 meters per second
|
||||
public static final double kMaxAngularSpeed = Math.PI; // 1/2 rotation per second
|
||||
|
||||
private final SpeedController m_frontLeftMotor = new PWMVictorSPX(1);
|
||||
private final SpeedController m_frontRightMotor = new PWMVictorSPX(2);
|
||||
private final SpeedController m_backLeftMotor = new PWMVictorSPX(3);
|
||||
private final SpeedController m_backRightMotor = new PWMVictorSPX(4);
|
||||
private final SpeedController m_frontLeftMotor = new PWMSparkMax(1);
|
||||
private final SpeedController m_frontRightMotor = new PWMSparkMax(2);
|
||||
private final SpeedController m_backLeftMotor = new PWMSparkMax(3);
|
||||
private final SpeedController m_backRightMotor = new PWMSparkMax(4);
|
||||
|
||||
private final Encoder m_frontLeftEncoder = new Encoder(0, 1);
|
||||
private final Encoder m_frontRightEncoder = new Encoder(2, 3);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.motorcontrol;
|
||||
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class Robot extends TimedRobot {
|
||||
|
||||
@Override
|
||||
public void robotInit() {
|
||||
m_motor = new PWMVictorSPX(kMotorPort);
|
||||
m_motor = new PWMSparkMax(kMotorPort);
|
||||
m_joystick = new Joystick(kJoystickPort);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.motorcontrolencoder;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
@@ -33,7 +33,7 @@ public class Robot extends TimedRobot {
|
||||
|
||||
@Override
|
||||
public void robotInit() {
|
||||
m_motor = new PWMVictorSPX(kMotorPort);
|
||||
m_motor = new PWMSparkMax(kMotorPort);
|
||||
m_joystick = new Joystick(kJoystickPort);
|
||||
m_encoder = new Encoder(kEncoderPortA, kEncoderPortB);
|
||||
// Use SetDistancePerPulse to set the multiplier for GetDistance
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.potentiometerpid;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogInput;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
@@ -42,7 +42,7 @@ public class Robot extends TimedRobot {
|
||||
@Override
|
||||
public void robotInit() {
|
||||
m_potentiometer = new AnalogInput(kPotChannel);
|
||||
m_elevatorMotor = new PWMVictorSPX(kMotorChannel);
|
||||
m_elevatorMotor = new PWMSparkMax(kMotorChannel);
|
||||
m_joystick = new Joystick(kJoystickChannel);
|
||||
|
||||
m_pidController = new PIDController(kP, kI, kD);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.ramsetecommand.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.ADXRS450_Gyro;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import edu.wpi.first.wpilibj.examples.ramsetecommand.Constants.DriveConstants;
|
||||
@@ -20,14 +20,14 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
// The motors on the left side of the drive.
|
||||
private final SpeedControllerGroup m_leftMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor2Port));
|
||||
|
||||
// The motors on the right side of the drive.
|
||||
private final SpeedControllerGroup m_rightMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kRightMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kRightMotor2Port));
|
||||
|
||||
// The robot's drive
|
||||
private final DifferentialDrive m_drive = new DifferentialDrive(m_leftMotors, m_rightMotors);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.ramsetecontroller;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
@@ -26,10 +26,10 @@ public class Drivetrain {
|
||||
private static final double kWheelRadius = 0.0508; // meters
|
||||
private static final int kEncoderResolution = 4096;
|
||||
|
||||
private final SpeedController m_leftLeader = new PWMVictorSPX(1);
|
||||
private final SpeedController m_leftFollower = new PWMVictorSPX(2);
|
||||
private final SpeedController m_rightLeader = new PWMVictorSPX(3);
|
||||
private final SpeedController m_rightFollower = new PWMVictorSPX(4);
|
||||
private final SpeedController m_leftLeader = new PWMSparkMax(1);
|
||||
private final SpeedController m_leftFollower = new PWMSparkMax(2);
|
||||
private final SpeedController m_rightLeader = new PWMSparkMax(3);
|
||||
private final SpeedController m_rightFollower = new PWMSparkMax(4);
|
||||
|
||||
private final Encoder m_leftEncoder = new Encoder(0, 1);
|
||||
private final Encoder m_rightEncoder = new Encoder(2, 3);
|
||||
|
||||
@@ -7,7 +7,7 @@ package edu.wpi.first.wpilibj.examples.shuffleboard;
|
||||
import edu.wpi.first.networktables.NetworkTableEntry;
|
||||
import edu.wpi.first.wpilibj.AnalogPotentiometer;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
@@ -16,11 +16,11 @@ import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||
|
||||
public class Robot extends TimedRobot {
|
||||
private final DifferentialDrive m_tankDrive =
|
||||
new DifferentialDrive(new PWMVictorSPX(0), new PWMVictorSPX(1));
|
||||
new DifferentialDrive(new PWMSparkMax(0), new PWMSparkMax(1));
|
||||
private final Encoder m_leftEncoder = new Encoder(0, 1);
|
||||
private final Encoder m_rightEncoder = new Encoder(2, 3);
|
||||
|
||||
private final PWMVictorSPX m_elevatorMotor = new PWMVictorSPX(2);
|
||||
private final PWMSparkMax m_elevatorMotor = new PWMSparkMax(2);
|
||||
private final AnalogPotentiometer m_elevatorPot = new AnalogPotentiometer(0);
|
||||
private NetworkTableEntry m_maxSpeed;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.simpledifferentialdrivesimulation;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.RobotController;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
@@ -37,10 +37,10 @@ public class Drivetrain {
|
||||
private static final double kWheelRadius = 0.0508;
|
||||
private static final int kEncoderResolution = -4096;
|
||||
|
||||
private final PWMVictorSPX m_leftLeader = new PWMVictorSPX(1);
|
||||
private final PWMVictorSPX m_leftFollower = new PWMVictorSPX(2);
|
||||
private final PWMVictorSPX m_rightLeader = new PWMVictorSPX(3);
|
||||
private final PWMVictorSPX m_rightFollower = new PWMVictorSPX(4);
|
||||
private final PWMSparkMax m_leftLeader = new PWMSparkMax(1);
|
||||
private final PWMSparkMax m_leftFollower = new PWMSparkMax(2);
|
||||
private final PWMSparkMax m_rightLeader = new PWMSparkMax(3);
|
||||
private final PWMSparkMax m_rightFollower = new PWMSparkMax(4);
|
||||
|
||||
private final SpeedControllerGroup m_leftGroup =
|
||||
new SpeedControllerGroup(m_leftLeader, m_leftFollower);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.statespacearm;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.controller.LinearQuadraticRegulator;
|
||||
@@ -91,7 +91,7 @@ public class Robot extends TimedRobot {
|
||||
// An encoder set up to measure arm position in radians.
|
||||
private final Encoder m_encoder = new Encoder(kEncoderAChannel, kEncoderBChannel);
|
||||
|
||||
private final SpeedController m_motor = new PWMVictorSPX(kMotorPort);
|
||||
private final SpeedController m_motor = new PWMSparkMax(kMotorPort);
|
||||
|
||||
// A joystick to read the trigger from.
|
||||
private final Joystick m_joystick = new Joystick(kJoystickPort);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.statespacedifferentialdrivesimulation.sub
|
||||
|
||||
import edu.wpi.first.wpilibj.ADXRS450_Gyro;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
import edu.wpi.first.wpilibj.RobotController;
|
||||
import edu.wpi.first.wpilibj.SpeedControllerGroup;
|
||||
@@ -28,14 +28,14 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
// The motors on the left side of the drive.
|
||||
private final SpeedControllerGroup m_leftMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kLeftMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kLeftMotor2Port));
|
||||
|
||||
// The motors on the right side of the drive.
|
||||
private final SpeedControllerGroup m_rightMotors =
|
||||
new SpeedControllerGroup(
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor1Port),
|
||||
new PWMVictorSPX(DriveConstants.kRightMotor2Port));
|
||||
new PWMSparkMax(DriveConstants.kRightMotor1Port),
|
||||
new PWMSparkMax(DriveConstants.kRightMotor2Port));
|
||||
|
||||
// The robot's drive
|
||||
private final DifferentialDrive m_drive = new DifferentialDrive(m_leftMotors, m_rightMotors);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.statespaceelevator;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.controller.LinearQuadraticRegulator;
|
||||
@@ -94,7 +94,7 @@ public class Robot extends TimedRobot {
|
||||
// An encoder set up to measure elevator height in meters.
|
||||
private final Encoder m_encoder = new Encoder(kEncoderAChannel, kEncoderBChannel);
|
||||
|
||||
private final SpeedController m_motor = new PWMVictorSPX(kMotorPort);
|
||||
private final SpeedController m_motor = new PWMSparkMax(kMotorPort);
|
||||
|
||||
// A joystick to read the trigger from.
|
||||
private final Joystick m_joystick = new Joystick(kJoystickPort);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.statespaceflywheel;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.controller.LinearQuadraticRegulator;
|
||||
@@ -77,7 +77,7 @@ public class Robot extends TimedRobot {
|
||||
// An encoder set up to measure flywheel velocity in radians per second.
|
||||
private final Encoder m_encoder = new Encoder(kEncoderAChannel, kEncoderBChannel);
|
||||
|
||||
private final SpeedController m_motor = new PWMVictorSPX(kMotorPort);
|
||||
private final SpeedController m_motor = new PWMSparkMax(kMotorPort);
|
||||
|
||||
// A joystick to read the trigger from.
|
||||
private final Joystick m_joystick = new Joystick(kJoystickPort);
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.statespaceflywheelsysid;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.controller.LinearQuadraticRegulator;
|
||||
@@ -72,7 +72,7 @@ public class Robot extends TimedRobot {
|
||||
// An encoder set up to measure flywheel velocity in radians per second.
|
||||
private final Encoder m_encoder = new Encoder(kEncoderAChannel, kEncoderBChannel);
|
||||
|
||||
private final SpeedController m_motor = new PWMVictorSPX(kMotorPort);
|
||||
private final SpeedController m_motor = new PWMSparkMax(kMotorPort);
|
||||
|
||||
// A joystick to read the trigger from.
|
||||
private final Joystick m_joystick = new Joystick(kJoystickPort);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.swervebot;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
import edu.wpi.first.wpilibj.controller.ProfiledPIDController;
|
||||
@@ -49,8 +49,8 @@ public class SwerveModule {
|
||||
* @param turningMotorChannel ID for the turning motor.
|
||||
*/
|
||||
public SwerveModule(int driveMotorChannel, int turningMotorChannel) {
|
||||
m_driveMotor = new PWMVictorSPX(driveMotorChannel);
|
||||
m_turningMotor = new PWMVictorSPX(turningMotorChannel);
|
||||
m_driveMotor = new PWMSparkMax(driveMotorChannel);
|
||||
m_turningMotor = new PWMSparkMax(turningMotorChannel);
|
||||
|
||||
// Set the distance per pulse for the drive encoder. We can simply use the
|
||||
// distance traveled for one rotation of the wheel divided by the encoder
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.swervesdriveposeestimator;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
import edu.wpi.first.wpilibj.controller.ProfiledPIDController;
|
||||
@@ -49,8 +49,8 @@ public class SwerveModule {
|
||||
* @param turningMotorChannel ID for the turning motor.
|
||||
*/
|
||||
public SwerveModule(int driveMotorChannel, int turningMotorChannel) {
|
||||
m_driveMotor = new PWMVictorSPX(driveMotorChannel);
|
||||
m_turningMotor = new PWMVictorSPX(turningMotorChannel);
|
||||
m_driveMotor = new PWMSparkMax(driveMotorChannel);
|
||||
m_turningMotor = new PWMSparkMax(turningMotorChannel);
|
||||
|
||||
// Set the distance per pulse for the drive encoder. We can simply use the
|
||||
// distance traveled for one rotation of the wheel divided by the encoder
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.tankdrive;
|
||||
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Robot extends TimedRobot {
|
||||
|
||||
@Override
|
||||
public void robotInit() {
|
||||
m_myRobot = new DifferentialDrive(new PWMVictorSPX(0), new PWMVictorSPX(1));
|
||||
m_myRobot = new DifferentialDrive(new PWMSparkMax(0), new PWMSparkMax(1));
|
||||
m_leftStick = new Joystick(0);
|
||||
m_rightStick = new Joystick(1);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.tankdrivexboxcontroller;
|
||||
|
||||
import edu.wpi.first.wpilibj.GenericHID.Hand;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.XboxController;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
@@ -15,8 +15,8 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
* steering and an Xbox controller.
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
private final PWMVictorSPX m_leftMotor = new PWMVictorSPX(0);
|
||||
private final PWMVictorSPX m_rightMotor = new PWMVictorSPX(1);
|
||||
private final PWMSparkMax m_leftMotor = new PWMSparkMax(0);
|
||||
private final PWMSparkMax m_rightMotor = new PWMSparkMax(1);
|
||||
private final DifferentialDrive m_robotDrive = new DifferentialDrive(m_leftMotor, m_rightMotor);
|
||||
private final XboxController m_driverController = new XboxController(0);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.ultrasonic;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogInput;
|
||||
import edu.wpi.first.wpilibj.MedianFilter;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Robot extends TimedRobot {
|
||||
|
||||
private final AnalogInput m_ultrasonic = new AnalogInput(kUltrasonicPort);
|
||||
private final DifferentialDrive m_robotDrive =
|
||||
new DifferentialDrive(new PWMVictorSPX(kLeftMotorPort), new PWMVictorSPX(kRightMotorPort));
|
||||
new DifferentialDrive(new PWMSparkMax(kLeftMotorPort), new PWMSparkMax(kRightMotorPort));
|
||||
|
||||
/**
|
||||
* Tells the robot to drive to a set distance (in inches) from an object using proportional
|
||||
|
||||
@@ -6,7 +6,7 @@ package edu.wpi.first.wpilibj.examples.ultrasonicpid;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogInput;
|
||||
import edu.wpi.first.wpilibj.MedianFilter;
|
||||
import edu.wpi.first.wpilibj.PWMVictorSPX;
|
||||
import edu.wpi.first.wpilibj.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.controller.PIDController;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
@@ -40,7 +40,7 @@ public class Robot extends TimedRobot {
|
||||
|
||||
private final AnalogInput m_ultrasonic = new AnalogInput(kUltrasonicPort);
|
||||
private final DifferentialDrive m_robotDrive =
|
||||
new DifferentialDrive(new PWMVictorSPX(kLeftMotorPort), new PWMVictorSPX(kRightMotorPort));
|
||||
new DifferentialDrive(new PWMSparkMax(kLeftMotorPort), new PWMSparkMax(kRightMotorPort));
|
||||
private final PIDController m_pidController = new PIDController(kP, kI, kD);
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user