Added some comments and sanity to the new robot project.
This commit is contained in:
parent
01c462c0c6
commit
71bdaab9bb
1
.project
1
.project
@ -7,6 +7,7 @@
|
|||||||
<buildSpec>
|
<buildSpec>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
|
<triggers>clean,full,incremental,</triggers>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
#include "../wpilib/WPILib.h"
|
#include "WPILib.h"
|
||||||
#include "Shooter.h"
|
#include "Shooter.h"
|
||||||
|
|
||||||
#ifndef BUTTON_LAYOUT
|
#ifndef BUTTON_LAYOUT
|
||||||
#define BUTTON_LAYOUT
|
#define BUTTON_LAYOUT
|
||||||
|
|
||||||
#define TRIGGER 1 // I have no idea what the right button number is...
|
#define TRIGGER 1 // Trigger button number
|
||||||
#define THUMB 2
|
#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
|
#endif // BUTTON_LAYOUT
|
||||||
|
|
||||||
@ -36,6 +38,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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();
|
LiveWindow *lw = LiveWindow::GetInstance();
|
||||||
SendableChooser *chooser;
|
SendableChooser *chooser;
|
||||||
const std::string autoNameDefault = "Default";
|
const std::string autoNameDefault = "Default";
|
||||||
@ -62,6 +67,8 @@ private:
|
|||||||
*/
|
*/
|
||||||
void AutonomousInit()
|
void AutonomousInit()
|
||||||
{
|
{
|
||||||
|
shooter.CalibrateRamp();
|
||||||
|
|
||||||
autoSelected = *((std::string*)chooser->GetSelected());
|
autoSelected = *((std::string*)chooser->GetSelected());
|
||||||
//std::string autoSelected = SmartDashboard::GetString("Auto Selector", autoNameDefault);
|
//std::string autoSelected = SmartDashboard::GetString("Auto Selector", autoNameDefault);
|
||||||
std::cout << "Auto selected: " << autoSelected << std::endl;
|
std::cout << "Auto selected: " << autoSelected << std::endl;
|
||||||
@ -84,18 +91,19 @@ private:
|
|||||||
|
|
||||||
void TeleopInit()
|
void TeleopInit()
|
||||||
{
|
{
|
||||||
|
shooter.CalibrateRamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TeleopPeriodic()
|
void TeleopPeriodic()
|
||||||
{
|
{
|
||||||
drive.ArcadeDrive(&driver_stick);
|
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);
|
ramp.Set(1);
|
||||||
}
|
}
|
||||||
else if(operator_stick.GetRawButton(4))
|
else if(operator_stick.GetRawButton(RAMP_LOWER))
|
||||||
{
|
{
|
||||||
ramp.Set(-1);
|
ramp.Set(-1);
|
||||||
}
|
}
|
||||||
@ -104,13 +112,15 @@ private:
|
|||||||
ramp.Set(0);
|
ramp.Set(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(operator_stick.GetRawButton(THUMB))
|
if(operator_stick.GetRawButton(THUMB) && !pickupRunning)
|
||||||
{
|
{
|
||||||
shooter.PickUp();
|
shooter.PickUp();
|
||||||
|
pickupRunning = true;
|
||||||
}
|
}
|
||||||
else
|
else if(pickupRunning)
|
||||||
{
|
{
|
||||||
shooter.PickUp(false);
|
shooter.PickUp(false);
|
||||||
|
pickupRunning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user