DeepSpace  2019
ControlSlider.cpp
Go to the documentation of this file.
2 #include "Robot.h"
3 
5  // Use Requires() here to declare subsystem dependencies
6  Requires(Robot::m_Slider);
7  Requires(Robot::m_Piston);
9 }
10 
11 // Called just before this Command runs the first time
12 // aka: every time teleop is enabled
14  this->speed = 0.0;
15 }
16 
17 // Called repeatedly when this Command is scheduled to run
19  // Slide slider
20  this->speed = this->pJoyOp->GetX(Hand::kLeftHand);
21  Robot::m_Slider->Slide(this->speed);
22 
23  if (fabs(this->speed) <= XBOX_DEADZONE_LEFT_JOY)
24  {
25  this->speed = 0.0;
26  }
27 
28  // Control piston
29  if(this->pJoyOp->GetTriggerAxis(Hand::kRightHand) > 0.8){
31  } else {
33  }
34 
35 
36 
37  // Reset the speed
38  this->speed = 0.00;
39 
40  // Move slider to center if button is pressed
41  if(this->pJoyOp->GetBButton()) {
43  }
44 }
45 
46 
47 bool ControlSlider::IsFinished() { return false; }
48 
49 // Called once after isFinished returns true
51 
52 // Called when another command which requires one or more of the same
53 // subsystems is scheduled to run
void Interrupted() override
Runs once if the command is forced to stop.
ControlSlider()
Class constructor.
frc::XboxController * GetJoystickOperator(void)
Definition: OI.cpp:14
void Deploy()
Deploy the piston.
Definition: Piston.cpp:11
#define XBOX_DEADZONE_LEFT_JOY
Definition: RobotMap.h:53
void Center()
Definition: Slider.cpp:53
bool IsFinished() override
void Execute() override
Called in a loop during Teleop.
static Slider * m_Slider
Pointer for the Slider.
Definition: Robot.h:69
void Slide(double speed)
Definition: Slider.cpp:27
double speed
Speed value that will be passed into Slider::Slide.
Definition: ControlSlider.h:30
static OI * m_oi
Pointer for the Operator Interface (OI)
Definition: Robot.h:68
void Retract()
Retract the piston.
Definition: Piston.cpp:15
static Piston * m_Piston
Pointer for the Piston.
Definition: Robot.h:64
void End() override
Runs once when IsFinished() returns true.
void Initialize() override
Runs once on initalization.
frc::XboxController * pJoyOp
A mnemonic for the operator&#39;s controller because we are lazy.
Definition: ControlSlider.h:32