-
Notifications
You must be signed in to change notification settings - Fork 11
/
MyRobot.cpp
60 lines (52 loc) · 1.15 KB
/
MyRobot.cpp
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
#include "WPILib.h"
/**
* This is a demo program SimpleTemplate project. We're using it for GitHub training.
* Simple Updates: Add your name below!
* Dan
* Gabby
* Celina
* Laurence
* Ken
* Jack
*/
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick; // only joystick
public:
RobotDemo(void):
myRobot(5, 6), // these must be initialized in the same order
stick(1) // as they are declared above.
{
myRobot.SetExpiration(0.1);
}
/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous(void)
{
myRobot.SetSafetyEnabled(false);
myRobot.Drive(-0.5, 0.0); // drive forwards half speed
Wait(2.0); // for 2 seconds
myRobot.Drive(0.0, 0.0); // stop robot
}
/**
* Runs the motors with arcade steering.
*/
void OperatorControl(void)
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl())
{
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
Wait(0.005); // wait for a motor update time
}
}
/**
* Runs during test mode
*/
void Test() {
}
};
START_ROBOT_CLASS(RobotDemo);
// This is an extra added bonus change.