Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(leds):spiked leds #136

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/cpp/subsystems/Drivetrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ Drivetrain::Drivetrain(frc::TimedRobot *_robot) : ValorSubsystem(_robot, "Drivet
estimator(NULL),
config(NULL),
thetaController{KPT, KIT, KDT, frc::ProfiledPIDController<units::radians>::Constraints(units::angular_velocity::radians_per_second_t{rotMaxSpeed}, units::angular_acceleration::radians_per_second_squared_t{rotMaxAccel})},
swerveNoError(true)
swerveNoError(true),
candle(robot, 286, 60, "baseCAN")
{
frc2::CommandScheduler::GetInstance().RegisterSubsystem(this);
init();
Expand Down Expand Up @@ -316,6 +317,10 @@ void Drivetrain::assignOutputs()
limeTable->PutNumber("pipeline", LimelightPipes::APRIL_TAGS);
drive(state.xSpeedMPS, state.ySpeedMPS, state.rotRPS, true);
}

if((fabs(state.xSpeed) + fabs(state.ySpeed))/2.0 > 0.8){
candle.setAnimation(candle.Rainbow);
}
}

void Drivetrain::pullSwerveModuleZeroReference(){
Expand Down
5 changes: 4 additions & 1 deletion src/main/cpp/subsystems/Intake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

Intake::Intake(frc::TimedRobot *_robot) : ValorSubsystem(_robot, "Intake"),
intakeMotor(CANIDs::INTAKE_LEAD_CAN, ValorNeutralMode::Coast, false, "baseCAN"),
currentSensor(_robot, subsystemName)
currentSensor(_robot, subsystemName),
candle(robot, 286, CANIDs::CANDLE, "baseCAN")

{
frc2::CommandScheduler::GetInstance().RegisterSubsystem(this);
Expand Down Expand Up @@ -175,6 +176,8 @@ void Intake::assignOutputs()
state.isCubeStall = false;
}
}

state.intakeState == SPIKED?candle.setAnimation(candle.Strobe):candle.clearAnimation();
prevState = state;
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/include/subsystems/Drivetrain.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "controllers/ValorFalconController.h"
#include "controllers/ValorNeoController.h"
#include "controllers/ValorPIDF.h"
#include "sensors/ValorCANdleSensor.h"

#include "AHRS.h"
#include "ctre/phoenix/sensors/WPI_Pigeon2.h"
Expand Down Expand Up @@ -285,4 +286,6 @@ class Drivetrain : public ValorSubsystem
std::shared_ptr<nt::NetworkTable> limeTable;

bool swerveNoError;

ValorCANdleSensor candle;
};
3 changes: 3 additions & 0 deletions src/main/include/subsystems/Intake.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "subsystems/Direction.h"
#include "subsystems/Position.h"
#include "subsystems/Piece.h"
#include "sensors/ValorCANdleSensor.h"

#include <frc/smartdashboard/SendableChooser.h>
#include <frc/smartdashboard/SmartDashboard.h>
Expand Down Expand Up @@ -131,4 +132,6 @@ class Intake : public ValorSubsystem
ValorFalconController intakeMotor;

ValorCurrentSensor currentSensor;

ValorCANdleSensor candle;
};