Skip to content

Commit

Permalink
testing, added shuffleboard
Browse files Browse the repository at this point in the history
  • Loading branch information
CooperNelson16 authored and mray190 committed Nov 20, 2020
1 parent cc3bfd4 commit 04d2d78
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 10 deletions.
13 changes: 6 additions & 7 deletions Competition/src/main/cpp/subsystems/Spindexer.cpp
Original file line number Diff line number Diff line change
@@ -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);
}

Expand All @@ -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;
}
Expand All @@ -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);
}
}
2 changes: 1 addition & 1 deletion Competition/src/main/include/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace DriveConstants {
}

namespace SpindexerConstants {
constexpr static int CAN_ID = 8;
constexpr static int CAN_ID = 3;
}

#endif
5 changes: 3 additions & 2 deletions Competition/src/main/include/subsystems/Spindexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <frc/smartdashboard/SmartDashboard.h>
#include <ctre/Phoenix.h>
#include <rev/CANSparkMax.h>
#include <frc/livewindow/LiveWindow.h>
#include <frc/SpeedControllerGroup.h>
#include <networktables/NetworkTableEntry.h>
Expand Down Expand Up @@ -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;

Expand Down
70 changes: 70 additions & 0 deletions Competition/vendordeps/REVRobotics.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 04d2d78

Please sign in to comment.