Added some comments and sanity to the new robot project.

This commit is contained in:
Jason Cox 2016-02-09 17:22:17 -05:00
parent 01c462c0c6
commit 71bdaab9bb
2 changed files with 19 additions and 8 deletions

View File

@ -7,6 +7,7 @@
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>

View File

@ -1,11 +1,13 @@
#include "../wpilib/WPILib.h"
#include "WPILib.h"
#include "Shooter.h"
#ifndef BUTTON_LAYOUT
#define BUTTON_LAYOUT
#define TRIGGER 1 // I have no idea what the right button number is...
#define THUMB 2
#define TRIGGER 1 // Trigger button number
#define THUMB 2 // Thumb button number
#define RAMP_RAISE 3 // Button 3 for Raising Ramp
#define RAMP_LOWER 4 // Button 4 to lower ramp.
#endif // BUTTON_LAYOUT
@ -36,6 +38,9 @@ public:
}
private:
// instance variables
bool pickupRunning; // don't want to spam the Talon with set messages. Toggle the pickup when a button is pressed or released.
LiveWindow *lw = LiveWindow::GetInstance();
SendableChooser *chooser;
const std::string autoNameDefault = "Default";
@ -62,6 +67,8 @@ private:
*/
void AutonomousInit()
{
shooter.CalibrateRamp();
autoSelected = *((std::string*)chooser->GetSelected());
//std::string autoSelected = SmartDashboard::GetString("Auto Selector", autoNameDefault);
std::cout << "Auto selected: " << autoSelected << std::endl;
@ -84,18 +91,19 @@ private:
void TeleopInit()
{
shooter.CalibrateRamp();
}
void TeleopPeriodic()
{
drive.ArcadeDrive(&driver_stick);
if(operator_stick.GetRawButton(3))
// This is shit code for testing. Replace it with real code.
if(operator_stick.GetRawButton(RAMP_RAISE))
{
ramp.Set(1);
}
else if(operator_stick.GetRawButton(4))
else if(operator_stick.GetRawButton(RAMP_LOWER))
{
ramp.Set(-1);
}
@ -104,13 +112,15 @@ private:
ramp.Set(0);
}
if(operator_stick.GetRawButton(THUMB))
if(operator_stick.GetRawButton(THUMB) && !pickupRunning)
{
shooter.PickUp();
pickupRunning = true;
}
else
else if(pickupRunning)
{
shooter.PickUp(false);
pickupRunning = false;
}