-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc32414
commit 522acf3
Showing
2 changed files
with
49 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,46 @@ | ||
/*----------------------------------------------------------------------------*/ | ||
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ | ||
/* Open Source Software - may be modified and shared by FRC teams. The code */ | ||
/* must be accompanied by the FIRST BSD license file in the root directory of */ | ||
/* the project. */ | ||
/*----------------------------------------------------------------------------*/ | ||
|
||
#include "Robot.h" | ||
|
||
#include <iostream> | ||
|
||
void Robot::AutonomousPeriodic() { | ||
void Robot::AutonomousPeriodic() | ||
{ | ||
PlayerControl(); | ||
} | ||
|
||
void Robot::TeleopPeriodic() { | ||
void Robot::TeleopPeriodic() | ||
{ | ||
PlayerControl(); | ||
} | ||
|
||
void Robot::PlayerControl() { | ||
|
||
hatch.Set(Controller.GetRawButton(4)); | ||
bucket.Set(Controller.GetRawButton(1)); | ||
void Robot::PlayerControl() | ||
{ | ||
|
||
//Pneumatic control | ||
hatch.Set(controller.GetRawButton(4)); | ||
bucket.Set(controller.GetRawButton(1)); | ||
|
||
//Toggles the lift | ||
if (controller.GetRawButtonPressed(2)) | ||
{ | ||
L2Lift.Set(!L2Lift.Get()); | ||
} | ||
|
||
//Tank Drive | ||
speedLeft += (controller.GetRawAxis(LeftJoystickY) - previousLeftSpeed) / speedScalingFactor; | ||
speedRight += (controller.GetRawAxis(RightJoystickY) - previousRightSpeed) / speedScalingFactor; | ||
|
||
DiffDrive.TankDrive(speedLeft * speedScale, speedRight * speedScale); | ||
|
||
DiffDrive.TankDrive(Controller.GetRawAxis(1), Controller.GetRawAxis(4)); | ||
|
||
if(Controller.GetRawButtonPressed(3)) { | ||
previousLeftSpeed = speedLeft; | ||
previousRightSpeed = speedRight; | ||
|
||
//Invert the controls when using the second camera | ||
if (controller.GetRawButtonPressed(3)) | ||
{ | ||
cameraView = !cameraView; | ||
speedScale = speedScale * -1; | ||
sinkCam.SetSource(cameraView ? frontCam : backCam); | ||
} | ||
|
||
} | ||
|
||
int main() { return frc::StartRobot<Robot>(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters