Skip to content

Commit 3239275

Browse files
Update Robot.cpp
1 parent b2ed029 commit 3239275

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

main/cpp/Robot.cpp

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99

1010
#include "Robot.h"
1111

12-
#include <iostream>
13-
1412
void Robot::RobotInit() {
1513
compressor.Stop ();
1614
}
1715

1816
void Robot::RobotPeriodic() {
17+
//Vision
1918
UsbCamera floorCamera = CameraServer::GetInstance()->StartAutomaticCapture(0);
2019
UsbCamera driverCamera = CameraServer::GetInstance()->StartAutomaticCapture(1);
2120
driverCamera.SetResolution(320, 240);
@@ -42,19 +41,31 @@ void Robot::RobotPeriodic() {
4241
//Drive
4342
if (flightStick.GetRawButton(2) == 1) { //Slow
4443
if (flightStick.GetRawAxis(1) > 0 || flightStick.GetRawAxis(1) < 0) {
45-
Drive.CurvatureDrive((flightStick.GetRawAxis(1) * pow(time.Get(), 2)) * -1 * speedSlow, flightStick.GetRawAxis(2) * turningSpeedFast, flightStick.GetRawButton(1));
44+
if (0<time.Get<(f/2)) {
45+
Drive.CurvatureDrive((flightStick.GetRawAxis(1)/2*sin((((2 * M_PI)/f)*time.Get()) - M_PI_2)+flightStick.GetRawAxis(1)/2) * -1 * speedSlow, flightStick.GetRawAxis(2) * turningSpeedSlow, flightStick.GetRawButton(1));
46+
} else {
47+
Drive.CurvatureDrive(flightStick.GetRawAxis(1) * -1 * speedSlow, flightStick.GetRawAxis(2) * turningSpeedSlow, flightStick.GetRawButton(1));
48+
}
4649
} else {
4750
time.Reset();
4851
}
49-
} else if (flightStick.GetRawButton(12/*Will Change*/) == 1) { // Fast
52+
} else if (flightStick.GetRawButton(11/*Will Change*/) == 1) { // Fast
5053
if (flightStick.GetRawAxis(1) > 0 || flightStick.GetRawAxis(1) < 0) {
51-
Drive.CurvatureDrive((flightStick.GetRawAxis(1) * pow(time.Get(), 2)) * -1 * speedFast, flightStick.GetRawAxis(2) * turningSpeedFast, flightStick.GetRawButton(1));
54+
if (0<time.Get()<(f/2)) {
55+
Drive.CurvatureDrive((flightStick.GetRawAxis(1)/2*sin((((2 * M_PI)/f)*time.Get()) - M_PI_2)+flightStick.GetRawAxis(1)/2) * -1 * speedFast, flightStick.GetRawAxis(2) * turningSpeedFast, flightStick.GetRawButton(1));
56+
} else {
57+
Drive.CurvatureDrive(flightStick.GetRawAxis(1) * -1 * speedFast, flightStick.GetRawAxis(2) * turningSpeedFast, flightStick.GetRawButton(1));
58+
}
5259
} else {
5360
time.Reset();
5461
}
5562
} else { //Normal
5663
if (flightStick.GetRawAxis(1) > 0 || flightStick.GetRawAxis(1) < 0) {
57-
Drive.CurvatureDrive((flightStick.GetRawAxis(1) * pow(time.Get(), 2)) * -1 * speedNormal, flightStick.GetRawAxis(2) * turningSpeedSlow, flightStick.GetRawButton(1));
64+
if (0<time.Get()<(f/2)) {
65+
Drive.CurvatureDrive((flightStick.GetRawAxis(1)/2*sin((((2 * M_PI)/f)*time.Get()) - M_PI_2)+flightStick.GetRawAxis(1)/2) * -1 * speedNormal, flightStick.GetRawAxis(2) * turningSpeedSlow, flightStick.GetRawButton(1));
66+
} else {
67+
Drive.CurvatureDrive(flightStick.GetRawAxis(1) * -1 * speedNormal, flightStick.GetRawAxis(2) * turningSpeedSlow, flightStick.GetRawButton(1));
68+
}
5869
} else {
5970
time.Reset();
6071
}
@@ -100,11 +111,11 @@ void Robot::RobotPeriodic() {
100111

101112
//Ball Intake
102113
if (fightStick.GetRawButton(1) == 1) {
103-
m_leftIntake.Set(.5);//+
104-
m_rightIntake.Set(-.5);
114+
m_leftIntake.Set(flywheelIntake);//+
115+
m_rightIntake.Set(-1 * flywheelIntake);
105116
} else if (fightStick.GetRawButton(3) == 1) {
106-
m_leftIntake.Set(-.5);
107-
m_rightIntake.Set(.5);
117+
m_leftIntake.Set(-1 * flywheelOutake);
118+
m_rightIntake.Set(flywheelOutake);
108119
} else {
109120
m_leftIntake.Set(0);
110121
m_rightIntake.Set(0);

0 commit comments

Comments
 (0)