This repository was archived by the owner on Oct 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexamplerobot.cpp
More file actions
65 lines (61 loc) · 1.82 KB
/
examplerobot.cpp
File metadata and controls
65 lines (61 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <Willpower.h>
int FRP = 0; //initialize and declare FRP as an integer with a value 0
int FLP = 2; //initialize and declare FLP as an integer with a value 2
int BRP = 1; //initialize and declare BRP as an integer with a value 1
int BLP = 3; //initialize and declare BLP as an integer with a value 3
int LServoPort = 4; //left servo port
int RServoPort = 5; //right servo port
std::string= ;
std::string = ;
std::string = ;
std::string = ;
std::string = ;
std::string = ;
std::string = ;
std::string = ;
const std::string autoNameMid = "Middle Auto";
const std::string autoNameLeft= "Left Auto";
const std::string autoNameRight = "Right Auto";
frc::SendableChooser<std::string> chooser;
std::string autoSelected;
class Robot: public frc::IterativeRobot{
public:
void RobotInit() {
CameraServer::GetInstance()->StartAutomaticCapture();
chooser.AddDefault(autoNameMid, autoNameMid);
chooser.AddObject(autoNameLeft, autoNameLeft);
chooser.AddObject(autoNameRight, autoNameRight);
frc::SmartDashboard::PutData("Auto Modes", &chooser);
timer.Start();
}
Willpower robo{LServoPort,RServoPort,FRP,BRP,FLP,BLP};
frc::LiveWindow* lw = LiveWindow::GetInstance();
frc::Spark winch {6};
frc::Timer autoTimer;
frc::Timer teleTime;
frc::Timer timer;
void AutonomousInit() override {
autoSelected = chooser.GetSelected();
std::cout << "Auto selected: " << autoSelected << std::endl;
timer.Reset(); //Set timer to 0
timer.Start(); //Start timer
autoTimer.Reset();
robo.ramp("back");
}
void AutonomousPeriodic() {
if (autoSelected == autoNameMid) {
autoTimer.Start();
robo.AutoDrive(-.5,-.545,.1,4.4); //mid 4.4, l/r 10
robo.AutoRamp("up", 4.4, 6);
}
}
void TeleopInit() {
robo.ramp("down");
}
void TeleopPeriodic() {
robo.buton(
void TestPeriodic() {
lw->Run();
}
};
START_ROBOT_CLASS(Robot)