Skip to content
This repository was archived by the owner on Apr 22, 2019. It is now read-only.

Commit c3d53dd

Browse files
committed
Climb is restarting! D: almost fixed...
Needs one more test and maybe more tweaks Current fix is a HasClimbed bool
1 parent bf4da99 commit c3d53dd

File tree

6 files changed

+12394
-11
lines changed

6 files changed

+12394
-11
lines changed

replay_pid140352.log

+5,670
Large diffs are not rendered by default.

replay_pid93516.log

+5,377
Large diffs are not rendered by default.

replay_pid94836.log

+1,320
Large diffs are not rendered by default.

src/main/cpp/Autonomous/AutoClimbHigh.cpp

+16-8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "Autonomous/AutoClimbHigh.h"
99
#include "Robot.h"
1010

11+
1112
AutoClimbHigh::AutoClimbHigh() {
1213
Requires(Robot::m_Arm);
1314
Requires(Robot::m_Leg);
@@ -16,6 +17,7 @@ AutoClimbHigh::AutoClimbHigh() {
1617
this->pTimer = new frc::Timer();
1718
this->stage = S_LOWER_ARM;
1819
this->onFloor = true;
20+
this->hasClimbed = false;
1921
}
2022

2123
void AutoClimbHigh::Initialize() {
@@ -27,14 +29,16 @@ void AutoClimbHigh::Initialize() {
2729

2830
void AutoClimbHigh::Execute() {
2931
// Execute the appropriate function for the current stage of climb
30-
switch (this->stage) {
31-
case S_LOWER_ARM : this->Execute_LowerArm() ; break;
32-
case S_LOWER_LEG : this->Execute_LowerLeg() ; break;
33-
case S_CRAWL : this->Execute_Crawl() ; break;
34-
case S_DRIVE : this->Execute_Drive() ; break;
35-
case S_RAISE_LEG : this->Execute_Raiseleg() ; break;
36-
default : this->stage = S_FINISHED ; break;
37-
}
32+
if (!this->hasClimbed) {
33+
switch (this->stage) {
34+
case S_LOWER_ARM : this->Execute_LowerArm() ; break;
35+
case S_LOWER_LEG : this->Execute_LowerLeg() ; break;
36+
case S_CRAWL : this->Execute_Crawl() ; break;
37+
case S_DRIVE : this->Execute_Drive() ; break;
38+
case S_RAISE_LEG : this->Execute_Raiseleg() ; break;
39+
default : this->stage = S_FINISHED ; break;
40+
}
41+
}
3842
}
3943

4044
void AutoClimbHigh::Execute_LowerArm(void) {
@@ -127,6 +131,8 @@ void AutoClimbHigh::End() {
127131
Robot::m_Leg->MoveLeg(0.0);
128132
Robot::m_DriveTrain->TankDrive(0.0, 0.0);
129133
Robot::m_CrawlDrive->Move(0.0);
134+
ClimbManager::CurrentClimbState = ClimbManager::ClimbState::kInactive;
135+
this->hasClimbed = true;
130136
this->pTimer->Stop();
131137
}
132138

@@ -136,5 +142,7 @@ void AutoClimbHigh::Interrupted() {
136142
Robot::m_Leg->MoveLeg(0.0);
137143
Robot::m_DriveTrain->TankDrive(0.0, 0.0);
138144
Robot::m_CrawlDrive->Move(0.0);
145+
ClimbManager::CurrentClimbState = ClimbManager::ClimbState::kInactive;
146+
this->hasClimbed = true;
139147
this->pTimer->Stop();
140148
}

src/main/cpp/Robot.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,14 @@ void Robot::SharedPeriodic(){
206206
this->pClimb->Start();
207207
}
208208
}
209-
if (ClimbManager::CurrentClimbSate == ClimbManager::ClimbSate::kAuto) {
209+
if (ClimbManager::CurrentClimbState == ClimbManager::ClimbState::kAuto) {
210210
// Start the auto climb
211-
if (this->pAutoClimbHigh != nullptr) {
212-
this->pAutoClimbHigh->Start();
211+
if (this->pAutoClimbHigh->hasClimbed == false) {
212+
if (this->pAutoClimbHigh != nullptr) {
213+
this->pAutoClimbHigh->Start();
214+
}
215+
} else {
216+
ClimbManager::CurrentClimbState = ClimbManager::ClimbState::kInactive;
213217
}
214218
}
215219

src/main/include/Autonomous/AutoClimbHigh.h

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <frc/commands/Command.h>
1212
#include <frc/Timer.h>
1313

14+
15+
1416
class AutoClimbHigh : public frc::Command {
1517
public:
1618
AutoClimbHigh();
@@ -24,6 +26,8 @@ class AutoClimbHigh : public frc::Command {
2426
void Execute_Crawl(void); //!< Execute stage CRAWL stuff
2527
void Execute_Drive(void); //!< Execute stage DRIVE stuff
2628
void Execute_Raiseleg(void); //!< Execute stage RAISE_LEG stuff
29+
30+
bool hasClimbed ;
2731
private:
2832
/**
2933
* @brief Enum for tracking which stage of climb the robot is on

0 commit comments

Comments
 (0)