Skip to content

Commit 04d2d78

Browse files
CooperNelson16mray190
authored andcommitted
testing, added shuffleboard
1 parent cc3bfd4 commit 04d2d78

File tree

4 files changed

+80
-10
lines changed

4 files changed

+80
-10
lines changed

Competition/src/main/cpp/subsystems/Spindexer.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#include "subsystems/Spindexer.h"
22

33
Spindexer::Spindexer() : ValorSubsystem(),
4-
motor{SpindexerConstants::CAN_ID} {
4+
motor{SpindexerConstants::CAN_ID, rev::CANSparkMax::MotorType::kBrushless} {
55
frc2::CommandScheduler::GetInstance().RegisterSubsystem(this);
66
spinTable = nt::NetworkTableInstance::GetDefault().GetTable("spindexer");
7-
spinTable->GetEntry("Speed?").SetDouble(0.0);
7+
spinTable->GetEntry("Spindexer Speed").SetDouble(0.0);
88
}
99

1010
void Spindexer::init() {
11+
motor.SetIdleMode(rev::CANSparkMax::IdleMode::kCoast);
1112
motor.SetInverted(false);
1213
}
1314

@@ -31,9 +32,7 @@ void Spindexer::assessInputs() {
3132

3233
if (driverController->GetBumper(frc::GenericHID::kLeftHand)) {
3334
state.spinState = SpindexerState::ENABLED;
34-
double power2 = spinTable->GetEntry("Speed?").GetDouble(0.0);
35-
frc::SmartDashboard::PutNumber("Spindexer Speed", power2);
36-
state.powah = 1.0;
35+
state.power = spinTable->GetEntry("Spindexer Speed").GetDouble(0.0);
3736
} else {
3837
state.spinState = SpindexerState::DISABLED;
3938
}
@@ -43,8 +42,8 @@ void Spindexer::assignOutputs() {
4342
state.spinState == SpindexerState::ENABLED ? frc::SmartDashboard::PutString("State", "Enabled") : frc::SmartDashboard::PutString("State", "Disabled");
4443

4544
if (state.spinState == SpindexerState::ENABLED) {
46-
motor.Set(ctre::phoenix::motorcontrol::VictorSPXControlMode::PercentOutput, state.powah);
45+
motor.Set(state.power);
4746
} else {
48-
motor.Set(ctre::phoenix::motorcontrol::VictorSPXControlMode::PercentOutput, 0);
47+
motor.Set(0);
4948
}
5049
}

Competition/src/main/include/Constants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace DriveConstants {
3737
}
3838

3939
namespace SpindexerConstants {
40-
constexpr static int CAN_ID = 8;
40+
constexpr static int CAN_ID = 3;
4141
}
4242

4343
#endif

Competition/src/main/include/subsystems/Spindexer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <frc/smartdashboard/SmartDashboard.h>
88
#include <ctre/Phoenix.h>
9+
#include <rev/CANSparkMax.h>
910
#include <frc/livewindow/LiveWindow.h>
1011
#include <frc/SpeedControllerGroup.h>
1112
#include <networktables/NetworkTableEntry.h>
@@ -36,10 +37,10 @@ class Spindexer : public ValorSubsystem {
3637

3738
struct x {
3839
SpindexerState spinState;
39-
double powah;
40+
double power;
4041
} state;
4142
private:
42-
VictorSPX motor;
43+
rev::CANSparkMax motor;
4344

4445
frc::XboxController* driverController;
4546

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"cppDependencies": [
3+
{
4+
"artifactId": "SparkMax-cpp",
5+
"binaryPlatforms": [
6+
"windowsx86-64",
7+
"windowsx86",
8+
"linuxaarch64bionic",
9+
"linuxx86-64",
10+
"linuxathena",
11+
"linuxraspbian"
12+
],
13+
"groupId": "com.revrobotics.frc",
14+
"headerClassifier": "headers",
15+
"libName": "SparkMax",
16+
"sharedLibrary": false,
17+
"skipInvalidPlatforms": true,
18+
"version": "1.5.2"
19+
},
20+
{
21+
"artifactId": "SparkMax-driver",
22+
"binaryPlatforms": [
23+
"windowsx86-64",
24+
"windowsx86",
25+
"linuxaarch64bionic",
26+
"linuxx86-64",
27+
"linuxathena",
28+
"linuxraspbian"
29+
],
30+
"groupId": "com.revrobotics.frc",
31+
"headerClassifier": "headers",
32+
"libName": "SparkMaxDriver",
33+
"sharedLibrary": false,
34+
"skipInvalidPlatforms": true,
35+
"version": "1.5.2"
36+
}
37+
],
38+
"fileName": "REVRobotics.json",
39+
"javaDependencies": [
40+
{
41+
"artifactId": "SparkMax-java",
42+
"groupId": "com.revrobotics.frc",
43+
"version": "1.5.2"
44+
}
45+
],
46+
"jniDependencies": [
47+
{
48+
"artifactId": "SparkMax-driver",
49+
"groupId": "com.revrobotics.frc",
50+
"isJar": false,
51+
"skipInvalidPlatforms": true,
52+
"validPlatforms": [
53+
"windowsx86-64",
54+
"windowsx86",
55+
"linuxaarch64bionic",
56+
"linuxx86-64",
57+
"linuxathena",
58+
"linuxraspbian"
59+
],
60+
"version": "1.5.2"
61+
}
62+
],
63+
"jsonUrl": "http://www.revrobotics.com/content/sw/max/sdk/REVRobotics.json",
64+
"mavenUrls": [
65+
"http://www.revrobotics.com/content/sw/max/sdk/maven/"
66+
],
67+
"name": "REVRobotics",
68+
"uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb",
69+
"version": "1.5.2"
70+
}

0 commit comments

Comments
 (0)