2
0
mirror of https://github.com/team2059/Dent synced 2024-12-18 20:52:29 -05:00

Merge branch 'develop'

This commit is contained in:
Austen Adler 2015-03-21 08:16:39 -04:00
parent 42fbba836a
commit 08473d42e1
4 changed files with 18 additions and 8 deletions

View File

@ -13,7 +13,7 @@ void RollIn::Execute(){
//}else{
// DentRobot::collector->MoveRollers(cvt*1.5);
//}
DentRobot::collector->MoveRollers(DentRobot::oi->GetLeftThrottle() * 1.0);
DentRobot::collector->MoveRollers(DentRobot::oi->GetLeftAxis("left", "throttle") * 1.0);
}
bool RollIn::IsFinished(){
return IsTimedOut();

View File

@ -7,8 +7,8 @@ void RollOut::Initialize(){
}
void RollOut::Execute(){
// Divide by 2 twice because this speed should be half the collector speed
DentRobot::collector->MoveRollers(-DentRobot::oi->GetLeftThrottle() * 0.8);
SmartDashboard::PutNumber("DriveThrottle", -DentRobot::oi->GetLeftThrottle());
DentRobot::collector->MoveRollers(-DentRobot::oi->GetLeftAxis("right", "trigger") * 0.8);
SmartDashboard::PutNumber("DriveThrottle", -DentRobot::oi->GetLeftAxis("right", "trigger"));
}
bool RollOut::IsFinished(){
return IsTimedOut();

View File

@ -18,7 +18,7 @@ void Drive::Execute(){
// y=0;
//}
//X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle)
if(DentRobot::oi->GetLeftStick()->GetRawButton(11)){
if(DentRobot::oi->GetLeftButton("y")){
x = -x;
y = -y;
}

18
OI.cpp
View File

@ -27,24 +27,34 @@ OI::OI(){
// Left, right stick press
leftLPress = new JoystickButton(leftController, 9);
leftRPress = new JoystickButton(leftController, 10);
// Commands
Raise *raise = new Raise(2.0);
Lower *lower = new Lower(2.0);
leftA->WhileHeld(raise);
leftA->CancelWhenPressed(lower);
leftB->WhenPressed(lower);
leftB->CancelWhenPressed(raise);
}
float OI::GetLeftAxis(std::string stick, std::string axis){
if(stick=="left"){
if(axis=="x"){
return leftController->GetX();
return leftController->GetRawAxis(0);
}else if(axis=="y"){
return -leftController->GetY();
return -leftController->GetRawAxis(1);
}else if(axis=="trigger"){
//TODO: Figure out what axis this is
return leftController->GetRawAxis(4);
return -4;
}
}else if(stick=="right"){
if(axis=="x"){
return leftController->GetTwist();
return leftController->GetRawAxis(2);
}else if(axis=="y"){
return -leftController->GetRawAxis(4);
return -leftController->GetRawAxis(3);
}else if(axis=="trigger"){
//TODO: Figure out what axis this is
return leftController->GetRawAxis(5);
return -4;
}
}