DeepSpace  2019
CrawlDrive.cpp
Go to the documentation of this file.
2 
3 CrawlDrive::CrawlDrive() : frc::Subsystem("CrawlDrive") {
4  //Initialize the motors
5  this->pCrawlLeft = new frc::Spark(CRAWL_LEFT_MOTOR);
6 
7  this->pCrawlLeft->SetInverted(false);
8  //this->pCrawlLeft->SetNeutralMode(NeutralMode::Brake);
9 
10  this->pCrawlRight = new frc::Spark(CRAWL_RIGHT_MOTOR);
11  this->pCrawlRight->SetInverted(false);
12  //this->pCrawlRight->SetNeutralMode(NeutralMode::Brake);
13 
14  // Disable saftey modes
15  // Sounds like a bad idea, but this prevents the robot from lockingup if we take too long on a loop
16  this->pCrawlLeft->SetSafetyEnabled(false);
17  this->pCrawlRight->SetSafetyEnabled(false);
18 
19  this->pFloorSensor = new frc::DigitalInput(OPTICAL_PIN) ;
20 
21 }
22 
24  //SetDefaultCommand(new DriveWithJoystick());
25 }
26 
28 {
29  return this->pFloorSensor->Get() ;
30 }
31 
32 void CrawlDrive::Move(double Speed) {
33  this->pCrawlRight->Set(Speed);
34  this->pCrawlLeft->Set(Speed);
35  return;
36 }
bool GetSensor(void)
Returns true if its on the floor.
Definition: CrawlDrive.cpp:27
frc::Spark * pCrawlRight
Pointer for the right crawl motor.
Definition: CrawlDrive.h:32
CrawlDrive()
Class constructor.
Definition: CrawlDrive.cpp:3
void InitDefaultCommand() override
Initalizes the default command for this subsystem ()
Definition: CrawlDrive.cpp:23
#define OPTICAL_PIN
Definition: RobotMap.h:64
frc::DigitalInput * pFloorSensor
Definition: CrawlDrive.h:33
void Move(double Speed)
Drive, (or crawl), forwards or backwards Moves the wheels attached to the arms. What wheels do...
Definition: CrawlDrive.cpp:32
#define CRAWL_LEFT_MOTOR
Definition: RobotMap.h:59
frc::Spark * pCrawlLeft
Pointer for the left crawl motor.
Definition: CrawlDrive.h:31
#define CRAWL_RIGHT_MOTOR
Definition: RobotMap.h:60