Skip to content

Commit

Permalink
feeder tuning for current intake
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitalamgari committed Apr 4, 2022
1 parent aaaadd1 commit 68ec834
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Competition/src/main/cpp/subsystems/Feeder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ void Feeder::assessInputs()
state.feederState = FeederState::FEEDER_DISABLE;
}

// Calculate instantaneous current
calcCurrent();

}

void Feeder::analyzeDashboard()
{
// Calculate instantaneous current
calcCurrent();
state.reversed = table->GetBoolean("Reverse Feeder?", false);
state.intakeReverseSpeed = table->GetNumber("Intake Reverse Speed", FeederConstants::DEFAULT_INTAKE_SPEED_REVERSE);
state.feederReverseSpeed = table->GetNumber("Feeder Reverse Speed", FeederConstants::DEFAULT_FEEDER_SPEED_REVERSE);
Expand Down
5 changes: 3 additions & 2 deletions Competition/src/main/cpp/subsystems/TurretTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void TurretTracker::init() {
initTable("TurretTracker");
table->PutBoolean("Use Turret Shoot", false);
table->PutNumber("Joystick Multiplier", ShooterConstants::jMultiplier);
table->PutNumber("Delta Heading", 0);
}

void TurretTracker::setDrivetrain(Drivetrain *dt){
Expand Down Expand Up @@ -51,13 +52,13 @@ double TurretTracker::tMinusJ(double robotHeading, double turretPos, double jx,
double ry = ty - jy;

double turretHeadingDesired = atan2(ry, rx);
double deltaHeading = turretHeading - turretHeadingDesired;
double deltaHeading = turretHeading - (turretHeadingDesired * MathConstants::toDegrees);

if (deltaHeading < -180) deltaHeading += 360;
if (deltaHeading > 180) deltaHeading -= 360;

table->PutNumber("Delta Heading", deltaHeading);
return deltaHeading;
return -deltaHeading;
}

void TurretTracker::assignOutputs() {
Expand Down
2 changes: 1 addition & 1 deletion Competition/src/main/include/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ namespace FeederConstants{
constexpr static double DEFAULT_FEEDER_SPEED_REVERSE = -1.0;

constexpr static int CACHE_SIZE = 20;
constexpr static double JAM_CURRENT = 30;
constexpr static double JAM_CURRENT = 20;
}

namespace MathConstants{
Expand Down

0 comments on commit 68ec834

Please sign in to comment.