From 19ed530a85478b10128986c15a55771d870f3779 Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Sat, 13 Feb 2016 16:44:57 -0500 Subject: [PATCH 1/6] Initial Arm stuff --- src/Robot.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Robot.cpp b/src/Robot.cpp index 86b0612..399834c 100644 --- a/src/Robot.cpp +++ b/src/Robot.cpp @@ -20,7 +20,8 @@ class Robot: public IterativeRobot { Talon left_drive, right_drive; CANTalon shooter1, shooter2, - launch_spinny; + launch_spinny, + arms; RobotDrive drive; Shooter shooter; Joystick driver_stick, operator_stick; @@ -31,6 +32,7 @@ public: shooter1(11), // shooter drive 1 shooter2(10), // shooter drive 2 launch_spinny(12), + arms(13), drive(&left_drive, &right_drive), shooter( // initialize Shooter object. &shooter1, &shooter2, &launch_spinny), @@ -47,6 +49,7 @@ private: bool ramping; bool shooting; bool unjamming; + bool arming; float shooter_power; LiveWindow *lw = LiveWindow::GetInstance(); @@ -71,6 +74,7 @@ private: ramping = false; shooting = false; unjamming = false; + arming = false; shooter_power = 0; } @@ -218,6 +222,8 @@ private: shooter.StopShooter(); } + + // This code will become obsolete after the Shooter logic is complete. float opThrottle = SaneThrottle(operator_stick.GetThrottle()); From fee9a526e12e32e1ced5fceaf5937b3913879f83 Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Sat, 13 Feb 2016 16:47:57 -0500 Subject: [PATCH 2/6] Code for moving arms... boring --- src/Robot.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Robot.cpp b/src/Robot.cpp index 399834c..29f1b8f 100644 --- a/src/Robot.cpp +++ b/src/Robot.cpp @@ -222,7 +222,21 @@ private: shooter.StopShooter(); } - + if(!arming && driver_stick.GetRawButton(RAMP_RAISE)) + { + arming = true; + arms.Set(1); + } + else if(!arming && driver_stick.GetRawButton(RAMP_LOWER)) + { + arming = true; + arms.Set(-1); + } + else if(arming && !driver_stick.GetRawButton(RAMP_RAISE) && !driver_stick.GetRawButton(RAMP_LOWER)) + { + arming = false; + arms.Set(0); + } // This code will become obsolete after the Shooter logic is complete. float opThrottle = SaneThrottle(operator_stick.GetThrottle()); From bbcd3ed4943c38ba1f54bfe83cdc0b7d981c8b70 Mon Sep 17 00:00:00 2001 From: Aidan Ferguson Date: Sat, 20 Feb 2016 13:28:56 -0500 Subject: [PATCH 3/6] debug code to tell what the H-E-double-hockey-sticks the int the encoder returns is doing. --- src/Robot.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Robot.cpp b/src/Robot.cpp index ca3e071..75f2aba 100644 --- a/src/Robot.cpp +++ b/src/Robot.cpp @@ -118,7 +118,8 @@ private: void TeleopPeriodic() { - //std::cout << "Ramp position: "<< launch_spinny.GetEncPosition() << std::endl; + std::cout << "arm encoder position: " << arms.GetEncPosition() << std::endl; + std::cout << "arm encoder velocity: " << arms.GetEncVel() << std::endl; drive.ArcadeDrive(&driver_stick, true); //bool rampDoing = false; From 37458e6d5cce35ab9ac4d879154d22f33347f322 Mon Sep 17 00:00:00 2001 From: Aidan Ferguson Date: Sat, 20 Feb 2016 13:30:42 -0500 Subject: [PATCH 4/6] Spelling is the foundation upon which our society stands. --- src/Robot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Robot.cpp b/src/Robot.cpp index 75f2aba..321ea98 100644 --- a/src/Robot.cpp +++ b/src/Robot.cpp @@ -168,7 +168,7 @@ private: /* * Run the Shooter only while the THUMB button is held down on the operator stick. * the 'pickupRunning' boolean is there to prevent the shooter from calling PickUp - * every itteration of the TeleopPeriodic method (once every 10ms!) + * every iteration of the TeleopPeriodic method (once every 10ms!) * The pickup is disabled when the thumb button is released, but the code still * has 'pickupRunning' as true. */ @@ -185,7 +185,7 @@ private: /* * The 'inverting' variable is used to make sure that the drive train isn't getting - * inverted every itteration of the TeleopPeriodic method while the button is held down. + * inverted every iteration of the TeleopPeriodic method while the button is held down. * This is important because the TeleopPeriodic method executes something like once every 10ms. * Thus, this if-else if pair make the button a toggle. */ From 98fa52cf2635b22f2bcda75afdd537713270d1b4 Mon Sep 17 00:00:00 2001 From: Aidan Ferguson Date: Sat, 20 Feb 2016 15:14:51 -0500 Subject: [PATCH 5/6] -launch_spinny +ramp --- src/Robot.cpp | 12 ++++++------ src/Shooter.h | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Robot.cpp b/src/Robot.cpp index 321ea98..2301648 100644 --- a/src/Robot.cpp +++ b/src/Robot.cpp @@ -20,7 +20,7 @@ class Robot: public IterativeRobot { Talon left_drive, right_drive; CANTalon shooter1, shooter2, - launch_spinny, + ramp, arms; RobotDrive drive; Shooter shooter; @@ -31,11 +31,11 @@ public: right_drive(1), // Right DriveTrain Talons plug // left wheel 2 shooter1(11), // shooter drive 1 shooter2(10), // shooter drive 2 - launch_spinny(12), + ramp(12), arms(13), drive(&left_drive, &right_drive), shooter( // initialize Shooter object. - &shooter1, &shooter2, &launch_spinny), + &shooter1, &shooter2, &ramp), driver_stick(0), // right stick (operator) operator_stick(1) // left stick (driver) { @@ -68,7 +68,7 @@ private: shooter2.Enable(); left_drive.SetInverted(true); right_drive.SetInverted(true); - //launch_spinny.SetInverted(true); + //ramp.SetInverted(true); inverting = false; pickupRunning = false; ramping = false; @@ -127,14 +127,14 @@ private: if(!ramping && operator_stick.GetRawButton(RAMP_RAISE)) { std::cout << "Raising Ramp."; - //launch_spinny.Set(1); + //ramp.Set(1); shooter.RaiseRamp(); ramping =true; } else if(!ramping && operator_stick.GetRawButton(RAMP_LOWER)) { std::cout << "Lowering Ramp."; - //launch_spinny.Set(-1); + //ramp.Set(-1); shooter.LowerRamp(); ramping = true; } diff --git a/src/Shooter.h b/src/Shooter.h index aeeab87..344f38e 100644 --- a/src/Shooter.h +++ b/src/Shooter.h @@ -37,7 +37,7 @@ public: // shooterDrive = new RobotDrive(s1, s2); launcher = s1; pickup = s2; - launch_spinny = r; + ramp = r; ready = true; state = READY; } @@ -51,35 +51,35 @@ public: { delete launcher; delete pickup; - delete launch_spinny; + delete ramp; } void StopShooter() { ready = true; - launch_spinny->Set(0); + ramp->Set(0); launcher->Set(0); pickup->Set(0); } void LowerRamp() { - launch_spinny->Set(-1); + ramp->Set(-1); } void RaiseRamp() { - launch_spinny->Set(1); + ramp->Set(1); } void StopRamp() { - launch_spinny->Set(0); + ramp->Set(0); } void BoostRamp() { - launch_spinny->Set(1); + ramp->Set(1); } void Shoot() @@ -96,7 +96,7 @@ public: case READY: { state = SPINNINGUP; - launch_spinny->Set(-1); + ramp->Set(-1); launcher->Set(PICKUP_POWER); pickup->Set(PICKUP_POWER); shotClock.Reset(); @@ -118,7 +118,7 @@ public: } case LAUNCH: { - launch_spinny->Set(1); + ramp->Set(1); state = LAUNCHING; break; } @@ -139,7 +139,7 @@ public: { pickup->Set((float) (state * PICKUP_POWER)); launcher->Set((float) (state * PICKUP_POWER * -1)); - //launch_spinny->Set(-1.0*PICKUP_POWER); + //ramp->Set(-1.0*PICKUP_POWER); //std::cout << "picking up!\n"; } @@ -162,7 +162,7 @@ private: //RobotDrive *shooterDrive; CANTalon *launcher; CANTalon *pickup; - CANTalon *launch_spinny; + CANTalon *ramp; ShooterState state; Timer shotClock; From d0ebd066cb169aa1a40fbc9b9ed942b34449fb02 Mon Sep 17 00:00:00 2001 From: dkbug Date: Sat, 20 Feb 2016 16:53:38 -0500 Subject: [PATCH 6/6] make ramp more sensitive. --- src/Shooter.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Shooter.h b/src/Shooter.h index 344f38e..06f139f 100644 --- a/src/Shooter.h +++ b/src/Shooter.h @@ -64,24 +64,18 @@ public: void LowerRamp() { - ramp->Set(-1); + ramp->Set(-.5); } void RaiseRamp() { - ramp->Set(1); + ramp->Set(0.5); } void StopRamp() { ramp->Set(0); } - - void BoostRamp() - { - ramp->Set(1); - } - void Shoot() { // TODO: Shooter Logic should go as follows: