mirror of
https://github.com/brendanhaines/mecanum.git
synced 2024-11-09 21:14:51 -07:00
adds untested buddy box support
This commit is contained in:
parent
9a46a420d9
commit
82ba59546d
|
@ -28,7 +28,8 @@ const double backLeftAngle = 3*PI/4;
|
||||||
const double frontRightAngle = -PI/4;
|
const double frontRightAngle = -PI/4;
|
||||||
const double backRightAngle = -3*PI/4;
|
const double backRightAngle = -3*PI/4;
|
||||||
|
|
||||||
#define InterLink_ID 0
|
#define Master_InterLink_ID 0
|
||||||
|
#define Slave_InterLink_ID 1
|
||||||
|
|
||||||
///// END USER PARAMETERS /////
|
///// END USER PARAMETERS /////
|
||||||
|
|
||||||
|
@ -44,7 +45,9 @@ class Robot: public IterativeRobot
|
||||||
Talon *backRight;
|
Talon *backRight;
|
||||||
|
|
||||||
// Input Devices
|
// Input Devices
|
||||||
InterLinkElite *InterLink;
|
InterLinkElite *MasterInterLink;
|
||||||
|
InterLinkElite *SlaveInterLink;
|
||||||
|
InterLinkElite *ActiveInterLink;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -59,7 +62,8 @@ public:
|
||||||
frontRight = new Talon( frontRightChannel );
|
frontRight = new Talon( frontRightChannel );
|
||||||
backRight = new Talon( backRightChannel );
|
backRight = new Talon( backRightChannel );
|
||||||
|
|
||||||
InterLink = new InterLinkElite( InterLink_ID );
|
MasterInterLink = new InterLinkElite( Master_InterLink_ID );
|
||||||
|
SlaveInterLink = new InterLinkElite( Slave_InterLink_ID );
|
||||||
ds = DriverStation::GetInstance();
|
ds = DriverStation::GetInstance();
|
||||||
lw = LiveWindow::GetInstance();
|
lw = LiveWindow::GetInstance();
|
||||||
}
|
}
|
||||||
|
@ -83,10 +87,23 @@ public:
|
||||||
|
|
||||||
void TeleopPeriodic()
|
void TeleopPeriodic()
|
||||||
{
|
{
|
||||||
double ch6 = InterLink->getCh6();
|
double throttle;
|
||||||
double aile = InterLink->getAile();
|
|
||||||
double elev = InterLink->getElev();
|
bool BuddyBoxEnabled = SmartDashboard::GetBoolean( "Buddy Box Enabled" , false);
|
||||||
double rudd = InterLink->getRudd();
|
bool SlaveInControl = MasterInterLink->GetCh5();
|
||||||
|
SmartDashboard::PutBoolean( "Slave In Control", SlaveInControl );
|
||||||
|
bool SlaveControlsSpeed = SmartDashboard::GetBoolean( "Slave Controls Speed", false );
|
||||||
|
|
||||||
|
if( BuddyBoxEnabled && SlaveInControl ) ActiveInterLink = SlaveInterLink;
|
||||||
|
else ActiveInterLink = MasterInterLink;
|
||||||
|
|
||||||
|
if( SlaveInControl && SlaveControlsSpeed ) throttle = SlaveInterLink->getCh6();
|
||||||
|
else throttle = MasterInterLink->getCh6();
|
||||||
|
|
||||||
|
double ch6 = ActiveInterLink->getCh6();
|
||||||
|
double aile = ActiveInterLink->getAile();
|
||||||
|
double elev = ActiveInterLink->getElev();
|
||||||
|
double rudd = ActiveInterLink->getRudd();
|
||||||
SmartDashboard::PutNumber( "Rudder", rudd );
|
SmartDashboard::PutNumber( "Rudder", rudd );
|
||||||
SmartDashboard::PutNumber( "Throttle", ch6 );
|
SmartDashboard::PutNumber( "Throttle", ch6 );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user