From 04d2d78834762b1f3e78ade199d1fd9b34307d29 Mon Sep 17 00:00:00 2001 From: Cooper Date: Fri, 20 Nov 2020 17:13:55 -0600 Subject: [PATCH] testing, added shuffleboard --- .../src/main/cpp/subsystems/Spindexer.cpp | 13 ++-- Competition/src/main/include/Constants.h | 2 +- .../src/main/include/subsystems/Spindexer.h | 5 +- Competition/vendordeps/REVRobotics.json | 70 +++++++++++++++++++ 4 files changed, 80 insertions(+), 10 deletions(-) create mode 100644 Competition/vendordeps/REVRobotics.json diff --git a/Competition/src/main/cpp/subsystems/Spindexer.cpp b/Competition/src/main/cpp/subsystems/Spindexer.cpp index 55687fa..73f2fb2 100644 --- a/Competition/src/main/cpp/subsystems/Spindexer.cpp +++ b/Competition/src/main/cpp/subsystems/Spindexer.cpp @@ -1,13 +1,14 @@ #include "subsystems/Spindexer.h" Spindexer::Spindexer() : ValorSubsystem(), - motor{SpindexerConstants::CAN_ID} { + motor{SpindexerConstants::CAN_ID, rev::CANSparkMax::MotorType::kBrushless} { frc2::CommandScheduler::GetInstance().RegisterSubsystem(this); spinTable = nt::NetworkTableInstance::GetDefault().GetTable("spindexer"); - spinTable->GetEntry("Speed?").SetDouble(0.0); + spinTable->GetEntry("Spindexer Speed").SetDouble(0.0); } void Spindexer::init() { + motor.SetIdleMode(rev::CANSparkMax::IdleMode::kCoast); motor.SetInverted(false); } @@ -31,9 +32,7 @@ void Spindexer::assessInputs() { if (driverController->GetBumper(frc::GenericHID::kLeftHand)) { state.spinState = SpindexerState::ENABLED; - double power2 = spinTable->GetEntry("Speed?").GetDouble(0.0); - frc::SmartDashboard::PutNumber("Spindexer Speed", power2); - state.powah = 1.0; + state.power = spinTable->GetEntry("Spindexer Speed").GetDouble(0.0); } else { state.spinState = SpindexerState::DISABLED; } @@ -43,8 +42,8 @@ void Spindexer::assignOutputs() { state.spinState == SpindexerState::ENABLED ? frc::SmartDashboard::PutString("State", "Enabled") : frc::SmartDashboard::PutString("State", "Disabled"); if (state.spinState == SpindexerState::ENABLED) { - motor.Set(ctre::phoenix::motorcontrol::VictorSPXControlMode::PercentOutput, state.powah); + motor.Set(state.power); } else { - motor.Set(ctre::phoenix::motorcontrol::VictorSPXControlMode::PercentOutput, 0); + motor.Set(0); } } \ No newline at end of file diff --git a/Competition/src/main/include/Constants.h b/Competition/src/main/include/Constants.h index 31b0e71..cd71d2f 100644 --- a/Competition/src/main/include/Constants.h +++ b/Competition/src/main/include/Constants.h @@ -37,7 +37,7 @@ namespace DriveConstants { } namespace SpindexerConstants { - constexpr static int CAN_ID = 8; + constexpr static int CAN_ID = 3; } #endif diff --git a/Competition/src/main/include/subsystems/Spindexer.h b/Competition/src/main/include/subsystems/Spindexer.h index 7b1a7fc..9b158fd 100644 --- a/Competition/src/main/include/subsystems/Spindexer.h +++ b/Competition/src/main/include/subsystems/Spindexer.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -36,10 +37,10 @@ class Spindexer : public ValorSubsystem { struct x { SpindexerState spinState; - double powah; + double power; } state; private: - VictorSPX motor; + rev::CANSparkMax motor; frc::XboxController* driverController; diff --git a/Competition/vendordeps/REVRobotics.json b/Competition/vendordeps/REVRobotics.json new file mode 100644 index 0000000..0d99fcd --- /dev/null +++ b/Competition/vendordeps/REVRobotics.json @@ -0,0 +1,70 @@ +{ + "cppDependencies": [ + { + "artifactId": "SparkMax-cpp", + "binaryPlatforms": [ + "windowsx86-64", + "windowsx86", + "linuxaarch64bionic", + "linuxx86-64", + "linuxathena", + "linuxraspbian" + ], + "groupId": "com.revrobotics.frc", + "headerClassifier": "headers", + "libName": "SparkMax", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "version": "1.5.2" + }, + { + "artifactId": "SparkMax-driver", + "binaryPlatforms": [ + "windowsx86-64", + "windowsx86", + "linuxaarch64bionic", + "linuxx86-64", + "linuxathena", + "linuxraspbian" + ], + "groupId": "com.revrobotics.frc", + "headerClassifier": "headers", + "libName": "SparkMaxDriver", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "version": "1.5.2" + } + ], + "fileName": "REVRobotics.json", + "javaDependencies": [ + { + "artifactId": "SparkMax-java", + "groupId": "com.revrobotics.frc", + "version": "1.5.2" + } + ], + "jniDependencies": [ + { + "artifactId": "SparkMax-driver", + "groupId": "com.revrobotics.frc", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "windowsx86", + "linuxaarch64bionic", + "linuxx86-64", + "linuxathena", + "linuxraspbian" + ], + "version": "1.5.2" + } + ], + "jsonUrl": "http://www.revrobotics.com/content/sw/max/sdk/REVRobotics.json", + "mavenUrls": [ + "http://www.revrobotics.com/content/sw/max/sdk/maven/" + ], + "name": "REVRobotics", + "uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb", + "version": "1.5.2" +} \ No newline at end of file