Skip to content

Commit

Permalink
end of day one del rio
Browse files Browse the repository at this point in the history
  • Loading branch information
VarunGorti committed Mar 24, 2019
1 parent 7f7bbd9 commit dddb0a9
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
11 changes: 6 additions & 5 deletions 2019 Comp Season Code/src/main/cpp/Robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,14 @@ void Robot::AutonomousPeriodic() {
frc::Scheduler::GetInstance()->Run();
Log();

m_carriage.SetHatchHolder(m_carriage.holderToGo);

// Check if the encoder breaks
if(m_elevator.EncoderBroken()) {
m_elevator.encoderBroken = true;
}

m_carriage.SetHatchScorer(m_carriage.scorerToGo);
}

void Robot::TeleopInit() {
Expand Down Expand Up @@ -179,11 +183,8 @@ void Robot::TeleopPeriodic() {
frc::Scheduler::GetInstance()->Run();
Log();

if(m_elevator.GetHeight() < 80 && m_elevator.hasZeroed) {
m_carriage.SetHatchHolder(false);
} else {
m_carriage.SetHatchHolder(m_carriage.holderToGo);
}
m_carriage.SetHatchHolder(m_carriage.holderToGo);


// Check if the encoder breaks
if(m_elevator.EncoderBroken()) {
Expand Down
6 changes: 3 additions & 3 deletions 2019 Comp Season Code/src/main/cpp/commands/AutoAlign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ void AutoAlign::Execute() {
Robot::m_drivetrain.m_robotDrive.ArcadeDrive(0.0,0.0);
}

if(table->GetNumber("ta",0.0) >= 1.7) {
// done = true;
}
// if(table->GetNumber("ta",0.0) >= 1.7) {
// // done = true;
// }
// } else {
// table->PutNumber("ledMode",1);
// table->PutNumber("camMode",1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void ElevatorManual::Execute() {
// If we are going down, DO half-speed mode, ELSE full speed mode
// NOTE: Negative yVal runs the lift up and vice versa
if(yVal > 0) {
yVal = yVal / 2.0;
yVal = yVal / 1.5;
}

// If we are out of deadband
Expand All @@ -53,15 +53,15 @@ void ElevatorManual::Execute() {

// TODO: Make this .25 with comp code
// If we are already towards the bottom and still trying to run the lift down
if(Robot::m_elevator.GetHeight() < 80 && yVal > .15) {
if(Robot::m_elevator.GetHeight() < 80 && yVal > .25) {
// Set the elevator to go quite slow
Robot::m_elevator.SetLiftSpeed(.15);
Robot::m_elevator.SetLiftSpeed(.25);

// As long as we are not at the very bottom and trying to go down
} else if(!(Robot::m_elevator.IsAtLowerLimit() && yVal > 0)) {
// Set the elevator to the y Value of the joystick
Robot::m_elevator.SetLiftSpeed(yVal);

// This means we are 0'd on the encoder
} else {
// Set it to 0 completely
Expand Down
8 changes: 5 additions & 3 deletions 2019 Comp Season Code/src/main/cpp/commands/SetHatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ SetHatch::SetHatch(bool scorerToGo) {
void SetHatch::Initialize() {
// Set the carriage to go to the new (or old) location
// toGo = (Robot::m_oi.g_shift || (Robot::m_elevator.GetHeight() < 80 && Robot::m_elevator.hasZeroed)) ? Robot::m_carriage.GetHatchScorer() : !Robot::m_carriage.GetHatchScorer();
if(!(Robot::m_elevator.GetHeight() < 80 && Robot::m_elevator.hasZeroed)) {
Robot::m_carriage.scorerToGo = toGo;
}
// if(!(Robot::m_elevator.GetHeight() < 80 && Robot::m_elevator.hasZeroed)) {
// Robot::m_carriage.scorerToGo = toGo;
// }

Robot::m_carriage.scorerToGo = toGo;
}

// Make this return true when this Command no longer needs to run execute()
Expand Down
2 changes: 1 addition & 1 deletion 2019 Comp Season Code/src/main/cpp/subsystems/Carriage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <subsystems/Carriage.h>

Carriage::Carriage() : frc::Subsystem("Carriage") {
holderToGo = false;
holderToGo = true;
}

void Carriage::InitDefaultCommand() {
Expand Down
5 changes: 3 additions & 2 deletions 2019 Comp Season Code/src/main/cpp/subsystems/Drivetrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ void Drivetrain::UpdateLimelightTracking() {
m_LimelightTurnCmd = clamp(m_LimelightTurnCmd,-MAX_STEER,MAX_STEER);

// drive forward until the target area reaches our desired area
m_LimelightDriveCmd = (DESIRED_TARGET_AREA - ta) * DRIVE_K;
m_LimelightDriveCmd = clamp(m_LimelightDriveCmd,-MAX_DRIVE,MAX_DRIVE);
// m_LimelightDriveCmd = (DESIRED_TARGET_AREA - ta) * DRIVE_K;
// m_LimelightDriveCmd = clamp(m_LimelightDriveCmd,-MAX_DRIVE,MAX_DRIVE);
m_LimelightDriveCmd = .5;
}
}

Expand Down

0 comments on commit dddb0a9

Please sign in to comment.