DeepSpace  2019
Climb.cpp
Go to the documentation of this file.
1 #include "Commands/Climb.h"
2 #include "Robot.h"
3 
5  Requires(Robot::m_Arm);
6  Requires(Robot::m_Leg);
7  Requires(Robot::m_CrawlDrive);
9 }
10 
11 // Called just before this Command runs the first time
13  this->armSpeed = 0.0;
14  this->crawlSpeed = 0.0;
15  this->legSpeed = 0.0;
16 }
17 
18 // Called repeatedly when this Command is scheduled to run
20  // Move arms
21  this->armSpeed = this->pJoyOp->GetY(Hand::kRightHand) * -1;
22 
23  // Set crawl speed
24  this->crawlSpeed = (this->pJoyOp->GetPOV() == 0) ? 1 : 0;
25  this->crawlSpeed = (this->pJoyOp->GetPOV() == 180) ? -1 : this->crawlSpeed;
26 
27  // Set leg speed
28  this->legSpeed = this->pJoyOp->GetBumper(Hand::kRightHand)? -1 : 0;
29  this->legSpeed = this->pJoyOp->GetBumper(Hand::kLeftHand) ? 1 : this->legSpeed;
30 
31  if(this->legSpeed < 0.0){
33  Log("Pushing legs down!");
34  }
35 
36  if(fabs(this->armSpeed) > 0.8){
37  Log("Arms are being full-forced!");
38  }
39 
40  // Set motor outputs
44 
45  // Reset speeds
46  this->armSpeed = 0.0;
47  this->crawlSpeed = 0.0;
48  this->legSpeed = 0.0;
49 }
50 
51 // Make this return true when this Command no longer needs to run execute()
53 
54  // Stop if we're no longer is manual climb mode
56 }
57 
58 // Called once after isFinished returns true
59 void Climb::End() {}
60 
61 // Called when another command which requires one or more of the same
62 // subsystems is scheduled to run
Climb()
Class constructor.
Definition: Climb.cpp:4
static CrawlDrive * m_CrawlDrive
Pointer for the DriveTrain.
Definition: Robot.h:65
frc::XboxController * pJoyOp
Definition: Climb.h:33
void MoveLeg(double Speed)
Move climb leg up or down.
Definition: Leg.cpp:23
frc::XboxController * GetJoystickOperator(void)
Definition: OI.cpp:14
static Arm * m_Arm
Pointer for the Arm.
Definition: Robot.h:66
void Log(std::string message)
Main robot class that is called by wpilib.
Definition: logging.cpp:9
void Initialize() override
Runs once on initalization.
Definition: Climb.cpp:12
void Execute() override
Called in a loop during Teleop.
Definition: Climb.cpp:19
void Interrupted() override
Runs once if the command is forced to stop.
Definition: Climb.cpp:63
static OI * m_oi
Pointer for the Operator Interface (OI)
Definition: Robot.h:68
void Move(double Speed)
Drive, (or crawl), forwards or backwards Moves the wheels attached to the arms. What wheels do...
Definition: CrawlDrive.cpp:32
bool IsFinished() override
Definition: Climb.cpp:52
static ClimbState CurrentClimbState
Definition: ClimbManager.h:15
void Append(LedColour colour)
Definition: EdgeLight.cpp:7
void MoveArm(double Speed)
Move Arm arm up or down.
Definition: Arm.cpp:37
double legSpeed
Definition: Climb.h:31
static Leg * m_Leg
Pointer for the Leg.
Definition: Robot.h:67
void End() override
Runs once when IsFinished() returns true.
Definition: Climb.cpp:59
double crawlSpeed
Definition: Climb.h:30
double armSpeed
Definition: Climb.h:29