From 1cfffa3ebb27cc345c71729fe0db7a8f91d3107a Mon Sep 17 00:00:00 2001 From: AdamJennissen Date: Fri, 7 Feb 2020 16:01:13 -0600 Subject: [PATCH 01/33] color --- src/main/cpp/Robot.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 38eb0d5..a6aad43 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -99,6 +99,8 @@ cs::UsbCamera fbi; frc::AnalogInput batman(0); // 230 - 630 is usable range //ultrsonic variable double distance; +//color/proximity sensor +rev::ColorSensorV3::ColorSensorV3 helenKeller; //speed var double speed; @@ -146,6 +148,9 @@ void Robot::RobotInit() fbi = frc::CameraServer::GetInstance()->StartAutomaticCapture(0); fbi.SetVideoMode(cs::VideoMode::PixelFormat::kYUYV, 320, 240, 10); + //setting up color/proximity sensor + helenKeller = rev::ColorSensorV3::ColorSensorV3(0); + //setting up controller //neighborlyInputDevice = new frc::XboxController(0); From ff7955974c944ad7cdba06c6b8bace4a19f032db Mon Sep 17 00:00:00 2001 From: AdamJennissen Date: Wed, 12 Feb 2020 17:09:34 -0600 Subject: [PATCH 02/33] whench, intake --- src/main/cpp/Robot.cpp | 167 +++++++-------------------- vendordeps/Phoenix.json | 180 ++++++++++++++++++++++++++++++ vendordeps/WPILibNewCommands.json | 37 ++++++ 3 files changed, 258 insertions(+), 126 deletions(-) create mode 100644 vendordeps/Phoenix.json create mode 100644 vendordeps/WPILibNewCommands.json diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index a6aad43..7489319 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -22,11 +22,10 @@ #include #include #include +#include "ctre/Phoenix.h" #define Brit -//#define Sounds - //joystick creation frc::Joystick *lonelyStick; frc::JoystickButton *nuke; //button 4 @@ -35,23 +34,13 @@ frc::JoystickButton *lessSpeed; //button 5 frc::JoystickButton *moreSpeed; //button 3 frc::JoystickButton *fullCheech; //button 2 frc::JoystickButton *putItIn; //button 1 -#ifdef Sounds -frc::JoystickButton *sound1; //button 7 -frc::JoystickButton *sound2; //button 8 -frc::JoystickButton *sound3; //button 9 -frc::JoystickButton *sound4; //button 11 -frc::JoystickButton *sound5; //button 12 -#endif - -//digital input creation -frc::DigitalOutput playSound1(1); - -//controller creation -frc::XboxController *soundController; //tank drive creation frc::DifferentialDrive *brit; +//controller creation +frc::XboxController *neighborlyInputDevice; + //brit motors #ifdef Brit rev::CANSparkMax driveboi1(7, rev::CANSparkMax::MotorType::kBrushless); @@ -79,7 +68,14 @@ frc::SpeedControllerGroup speedyboiL(driveboi3, driveboi4); #endif //winch motor creation -rev::CANSparkMax whinch(3, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax whench(0, rev::CANSparkMax::MotorType::kBrushless); + +//mike whipper motor creation +ctre::phoenix::motorcontrol::can::VictorSPX whippedCheese = {0}; +//mike whipper up/down solenoid +frc::Solenoid viagra(3); +//intake motor creation +rev::CANSparkMax simp(0, rev::CANSparkMax::MotorType::kBrushless); //Encoder creation rev::CANEncoder spinReader1 = driveboi1.GetEncoder(); @@ -90,7 +86,7 @@ rev::CANEncoder spinReader4 = driveboi4.GetEncoder(); rev::CANEncoder spinReader5 = driveboi5.GetEncoder(); rev::CANEncoder spinReader6 = driveboi6.GetEncoder(); #endif -rev::CANEncoder pimp = whinch.GetEncoder(); +rev::CANEncoder pimp = whench.GetEncoder(); //camera creation cs::UsbCamera fbi; @@ -99,8 +95,6 @@ cs::UsbCamera fbi; frc::AnalogInput batman(0); // 230 - 630 is usable range //ultrsonic variable double distance; -//color/proximity sensor -rev::ColorSensorV3::ColorSensorV3 helenKeller; //speed var double speed; @@ -133,6 +127,9 @@ frc::DigitalInput stopIt(9); int forwardBackwardDistance = 46; //23 is about 5 ft int turnDistance = 29; //25 is about 360 degrees on shop floors, 29 is about 360 on carpet +//toggle variable for intake things +int toggle = 1; + //Dead Zone Variables double lonelyY; double lonelyTwist; @@ -148,11 +145,8 @@ void Robot::RobotInit() fbi = frc::CameraServer::GetInstance()->StartAutomaticCapture(0); fbi.SetVideoMode(cs::VideoMode::PixelFormat::kYUYV, 320, 240, 10); - //setting up color/proximity sensor - helenKeller = rev::ColorSensorV3::ColorSensorV3(0); - //setting up controller - //neighborlyInputDevice = new frc::XboxController(0); + neighborlyInputDevice = new frc::XboxController(0); //setting up Joystick lonelyStick = new frc::Joystick(0); @@ -162,13 +156,6 @@ void Robot::RobotInit() lessSpeed = new frc::JoystickButton(lonelyStick, 5); moreSpeed = new frc::JoystickButton(lonelyStick, 3); putItIn = new frc::JoystickButton(lonelyStick, 1); -#ifdef Sounds - sound1 = new frc::JoystickButton(lonelyStick, 7); - sound2 = new frc::JoystickButton(lonelyStick, 8); - sound3 = new frc::JoystickButton(lonelyStick, 9); - sound4 = new frc::JoystickButton(lonelyStick, 11); - sound5 = new frc::JoystickButton(lonelyStick, 12); -#endif //setting up drivetrain brit = new frc::DifferentialDrive(speedyboiL, speedyboiR); @@ -350,7 +337,6 @@ void Robot::TeleopInit() {} void Robot::TeleopPeriodic() { - //42 counts per rev. on neo if (spinReader1.GetVelocity() == 0) spinReader1.SetPosition(0); @@ -414,115 +400,44 @@ void Robot::TeleopPeriodic() //pneumatic actuator roboMyRio.Set(putItIn->Get()); - //drive train code - if (fullCheech->Get()) + //mike whipper/intake code + if (neighborlyInputDevice->GetAButtonPressed()) { - speed = 1; + toggle = -toggle; } - else + + if (toggle == 1) { - speed = .4; + viagra.Set(false); + simp.Set(0); + whippedCheese.Set(ControlMode::PercentOutput, 0); } - brit->ArcadeDrive(lonelyY * speed, lonelyTwist * speed); - - /*//joystick values to movement in drivetrain -brit->ArcadeDrive ( -lonelyStick->GetY () , lonelyStick->GetTwist () );*/ - - //controller values to movement in drivetrain - //brit->ArcadeDrive ( soundController->GetY ( frc::GenericHID::JoystickHand::kLeftHand ) , soundController->GetX ( frc::GenericHID::JoystickHand::kLeftHand ) ); - - //testing to use controller - /*double testingboi = soundController->GetX(frc::GenericHID::JoystickHand::kLeftHand); -if ( testingboi > 0 ) { - std::cout << "x axis is goin \n"; -}*/ -#ifdef Sounds - /*if (lonelyStick.GetThrottle() == 1) + else if (toggle == -1) { - if (sound1 && sound2 && sound3) - { - } - if (sound1 && sound2 && sound4) - { - } - if (sound1 && sound2 && sound5) - { - } - if (sound1 && sound2 && sound6) - { - } + viagra.Set(true); + simp.Set(1); + whippedCheese.Set(ControlMode::PercentOutput, 1); } - if (lonelyStick.GetThrottle() == 0) + + //winch code + if (neighborlyInputDevice->GetBButton()) { - }*/ - if (sound3->Get()) + whench.Set(.1); + } + + //drive train code + if (fullCheech->Get()) { - playSound1.Set(true); + speed = 1; } else { - playSound1.Set(false); + speed = .4; } -#endif + brit->ArcadeDrive(lonelyY * speed, lonelyTwist * speed); } -void Robot::TestPeriodic() -{ - - /* -//back motors following front motors -//driveboi2.Follow (driveboi1, false); -//driveboi4.Follow (driveboi3, false); -//driveboi5.Follow (driveboi1, false); -//driveboi6.Follow (driveboi3, false); - -//encoder math -forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); -turn = spinReader1.GetPosition() + spinReader3.GetPosition(); -forwardBackwardDistance = 46; //23 is about 5 ft -turnDistance = 29; //25 is about 360 degrees on shop floors, 29 is about 360 on carpet - -if (oneSpin->Get()) { - driveboi1.Set(.1); - driveboi3.Set(-.1); -} else if (nuke->Get()) { - driveboi1.Set(-.1); - driveboi3.Set(.1); -} else if (moreSpeed->Get()) { - driveboi1.Set(-.1); - driveboi3.Set(-.1); -} else if (lessSpeed->Get()) { - driveboi1.Set(.1); - driveboi3.Set(.1); -} else if ( forwardBackward < -2*forwardBackwardDistance || forwardBackward > 2*forwardBackwardDistance || turn < -2*turnDistance || turn > 2*turnDistance ) { - driveboi1.Set(0); - driveboi3.Set(0); - spinReader1.SetPosition(0); - spinReader2.SetPosition(0); - spinReader3.SetPosition(0); - spinReader4.SetPosition(0); - } - - -//Motor spins once with Joystick button -//if (spinReader1.GetPosition() < 10) driveboi1.Set(.25); -if (spinReader1.GetPosition() < r) driveboi1.Set(.1); -else if (spinReader1.GetPosition() > r) driveboi1.Set(-.1); -//else if (spinReader1.GetPosition() < 10 ) driveboi1.Set(-1/2*spinReader1.GetPosition()+5); -else driveboi1.Set(0); - -//if (spinReader3.GetPosition() > -10) driveboi3.Set(-.25); -if (spinReader3.GetPosition() > -r ) driveboi3.Set(-.1); -else if (spinReader3.GetPosition() < -r) driveboi3.Set(.1); -//else if (spinReader3.GetPosition() > -10 ) driveboi3.Set(1/2*spinReader1.GetPosition()-5); -else driveboi3.Set(0); - -motor group = .99^encoder value -motor group = -.99^encoder value -make sure the opposite encoder stuff is the opposite otherwise as it counts up it will keep getting faster/ need two different equations -driveboi1.Set(.99^spinReader1.GetPosition()) for the positive side -*/ -} +void Robot::TestPeriodic() {} void Robot::ZeroMotors() { diff --git a/vendordeps/Phoenix.json b/vendordeps/Phoenix.json new file mode 100644 index 0000000..c6ec878 --- /dev/null +++ b/vendordeps/Phoenix.json @@ -0,0 +1,180 @@ +{ + "fileName": "Phoenix.json", + "name": "CTRE-Phoenix", + "version": "5.18.1", + "uuid": "ab676553-b602-441f-a38d-f1296eff6537", + "mavenUrls": [ + "http://devsite.ctr-electronics.com/maven/release/" + ], + "jsonUrl": "http://devsite.ctr-electronics.com/maven/release/com/ctre/phoenix/Phoenix-latest.json", + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-java", + "version": "5.18.1" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-java", + "version": "5.18.1" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.18.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "diagnostics", + "version": "5.18.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "canutils", + "version": "5.18.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "platform-stub", + "version": "5.18.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "core", + "version": "5.18.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-cpp", + "version": "5.18.1", + "libName": "CTRE_Phoenix_WPI", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-cpp", + "version": "5.18.1", + "libName": "CTRE_Phoenix", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.18.1", + "libName": "CTRE_PhoenixCCI", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "diagnostics", + "version": "5.18.1", + "libName": "CTRE_PhoenixDiagnostics", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "canutils", + "version": "5.18.1", + "libName": "CTRE_PhoenixCanutils", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "platform-stub", + "version": "5.18.1", + "libName": "CTRE_PhoenixPlatform", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "core", + "version": "5.18.1", + "libName": "CTRE_PhoenixCore", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + } + ] +} \ No newline at end of file diff --git a/vendordeps/WPILibNewCommands.json b/vendordeps/WPILibNewCommands.json new file mode 100644 index 0000000..83de291 --- /dev/null +++ b/vendordeps/WPILibNewCommands.json @@ -0,0 +1,37 @@ +{ + "fileName": "WPILibNewCommands.json", + "name": "WPILib-New-Commands", + "version": "2020.0.0", + "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", + "mavenUrls": [], + "jsonUrl": "", + "javaDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-java", + "version": "wpilib" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "edu.wpi.first.wpilibNewCommands", + "artifactId": "wpilibNewCommands-cpp", + "version": "wpilib", + "libName": "wpilibNewCommands", + "headerClassifier": "headers", + "sourcesClassifier": "sources", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "linuxraspbian", + "linuxaarch64bionic", + "windowsx86-64", + "windowsx86", + "linuxx86-64", + "osxx86-64" + ] + } + ] +} \ No newline at end of file From 2f8190b86b788d6c1afa9e9e5c549f25b2585a4a Mon Sep 17 00:00:00 2001 From: AdamJennissen Date: Wed, 12 Feb 2020 17:45:50 -0600 Subject: [PATCH 03/33] ? --- src/main/cpp/Robot.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 7489319..4c0e9b2 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -108,7 +108,8 @@ enum Auton forward2 = 5, back2 = 6, turn2 = 7, - forward3 = 8 + forward3 = 8, + null = 9 }; Auton step; @@ -314,7 +315,7 @@ void Robot::AutonomousPeriodic() else { ZeroMotors(); - step = dump; + step = null; } break; } From aec6e88faf1bd02e94468188b73c32a66ca2eda1 Mon Sep 17 00:00:00 2001 From: AdamJennissen Date: Fri, 14 Feb 2020 10:30:13 -0600 Subject: [PATCH 04/33] climber --- src/main/cpp/Robot.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 4c0e9b2..4c46660 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -69,7 +69,8 @@ frc::SpeedControllerGroup speedyboiL(driveboi3, driveboi4); //winch motor creation rev::CANSparkMax whench(0, rev::CANSparkMax::MotorType::kBrushless); - +//climber motor creation +rev::CANSparkMax spoodermoon(11, rev::CANSparkMax::MotorType::kBrushless); //mike whipper motor creation ctre::phoenix::motorcontrol::can::VictorSPX whippedCheese = {0}; //mike whipper up/down solenoid @@ -86,7 +87,10 @@ rev::CANEncoder spinReader4 = driveboi4.GetEncoder(); rev::CANEncoder spinReader5 = driveboi5.GetEncoder(); rev::CANEncoder spinReader6 = driveboi6.GetEncoder(); #endif +//winch encoder creation rev::CANEncoder pimp = whench.GetEncoder(); +//climber encoder creation +rev::CANEncoder gwen = spoodermoon.GetEncoder(); //camera creation cs::UsbCamera fbi; @@ -363,7 +367,7 @@ void Robot::TeleopPeriodic() frc::SmartDashboard::PutNumber("Encoder5 Position", spinReader5.GetPosition()); frc::SmartDashboard::PutNumber("Encoder6 Position", spinReader6.GetPosition()); #endif - + frc::SmartDashboard::PutNumber("climber position", gwen.GetPosition()); //read sensor double distance = batman.GetValue(); // * 0.393701; //multiplying by 0.393701 converts the sonar value to inches (hopefully) frc::SmartDashboard::PutNumber("Range Sensor 1", distance); @@ -426,6 +430,10 @@ void Robot::TeleopPeriodic() whench.Set(.1); } + //climber code + spoodermoon.Set(neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand)); + spoodermoon.Set(-neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand)); + //drive train code if (fullCheech->Get()) { From 849062443b992cc787be50a9f4377edc4bf458b2 Mon Sep 17 00:00:00 2001 From: AdamJennissen Date: Fri, 14 Feb 2020 11:46:22 -0600 Subject: [PATCH 05/33] more climber --- src/main/cpp/Robot.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 4c46660..0f205ad 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -151,7 +151,7 @@ void Robot::RobotInit() fbi.SetVideoMode(cs::VideoMode::PixelFormat::kYUYV, 320, 240, 10); //setting up controller - neighborlyInputDevice = new frc::XboxController(0); + neighborlyInputDevice = new frc::XboxController(1); //setting up Joystick lonelyStick = new frc::Joystick(0); @@ -431,8 +431,14 @@ void Robot::TeleopPeriodic() } //climber code - spoodermoon.Set(neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand)); - spoodermoon.Set(-neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand)); + if (neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand) > 0) + { + spoodermoon.Set(neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand)); + } + if (neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand) > 0) + { + spoodermoon.Set(-neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand)); + } //drive train code if (fullCheech->Get()) From 7ddc636cd52768c681ae0b78d21a69602412261a Mon Sep 17 00:00:00 2001 From: Robotics Laptop <6758@devjoe.net> Date: Fri, 14 Feb 2020 12:00:01 -0600 Subject: [PATCH 06/33] climbing arm works --- src/main/cpp/Robot.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 4c46660..9214f1d 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -72,7 +72,7 @@ rev::CANSparkMax whench(0, rev::CANSparkMax::MotorType::kBrushless); //climber motor creation rev::CANSparkMax spoodermoon(11, rev::CANSparkMax::MotorType::kBrushless); //mike whipper motor creation -ctre::phoenix::motorcontrol::can::VictorSPX whippedCheese = {0}; +ctre::phoenix::motorcontrol::can::VictorSPX whippedCheese = {25}; //mike whipper up/down solenoid frc::Solenoid viagra(3); //intake motor creation @@ -151,7 +151,7 @@ void Robot::RobotInit() fbi.SetVideoMode(cs::VideoMode::PixelFormat::kYUYV, 320, 240, 10); //setting up controller - neighborlyInputDevice = new frc::XboxController(0); + neighborlyInputDevice = new frc::XboxController(1); //setting up Joystick lonelyStick = new frc::Joystick(0); @@ -406,9 +406,10 @@ void Robot::TeleopPeriodic() roboMyRio.Set(putItIn->Get()); //mike whipper/intake code - if (neighborlyInputDevice->GetAButtonPressed()) + if (neighborlyInputDevice->GetAButtonReleased()) { toggle = -toggle; + std::cout << "a button"; } if (toggle == 1) @@ -421,7 +422,7 @@ void Robot::TeleopPeriodic() { viagra.Set(true); simp.Set(1); - whippedCheese.Set(ControlMode::PercentOutput, 1); + whippedCheese.Set(ControlMode::PercentOutput, .1); } //winch code @@ -431,8 +432,19 @@ void Robot::TeleopPeriodic() } //climber code - spoodermoon.Set(neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand)); - spoodermoon.Set(-neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand)); + if (neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand) > 0) + { + spoodermoon.Set(neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand) * .1); + } + + else if (neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand) > 0) + { + spoodermoon.Set(-neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand) * .1); + } + else + { + spoodermoon.Set(0); + } //drive train code if (fullCheech->Get()) From 1851910fc8b589a86ed2072341bf974fe9a95598 Mon Sep 17 00:00:00 2001 From: Robotics Laptop <6758@devjoe.net> Date: Fri, 14 Feb 2020 12:01:53 -0600 Subject: [PATCH 07/33] climber works --- src/main/cpp/Robot.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 9214f1d..5d04149 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -436,7 +436,6 @@ void Robot::TeleopPeriodic() { spoodermoon.Set(neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand) * .1); } - else if (neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand) > 0) { spoodermoon.Set(-neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand) * .1); From 31eec569a2942ae9444822de9c396defc0f4a0f4 Mon Sep 17 00:00:00 2001 From: Robotics Laptop <6758@devjoe.net> Date: Fri, 14 Feb 2020 13:23:44 -0600 Subject: [PATCH 08/33] Merge branch 'master' of https://github.com/FRC6758/2020BasicDriveCode into Climber From 8be8c16111195b84595d93e54414cff997749cc2 Mon Sep 17 00:00:00 2001 From: Robotics Laptop <6758@devjoe.net> Date: Fri, 14 Feb 2020 13:23:56 -0600 Subject: [PATCH 09/33] faster climb --- src/main/cpp/Robot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 5d04149..aff7060 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -434,11 +434,11 @@ void Robot::TeleopPeriodic() //climber code if (neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand) > 0) { - spoodermoon.Set(neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand) * .1); + spoodermoon.Set(neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand) * .2); } else if (neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand) > 0) { - spoodermoon.Set(-neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand) * .1); + spoodermoon.Set(-neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand) * .2); } else { From 8c0f86620905810f8347539de86b3ec91121488a Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Sat, 15 Feb 2020 01:09:22 -0600 Subject: [PATCH 10/33] did stuff --- build.gradle | 2 +- src/main/cpp/Robot.cpp | 22 ++++++++++++++++++---- src/main/include/Robot.h | 1 + 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index f7d64fb..d7c94a4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2020.1.2" + id "edu.wpi.first.GradleRIO" version "2020.2.2" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index aff7060..d49a54f 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -23,6 +23,7 @@ #include #include #include "ctre/Phoenix.h" +#include #define Brit @@ -68,7 +69,7 @@ frc::SpeedControllerGroup speedyboiL(driveboi3, driveboi4); #endif //winch motor creation -rev::CANSparkMax whench(0, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax whench(16, rev::CANSparkMax::MotorType::kBrushless); //climber motor creation rev::CANSparkMax spoodermoon(11, rev::CANSparkMax::MotorType::kBrushless); //mike whipper motor creation @@ -76,7 +77,7 @@ ctre::phoenix::motorcontrol::can::VictorSPX whippedCheese = {25}; //mike whipper up/down solenoid frc::Solenoid viagra(3); //intake motor creation -rev::CANSparkMax simp(0, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax simp(1, rev::CANSparkMax::MotorType::kBrushless); //Encoder creation rev::CANEncoder spinReader1 = driveboi1.GetEncoder(); @@ -403,7 +404,12 @@ void Robot::TeleopPeriodic() peerPressure1.Set(moreSpeed->Get()); //pneumatic actuator - roboMyRio.Set(putItIn->Get()); + if (putItIn->Get()) + { + roboMyRio.Set(true); + Robot::Wait(.5); + roboMyRio.Set(false); + } //mike whipper/intake code if (neighborlyInputDevice->GetAButtonReleased()) @@ -421,7 +427,7 @@ void Robot::TeleopPeriodic() else if (toggle == -1) { viagra.Set(true); - simp.Set(1); + simp.Set(.1); whippedCheese.Set(ControlMode::PercentOutput, .1); } @@ -493,6 +499,14 @@ void Robot::CounterClock() driveboi1.Set(-.1); driveboi3.Set(-.1); } +void Robot::Wait(double seconds) +{ + clock_t endwait; + endwait = clock() + seconds * CLOCKS_PER_SEC; + while (clock() < endwait) + { + } +} #ifndef RUNNING_FRC_TESTS int main() diff --git a/src/main/include/Robot.h b/src/main/include/Robot.h index 76ab331..2ab8cc8 100644 --- a/src/main/include/Robot.h +++ b/src/main/include/Robot.h @@ -27,6 +27,7 @@ class Robot : public frc::TimedRobot void Backwards(); void Clock(); void CounterClock(); + void Wait(double); private: frc::SendableChooser m_chooser; From 20e8e13945bf15d5fadac9c31cb5723ddc428e72 Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Sat, 15 Feb 2020 12:58:00 -0600 Subject: [PATCH 11/33] Update Robot.cpp --- src/main/cpp/Robot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index d49a54f..feb7620 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -422,13 +422,13 @@ void Robot::TeleopPeriodic() { viagra.Set(false); simp.Set(0); - whippedCheese.Set(ControlMode::PercentOutput, 0); + whippedCheese.Set(ControlMode::PercentOutput, 0); //should be 0 just testing } else if (toggle == -1) { viagra.Set(true); simp.Set(.1); - whippedCheese.Set(ControlMode::PercentOutput, .1); + whippedCheese.Set(ControlMode::PercentOutput, .1); //should be .1 just testing } //winch code From 90e7e5e18c72560e813f7dc47913bd6a943c6785 Mon Sep 17 00:00:00 2001 From: Robotics Laptop <6758@devjoe.net> Date: Wed, 19 Feb 2020 15:55:11 -0600 Subject: [PATCH 12/33] speed --- src/main/cpp/Robot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index feb7620..751ef89 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -427,7 +427,7 @@ void Robot::TeleopPeriodic() else if (toggle == -1) { viagra.Set(true); - simp.Set(.1); + simp.Set(.5); whippedCheese.Set(ControlMode::PercentOutput, .1); //should be .1 just testing } From 4ddbde64ccdb04afd443c5cfb33fa50eea6933d8 Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Thu, 27 Feb 2020 15:35:43 -0600 Subject: [PATCH 13/33] climb button --- src/main/cpp/Robot.cpp | 173 ++++++++++++++++++++++++++++++++++------- 1 file changed, 144 insertions(+), 29 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index feb7620..e7e7602 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -69,7 +69,7 @@ frc::SpeedControllerGroup speedyboiL(driveboi3, driveboi4); #endif //winch motor creation -rev::CANSparkMax whench(16, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax whench(12, rev::CANSparkMax::MotorType::kBrushless); //climber motor creation rev::CANSparkMax spoodermoon(11, rev::CANSparkMax::MotorType::kBrushless); //mike whipper motor creation @@ -115,6 +115,8 @@ enum Auton turn2 = 7, forward3 = 8, null = 9 + /* altForw1 = 10 + altTurn1 = 11 */ }; Auton step; @@ -327,16 +329,115 @@ void Robot::AutonomousPeriodic() default: break; } - /*auton idea - go forward until limit switch hits wall or range gets to very low - dump balls - go backward until across the line - turn tward wall - go forward until limit switch hits wall or range gets to very low - back up a little - turn 90 degrees twards our side - turn on intake things - go forward under the trench*/ + + //Auton Code for if someone is in our spot + /* + +switch (step) + { + case forward1: + { + if (batman.GetValue() > 375) //230 - 630 usable range + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = dump; + } + break; + } + case dump: + { + roboMyRio.Set(true); + roboMyRio.Set(false); + step = back1; + break; + } + case back1: + { + if (forwardBackward < 92) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn1; + } + break; + } + case turn1: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward2; + } + break; + } + case forward2: + { + if (batman.GetValue() > 250) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = back2; + } + break; + } + case back2: + { + if (forwardBackward < 4.6) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn2; + } + break; + } + case turn2: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward3; + } + break; + } + case forward3: + { + if (forwardBackward < 198.49) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = null; + } + break; + } + default: + break; + } + +*/ } void Robot::TeleopInit() {} @@ -368,9 +469,9 @@ void Robot::TeleopPeriodic() frc::SmartDashboard::PutNumber("Encoder5 Position", spinReader5.GetPosition()); frc::SmartDashboard::PutNumber("Encoder6 Position", spinReader6.GetPosition()); #endif - frc::SmartDashboard::PutNumber("climber position", gwen.GetPosition()); + frc::SmartDashboard::PutNumber("climber position", -1 * gwen.GetPosition()); //read sensor - double distance = batman.GetValue(); // * 0.393701; //multiplying by 0.393701 converts the sonar value to inches (hopefully) + double distance = batman.GetValue() * 0.393701; //multiplying by 0.393701 converts the sonar value to inches (hopefully) frc::SmartDashboard::PutNumber("Range Sensor 1", distance); // Code for deadzones on joystick @@ -411,11 +512,11 @@ void Robot::TeleopPeriodic() roboMyRio.Set(false); } - //mike whipper/intake code + //mike + //intake code if (neighborlyInputDevice->GetAButtonReleased()) { toggle = -toggle; - std::cout << "a button"; } if (toggle == 1) @@ -427,30 +528,44 @@ void Robot::TeleopPeriodic() else if (toggle == -1) { viagra.Set(true); - simp.Set(.1); - whippedCheese.Set(ControlMode::PercentOutput, .1); //should be .1 just testing + simp.Set(.5); + whippedCheese.Set(ControlMode::PercentOutput, .8); //should be .1 just testing } //winch code if (neighborlyInputDevice->GetBButton()) { - whench.Set(.1); + whench.Set(1); + } + else + { + whench.Set(0); } //climber code if (neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand) > 0) { - spoodermoon.Set(neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand) * .2); + spoodermoon.Set(-neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kRightHand) * .2); } else if (neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand) > 0) { - spoodermoon.Set(-neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand) * .2); + spoodermoon.Set(neighborlyInputDevice->GetTriggerAxis(frc::GenericHID::JoystickHand::kLeftHand) * .2); } else { spoodermoon.Set(0); } + //Bumber to preset climbing positions (63 in and all the way down) + if (neighborlyInputDevice->GetBumper(frc::GenericHID::JoystickHand::kRightHand) && -gwen.GetPosition() < 82) + { + spoodermoon.Set(-.2); + } + else if (neighborlyInputDevice->GetBumper(frc::GenericHID::JoystickHand::kLeftHand) && -gwen.GetPosition() > 0) + { + spoodermoon.Set(.2); + } + //drive train code if (fullCheech->Get()) { @@ -458,7 +573,7 @@ void Robot::TeleopPeriodic() } else { - speed = .4; + speed = .8; } brit->ArcadeDrive(lonelyY * speed, lonelyTwist * speed); } @@ -481,23 +596,23 @@ void Robot::ZeroMotors() void Robot::Forwards() { - driveboi1.Set(-.1); - driveboi3.Set(.1); + driveboi1.Set(-.5); + driveboi3.Set(.5); } void Robot::Backwards() { - driveboi1.Set(.1); - driveboi3.Set(-.1); + driveboi1.Set(.5); + driveboi3.Set(-.5); } void Robot::Clock() { - driveboi1.Set(.1); - driveboi3.Set(.1); + driveboi1.Set(.5); + driveboi3.Set(.5); } void Robot::CounterClock() { - driveboi1.Set(-.1); - driveboi3.Set(-.1); + driveboi1.Set(-.5); + driveboi3.Set(-.5); } void Robot::Wait(double seconds) { From 4d27d10e7446e6550f6e11e85c76c98134ef1dcc Mon Sep 17 00:00:00 2001 From: Bluecookies3942 <58235450+Bluecookies3942@users.noreply.github.com> Date: Thu, 27 Feb 2020 17:15:35 -0600 Subject: [PATCH 14/33] more auton --- src/main/cpp/Robot.cpp | 53 +++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index e7e7602..4bde89c 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -115,8 +115,9 @@ enum Auton turn2 = 7, forward3 = 8, null = 9 - /* altForw1 = 10 - altTurn1 = 11 */ + /*forwardfromside = 10 (for the UltraSonic Side Shot) + turnsideshot = 11 +*/ }; Auton step; @@ -226,6 +227,7 @@ void Robot::AutonomousPeriodic() // Default Auto goes here }*/ + // Ultra Sonic Straight Shot (Best Option) (Not Tested) switch (step) { case forward1: @@ -244,6 +246,7 @@ void Robot::AutonomousPeriodic() case dump: { roboMyRio.Set(true); + Wait(.5); roboMyRio.Set(false); step = back1; break; @@ -330,11 +333,35 @@ void Robot::AutonomousPeriodic() break; } - //Auton Code for if someone is in our spot + //UltraSonic Side Shot (2nd Best Option) (Not Tested) /* - switch (step) { + case forwardfromside: + { + if (forwardBackward < 92) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = turnsideshot; + } + break; + } + case turnsideshot: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward1; + } + } case forward1: { if (batman.GetValue() > 375) //230 - 630 usable range @@ -351,6 +378,7 @@ switch (step) case dump: { roboMyRio.Set(true); + Wait(.5); roboMyRio.Set(false); step = back1; break; @@ -436,7 +464,6 @@ switch (step) default: break; } - */ } @@ -566,15 +593,19 @@ void Robot::TeleopPeriodic() spoodermoon.Set(.2); } - //drive train code - if (fullCheech->Get()) - { - speed = 1; - } + //90 Degree turn code (Not Tested) + if () + else if () + { + Robot::Clock(); + } else { - speed = .8; + ZeroMotors(); } + + speed = .8; + brit->ArcadeDrive(lonelyY * speed, lonelyTwist * speed); } From 3c083f8b483c3ed20a44fba1474ab32dbdd89a73 Mon Sep 17 00:00:00 2001 From: AdamJennissen Date: Thu, 27 Feb 2020 17:29:33 -0600 Subject: [PATCH 15/33] clean up --- src/main/cpp/Robot.cpp | 79 +++++----------------------------------- src/main/include/Robot.h | 20 +++++++++- 2 files changed, 28 insertions(+), 71 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 4bde89c..d523c62 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -1,31 +1,4 @@ -/*----------------------------------------------------------------------------*/ -/* 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 "cscore.h" #include "Robot.h" -#include -#include -#include -#include "rev/CANSparkMax.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ctre/Phoenix.h" -#include - -#define Brit //joystick creation frc::Joystick *lonelyStick; @@ -43,7 +16,6 @@ frc::DifferentialDrive *brit; frc::XboxController *neighborlyInputDevice; //brit motors -#ifdef Brit rev::CANSparkMax driveboi1(7, rev::CANSparkMax::MotorType::kBrushless); rev::CANSparkMax driveboi2(10, rev::CANSparkMax::MotorType::kBrushless); rev::CANSparkMax driveboi3(13, rev::CANSparkMax::MotorType::kBrushless); @@ -54,19 +26,6 @@ rev::CANSparkMax driveboi6(9, rev::CANSparkMax::MotorType::kBrushless); //brit motor groups frc::SpeedControllerGroup speedyboiL(driveboi1, driveboi2, driveboi3); frc::SpeedControllerGroup speedyboiR(driveboi4, driveboi5, driveboi6); -#endif - -#ifndef Brit -//axel motors -rev::CANSparkMax driveboi1(4, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi2(6, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi3(1, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi4(3, rev::CANSparkMax::MotorType::kBrushless); - -//axel motor croups -frc::SpeedControllerGroup speedyboiR(driveboi1, driveboi2); -frc::SpeedControllerGroup speedyboiL(driveboi3, driveboi4); -#endif //winch motor creation rev::CANSparkMax whench(12, rev::CANSparkMax::MotorType::kBrushless); @@ -84,10 +43,8 @@ rev::CANEncoder spinReader1 = driveboi1.GetEncoder(); rev::CANEncoder spinReader2 = driveboi2.GetEncoder(); rev::CANEncoder spinReader3 = driveboi3.GetEncoder(); rev::CANEncoder spinReader4 = driveboi4.GetEncoder(); -#ifdef Brit rev::CANEncoder spinReader5 = driveboi5.GetEncoder(); rev::CANEncoder spinReader6 = driveboi6.GetEncoder(); -#endif //winch encoder creation rev::CANEncoder pimp = whench.GetEncoder(); //climber encoder creation @@ -209,10 +166,8 @@ void Robot::AutonomousInit() step = forward1; driveboi2.Follow(driveboi1, /*invert*/ false); driveboi4.Follow(driveboi3, /*invert*/ false); -#ifdef Brit driveboi5.Follow(driveboi1, /*invert*/ false); driveboi6.Follow(driveboi3, /*invert*/ false); -#endif } void Robot::AutonomousPeriodic() @@ -480,23 +435,19 @@ void Robot::TeleopPeriodic() spinReader3.SetPosition(0); if (spinReader4.GetVelocity() == 0) spinReader4.SetPosition(0); -#ifdef Brit if (spinReader5.GetVelocity() == 0) spinReader5.SetPosition(0); if (spinReader6.GetVelocity() == 0) spinReader6.SetPosition(0); -#endif //Read Encoder frc::SmartDashboard::PutNumber("Encoder1 Position", spinReader1.GetPosition()); frc::SmartDashboard::PutNumber("Encoder2 Position", spinReader2.GetPosition()); frc::SmartDashboard::PutNumber("Encoder3 Position", spinReader3.GetPosition()); frc::SmartDashboard::PutNumber("Encoder4 Position", spinReader4.GetPosition()); -#ifdef Brit frc::SmartDashboard::PutNumber("Encoder5 Position", spinReader5.GetPosition()); frc::SmartDashboard::PutNumber("Encoder6 Position", spinReader6.GetPosition()); -#endif - frc::SmartDashboard::PutNumber("climber position", -1 * gwen.GetPosition()); + frc::SmartDashboard::PutNumber("climber position", -gwen.GetPosition()); //read sensor double distance = batman.GetValue() * 0.393701; //multiplying by 0.393701 converts the sonar value to inches (hopefully) frc::SmartDashboard::PutNumber("Range Sensor 1", distance); @@ -505,23 +456,11 @@ void Robot::TeleopPeriodic() notFarEnough = .05; /*todo: Adjust to driver's needs*/ if (-lonelyStick->GetY() < notFarEnough || -lonelyStick->GetY() > -notFarEnough) { -#ifdef Brit lonelyY = lonelyStick->GetY(); -#endif - -#ifndef Brit - lonelyY = -lonelyStick->GetY(); -#endif } if (lonelyStick->GetTwist() < notFarEnough || lonelyStick->GetTwist() > -notFarEnough) { -#ifdef Brit lonelyTwist = -lonelyStick->GetTwist(); -#endif - -#ifndef Brit - lonelyTwist = lonelyStick->GetTwist(); -#endif } //making the compressor compress @@ -594,15 +533,17 @@ void Robot::TeleopPeriodic() } //90 Degree turn code (Not Tested) - if () - else if () - { - Robot::Clock(); - } + /*if () + { + } + else if () + { + Robot::Clock(); + } else { ZeroMotors(); - } + }*/ speed = .8; @@ -619,10 +560,8 @@ void Robot::ZeroMotors() spinReader2.SetPosition(0); spinReader3.SetPosition(0); spinReader4.SetPosition(0); -#ifdef Brit spinReader5.SetPosition(0); spinReader6.SetPosition(0); -#endif } void Robot::Forwards() diff --git a/src/main/include/Robot.h b/src/main/include/Robot.h index 2ab8cc8..d51c3d6 100644 --- a/src/main/include/Robot.h +++ b/src/main/include/Robot.h @@ -7,8 +7,26 @@ #pragma once +#include "cscore.h" #include - +#include +#include +#include +#include "rev/CANSparkMax.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ctre/Phoenix.h" +#include #include #include From e91699c65b908246f13ec0cc3d4f527c0fdc239e Mon Sep 17 00:00:00 2001 From: Computer 3 <6758@devjoe.net> Date: Thu, 27 Feb 2020 18:22:38 -0600 Subject: [PATCH 16/33] Goodererer codeing thingy --- .vscode/settings.json | 3 +- src/main/cpp/Auton/Auton.h | 276 +++++++++++++++++++++ src/main/cpp/Robot.cpp | 375 +---------------------------- src/main/cpp/Variables/Variables.h | 103 ++++++++ src/main/include/Robot.h | 2 + 5 files changed, 391 insertions(+), 368 deletions(-) create mode 100644 src/main/cpp/Auton/Auton.h create mode 100644 src/main/cpp/Variables/Variables.h diff --git a/.vscode/settings.json b/.vscode/settings.json index cc74d5b..4e2ca28 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,5 +18,6 @@ "*.inc": "cpp", "*.tcc": "cpp", "fstream": "cpp" - } + }, + "C_Cpp.errorSquiggles": "Disabled" } diff --git a/src/main/cpp/Auton/Auton.h b/src/main/cpp/Auton/Auton.h new file mode 100644 index 0000000..c1554af --- /dev/null +++ b/src/main/cpp/Auton/Auton.h @@ -0,0 +1,276 @@ +#pragma once +#include +#include + +void Robot::AutonomousInit2() +{ + m_autoSelected = m_chooser.GetSelected(); + // m_autoSelected = SmartDashboard::GetString("Auto Selector", + // kAutoNameDefault); + std::cout << "Auto selected: " << m_autoSelected << std::endl; + + /*if (m_autoSelected == kAutoNameCustom) { + // Custom Auto goes here + } + else { + // Default Auto goes here + }*/ + + step = forward1; + driveboi2.Follow(driveboi1, /*invert*/ false); + driveboi4.Follow(driveboi3, /*invert*/ false); + driveboi5.Follow(driveboi1, /*invert*/ false); + driveboi6.Follow(driveboi3, /*invert*/ false); +} + +void Robot::AutonomousPeriodic2() +{ + + double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); + double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); + /*if (m_autoSelected == kAutoNameCustom) { + // Custom Auto goes here + } + else { + // Default Auto goes here + }*/ + + // Ultra Sonic Straight Shot (Best Option) (Not Tested) + switch (step) + { + case forward1: + { + if (batman.GetValue() > 375) //230 - 630 usable range + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = dump; + } + break; + } + case dump: + { + roboMyRio.Set(true); + Wait(.5); + roboMyRio.Set(false); + step = back1; + break; + } + case back1: + { + if (forwardBackward < 92) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn1; + } + break; + } + case turn1: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward2; + } + break; + } + case forward2: + { + if (batman.GetValue() > 250) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = back2; + } + break; + } + case back2: + { + if (forwardBackward < 4.6) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn2; + } + break; + } + case turn2: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward3; + } + break; + } + case forward3: + { + if (forwardBackward < 198.49) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = null; + } + break; + } + default: + break; + } + + //UltraSonic Side Shot (2nd Best Option) (Not Tested) + /* +switch (step) + { + case forwardfromside: + { + if (forwardBackward < 92) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = turnsideshot; + } + break; + } + case turnsideshot: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward1; + } + } + case forward1: + { + if (batman.GetValue() > 375) //230 - 630 usable range + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = dump; + } + break; + } + case dump: + { + roboMyRio.Set(true); + Wait(.5); + roboMyRio.Set(false); + step = back1; + break; + } + case back1: + { + if (forwardBackward < 92) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn1; + } + break; + } + case turn1: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward2; + } + break; + } + case forward2: + { + if (batman.GetValue() > 250) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = back2; + } + break; + } + case back2: + { + if (forwardBackward < 4.6) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn2; + } + break; + } + case turn2: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward3; + } + break; + } + case forward3: + { + if (forwardBackward < 198.49) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = null; + } + break; + } + default: + break; + } +*/ +} \ No newline at end of file diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index d523c62..e7ad5a4 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -1,105 +1,6 @@ #include "Robot.h" - -//joystick creation -frc::Joystick *lonelyStick; -frc::JoystickButton *nuke; //button 4 -frc::JoystickButton *oneSpin; //button 6 -frc::JoystickButton *lessSpeed; //button 5 -frc::JoystickButton *moreSpeed; //button 3 -frc::JoystickButton *fullCheech; //button 2 -frc::JoystickButton *putItIn; //button 1 - -//tank drive creation -frc::DifferentialDrive *brit; - -//controller creation -frc::XboxController *neighborlyInputDevice; - -//brit motors -rev::CANSparkMax driveboi1(7, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi2(10, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi3(13, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi4(2, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi5(8, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi6(9, rev::CANSparkMax::MotorType::kBrushless); - -//brit motor groups -frc::SpeedControllerGroup speedyboiL(driveboi1, driveboi2, driveboi3); -frc::SpeedControllerGroup speedyboiR(driveboi4, driveboi5, driveboi6); - -//winch motor creation -rev::CANSparkMax whench(12, rev::CANSparkMax::MotorType::kBrushless); -//climber motor creation -rev::CANSparkMax spoodermoon(11, rev::CANSparkMax::MotorType::kBrushless); -//mike whipper motor creation -ctre::phoenix::motorcontrol::can::VictorSPX whippedCheese = {25}; -//mike whipper up/down solenoid -frc::Solenoid viagra(3); -//intake motor creation -rev::CANSparkMax simp(1, rev::CANSparkMax::MotorType::kBrushless); - -//Encoder creation -rev::CANEncoder spinReader1 = driveboi1.GetEncoder(); -rev::CANEncoder spinReader2 = driveboi2.GetEncoder(); -rev::CANEncoder spinReader3 = driveboi3.GetEncoder(); -rev::CANEncoder spinReader4 = driveboi4.GetEncoder(); -rev::CANEncoder spinReader5 = driveboi5.GetEncoder(); -rev::CANEncoder spinReader6 = driveboi6.GetEncoder(); -//winch encoder creation -rev::CANEncoder pimp = whench.GetEncoder(); -//climber encoder creation -rev::CANEncoder gwen = spoodermoon.GetEncoder(); - -//camera creation -cs::UsbCamera fbi; - -//ultrasonic range sensor creation -frc::AnalogInput batman(0); // 230 - 630 is usable range -//ultrsonic variable -double distance; - -//speed var -double speed; -//auton steps variable thing -enum Auton -{ - forward1 = 1, - dump = 2, - back1 = 3, - turn1 = 4, - forward2 = 5, - back2 = 6, - turn2 = 7, - forward3 = 8, - null = 9 - /*forwardfromside = 10 (for the UltraSonic Side Shot) - turnsideshot = 11 -*/ -}; -Auton step; - -//sonlenoid creation -frc::Solenoid peerPressure1(0); -frc::Solenoid peerPressure2(1); -frc::Solenoid roboMyRio(2); - -//compressor creation -frc::Compressor bonusPressure(0); - -//limit switch creation -frc::DigitalInput stopIt(9); - -//revolution var -int forwardBackwardDistance = 46; //23 is about 5 ft -int turnDistance = 29; //25 is about 360 degrees on shop floors, 29 is about 360 on carpet - -//toggle variable for intake things -int toggle = 1; - -//Dead Zone Variables -double lonelyY; -double lonelyTwist; -double notFarEnough; +#include +#include void Robot::RobotInit() { @@ -149,280 +50,20 @@ void Robot::RobotPeriodic() * if-else structure below with additional strings. If using the SendableChooser * make sure to add them to the chooser code above as well. */ + void Robot::AutonomousInit() { - m_autoSelected = m_chooser.GetSelected(); - // m_autoSelected = SmartDashboard::GetString("Auto Selector", - // kAutoNameDefault); - std::cout << "Auto selected: " << m_autoSelected << std::endl; - - /*if (m_autoSelected == kAutoNameCustom) { - // Custom Auto goes here - } - else { - // Default Auto goes here - }*/ - - step = forward1; - driveboi2.Follow(driveboi1, /*invert*/ false); - driveboi4.Follow(driveboi3, /*invert*/ false); - driveboi5.Follow(driveboi1, /*invert*/ false); - driveboi6.Follow(driveboi3, /*invert*/ false); + Robot::AutonomousInit2(); } void Robot::AutonomousPeriodic() { - - double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); - double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); - /*if (m_autoSelected == kAutoNameCustom) { - // Custom Auto goes here - } - else { - // Default Auto goes here - }*/ - - // Ultra Sonic Straight Shot (Best Option) (Not Tested) - switch (step) - { - case forward1: - { - if (batman.GetValue() > 375) //230 - 630 usable range - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = dump; - } - break; - } - case dump: - { - roboMyRio.Set(true); - Wait(.5); - roboMyRio.Set(false); - step = back1; - break; - } - case back1: - { - if (forwardBackward < 92) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn1; - } - break; - } - case turn1: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward2; - } - break; - } - case forward2: - { - if (batman.GetValue() > 250) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = back2; - } - break; - } - case back2: - { - if (forwardBackward < 4.6) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn2; - } - break; - } - case turn2: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward3; - } - break; - } - case forward3: - { - if (forwardBackward < 198.49) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = null; - } - break; - } - default: - break; - } - - //UltraSonic Side Shot (2nd Best Option) (Not Tested) - /* -switch (step) - { - case forwardfromside: - { - if (forwardBackward < 92) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = turnsideshot; - } - break; - } - case turnsideshot: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward1; - } - } - case forward1: - { - if (batman.GetValue() > 375) //230 - 630 usable range - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = dump; - } - break; - } - case dump: - { - roboMyRio.Set(true); - Wait(.5); - roboMyRio.Set(false); - step = back1; - break; - } - case back1: - { - if (forwardBackward < 92) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn1; - } - break; - } - case turn1: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward2; - } - break; - } - case forward2: - { - if (batman.GetValue() > 250) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = back2; - } - break; - } - case back2: - { - if (forwardBackward < 4.6) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn2; - } - break; - } - case turn2: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward3; - } - break; - } - case forward3: - { - if (forwardBackward < 198.49) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = null; - } - break; - } - default: - break; - } -*/ + Robot::AutonomousPeriodic2(); } -void Robot::TeleopInit() {} +void Robot::TeleopInit() +{ +} void Robot::TeleopPeriodic() { diff --git a/src/main/cpp/Variables/Variables.h b/src/main/cpp/Variables/Variables.h new file mode 100644 index 0000000..94298e2 --- /dev/null +++ b/src/main/cpp/Variables/Variables.h @@ -0,0 +1,103 @@ +#pragma once +#include + +//joystick creation +frc::Joystick *lonelyStick; +frc::JoystickButton *nuke; //button 4 +frc::JoystickButton *oneSpin; //button 6 +frc::JoystickButton *lessSpeed; //button 5 +frc::JoystickButton *moreSpeed; //button 3 +frc::JoystickButton *fullCheech; //button 2 +frc::JoystickButton *putItIn; //button 1 + +//tank drive creation +frc::DifferentialDrive *brit; + +//controller creation +frc::XboxController *neighborlyInputDevice; + +//brit motors +rev::CANSparkMax driveboi1(7, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax driveboi2(10, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax driveboi3(13, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax driveboi4(2, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax driveboi5(8, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax driveboi6(9, rev::CANSparkMax::MotorType::kBrushless); + +//brit motor groups +frc::SpeedControllerGroup speedyboiL(driveboi1, driveboi2, driveboi3); +frc::SpeedControllerGroup speedyboiR(driveboi4, driveboi5, driveboi6); + +//winch motor creation +rev::CANSparkMax whench(12, rev::CANSparkMax::MotorType::kBrushless); +//climber motor creation +rev::CANSparkMax spoodermoon(11, rev::CANSparkMax::MotorType::kBrushless); +//mike whipper motor creation +ctre::phoenix::motorcontrol::can::VictorSPX whippedCheese = {25}; +//mike whipper up/down solenoid +frc::Solenoid viagra(3); +//intake motor creation +rev::CANSparkMax simp(1, rev::CANSparkMax::MotorType::kBrushless); + +//Encoder creation +rev::CANEncoder spinReader1 = driveboi1.GetEncoder(); +rev::CANEncoder spinReader2 = driveboi2.GetEncoder(); +rev::CANEncoder spinReader3 = driveboi3.GetEncoder(); +rev::CANEncoder spinReader4 = driveboi4.GetEncoder(); +rev::CANEncoder spinReader5 = driveboi5.GetEncoder(); +rev::CANEncoder spinReader6 = driveboi6.GetEncoder(); +//winch encoder creation +rev::CANEncoder pimp = whench.GetEncoder(); +//climber encoder creation +rev::CANEncoder gwen = spoodermoon.GetEncoder(); + +//camera creation +cs::UsbCamera fbi; + +//ultrasonic range sensor creation +frc::AnalogInput batman(0); // 230 - 630 is usable range +//ultrsonic variable +double distance; + +//speed var +double speed; +//auton steps variable thing +enum Auton +{ + forward1 = 1, + dump = 2, + back1 = 3, + turn1 = 4, + forward2 = 5, + back2 = 6, + turn2 = 7, + forward3 = 8, + null = 9 + /*forwardfromside = 10 (for the UltraSonic Side Shot) + turnsideshot = 11 +*/ +}; +Auton step; + +//sonlenoid creation +frc::Solenoid peerPressure1(0); +frc::Solenoid peerPressure2(1); +frc::Solenoid roboMyRio(2); + +//compressor creation +frc::Compressor bonusPressure(0); + +//limit switch creation +frc::DigitalInput stopIt(9); + +//revolution var +int forwardBackwardDistance = 46; //23 is about 5 ft +int turnDistance = 29; //25 is about 360 degrees on shop floors, 29 is about 360 on carpet + +//toggle variable for intake things +int toggle = 1; + +//Dead Zone Variables +double lonelyY; +double lonelyTwist; +double notFarEnough; diff --git a/src/main/include/Robot.h b/src/main/include/Robot.h index d51c3d6..732f282 100644 --- a/src/main/include/Robot.h +++ b/src/main/include/Robot.h @@ -36,7 +36,9 @@ class Robot : public frc::TimedRobot void RobotInit() override; void RobotPeriodic() override; void AutonomousInit() override; + void AutonomousInit2(); void AutonomousPeriodic() override; + void AutonomousPeriodic2(); void TeleopInit() override; void TeleopPeriodic() override; void TestPeriodic() override; From 5ff19c6cc93f816226e5f4e4a805a172421e8f6a Mon Sep 17 00:00:00 2001 From: AdamJennissen Date: Thu, 27 Feb 2020 18:45:33 -0600 Subject: [PATCH 17/33] Revert "Merge pull request #9 from FRC6758/organized" This reverts commit a8843db80d85a94c534c3713d3598bef1e70c469, reversing changes made to 3c083f8b483c3ed20a44fba1474ab32dbdd89a73. --- .vscode/settings.json | 3 +- src/main/cpp/Auton/Auton.h | 276 --------------------- src/main/cpp/Robot.cpp | 375 ++++++++++++++++++++++++++++- src/main/cpp/Variables/Variables.h | 103 -------- src/main/include/Robot.h | 2 - 5 files changed, 368 insertions(+), 391 deletions(-) delete mode 100644 src/main/cpp/Auton/Auton.h delete mode 100644 src/main/cpp/Variables/Variables.h diff --git a/.vscode/settings.json b/.vscode/settings.json index 4e2ca28..cc74d5b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,6 +18,5 @@ "*.inc": "cpp", "*.tcc": "cpp", "fstream": "cpp" - }, - "C_Cpp.errorSquiggles": "Disabled" + } } diff --git a/src/main/cpp/Auton/Auton.h b/src/main/cpp/Auton/Auton.h deleted file mode 100644 index c1554af..0000000 --- a/src/main/cpp/Auton/Auton.h +++ /dev/null @@ -1,276 +0,0 @@ -#pragma once -#include -#include - -void Robot::AutonomousInit2() -{ - m_autoSelected = m_chooser.GetSelected(); - // m_autoSelected = SmartDashboard::GetString("Auto Selector", - // kAutoNameDefault); - std::cout << "Auto selected: " << m_autoSelected << std::endl; - - /*if (m_autoSelected == kAutoNameCustom) { - // Custom Auto goes here - } - else { - // Default Auto goes here - }*/ - - step = forward1; - driveboi2.Follow(driveboi1, /*invert*/ false); - driveboi4.Follow(driveboi3, /*invert*/ false); - driveboi5.Follow(driveboi1, /*invert*/ false); - driveboi6.Follow(driveboi3, /*invert*/ false); -} - -void Robot::AutonomousPeriodic2() -{ - - double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); - double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); - /*if (m_autoSelected == kAutoNameCustom) { - // Custom Auto goes here - } - else { - // Default Auto goes here - }*/ - - // Ultra Sonic Straight Shot (Best Option) (Not Tested) - switch (step) - { - case forward1: - { - if (batman.GetValue() > 375) //230 - 630 usable range - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = dump; - } - break; - } - case dump: - { - roboMyRio.Set(true); - Wait(.5); - roboMyRio.Set(false); - step = back1; - break; - } - case back1: - { - if (forwardBackward < 92) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn1; - } - break; - } - case turn1: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward2; - } - break; - } - case forward2: - { - if (batman.GetValue() > 250) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = back2; - } - break; - } - case back2: - { - if (forwardBackward < 4.6) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn2; - } - break; - } - case turn2: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward3; - } - break; - } - case forward3: - { - if (forwardBackward < 198.49) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = null; - } - break; - } - default: - break; - } - - //UltraSonic Side Shot (2nd Best Option) (Not Tested) - /* -switch (step) - { - case forwardfromside: - { - if (forwardBackward < 92) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = turnsideshot; - } - break; - } - case turnsideshot: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward1; - } - } - case forward1: - { - if (batman.GetValue() > 375) //230 - 630 usable range - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = dump; - } - break; - } - case dump: - { - roboMyRio.Set(true); - Wait(.5); - roboMyRio.Set(false); - step = back1; - break; - } - case back1: - { - if (forwardBackward < 92) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn1; - } - break; - } - case turn1: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward2; - } - break; - } - case forward2: - { - if (batman.GetValue() > 250) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = back2; - } - break; - } - case back2: - { - if (forwardBackward < 4.6) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn2; - } - break; - } - case turn2: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward3; - } - break; - } - case forward3: - { - if (forwardBackward < 198.49) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = null; - } - break; - } - default: - break; - } -*/ -} \ No newline at end of file diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index e7ad5a4..d523c62 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -1,6 +1,105 @@ #include "Robot.h" -#include -#include + +//joystick creation +frc::Joystick *lonelyStick; +frc::JoystickButton *nuke; //button 4 +frc::JoystickButton *oneSpin; //button 6 +frc::JoystickButton *lessSpeed; //button 5 +frc::JoystickButton *moreSpeed; //button 3 +frc::JoystickButton *fullCheech; //button 2 +frc::JoystickButton *putItIn; //button 1 + +//tank drive creation +frc::DifferentialDrive *brit; + +//controller creation +frc::XboxController *neighborlyInputDevice; + +//brit motors +rev::CANSparkMax driveboi1(7, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax driveboi2(10, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax driveboi3(13, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax driveboi4(2, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax driveboi5(8, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax driveboi6(9, rev::CANSparkMax::MotorType::kBrushless); + +//brit motor groups +frc::SpeedControllerGroup speedyboiL(driveboi1, driveboi2, driveboi3); +frc::SpeedControllerGroup speedyboiR(driveboi4, driveboi5, driveboi6); + +//winch motor creation +rev::CANSparkMax whench(12, rev::CANSparkMax::MotorType::kBrushless); +//climber motor creation +rev::CANSparkMax spoodermoon(11, rev::CANSparkMax::MotorType::kBrushless); +//mike whipper motor creation +ctre::phoenix::motorcontrol::can::VictorSPX whippedCheese = {25}; +//mike whipper up/down solenoid +frc::Solenoid viagra(3); +//intake motor creation +rev::CANSparkMax simp(1, rev::CANSparkMax::MotorType::kBrushless); + +//Encoder creation +rev::CANEncoder spinReader1 = driveboi1.GetEncoder(); +rev::CANEncoder spinReader2 = driveboi2.GetEncoder(); +rev::CANEncoder spinReader3 = driveboi3.GetEncoder(); +rev::CANEncoder spinReader4 = driveboi4.GetEncoder(); +rev::CANEncoder spinReader5 = driveboi5.GetEncoder(); +rev::CANEncoder spinReader6 = driveboi6.GetEncoder(); +//winch encoder creation +rev::CANEncoder pimp = whench.GetEncoder(); +//climber encoder creation +rev::CANEncoder gwen = spoodermoon.GetEncoder(); + +//camera creation +cs::UsbCamera fbi; + +//ultrasonic range sensor creation +frc::AnalogInput batman(0); // 230 - 630 is usable range +//ultrsonic variable +double distance; + +//speed var +double speed; +//auton steps variable thing +enum Auton +{ + forward1 = 1, + dump = 2, + back1 = 3, + turn1 = 4, + forward2 = 5, + back2 = 6, + turn2 = 7, + forward3 = 8, + null = 9 + /*forwardfromside = 10 (for the UltraSonic Side Shot) + turnsideshot = 11 +*/ +}; +Auton step; + +//sonlenoid creation +frc::Solenoid peerPressure1(0); +frc::Solenoid peerPressure2(1); +frc::Solenoid roboMyRio(2); + +//compressor creation +frc::Compressor bonusPressure(0); + +//limit switch creation +frc::DigitalInput stopIt(9); + +//revolution var +int forwardBackwardDistance = 46; //23 is about 5 ft +int turnDistance = 29; //25 is about 360 degrees on shop floors, 29 is about 360 on carpet + +//toggle variable for intake things +int toggle = 1; + +//Dead Zone Variables +double lonelyY; +double lonelyTwist; +double notFarEnough; void Robot::RobotInit() { @@ -50,21 +149,281 @@ void Robot::RobotPeriodic() * if-else structure below with additional strings. If using the SendableChooser * make sure to add them to the chooser code above as well. */ - void Robot::AutonomousInit() { - Robot::AutonomousInit2(); + m_autoSelected = m_chooser.GetSelected(); + // m_autoSelected = SmartDashboard::GetString("Auto Selector", + // kAutoNameDefault); + std::cout << "Auto selected: " << m_autoSelected << std::endl; + + /*if (m_autoSelected == kAutoNameCustom) { + // Custom Auto goes here + } + else { + // Default Auto goes here + }*/ + + step = forward1; + driveboi2.Follow(driveboi1, /*invert*/ false); + driveboi4.Follow(driveboi3, /*invert*/ false); + driveboi5.Follow(driveboi1, /*invert*/ false); + driveboi6.Follow(driveboi3, /*invert*/ false); } void Robot::AutonomousPeriodic() { - Robot::AutonomousPeriodic2(); -} -void Robot::TeleopInit() -{ + double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); + double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); + /*if (m_autoSelected == kAutoNameCustom) { + // Custom Auto goes here + } + else { + // Default Auto goes here + }*/ + + // Ultra Sonic Straight Shot (Best Option) (Not Tested) + switch (step) + { + case forward1: + { + if (batman.GetValue() > 375) //230 - 630 usable range + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = dump; + } + break; + } + case dump: + { + roboMyRio.Set(true); + Wait(.5); + roboMyRio.Set(false); + step = back1; + break; + } + case back1: + { + if (forwardBackward < 92) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn1; + } + break; + } + case turn1: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward2; + } + break; + } + case forward2: + { + if (batman.GetValue() > 250) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = back2; + } + break; + } + case back2: + { + if (forwardBackward < 4.6) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn2; + } + break; + } + case turn2: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward3; + } + break; + } + case forward3: + { + if (forwardBackward < 198.49) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = null; + } + break; + } + default: + break; + } + + //UltraSonic Side Shot (2nd Best Option) (Not Tested) + /* +switch (step) + { + case forwardfromside: + { + if (forwardBackward < 92) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = turnsideshot; + } + break; + } + case turnsideshot: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward1; + } + } + case forward1: + { + if (batman.GetValue() > 375) //230 - 630 usable range + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = dump; + } + break; + } + case dump: + { + roboMyRio.Set(true); + Wait(.5); + roboMyRio.Set(false); + step = back1; + break; + } + case back1: + { + if (forwardBackward < 92) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn1; + } + break; + } + case turn1: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward2; + } + break; + } + case forward2: + { + if (batman.GetValue() > 250) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = back2; + } + break; + } + case back2: + { + if (forwardBackward < 4.6) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn2; + } + break; + } + case turn2: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward3; + } + break; + } + case forward3: + { + if (forwardBackward < 198.49) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = null; + } + break; + } + default: + break; + } +*/ } +void Robot::TeleopInit() {} + void Robot::TeleopPeriodic() { //42 counts per rev. on neo diff --git a/src/main/cpp/Variables/Variables.h b/src/main/cpp/Variables/Variables.h deleted file mode 100644 index 94298e2..0000000 --- a/src/main/cpp/Variables/Variables.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once -#include - -//joystick creation -frc::Joystick *lonelyStick; -frc::JoystickButton *nuke; //button 4 -frc::JoystickButton *oneSpin; //button 6 -frc::JoystickButton *lessSpeed; //button 5 -frc::JoystickButton *moreSpeed; //button 3 -frc::JoystickButton *fullCheech; //button 2 -frc::JoystickButton *putItIn; //button 1 - -//tank drive creation -frc::DifferentialDrive *brit; - -//controller creation -frc::XboxController *neighborlyInputDevice; - -//brit motors -rev::CANSparkMax driveboi1(7, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi2(10, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi3(13, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi4(2, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi5(8, rev::CANSparkMax::MotorType::kBrushless); -rev::CANSparkMax driveboi6(9, rev::CANSparkMax::MotorType::kBrushless); - -//brit motor groups -frc::SpeedControllerGroup speedyboiL(driveboi1, driveboi2, driveboi3); -frc::SpeedControllerGroup speedyboiR(driveboi4, driveboi5, driveboi6); - -//winch motor creation -rev::CANSparkMax whench(12, rev::CANSparkMax::MotorType::kBrushless); -//climber motor creation -rev::CANSparkMax spoodermoon(11, rev::CANSparkMax::MotorType::kBrushless); -//mike whipper motor creation -ctre::phoenix::motorcontrol::can::VictorSPX whippedCheese = {25}; -//mike whipper up/down solenoid -frc::Solenoid viagra(3); -//intake motor creation -rev::CANSparkMax simp(1, rev::CANSparkMax::MotorType::kBrushless); - -//Encoder creation -rev::CANEncoder spinReader1 = driveboi1.GetEncoder(); -rev::CANEncoder spinReader2 = driveboi2.GetEncoder(); -rev::CANEncoder spinReader3 = driveboi3.GetEncoder(); -rev::CANEncoder spinReader4 = driveboi4.GetEncoder(); -rev::CANEncoder spinReader5 = driveboi5.GetEncoder(); -rev::CANEncoder spinReader6 = driveboi6.GetEncoder(); -//winch encoder creation -rev::CANEncoder pimp = whench.GetEncoder(); -//climber encoder creation -rev::CANEncoder gwen = spoodermoon.GetEncoder(); - -//camera creation -cs::UsbCamera fbi; - -//ultrasonic range sensor creation -frc::AnalogInput batman(0); // 230 - 630 is usable range -//ultrsonic variable -double distance; - -//speed var -double speed; -//auton steps variable thing -enum Auton -{ - forward1 = 1, - dump = 2, - back1 = 3, - turn1 = 4, - forward2 = 5, - back2 = 6, - turn2 = 7, - forward3 = 8, - null = 9 - /*forwardfromside = 10 (for the UltraSonic Side Shot) - turnsideshot = 11 -*/ -}; -Auton step; - -//sonlenoid creation -frc::Solenoid peerPressure1(0); -frc::Solenoid peerPressure2(1); -frc::Solenoid roboMyRio(2); - -//compressor creation -frc::Compressor bonusPressure(0); - -//limit switch creation -frc::DigitalInput stopIt(9); - -//revolution var -int forwardBackwardDistance = 46; //23 is about 5 ft -int turnDistance = 29; //25 is about 360 degrees on shop floors, 29 is about 360 on carpet - -//toggle variable for intake things -int toggle = 1; - -//Dead Zone Variables -double lonelyY; -double lonelyTwist; -double notFarEnough; diff --git a/src/main/include/Robot.h b/src/main/include/Robot.h index 732f282..d51c3d6 100644 --- a/src/main/include/Robot.h +++ b/src/main/include/Robot.h @@ -36,9 +36,7 @@ class Robot : public frc::TimedRobot void RobotInit() override; void RobotPeriodic() override; void AutonomousInit() override; - void AutonomousInit2(); void AutonomousPeriodic() override; - void AutonomousPeriodic2(); void TeleopInit() override; void TeleopPeriodic() override; void TestPeriodic() override; From 02cc528b349df18f4e71acaaac48adf04a246821 Mon Sep 17 00:00:00 2001 From: AdamJennissen Date: Thu, 27 Feb 2020 18:51:13 -0600 Subject: [PATCH 18/33] no more error squiggles --- .vscode/settings.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index cc74d5b..638a2bd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,5 +18,6 @@ "*.inc": "cpp", "*.tcc": "cpp", "fstream": "cpp" - } -} + }, + "C_Cpp.errorSquiggles": "Disabled" +} \ No newline at end of file From dc43336074981d25047ed860aeed47b1951e188e Mon Sep 17 00:00:00 2001 From: AdamJennissen Date: Thu, 27 Feb 2020 18:51:59 -0600 Subject: [PATCH 19/33] ? --- src/main/cpp/Robot.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index d523c62..91f211e 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -533,8 +533,9 @@ void Robot::TeleopPeriodic() } //90 Degree turn code (Not Tested) - /*if () + if () { + Robot::CounterClock(); } else if () { @@ -543,7 +544,7 @@ void Robot::TeleopPeriodic() else { ZeroMotors(); - }*/ + } speed = .8; From 8bafd4b52b192fee2a43a5df057542fa52991a4e Mon Sep 17 00:00:00 2001 From: AdamJennissen Date: Thu, 27 Feb 2020 18:53:09 -0600 Subject: [PATCH 20/33] clean --- src/main/cpp/Robot.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 91f211e..eae7b9f 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -478,8 +478,7 @@ void Robot::TeleopPeriodic() roboMyRio.Set(false); } - //mike - //intake code + //mike whipper and intake code if (neighborlyInputDevice->GetAButtonReleased()) { toggle = -toggle; From f8749b99008e217bbbd0916d5a68383983da22e7 Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Sat, 29 Feb 2020 08:20:18 -0600 Subject: [PATCH 21/33] 2nd intake motor --- src/main/cpp/Robot.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index eae7b9f..bdc0e79 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -37,6 +37,7 @@ ctre::phoenix::motorcontrol::can::VictorSPX whippedCheese = {25}; frc::Solenoid viagra(3); //intake motor creation rev::CANSparkMax simp(1, rev::CANSparkMax::MotorType::kBrushless); +rev::CANSparkMax egirl(3, rev::CANSparkMax::MotorType::kBrushless); //Encoder creation rev::CANEncoder spinReader1 = driveboi1.GetEncoder(); @@ -488,13 +489,15 @@ void Robot::TeleopPeriodic() { viagra.Set(false); simp.Set(0); + egirl.Set(0); whippedCheese.Set(ControlMode::PercentOutput, 0); //should be 0 just testing } else if (toggle == -1) { viagra.Set(true); - simp.Set(.5); - whippedCheese.Set(ControlMode::PercentOutput, .8); //should be .1 just testing + simp.Set(-1); + egirl.Set(1); + whippedCheese.Set(ControlMode::PercentOutput, 1); //should be .1 just testing } //winch code @@ -532,7 +535,7 @@ void Robot::TeleopPeriodic() } //90 Degree turn code (Not Tested) - if () + /*if () { Robot::CounterClock(); } @@ -544,7 +547,7 @@ void Robot::TeleopPeriodic() { ZeroMotors(); } - +*/ speed = .8; brit->ArcadeDrive(lonelyY * speed, lonelyTwist * speed); From a5008963afc2f4830780e1ea3b4fc5b1c2fc48a3 Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Sat, 29 Feb 2020 13:58:23 -0600 Subject: [PATCH 22/33] controls --- src/main/cpp/Robot.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index bdc0e79..c162653 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -82,6 +82,7 @@ Auton step; //sonlenoid creation frc::Solenoid peerPressure1(0); frc::Solenoid peerPressure2(1); +//dump intake frc::Solenoid roboMyRio(2); //compressor creation @@ -102,6 +103,9 @@ double lonelyY; double lonelyTwist; double notFarEnough; +//intake stop var +int estop = 1; + void Robot::RobotInit() { //m_chooser.SetDefaultOption(kAutoNameDefault, kAutoNameDefault); @@ -472,7 +476,7 @@ void Robot::TeleopPeriodic() peerPressure1.Set(moreSpeed->Get()); //pneumatic actuator - if (putItIn->Get()) + if (neighborlyInputDevice->GetXButton()) { roboMyRio.Set(true); Robot::Wait(.5); @@ -485,17 +489,36 @@ void Robot::TeleopPeriodic() toggle = -toggle; } - if (toggle == 1) + if (neighborlyInputDevice->GetBackButtonPressed()) + { + estop = -estop; + } + else if (estop == -1) { - viagra.Set(false); simp.Set(0); + } + else if (estop == 1) + { + simp.Set(-1); + } + + if (neighborlyInputDevice->GetYButton()) + { + viagra.Set(false); + simp.Set(1); + egirl.Set(-1); + } + else if (toggle == 1) + { + viagra.Set(false); + //simp.Set(0); egirl.Set(0); whippedCheese.Set(ControlMode::PercentOutput, 0); //should be 0 just testing } else if (toggle == -1) { viagra.Set(true); - simp.Set(-1); + //simp.Set(-1); egirl.Set(1); whippedCheese.Set(ControlMode::PercentOutput, 1); //should be .1 just testing } From 6657c563a7de506e4e03d2125143abf274dffebd Mon Sep 17 00:00:00 2001 From: Computer 3 <6758@devjoe.net> Date: Sat, 29 Feb 2020 17:10:10 -0600 Subject: [PATCH 23/33] limit move thingy --- src/main/cpp/Robot.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index c162653..1860683 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -39,6 +39,8 @@ frc::Solenoid viagra(3); rev::CANSparkMax simp(1, rev::CANSparkMax::MotorType::kBrushless); rev::CANSparkMax egirl(3, rev::CANSparkMax::MotorType::kBrushless); +ctre::phoenix::motorcontrol::can::VictorSPX heli = {26}; + //Encoder creation rev::CANEncoder spinReader1 = driveboi1.GetEncoder(); rev::CANEncoder spinReader2 = driveboi2.GetEncoder(); @@ -173,6 +175,11 @@ void Robot::AutonomousInit() driveboi4.Follow(driveboi3, /*invert*/ false); driveboi5.Follow(driveboi1, /*invert*/ false); driveboi6.Follow(driveboi3, /*invert*/ false); + + //limit switch moving thingy + heli.Set(ControlMode::PercentOutput, .2); + wait(.01); + heli.Set(ControlMode::PercentOutput, 0); } void Robot::AutonomousPeriodic() @@ -427,7 +434,13 @@ switch (step) */ } -void Robot::TeleopInit() {} +void Robot::TeleopInit() +{ + //limit switch moving thingy but the other way + heli.Set(ControlMode::PercentOutput, -.2); + wait(.009); + heli.Set(ControlMode::PercentOutput, 0); +} void Robot::TeleopPeriodic() { From 8f517df153b67c2d13dbaa356a49554f1150ad60 Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Sat, 29 Feb 2020 17:21:27 -0600 Subject: [PATCH 24/33] changes --- src/main/cpp/Robot.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index c162653..3f08381 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -493,11 +493,11 @@ void Robot::TeleopPeriodic() { estop = -estop; } - else if (estop == -1) + else if (estop == 1) { simp.Set(0); } - else if (estop == 1) + else if (estop == -1) { simp.Set(-1); } @@ -511,14 +511,14 @@ void Robot::TeleopPeriodic() else if (toggle == 1) { viagra.Set(false); - //simp.Set(0); + simp.Set(0); egirl.Set(0); whippedCheese.Set(ControlMode::PercentOutput, 0); //should be 0 just testing } else if (toggle == -1) { viagra.Set(true); - //simp.Set(-1); + simp.Set(-1); egirl.Set(1); whippedCheese.Set(ControlMode::PercentOutput, 1); //should be .1 just testing } From 1402d67a3d04110380f5829f1fa24cea260b6eff Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:12:59 -0600 Subject: [PATCH 25/33] limit move thingy tested and works --- src/main/cpp/Robot.cpp | 60 ++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 8e15fba..a4d6956 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -39,7 +39,9 @@ frc::Solenoid viagra(3); rev::CANSparkMax simp(1, rev::CANSparkMax::MotorType::kBrushless); rev::CANSparkMax egirl(3, rev::CANSparkMax::MotorType::kBrushless); +//limit switch move thing ctre::phoenix::motorcontrol::can::VictorSPX heli = {26}; +int x; //Encoder creation rev::CANEncoder spinReader1 = driveboi1.GetEncoder(); @@ -177,22 +179,26 @@ void Robot::AutonomousInit() driveboi6.Follow(driveboi3, /*invert*/ false); //limit switch moving thingy - heli.Set(ControlMode::PercentOutput, .2); - wait(.01); - heli.Set(ControlMode::PercentOutput, 0); + if (1 == 1) + { + heli.Set(ControlMode::PercentOutput, -1); + Wait(.09); + heli.Set(ControlMode::PercentOutput, 0); + x = 1; + } } void Robot::AutonomousPeriodic() -{ +{ /* - double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); - double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); - /*if (m_autoSelected == kAutoNameCustom) { - // Custom Auto goes here - } - else { - // Default Auto goes here - }*/ + // double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); + // double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); + // if (m_autoSelected == kAutoNameCustom) { + // // Custom Auto goes here + // } + // else { + // // Default Auto goes here + // } // Ultra Sonic Straight Shot (Best Option) (Not Tested) switch (step) @@ -301,15 +307,15 @@ void Robot::AutonomousPeriodic() } //UltraSonic Side Shot (2nd Best Option) (Not Tested) - /* -switch (step) + + switch (step) { case forwardfromside: { if (forwardBackward < 92) { - Robot::Forwards(); - } + Robot::Forwards(); + } else { ZeroMotors(); @@ -431,19 +437,33 @@ switch (step) default: break; } -*/ + */ } void Robot::TeleopInit() { //limit switch moving thingy but the other way - heli.Set(ControlMode::PercentOutput, -.2); - wait(.009); - heli.Set(ControlMode::PercentOutput, 0); + if (x == 1) + { + heli.Set(ControlMode::PercentOutput, 1); + Wait(.075); + heli.Set(ControlMode::PercentOutput, 0); + x = 2; + } } void Robot::TeleopPeriodic() { + //limit switch move button + if (neighborlyInputDevice->GetStartButton()) + { + heli.Set(ControlMode::PercentOutput, .1); + } + else + { + heli.Set(ControlMode::PercentOutput, 0); + } + //42 counts per rev. on neo if (spinReader1.GetVelocity() == 0) spinReader1.SetPosition(0); From f992ed1ec342314854b50a9aa7ac41c671be7bb2 Mon Sep 17 00:00:00 2001 From: Computer 3 <6758@devjoe.net> Date: Sat, 29 Feb 2020 18:21:16 -0600 Subject: [PATCH 26/33] limit auton --- src/main/cpp/Robot.cpp | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index a4d6956..f5eabbd 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -1,5 +1,8 @@ #include "Robot.h" +#define StraightShot +// #define SideShot + //joystick creation frc::Joystick *lonelyStick; frc::JoystickButton *nuke; //button 4 @@ -189,23 +192,24 @@ void Robot::AutonomousInit() } void Robot::AutonomousPeriodic() -{ /* - - // double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); - // double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); - // if (m_autoSelected == kAutoNameCustom) { - // // Custom Auto goes here - // } - // else { - // // Default Auto goes here - // } - - // Ultra Sonic Straight Shot (Best Option) (Not Tested) +{ + +// double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); +// double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); +// if (m_autoSelected == kAutoNameCustom) { +// // Custom Auto goes here +// } +// else { +// // Default Auto goes here +// } + +//Straight Shot (Best Option) (Not Tested) +#ifdef StraightShot switch (step) { case forward1: { - if (batman.GetValue() > 375) //230 - 630 usable range + if (!stopIt.Get()) //230 - 630 usable range { Robot::Forwards(); } @@ -252,7 +256,7 @@ void Robot::AutonomousPeriodic() } case forward2: { - if (batman.GetValue() > 250) + if (!stopIt.Get()) { Robot::Forwards(); } @@ -305,9 +309,10 @@ void Robot::AutonomousPeriodic() default: break; } +#endif //UltraSonic Side Shot (2nd Best Option) (Not Tested) - +#ifdef SideShot switch (step) { case forwardfromside: @@ -337,7 +342,7 @@ void Robot::AutonomousPeriodic() } case forward1: { - if (batman.GetValue() > 375) //230 - 630 usable range + if (!stopIt.Get()) //230 - 630 usable range { Robot::Forwards(); } @@ -384,7 +389,7 @@ void Robot::AutonomousPeriodic() } case forward2: { - if (batman.GetValue() > 250) + if (!stopIt.Get()) { Robot::Forwards(); } @@ -437,7 +442,7 @@ void Robot::AutonomousPeriodic() default: break; } - */ +#endif } void Robot::TeleopInit() From 4256c94bc5815b0dc155296c4012dfbd4caaaa7a Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Mon, 2 Mar 2020 15:38:48 -0600 Subject: [PATCH 27/33] sure --- src/main/cpp/Robot.cpp | 141 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 125 insertions(+), 16 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index a4d6956..c79e744 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -57,6 +57,7 @@ rev::CANEncoder gwen = spoodermoon.GetEncoder(); //camera creation cs::UsbCamera fbi; +cs::UsbCamera cia; //ultrasonic range sensor creation frc::AnalogInput batman(0); // 230 - 630 is usable range @@ -119,6 +120,8 @@ void Robot::RobotInit() //setting up camera fbi = frc::CameraServer::GetInstance()->StartAutomaticCapture(0); fbi.SetVideoMode(cs::VideoMode::PixelFormat::kYUYV, 320, 240, 10); + cia = frc::CameraServer::GetInstance()->StartAutomaticCapture(1); + cia.SetVideoMode(cs::VideoMode::PixelFormat::kYUYV, 320, 240, 10); //setting up controller neighborlyInputDevice = new frc::XboxController(1); @@ -174,9 +177,9 @@ void Robot::AutonomousInit() step = forward1; driveboi2.Follow(driveboi1, /*invert*/ false); - driveboi4.Follow(driveboi3, /*invert*/ false); - driveboi5.Follow(driveboi1, /*invert*/ false); - driveboi6.Follow(driveboi3, /*invert*/ false); + driveboi4.Follow(driveboi5, /*invert*/ false); + driveboi3.Follow(driveboi1, /*invert*/ false); + driveboi6.Follow(driveboi5, /*invert*/ false); //limit switch moving thingy if (1 == 1) @@ -189,17 +192,17 @@ void Robot::AutonomousInit() } void Robot::AutonomousPeriodic() -{ /* +{ - // double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); - // double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); + double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); + double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); // if (m_autoSelected == kAutoNameCustom) { // // Custom Auto goes here - // } + // } // else { // // Default Auto goes here // } - + /* // Ultra Sonic Straight Shot (Best Option) (Not Tested) switch (step) { @@ -438,6 +441,112 @@ void Robot::AutonomousPeriodic() break; } */ + + // Encoder Straight Shot (3rd Option) (Not Tested) + switch (step) + { + case forward1: + { + if (forwardBackward > 92) //way to far + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = dump; + } + break; + } + case dump: + { + roboMyRio.Set(true); + Wait(.5); + roboMyRio.Set(false); + step = back1; + break; + } + case back1: + { + if (forwardBackward < 92) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn1; + } + break; + } + case turn1: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward2; + } + break; + } + case forward2: + { + if (forwardBackward < 72.578) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = back2; + } + break; + } + case back2: + { + if (forwardBackward < 4.6) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn2; + } + break; + } + case turn2: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward3; + } + break; + } + case forward3: + { + if (forwardBackward < 198.49) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = null; + } + break; + } + default: + break; + } } void Robot::TeleopInit() @@ -581,9 +690,9 @@ void Robot::TeleopPeriodic() } //Bumber to preset climbing positions (63 in and all the way down) - if (neighborlyInputDevice->GetBumper(frc::GenericHID::JoystickHand::kRightHand) && -gwen.GetPosition() < 82) + if (neighborlyInputDevice->GetBumper(frc::GenericHID::JoystickHand::kRightHand) && -gwen.GetPosition() < 75) { - spoodermoon.Set(-.2); + spoodermoon.Set(-.3); } else if (neighborlyInputDevice->GetBumper(frc::GenericHID::JoystickHand::kLeftHand) && -gwen.GetPosition() > 0) { @@ -625,23 +734,23 @@ void Robot::ZeroMotors() void Robot::Forwards() { - driveboi1.Set(-.5); - driveboi3.Set(.5); + driveboi1.Set(.5); + driveboi5.Set(-.5); } void Robot::Backwards() { - driveboi1.Set(.5); - driveboi3.Set(-.5); + driveboi1.Set(-.5); + driveboi5.Set(.5); } void Robot::Clock() { driveboi1.Set(.5); - driveboi3.Set(.5); + driveboi5.Set(.5); } void Robot::CounterClock() { driveboi1.Set(-.5); - driveboi3.Set(-.5); + driveboi5.Set(-.5); } void Robot::Wait(double seconds) { From 0428cea4ec54057d2edf73d97b97247b13199e66 Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Mon, 2 Mar 2020 16:21:08 -0600 Subject: [PATCH 28/33] turn thing button thing --- src/main/cpp/Robot.cpp | 640 +++++++++++++++++------------------------ 1 file changed, 267 insertions(+), 373 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 0f9070d..5557769 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -81,9 +81,6 @@ enum Auton turn2 = 7, forward3 = 8, null = 9 - /*forwardfromside = 10 (for the UltraSonic Side Shot) - turnsideshot = 11 -*/ }; Auton step; @@ -99,10 +96,6 @@ frc::Compressor bonusPressure(0); //limit switch creation frc::DigitalInput stopIt(9); -//revolution var -int forwardBackwardDistance = 46; //23 is about 5 ft -int turnDistance = 29; //25 is about 360 degrees on shop floors, 29 is about 360 on carpet - //toggle variable for intake things int toggle = 1; @@ -114,6 +107,10 @@ double notFarEnough; //intake stop var int estop = 1; +//encoder variables +double forwardBackward; +double turn; + void Robot::RobotInit() { //m_chooser.SetDefaultOption(kAutoNameDefault, kAutoNameDefault); @@ -152,6 +149,8 @@ void Robot::RobotInit() */ void Robot::RobotPeriodic() { + double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); + double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); } /** * This autonomous (along with the chooser code above) shows how to select @@ -184,399 +183,290 @@ void Robot::AutonomousInit() driveboi3.Follow(driveboi1, /*invert*/ false); driveboi6.Follow(driveboi5, /*invert*/ false); - //limit switch moving thingy - if (1 == 1) - { - heli.Set(ControlMode::PercentOutput, -1); - Wait(.09); - heli.Set(ControlMode::PercentOutput, 0); - x = 1; - } + // //limit switch moving thingy + // if (1 == 1) + // { + // heli.Set(ControlMode::PercentOutput, -1); + // Wait(.09); + // heli.Set(ControlMode::PercentOutput, 0); + // x = 1; + // } } void Robot::AutonomousPeriodic() { - - double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); - double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); // if (m_autoSelected == kAutoNameCustom) { // // Custom Auto goes here // } // else { // // Default Auto goes here -} +// } //Straight Shot (Best Option) (Not Tested) #ifdef StraightShot -switch (step) -{ -case forward1: -{ - if (!stopIt.Get()) //230 - 630 usable range - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = dump; - } - break; -} -case dump: -{ - roboMyRio.Set(true); - Wait(.5); - roboMyRio.Set(false); - step = back1; - break; -} -case back1: -{ - if (forwardBackward < 92) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn1; - } - break; -} -case turn1: -{ - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward2; - } - break; -} -case forward2: -{ - if (!stopIt.Get()) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = back2; - } - break; -} -case back2: -{ - if (forwardBackward < 4.6) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn2; - } - break; -} -case turn2: -{ - if (turn < 14.5) - { - Robot::Clock(); - } - else + switch (step) { - ZeroMotors(); - step = forward3; - } - break; -} -case forward3: -{ - if (forwardBackward < 198.49) + case forward1: { - Robot::Forwards(); + if (!stopIt.Get()) //230 - 630 usable range + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = dump; + } + break; } - else + case dump: { - ZeroMotors(); - step = null; + roboMyRio.Set(true); + Wait(.5); + roboMyRio.Set(false); + step = back1; + break; + } + case back1: + { + if (forwardBackward < 92) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn1; + } + break; + } + case turn1: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward2; + } + break; + } + case forward2: + { + if (!stopIt.Get()) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = back2; + } + break; + } + case back2: + { + if (forwardBackward < 4.6) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn2; + } + break; + } + case turn2: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward3; + } + break; + } + case forward3: + { + if (forwardBackward < 198.49) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = null; + } + break; + } + default: + break; } - break; -} -default: - break; -} #endif //UltraSonic Side Shot (2nd Best Option) (Not Tested) #ifdef SideShot -switch (step) -{ -case forwardfromside: -{ - if (forwardBackward < 92) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = turnsideshot; - } - break; -} -case turnsideshot: -{ - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward1; - } -} -case forward1: -{ - if (!stopIt.Get()) //230 - 630 usable range - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = dump; - } - break; -} -case dump: -{ - roboMyRio.Set(true); - Wait(.5); - roboMyRio.Set(false); - step = back1; - break; -} -case back1: -{ - if (forwardBackward < 92) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn1; - } - break; -} -case turn1: -{ - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward2; - } - break; -} -case forward2: -{ - if (!stopIt.Get()) - { - Robot::Forwards(); - } - else + switch (step) + { + case forwardfromside: + { + if (forwardBackward < 92) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = turnsideshot; + } + break; + } + case turnsideshot: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward1; + } + } + case forward1: + { + if (!stopIt.Get()) //230 - 630 usable range + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = dump; + } + break; + } + case dump: { - ZeroMotors(); - step = back2; - } - break; -} -case back2: -{ - if (forwardBackward < 4.6) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn2; - } - break; -} -case turn2: -{ - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward3; - } - break; -} -case forward3: -{ - if (forwardBackward < 198.49) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = null; + roboMyRio.Set(true); + Wait(.5); + roboMyRio.Set(false); + step = back1; + break; + } + case back1: + { + if (forwardBackward < 92) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn1; + } + break; + } + case turn1: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward2; + } + break; + } + case forward2: + { + if (!stopIt.Get()) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = back2; + } + break; + } + case back2: + { + if (forwardBackward < 4.6) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn2; + } + break; + } + case turn2: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward3; + } + break; + } + case forward3: + { + if (forwardBackward < 198.49) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = null; + } + break; + } + default: + break; } - break; -} -default: - break; -} #endif - -// Encoder Straight Shot (3rd Option) (Not Tested) -switch (step) -{ -case forward1: -{ - if (forwardBackward > 92) //way to far - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = dump; - } - break; -} -case dump: -{ - roboMyRio.Set(true); - Wait(.5); - roboMyRio.Set(false); - step = back1; - break; -} -case back1: -{ - if (forwardBackward < 92) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn1; - } - break; -} -case turn1: -{ - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward2; - } - break; -} -case forward2: -{ - if (forwardBackward < 72.578) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = back2; - } - break; -} -case back2: -{ - if (forwardBackward < 4.6) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn2; - } - break; -} -case turn2: -{ - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward3; - } - break; -} -case forward3: -{ - if (forwardBackward < 198.49) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = null; - } - break; -} -default: - break; -} } void Robot::TeleopInit() { - //limit switch moving thingy but the other way - if (x == 1) - { - heli.Set(ControlMode::PercentOutput, 1); - Wait(.075); - heli.Set(ControlMode::PercentOutput, 0); - x = 2; - } + // //limit switch moving thingy but the other way + // if (x == 1) + // { + // heli.Set(ControlMode::PercentOutput, 1); + // Wait(.075); + // heli.Set(ControlMode::PercentOutput, 0); + // x = 2; + // } } void Robot::TeleopPeriodic() { - //limit switch move button - if (neighborlyInputDevice->GetStartButton()) - { - heli.Set(ControlMode::PercentOutput, .1); - } - else - { - heli.Set(ControlMode::PercentOutput, 0); - } + // //limit switch move button + // if (neighborlyInputDevice->GetStartButton()) + // { + // heli.Set(ControlMode::PercentOutput, .1); + // } + // else + // { + // heli.Set(ControlMode::PercentOutput, 0); + // } //42 counts per rev. on neo if (spinReader1.GetVelocity() == 0) @@ -655,10 +545,14 @@ void Robot::TeleopPeriodic() simp.Set(1); egirl.Set(-1); } + else if (neighborlyInputDevice->GetStartButton()) + { + simp.Set(-1); + egirl.Set(1); + } else if (toggle == 1) { viagra.Set(false); - simp.Set(0); egirl.Set(0); whippedCheese.Set(ControlMode::PercentOutput, 0); //should be 0 just testing } @@ -704,12 +598,12 @@ void Robot::TeleopPeriodic() spoodermoon.Set(.2); } - //90 Degree turn code (Not Tested) - /*if () + //90 Degrees turn code (Not Tested) + if (fullCheech->Get() && turn > -10) { Robot::CounterClock(); } - else if () + else if (putItIn->Get() && turn < 10) { Robot::Clock(); } @@ -717,7 +611,7 @@ void Robot::TeleopPeriodic() { ZeroMotors(); } -*/ + speed = .8; brit->ArcadeDrive(lonelyY * speed, lonelyTwist * speed); From 819514b56db4397b1de1d6e45803d9894869d7b3 Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Mon, 2 Mar 2020 17:06:41 -0600 Subject: [PATCH 29/33] turn button --- src/main/cpp/Robot.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 5557769..54b2e97 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -111,6 +111,10 @@ int estop = 1; double forwardBackward; double turn; +//turn variables +int right; +int left; + void Robot::RobotInit() { //m_chooser.SetDefaultOption(kAutoNameDefault, kAutoNameDefault); @@ -599,17 +603,27 @@ void Robot::TeleopPeriodic() } //90 Degrees turn code (Not Tested) - if (fullCheech->Get() && turn > -10) + if (fullCheech->Get()) + { + right = 1; + } + else if (putItIn->Get()) + { + left = 1; + } + + if (right == 1 && turn > -10) { Robot::CounterClock(); } - else if (putItIn->Get() && turn < 10) + else if (left == 1 && turn < 10) { Robot::Clock(); } else { - ZeroMotors(); + right = 0; + left = 0; } speed = .8; @@ -622,7 +636,7 @@ void Robot::TestPeriodic() {} void Robot::ZeroMotors() { driveboi1.Set(0); - driveboi3.Set(0); + driveboi5.Set(0); spinReader1.SetPosition(0); spinReader2.SetPosition(0); spinReader3.SetPosition(0); From 1d127444f61270cf19eca0612435d16673a0ad59 Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Tue, 3 Mar 2020 17:14:11 -0600 Subject: [PATCH 30/33] AUTON? --- src/main/cpp/Robot.cpp | 221 +++++++++++++++++++++++++++++------------ 1 file changed, 158 insertions(+), 63 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 54b2e97..5b14bad 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -81,6 +81,9 @@ enum Auton turn2 = 7, forward3 = 8, null = 9 + /*forwardfromside = 10 (for the UltraSonic Side Shot) + turnsideshot = 11 +*/ }; Auton step; @@ -96,6 +99,10 @@ frc::Compressor bonusPressure(0); //limit switch creation frc::DigitalInput stopIt(9); +//revolution var +int forwardBackwardDistance = 46; //23 is about 5 ft +int turnDistance = 29; //25 is about 360 degrees on shop floors, 29 is about 360 on carpet + //toggle variable for intake things int toggle = 1; @@ -107,14 +114,6 @@ double notFarEnough; //intake stop var int estop = 1; -//encoder variables -double forwardBackward; -double turn; - -//turn variables -int right; -int left; - void Robot::RobotInit() { //m_chooser.SetDefaultOption(kAutoNameDefault, kAutoNameDefault); @@ -153,8 +152,6 @@ void Robot::RobotInit() */ void Robot::RobotPeriodic() { - double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); - double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); } /** * This autonomous (along with the chooser code above) shows how to select @@ -187,24 +184,27 @@ void Robot::AutonomousInit() driveboi3.Follow(driveboi1, /*invert*/ false); driveboi6.Follow(driveboi5, /*invert*/ false); - // //limit switch moving thingy - // if (1 == 1) - // { - // heli.Set(ControlMode::PercentOutput, -1); - // Wait(.09); - // heli.Set(ControlMode::PercentOutput, 0); - // x = 1; - // } + //limit switch moving thingy + if (1 == 1) + { + heli.Set(ControlMode::PercentOutput, -1); + Wait(.09); + heli.Set(ControlMode::PercentOutput, 0); + x = 1; + } } void Robot::AutonomousPeriodic() { - // if (m_autoSelected == kAutoNameCustom) { - // // Custom Auto goes here - // } - // else { - // // Default Auto goes here -// } + + double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); + double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); +// if (m_autoSelected == kAutoNameCustom) { +// // Custom Auto goes here +// } +// else { +// // Default Auto goes here +// } //Straight Shot (Best Option) (Not Tested) #ifdef StraightShot @@ -314,7 +314,7 @@ void Robot::AutonomousPeriodic() } #endif -//UltraSonic Side Shot (2nd Best Option) (Not Tested) + //UltraSonic Side Shot (2nd Best Option) (Not Tested) #ifdef SideShot switch (step) { @@ -445,32 +445,141 @@ void Robot::AutonomousPeriodic() default: break; } +<<<<<<< HEAD + * / + + // Encoder Straight Shot (3rd Option) (Not Tested) + switch (step) + { + case forward1: + { + if (forwardBackward > 92) //way to far + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = dump; + } + break; + } + case dump: + { + roboMyRio.Set(true); + Wait(.5); + roboMyRio.Set(false); + step = back1; + break; + } + case back1: + { + if (forwardBackward < 92) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn1; + } + break; + } + case turn1: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward2; + } + break; + } + case forward2: + { + if (forwardBackward < 72.578) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = back2; + } + break; + } + case back2: + { + if (forwardBackward < 4.6) + { + Robot::Backwards(); + } + else + { + ZeroMotors(); + step = turn2; + } + break; + } + case turn2: + { + if (turn < 14.5) + { + Robot::Clock(); + } + else + { + ZeroMotors(); + step = forward3; + } + break; + } + case forward3: + { + if (forwardBackward < 198.49) + { + Robot::Forwards(); + } + else + { + ZeroMotors(); + step = null; + } + break; + } + default: + break; + } + == == == = #endif } void Robot::TeleopInit() { - // //limit switch moving thingy but the other way - // if (x == 1) - // { - // heli.Set(ControlMode::PercentOutput, 1); - // Wait(.075); - // heli.Set(ControlMode::PercentOutput, 0); - // x = 2; - // } + //limit switch moving thingy but the other way + if (x == 1) + { + heli.Set(ControlMode::PercentOutput, 1); + Wait(.075); + heli.Set(ControlMode::PercentOutput, 0); + x = 2; + } } void Robot::TeleopPeriodic() { - // //limit switch move button - // if (neighborlyInputDevice->GetStartButton()) - // { - // heli.Set(ControlMode::PercentOutput, .1); - // } - // else - // { - // heli.Set(ControlMode::PercentOutput, 0); - // } + //limit switch move button + if (neighborlyInputDevice->GetStartButton()) + { + heli.Set(ControlMode::PercentOutput, .1); + } + else + { + heli.Set(ControlMode::PercentOutput, 0); + } //42 counts per rev. on neo if (spinReader1.GetVelocity() == 0) @@ -549,14 +658,10 @@ void Robot::TeleopPeriodic() simp.Set(1); egirl.Set(-1); } - else if (neighborlyInputDevice->GetStartButton()) - { - simp.Set(-1); - egirl.Set(1); - } else if (toggle == 1) { viagra.Set(false); + simp.Set(0); egirl.Set(0); whippedCheese.Set(ControlMode::PercentOutput, 0); //should be 0 just testing } @@ -602,30 +707,20 @@ void Robot::TeleopPeriodic() spoodermoon.Set(.2); } - //90 Degrees turn code (Not Tested) - if (fullCheech->Get()) - { - right = 1; - } - else if (putItIn->Get()) - { - left = 1; - } - - if (right == 1 && turn > -10) + //90 Degree turn code (Not Tested) + /*if () { Robot::CounterClock(); } - else if (left == 1 && turn < 10) + else if () { Robot::Clock(); } else { - right = 0; - left = 0; + ZeroMotors(); } - +*/ speed = .8; brit->ArcadeDrive(lonelyY * speed, lonelyTwist * speed); @@ -636,7 +731,7 @@ void Robot::TestPeriodic() {} void Robot::ZeroMotors() { driveboi1.Set(0); - driveboi5.Set(0); + driveboi3.Set(0); spinReader1.SetPosition(0); spinReader2.SetPosition(0); spinReader3.SetPosition(0); From 61cda38d29e9ea8eef883fad541bb8e8504775aa Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Tue, 3 Mar 2020 17:17:45 -0600 Subject: [PATCH 31/33] idk anymore --- src/main/cpp/Robot.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 5b14bad..75d11d1 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -212,7 +212,7 @@ void Robot::AutonomousPeriodic() { case forward1: { - if (!stopIt.Get()) //230 - 630 usable range + if (batman.GetValue() < 95) //230 - 630 usable range { Robot::Forwards(); } @@ -259,7 +259,7 @@ void Robot::AutonomousPeriodic() } case forward2: { - if (!stopIt.Get()) + if (batman.GetValue() < 95) { Robot::Forwards(); } @@ -345,7 +345,7 @@ void Robot::AutonomousPeriodic() } case forward1: { - if (!stopIt.Get()) //230 - 630 usable range + if (batman.GetValue() < 95) //230 - 630 usable range { Robot::Forwards(); } @@ -392,7 +392,7 @@ void Robot::AutonomousPeriodic() } case forward2: { - if (!stopIt.Get()) + if (batman.GetValue() < 95) { Robot::Forwards(); } From bae06f52e463b1cb16c7171a37bcfc883f57beef Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Tue, 3 Mar 2020 17:21:57 -0600 Subject: [PATCH 32/33] auton --- src/main/cpp/Robot.cpp | 124 ++++------------------------------------- 1 file changed, 11 insertions(+), 113 deletions(-) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index 75d11d1..d31efc4 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -114,6 +114,13 @@ double notFarEnough; //intake stop var int estop = 1; +<<<<<<< HEAD +== == == = + //encoder variables + double forwardBackward; +double turn; + +>>>>>>> parent of 819514b... turn button void Robot::RobotInit() { //m_chooser.SetDefaultOption(kAutoNameDefault, kAutoNameDefault); @@ -445,115 +452,6 @@ void Robot::AutonomousPeriodic() default: break; } -<<<<<<< HEAD - * / - - // Encoder Straight Shot (3rd Option) (Not Tested) - switch (step) - { - case forward1: - { - if (forwardBackward > 92) //way to far - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = dump; - } - break; - } - case dump: - { - roboMyRio.Set(true); - Wait(.5); - roboMyRio.Set(false); - step = back1; - break; - } - case back1: - { - if (forwardBackward < 92) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn1; - } - break; - } - case turn1: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward2; - } - break; - } - case forward2: - { - if (forwardBackward < 72.578) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = back2; - } - break; - } - case back2: - { - if (forwardBackward < 4.6) - { - Robot::Backwards(); - } - else - { - ZeroMotors(); - step = turn2; - } - break; - } - case turn2: - { - if (turn < 14.5) - { - Robot::Clock(); - } - else - { - ZeroMotors(); - step = forward3; - } - break; - } - case forward3: - { - if (forwardBackward < 198.49) - { - Robot::Forwards(); - } - else - { - ZeroMotors(); - step = null; - } - break; - } - default: - break; - } - == == == = #endif } @@ -707,12 +605,12 @@ void Robot::TeleopPeriodic() spoodermoon.Set(.2); } - //90 Degree turn code (Not Tested) - /*if () + //90 Degrees turn code (Not Tested) + if (fullCheech->Get() && turn > -10) { Robot::CounterClock(); } - else if () + else if (putItIn->Get() && turn < 10) { Robot::Clock(); } @@ -720,7 +618,7 @@ void Robot::TeleopPeriodic() { ZeroMotors(); } -*/ + speed = .8; brit->ArcadeDrive(lonelyY * speed, lonelyTwist * speed); From 664c50b301274f3791f9f49aa212c6ea6cff7eec Mon Sep 17 00:00:00 2001 From: 6758Guy <46696216+6758Guy@users.noreply.github.com> Date: Thu, 5 Mar 2020 13:41:58 -0600 Subject: [PATCH 33/33] more stuff --- build.gradle | 2 +- src/main/cpp/Robot.cpp | 199 +++++++++++++++++++----------------- vendordeps/Phoenix.json | 30 +++--- vendordeps/REVRobotics.json | 78 +++++++------- 4 files changed, 162 insertions(+), 147 deletions(-) diff --git a/build.gradle b/build.gradle index d7c94a4..3a93cbb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2020.2.2" + id "edu.wpi.first.GradleRIO" version "2020.3.2" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/src/main/cpp/Robot.cpp b/src/main/cpp/Robot.cpp index d31efc4..b3e4ac2 100644 --- a/src/main/cpp/Robot.cpp +++ b/src/main/cpp/Robot.cpp @@ -11,6 +11,7 @@ frc::JoystickButton *lessSpeed; //button 5 frc::JoystickButton *moreSpeed; //button 3 frc::JoystickButton *fullCheech; //button 2 frc::JoystickButton *putItIn; //button 1 +frc::JoystickButton *snoop; //button 7 //tank drive creation frc::DifferentialDrive *brit; @@ -43,8 +44,8 @@ rev::CANSparkMax simp(1, rev::CANSparkMax::MotorType::kBrushless); rev::CANSparkMax egirl(3, rev::CANSparkMax::MotorType::kBrushless); //limit switch move thing -ctre::phoenix::motorcontrol::can::VictorSPX heli = {26}; -int x; +// ctre::phoenix::motorcontrol::can::VictorSPX heli = {26}; +// int x; //Encoder creation rev::CANEncoder spinReader1 = driveboi1.GetEncoder(); @@ -87,6 +88,10 @@ enum Auton }; Auton step; +// encoder variables +double forwardBackward; +double turn; + //sonlenoid creation frc::Solenoid peerPressure1(0); frc::Solenoid peerPressure2(1); @@ -99,10 +104,6 @@ frc::Compressor bonusPressure(0); //limit switch creation frc::DigitalInput stopIt(9); -//revolution var -int forwardBackwardDistance = 46; //23 is about 5 ft -int turnDistance = 29; //25 is about 360 degrees on shop floors, 29 is about 360 on carpet - //toggle variable for intake things int toggle = 1; @@ -114,13 +115,10 @@ double notFarEnough; //intake stop var int estop = 1; -<<<<<<< HEAD -== == == = - //encoder variables - double forwardBackward; -double turn; +//turn variables +int right; +int left; ->>>>>>> parent of 819514b... turn button void Robot::RobotInit() { //m_chooser.SetDefaultOption(kAutoNameDefault, kAutoNameDefault); @@ -144,6 +142,7 @@ void Robot::RobotInit() lessSpeed = new frc::JoystickButton(lonelyStick, 5); moreSpeed = new frc::JoystickButton(lonelyStick, 3); putItIn = new frc::JoystickButton(lonelyStick, 1); + snoop = new frc::JoystickButton(lonelyStick, 7); //setting up drivetrain brit = new frc::DifferentialDrive(speedyboiL, speedyboiR); @@ -190,36 +189,42 @@ void Robot::AutonomousInit() driveboi4.Follow(driveboi5, /*invert*/ false); driveboi3.Follow(driveboi1, /*invert*/ false); driveboi6.Follow(driveboi5, /*invert*/ false); - - //limit switch moving thingy - if (1 == 1) - { - heli.Set(ControlMode::PercentOutput, -1); - Wait(.09); - heli.Set(ControlMode::PercentOutput, 0); - x = 1; - } } void Robot::AutonomousPeriodic() { - - double forwardBackward = spinReader1.GetPosition() - spinReader3.GetPosition(); - double turn = spinReader1.GetPosition() + spinReader3.GetPosition(); -// if (m_autoSelected == kAutoNameCustom) { -// // Custom Auto goes here -// } -// else { -// // Default Auto goes here -// } - + double distance = batman.GetValue() * 0.393701; + + forwardBackward = spinReader1.GetPosition() - spinReader5.GetPosition(); + turn = spinReader1.GetPosition() + spinReader5.GetPosition(); + // if (m_autoSelected == kAutoNameCustom) { + // // Custom Auto goes here + // } + // else { + // // Default Auto goes here + // } + //Read Encoder + frc::SmartDashboard::PutNumber("Encoder1 Position", spinReader1.GetPosition()); + frc::SmartDashboard::PutNumber("Encoder2 Position", spinReader2.GetPosition()); + frc::SmartDashboard::PutNumber("Encoder3 Position", spinReader3.GetPosition()); + frc::SmartDashboard::PutNumber("Encoder4 Position", spinReader4.GetPosition()); + frc::SmartDashboard::PutNumber("Encoder5 Position", spinReader5.GetPosition()); + frc::SmartDashboard::PutNumber("Encoder6 Position", spinReader6.GetPosition()); + frc::SmartDashboard::PutNumber("climber position", -gwen.GetPosition()); + frc::SmartDashboard::PutNumber("Range Sensor 1", distance); +/* + //climber down + if (-gwen.GetPosition() > -42.1) + { + spoodermoon.Set(.5); + } */ //Straight Shot (Best Option) (Not Tested) #ifdef StraightShot switch (step) { case forward1: { - if (batman.GetValue() < 95) //230 - 630 usable range + if (distance > 230) //230 - 630 usable range { Robot::Forwards(); } @@ -233,14 +238,14 @@ void Robot::AutonomousPeriodic() case dump: { roboMyRio.Set(true); - Wait(.5); + Wait(1); roboMyRio.Set(false); step = back1; break; } case back1: { - if (forwardBackward < 92) + if (forwardBackward < 180) { Robot::Backwards(); } @@ -253,7 +258,7 @@ void Robot::AutonomousPeriodic() } case turn1: { - if (turn < 14.5) + if (turn > -9.5) { Robot::Clock(); } @@ -266,7 +271,7 @@ void Robot::AutonomousPeriodic() } case forward2: { - if (batman.GetValue() < 95) + if (distance > 230) { Robot::Forwards(); } @@ -279,7 +284,7 @@ void Robot::AutonomousPeriodic() } case back2: { - if (forwardBackward < 4.6) + if (forwardBackward < 2) { Robot::Backwards(); } @@ -292,7 +297,7 @@ void Robot::AutonomousPeriodic() } case turn2: { - if (turn < 14.5) + if (turn > -9.5) { Robot::Clock(); } @@ -307,6 +312,10 @@ void Robot::AutonomousPeriodic() { if (forwardBackward < 198.49) { + viagra.Set(true); + simp.Set(-.5); + egirl.Set(.35); + whippedCheese.Set(ControlMode::PercentOutput, -1); Robot::Forwards(); } else @@ -325,34 +334,34 @@ void Robot::AutonomousPeriodic() #ifdef SideShot switch (step) { - case forwardfromside: + case forward1: { - if (forwardBackward < 92) + if (forwardBackward < 120) { Robot::Forwards(); } else { ZeroMotors(); - step = turnsideshot; + step = turn1; } break; } - case turnsideshot: + case turn1: { - if (turn < 14.5) + if (turn > -9.5) { Robot::Clock(); } else { ZeroMotors(); - step = forward1; + step = forward2; } } - case forward1: + case forward2: { - if (batman.GetValue() < 95) //230 - 630 usable range + if (distance > 230) //230 - 630 usable range { Robot::Forwards(); } @@ -366,27 +375,27 @@ void Robot::AutonomousPeriodic() case dump: { roboMyRio.Set(true); - Wait(.5); + Wait(1); roboMyRio.Set(false); step = back1; break; } case back1: { - if (forwardBackward < 92) + if (forwardBackward < 180) { Robot::Backwards(); } else { ZeroMotors(); - step = turn1; + step = turn2; } break; } - case turn1: + case turn2: { - if (turn < 14.5) + if (turn > -9.5) { Robot::Clock(); } @@ -399,7 +408,7 @@ void Robot::AutonomousPeriodic() } case forward2: { - if (batman.GetValue() < 95) + if (distance > 230) { Robot::Forwards(); } @@ -412,20 +421,20 @@ void Robot::AutonomousPeriodic() } case back2: { - if (forwardBackward < 4.6) + if (forwardBackward < 2) { Robot::Backwards(); } else { ZeroMotors(); - step = turn2; + step = turn3; } break; } - case turn2: + case turn3: { - if (turn < 14.5) + if (turn > -9.5) { Robot::Clock(); } @@ -457,28 +466,10 @@ void Robot::AutonomousPeriodic() void Robot::TeleopInit() { - //limit switch moving thingy but the other way - if (x == 1) - { - heli.Set(ControlMode::PercentOutput, 1); - Wait(.075); - heli.Set(ControlMode::PercentOutput, 0); - x = 2; - } } void Robot::TeleopPeriodic() { - //limit switch move button - if (neighborlyInputDevice->GetStartButton()) - { - heli.Set(ControlMode::PercentOutput, .1); - } - else - { - heli.Set(ControlMode::PercentOutput, 0); - } - //42 counts per rev. on neo if (spinReader1.GetVelocity() == 0) spinReader1.SetPosition(0); @@ -515,6 +506,12 @@ void Robot::TeleopPeriodic() { lonelyTwist = -lonelyStick->GetTwist(); } + /* + //climber back up + if (snoop->Get() && -gwen.GetPosition() < 42.1) + { + spoodermoon.Set(-.3); + }*/ //making the compressor compress bonusPressure.SetClosedLoopControl(true); @@ -527,7 +524,10 @@ void Robot::TeleopPeriodic() if (neighborlyInputDevice->GetXButton()) { roboMyRio.Set(true); - Robot::Wait(.5); + } + // Robot::Wait(.5); + else + { roboMyRio.Set(false); } @@ -547,28 +547,32 @@ void Robot::TeleopPeriodic() } else if (estop == -1) { - simp.Set(-1); + simp.Set(-.5); } if (neighborlyInputDevice->GetYButton()) { viagra.Set(false); - simp.Set(1); - egirl.Set(-1); + simp.Set(.5); + egirl.Set(-.5); + } + else if (neighborlyInputDevice->GetStartButton()) + { + simp.Set(-.5); + egirl.Set(.5); } else if (toggle == 1) { viagra.Set(false); - simp.Set(0); egirl.Set(0); whippedCheese.Set(ControlMode::PercentOutput, 0); //should be 0 just testing } else if (toggle == -1) { viagra.Set(true); - simp.Set(-1); - egirl.Set(1); - whippedCheese.Set(ControlMode::PercentOutput, 1); //should be .1 just testing + simp.Set(-.5); + egirl.Set(.35); + whippedCheese.Set(ControlMode::PercentOutput, -1); //should be .1 just testing } //winch code @@ -606,17 +610,28 @@ void Robot::TeleopPeriodic() } //90 Degrees turn code (Not Tested) - if (fullCheech->Get() && turn > -10) + if (putItIn->Get()) + { + right = 1; + } + else if (fullCheech->Get()) + { + left = 1; + } + + if (left == 1 && turn > -40) { Robot::CounterClock(); } - else if (putItIn->Get() && turn < 10) + else if (right == 1 && turn < 40) { Robot::Clock(); } else { ZeroMotors(); + right = 0; + left = 0; } speed = .8; @@ -639,25 +654,25 @@ void Robot::ZeroMotors() } void Robot::Forwards() -{ - driveboi1.Set(.5); - driveboi5.Set(-.5); -} -void Robot::Backwards() { driveboi1.Set(-.5); driveboi5.Set(.5); } -void Robot::Clock() +void Robot::Backwards() { driveboi1.Set(.5); - driveboi5.Set(.5); + driveboi5.Set(-.5); } -void Robot::CounterClock() +void Robot::Clock() { driveboi1.Set(-.5); driveboi5.Set(-.5); } +void Robot::CounterClock() +{ + driveboi1.Set(.5); + driveboi5.Set(.5); +} void Robot::Wait(double seconds) { clock_t endwait; diff --git a/vendordeps/Phoenix.json b/vendordeps/Phoenix.json index c6ec878..aa5554e 100644 --- a/vendordeps/Phoenix.json +++ b/vendordeps/Phoenix.json @@ -1,7 +1,7 @@ { "fileName": "Phoenix.json", "name": "CTRE-Phoenix", - "version": "5.18.1", + "version": "5.18.2", "uuid": "ab676553-b602-441f-a38d-f1296eff6537", "mavenUrls": [ "http://devsite.ctr-electronics.com/maven/release/" @@ -11,19 +11,19 @@ { "groupId": "com.ctre.phoenix", "artifactId": "api-java", - "version": "5.18.1" + "version": "5.18.2" }, { "groupId": "com.ctre.phoenix", "artifactId": "wpiapi-java", - "version": "5.18.1" + "version": "5.18.2" } ], "jniDependencies": [ { "groupId": "com.ctre.phoenix", "artifactId": "cci", - "version": "5.18.1", + "version": "5.18.2", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -35,7 +35,7 @@ { "groupId": "com.ctre.phoenix", "artifactId": "diagnostics", - "version": "5.18.1", + "version": "5.18.2", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -47,7 +47,7 @@ { "groupId": "com.ctre.phoenix", "artifactId": "canutils", - "version": "5.18.1", + "version": "5.18.2", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -58,7 +58,7 @@ { "groupId": "com.ctre.phoenix", "artifactId": "platform-stub", - "version": "5.18.1", + "version": "5.18.2", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -69,7 +69,7 @@ { "groupId": "com.ctre.phoenix", "artifactId": "core", - "version": "5.18.1", + "version": "5.18.2", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -83,7 +83,7 @@ { "groupId": "com.ctre.phoenix", "artifactId": "wpiapi-cpp", - "version": "5.18.1", + "version": "5.18.2", "libName": "CTRE_Phoenix_WPI", "headerClassifier": "headers", "sharedLibrary": false, @@ -97,7 +97,7 @@ { "groupId": "com.ctre.phoenix", "artifactId": "api-cpp", - "version": "5.18.1", + "version": "5.18.2", "libName": "CTRE_Phoenix", "headerClassifier": "headers", "sharedLibrary": false, @@ -111,7 +111,7 @@ { "groupId": "com.ctre.phoenix", "artifactId": "cci", - "version": "5.18.1", + "version": "5.18.2", "libName": "CTRE_PhoenixCCI", "headerClassifier": "headers", "sharedLibrary": false, @@ -125,7 +125,7 @@ { "groupId": "com.ctre.phoenix", "artifactId": "diagnostics", - "version": "5.18.1", + "version": "5.18.2", "libName": "CTRE_PhoenixDiagnostics", "headerClassifier": "headers", "sharedLibrary": false, @@ -139,7 +139,7 @@ { "groupId": "com.ctre.phoenix", "artifactId": "canutils", - "version": "5.18.1", + "version": "5.18.2", "libName": "CTRE_PhoenixCanutils", "headerClassifier": "headers", "sharedLibrary": false, @@ -152,7 +152,7 @@ { "groupId": "com.ctre.phoenix", "artifactId": "platform-stub", - "version": "5.18.1", + "version": "5.18.2", "libName": "CTRE_PhoenixPlatform", "headerClassifier": "headers", "sharedLibrary": false, @@ -165,7 +165,7 @@ { "groupId": "com.ctre.phoenix", "artifactId": "core", - "version": "5.18.1", + "version": "5.18.2", "libName": "CTRE_PhoenixCore", "headerClassifier": "headers", "sharedLibrary": false, diff --git a/vendordeps/REVRobotics.json b/vendordeps/REVRobotics.json index cea495f..5eb069f 100644 --- a/vendordeps/REVRobotics.json +++ b/vendordeps/REVRobotics.json @@ -1,24 +1,45 @@ { - "cppDependencies": [ + "fileName": "REVRobotics.json", + "name": "REVRobotics", + "version": "1.5.2", + "uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb", + "mavenUrls": [ + "http://www.revrobotics.com/content/sw/max/sdk/maven/" + ], + "jsonUrl": "http://www.revrobotics.com/content/sw/max/sdk/REVRobotics.json", + "javaDependencies": [ { - "artifactId": "SparkMax-cpp", - "binaryPlatforms": [ + "groupId": "com.revrobotics.frc", + "artifactId": "SparkMax-java", + "version": "1.5.2" + } + ], + "jniDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "SparkMax-driver", + "version": "1.5.2", + "skipInvalidPlatforms": true, + "isJar": false, + "validPlatforms": [ "windowsx86-64", "windowsx86", "linuxaarch64bionic", "linuxx86-64", "linuxathena", "linuxraspbian" - ], + ] + } + ], + "cppDependencies": [ + { "groupId": "com.revrobotics.frc", - "headerClassifier": "headers", + "artifactId": "SparkMax-cpp", + "version": "1.5.2", "libName": "SparkMax", + "headerClassifier": "headers", "sharedLibrary": false, "skipInvalidPlatforms": true, - "version": "1.5.1" - }, - { - "artifactId": "SparkMax-driver", "binaryPlatforms": [ "windowsx86-64", "windowsx86", @@ -26,45 +47,24 @@ "linuxx86-64", "linuxathena", "linuxraspbian" - ], - "groupId": "com.revrobotics.frc", - "headerClassifier": "headers", - "libName": "SparkMaxDriver", - "sharedLibrary": false, - "skipInvalidPlatforms": true, - "version": "1.5.1" - } - ], - "fileName": "REVRobotics.json", - "javaDependencies": [ + ] + }, { - "artifactId": "SparkMax-java", "groupId": "com.revrobotics.frc", - "version": "1.5.1" - } - ], - "jniDependencies": [ - { "artifactId": "SparkMax-driver", - "groupId": "com.revrobotics.frc", - "isJar": false, + "version": "1.5.2", + "libName": "SparkMaxDriver", + "headerClassifier": "headers", + "sharedLibrary": false, "skipInvalidPlatforms": true, - "validPlatforms": [ + "binaryPlatforms": [ "windowsx86-64", "windowsx86", "linuxaarch64bionic", "linuxx86-64", "linuxathena", "linuxraspbian" - ], - "version": "1.5.1" + ] } - ], - "jsonUrl": "http://www.revrobotics.com/content/sw/max/sdk/REVRobotics.json", - "mavenUrls": [ - "http://www.revrobotics.com/content/sw/max/sdk/maven/" - ], - "name": "REVRobotics", - "uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb", - "version": "1.5.1" + ] } \ No newline at end of file