DeepSpace  2019
Robot.h
Go to the documentation of this file.
1 #ifndef _ROBOT_HG_
3 #define _ROBOT_HG_
4 
5 // FRC
6 #include <frc/commands/Command.h>
7 #include <frc/smartdashboard/SendableChooser.h>
8 #include <frc/TimedRobot.h>
9 #include <frc/WPILib.h>
10 #include <cscore_oo.h>
11 #include <iostream>
12 #include <networktables/NetworkTable.h>
13 
14 // Commands
15 #include "Commands/TriggerDrive.h"
17 #include "Commands/PullArm.h"
18 #include "Commands/PullLeg.h"
20 #include "Commands/ClimbManager.h"
22 #include "Commands/ControlLight.h"
23 #include "Commands/Climb.h"
24 #include "Commands/ControlSlider.h"
25 #include "Commands/ControlCargo.h"
26 
27 // Interfaces
28 #include "OI.h"
29 
30 // Subsystems
31 #include "Subsystems/DriveTrain.h"
32 #include "Subsystems/CrawlDrive.h"
33 #include "Subsystems/Arm.h"
34 #include "Subsystems/Leg.h"
35 #include "Subsystems/Slider.h"
36 #include "Subsystems/Compressor.h"
37 #include "Subsystems/Piston.h"
39 #include "Subsystems/Flap.h"
40 #include "Subsystems/Light.h"
41 
42 // Telemetry devices
43 #include <frc/PowerDistributionPanel.h>
44 #include <frc/DriverStation.h>
45 #include "AHRS.h"
46 
47 // Logging
48 #include <string>
49 #include <iostream>
50 #include <vector>
51 #include <time.h>
52 
53 
54 void Log(std::string msg);
55 void Display(clock_t start, clock_t current);
56 
57 class Robot : public frc::TimedRobot
58 {
59 public:
60 
61  // Subsystems
64  static Piston *m_Piston;
66  static Arm *m_Arm;
67  static Leg *m_Leg;
68  static OI *m_oi;
69  static Slider *m_Slider;
71  static Flap *m_Flap;
72  static Light *m_Light;
73 
74  // Commands
86 
87  // Robot methods
88  void RobotInit() override;
89  void RobotPeriodic() override;
90  void DisabledInit() override;
91  void DisabledPeriodic() override;
92  void AutonomousInit() override;
93  void AutonomousPeriodic() override;
94  void TeleopInit() override;
95  void TeleopPeriodic() override;
96  void TestPeriodic() override;
97  void SharedPeriodic();
98  void SharedInit();
99 
100 private:
101  // Define cameras
102  cs::UsbCamera frontCam;
103  cs::UsbCamera visionCam;
104 
105  // Have it null by default so that if testing teleop it
106  // doesn't have undefined behavior and potentially crash.
107  // MyAutoCommand m_myAuto;
108  frc::SendableChooser<frc::Command*> m_chooser;
109 
110  frc::DriverStation& driverStation = frc::DriverStation::GetInstance();
111  // frc::PowerDistributionPanel* pdp; //!< Power Distrobution Panel information
112 
113  std::shared_ptr<NetworkTable> ntTelemetry;
114 
115  AHRS* pGyro;
116 
118 };
119 
120 #endif //_ROBOT_HG_
bool start
Definition: __main__.py:1094
Definition: Flap.h:9
static CrawlDrive * m_CrawlDrive
Pointer for the DriveTrain.
Definition: Robot.h:65
Definition: Light.h:9
TriggerDrive * pTriggerDrive
Pointer for the TriggerDrive command.
Definition: Robot.h:75
void SharedInit()
Used to initalize commands for both auto and teleop. (2019 only)
Definition: Robot.cpp:222
ClimbManager * pClimbManager
Pointer for the climb management command.
Definition: Robot.h:83
An interface command for toggleing the gripper.
Definition: ControlLight.h:11
Definition: Robot.h:57
void RobotInit() override
Runs once on robot boot.
Definition: Robot.cpp:49
A subsystem that interfaces with the robot&#39;s cCompressor.
Definition: Compressor.h:10
static Arm * m_Arm
Pointer for the Arm.
Definition: Robot.h:66
An interface command for driving the robot with an xbox controller.
Definition: TriggerDrive.h:12
PullLeg * pPullLeg
Pointer for the leg debugging command.
Definition: Robot.h:77
An interface command for activating the Pull Arm on the robot.
Definition: PullLeg.h:11
static cCompressor * m_cCompressor
Pointer for the cCompressor.
Definition: Robot.h:62
static Flap * m_Flap
Pointer for the Cargo Flap.
Definition: Robot.h:71
An interface command for activating the Pull Arm on the robot.
Definition: PullArm.h:11
A subsystem that interfaces with the drivebase on the robot.
Definition: DriveTrain.h:13
frc::SendableChooser< frc::Command * > m_chooser
Definition: Robot.h:108
A subsytem that interfaces with the climberbase on the robot.
Definition: CrawlDrive.h:11
void DisabledPeriodic() override
Runs in a loop while the robot is disabled.
Definition: Robot.cpp:160
Definition: Climb.h:11
void TestPeriodic() override
Runs in a loop during test mode.
Definition: Robot.cpp:284
AHRS * pGyro
Definition: Robot.h:115
Operator Interface allows various commands to access the xbox controllers through the DriverStation...
Definition: OI.h:7
frc::DriverStation & driverStation
DriverStation instance.
Definition: Robot.h:110
An interface command for driving the robot with an xbox controller.
Climb * pClimb
Pointer for the climb control command.
Definition: Robot.h:85
ControlHatchGripper * pControlHatchGripper
Pointer for the finger control command.
Definition: Robot.h:78
void AutonomousPeriodic() override
Runs in a loop during auto.
Definition: Robot.cpp:196
cs::UsbCamera frontCam
Variable for the front camera.
Definition: Robot.h:102
void RobotPeriodic() override
Runs in a loop while the robot is turned on in any mode.
Definition: Robot.cpp:126
ControlCargo * pControlCargo
Pointer for the cargo control command.
Definition: Robot.h:81
Definition: Leg.h:10
AutoClimbHigh * pAutoClimbHigh
Pointer for the auto high climb command.
Definition: Robot.h:84
static Slider * m_Slider
Pointer for the Slider.
Definition: Robot.h:69
std::shared_ptr< NetworkTable > ntTelemetry
A pointer to the /SmartDashboard/Telemetry table.
Definition: Robot.h:113
An interface command for driving the robot with an xbox controller.
Definition: ControlCargo.h:12
static OI * m_oi
Pointer for the Operator Interface (OI)
Definition: Robot.h:68
PullArm * pPullArm
Pointer for the arm debugging command.
Definition: Robot.h:76
Definition: Piston.h:9
void Display(clock_t start, clock_t current)
Definition: logging.cpp:20
static Piston * m_Piston
Pointer for the Piston.
Definition: Robot.h:64
static HatchGripper * m_HatchGripper
Pointer for the Hatch Gripper.
Definition: Robot.h:70
void AutonomousInit() override
Runs once at the start of auto. Usually while the announcer starts counting down from 3...
Definition: Robot.cpp:173
static DriveTrain * m_DriveTrain
Pointer for the DriveTrain.
Definition: Robot.h:63
void SharedPeriodic()
Runs during teleop and auto.
Definition: Robot.cpp:234
void Log(std::string msg)
Main robot class that is called by wpilib.
Definition: logging.cpp:9
cs::UsbCamera visionCam
Variable for the Vision camera.
Definition: Robot.h:103
A subsystem that interfaces with the drivebase on the robot.
Definition: Slider.h:13
void DisabledInit() override
Runs once every time the robot is disabled.
Definition: Robot.cpp:149
An interface command for driving the robot with an xbox controller.
Definition: ControlSlider.h:12
ControlSlider * pControlSlider
Pointer for the ControlSlider command.
Definition: Robot.h:79
static Leg * m_Leg
Pointer for the Leg.
Definition: Robot.h:67
static Light * m_Light
Pointer for the Light.
Definition: Robot.h:72
clock_t logStart
Definition: Robot.h:117
void TeleopInit() override
Runs once at the start of teleop when the bell sounds.
Definition: Robot.cpp:202
ControlCompressor * pControlCompressor
Pointer for the ControlCompressor command.
Definition: Robot.h:80
clock_t logCurrent
Definition: Robot.h:117
void TeleopPeriodic() override
Runs in a loop during teleop.
Definition: Robot.cpp:216
An interface command for toggleing the gripper.
ControlLight * pControlLight
Pointer for the vision light control command.
Definition: Robot.h:82
A subsystem that controls the Arm of the robot.
Definition: Arm.h:15