44import edu .wpi .first .wpilibj .PowerDistributionPanel ;
55import edu .wpi .first .wpilibj .TimedRobot ;
66import edu .wpi .first .wpilibj .command .Scheduler ;
7- import frc .team4909 .robot .subsystems .drivetrain .Linefollow ;
8- import frc .team4909 .robot .subsystems .intake .CargoIntakeIn ;
9- import frc .team4909 .robot .subsystems .intake .CargoIntakeOut ;
10- import frc .team4909 .robot .subsystems .intake .HatchPanelIntakeOpen ;
11- import frc .team4909 .robot .subsystems .intake .HatchPanelIntakeClose ;
127import frc .team4909 .robot .operator .controllers .BionicF310 ;
13- // import frc.team4909.robot.sensors.Stream;
8+ import frc .team4909 .robot .sensors .LidarLitePWM ;
9+ import frc .team4909 .robot .sensors .Stream ;
10+ import frc .team4909 .robot .subsystems .climber .ClimberSubsystem ;
11+ import frc .team4909 .robot .subsystems .climber .commands .DriveStiltsBack ;
12+ import frc .team4909 .robot .subsystems .climber .commands .DriveStiltsForward ;
13+ import frc .team4909 .robot .subsystems .climber .commands .ExtendStilts ;
14+ import frc .team4909 .robot .subsystems .climber .commands .RetractStilts ;
1415import frc .team4909 .robot .subsystems .drivetrain .DriveTrainSubsystem ;
16+ import frc .team4909 .robot .subsystems .drivetrain .Linefollow ;
1517import frc .team4909 .robot .subsystems .drivetrain .commands .InvertDriveDirection ;
18+ import frc .team4909 .robot .subsystems .elevator .ElevatorSubsystem ;
19+ import frc .team4909 .robot .subsystems .elevator .commands .SetElevatorPosition ;
20+ import frc .team4909 .robot .subsystems .elevatorarm .ElevatorArmSubsystem ;
1621import frc .team4909 .robot .subsystems .intake .IntakeSubsystem ;
17- import frc .team4909 .robot .subsystems .elevator .ElevatorSubsystem ;;
22+ import frc .team4909 .robot .subsystems .intake .commands .CargoIntakeIn ;
23+ import frc .team4909 .robot .subsystems .intake .commands .CargoIntakeOut ;
24+ import frc .team4909 .robot .subsystems .intake .commands .HatchPanelIntakeOpen ;
25+
26+ // Controls:
27+ //
28+ // Driver Gamepad (Port 0):
29+ // LY: Drive Speed
30+ // RX: Drive Rotation
31+ // LT: Retract Stilts
32+ // RT: Extend Stilts
33+ // LB: Drive Stilt Back
34+ // RB: Drive Stilt Forward
35+ // A: Invert Drive Direction
36+ // B: Line Follow
37+ //
38+ // Operator Gamped (Port 1):
39+ // RY: Elevator Arm Pivot
40+ // LY: Elevator Speed
41+ // RT: Cargo Intake In
42+ // RB: Cargo Intake Out
43+ // LT: Hatch Panel Intake In
44+
1845public class Robot extends TimedRobot {
1946
20- // Stream stream = new Stream();
47+ // Camera
48+ public static Stream stream ;
49+ // public static GripPipeline grip;
2150 // Operator Input
2251 public static BionicF310 driverGamepad ;
2352 public static BionicF310 manipulatorGamepad ;
53+ public boolean StiltsStop ;
2454
2555 // Subsystems
2656 public static PowerDistributionPanel powerDistributionPanel ;
2757 public static DriveTrainSubsystem drivetrainSubsystem ;
2858 public static IntakeSubsystem intakeSubsystem ;
2959 public static ElevatorSubsystem elevatorSubsystem ;
60+ public static ElevatorArmSubsystem elevatorArmSubsystem ;
61+ public static ClimberSubsystem climberSubsystem ;
3062 public static Compressor c ;
3163
32-
3364 // Sensors
3465 public static LidarLitePWM lidar ;
3566
67+ // SmartDashboard Buttons
68+ public boolean CargoIntake ;
69+ public boolean CargoOuttake ;
70+
3671 /**
3772 * This function is run when the robot is first started up and should be used
3873 * for any initialization code.
3974 */
75+
4076 @ Override
4177 public void robotInit () {
4278
43- c = new Compressor (0 ); //Initialize Compressor
44- c .setClosedLoopControl (true ); // Start Compressor in Closed Loop Control
45-
79+ // Cameras (subsystem)
80+ stream = new Stream ();
81+ // CameraServer.getInstance().startAutomaticCapture();
82+ stream .streamCamera ();
83+ // grip = new GripPipeline();
4684
47- // stream.streamCamera();
48- // GripPipeline grip = new GripPipeline();
85+ // Compressor
86+ c = new Compressor (0 ); // Initialize Compressor
87+ c .setClosedLoopControl (true ); // Start Compressor in Closed Loop Control
4988
5089 // Subsystems
5190 powerDistributionPanel = new PowerDistributionPanel ();
5291 drivetrainSubsystem = new DriveTrainSubsystem ();
5392 intakeSubsystem = new IntakeSubsystem ();
5493 elevatorSubsystem = new ElevatorSubsystem ();
94+ elevatorArmSubsystem = new ElevatorArmSubsystem ();
95+ climberSubsystem = new ClimberSubsystem ();
5596
5697 // Sensors
57- lidar = new LidarLitePWM (4 );
98+ lidar = new LidarLitePWM (RobotMap . lidarPort );
5899
59100 // Operator Input
60-
61- driverGamepad = new BionicF310 (RobotConstants .driverGamepadPort , // Port
62- RobotConstants .driverGamepadDeadzone , // Deadzone
63- RobotConstants .driverGamepadSensitivity // Gamepad sensitivity
101+ driverGamepad = new BionicF310 (RobotMap .driverGamepadPort , // Port
102+ RobotConstants .driverGamepadDeadzone , // Deadzone
103+ RobotConstants .driverGamepadSensitivity // Gamepad sensitivity
64104 );
65105
66- manipulatorGamepad = new BionicF310 (RobotConstants .manipulatorGamepadPort , // Port
67- RobotConstants .manipulatorGamepadDeadzone , // Deadzone
68- RobotConstants .manipulatorGamepadSensitivity // Gamepad sensitivity
106+ manipulatorGamepad = new BionicF310 (RobotMap .manipulatorGamepadPort , // Port
107+ RobotConstants .manipulatorGamepadDeadzone , // Deadzone
108+ RobotConstants .manipulatorGamepadSensitivity // Gamepad sensitivity
69109 );
110+ /* Drivetrain */
70111
71- driverGamepad .buttonPressed (BionicF310 .A , new Linefollow ());
72- driverGamepad .buttonPressed (BionicF310 .X , new CargoIntakeIn ());
73- driverGamepad .buttonPressed (BionicF310 .Y , new CargoIntakeOut ());
74- driverGamepad .buttonPressed (BionicF310 .LB , new HatchPanelIntakeOpen ());
75- driverGamepad .buttonPressed (BionicF310 .RB , new HatchPanelIntakeClose ());
76- driverGamepad .buttonPressed (BionicF310 .Start , new InvertDriveDirection ());
77- }
112+ /* Intake */
113+ manipulatorGamepad .buttonHeld (BionicF310 .RT , 0.2 , new CargoIntakeIn ());
114+ manipulatorGamepad .buttonHeld (BionicF310 .RB , new CargoIntakeOut ());
115+ manipulatorGamepad .buttonHeld (BionicF310 .LT , 0.2 , new HatchPanelIntakeOpen ());
116+
117+ /* Climber */
118+ driverGamepad .buttonHeld (BionicF310 .RT , 0.2 , new ExtendStilts ());
119+ driverGamepad .buttonHeld (BionicF310 .LT , 0.2 , new RetractStilts ());
120+ driverGamepad .buttonHeld (BionicF310 .LB , new DriveStiltsBack ());
121+ driverGamepad .buttonHeld (BionicF310 .RB , new DriveStiltsForward ());
122+
123+ /* Elevator */
124+ manipulatorGamepad .buttonPressed (BionicF310 .A , new SetElevatorPosition (-13000 , 1 ));
125+
126+ /* Sensors/Misc. */
127+ driverGamepad .buttonPressed (BionicF310 .A , new InvertDriveDirection ());
128+ driverGamepad .buttonPressed (BionicF310 .B , new Linefollow ());
129+ }
78130
79131 /**
80- * This function is called every robot packet, no matter the mode. Use this for
81- * items like diagnostics that you want ran during disabled, autonomous,
132+ * '' This function is called every robot packet, no matter the mode. Use this
133+ * for items like diagnostics that you want ran during disabled, autonomous,
82134 * teleoperated and test.
83135 *
84136 * <p>
@@ -108,7 +160,7 @@ public void autonomousPeriodic() {
108160 */
109161 @ Override
110162 public void teleopPeriodic () {
111- System . out . println ( "Distance is " + lidar . getDistance ()); // Remove for competition (necessary only for testing)
163+
112164 }
113165
114166 /**
@@ -117,4 +169,4 @@ public void teleopPeriodic() {
117169 @ Override
118170 public void testPeriodic () {
119171 }
120- }
172+ }
0 commit comments