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

Stop elevator with button 12 and when inverse button is pressed

This commit is contained in:
Austen Adler 2015-02-07 17:34:44 -05:00
parent 4c6e75969e
commit 1ebb5661b0
5 changed files with 14 additions and 9 deletions

View File

@ -7,7 +7,6 @@ void CollectTote::Initialize(){
}
void CollectTote::Execute(){
//TODO check this value to move the motors in the right direction
printf("collecting tote\n");
DentRobot::collector->MoveRollers(-(-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
}
bool CollectTote::IsFinished(){

View File

@ -7,7 +7,6 @@ void ReleaseTote::Initialize(){
}
void ReleaseTote::Execute(){
//TODO check this value to move the motors in the right direction
printf("releasing tote\n");
// Devide by 2 twice because this speed should be half the collector speed
DentRobot::collector->MoveRollers((-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2/2);
}

19
OI.cpp
View File

@ -10,7 +10,6 @@ OI::OI() {
// Joysticks
leftStick=new Joystick(0);
rightStick=new Joystick(1);
// Collector
JoystickButton *right1=new JoystickButton(rightStick, 1);
JoystickButton *right2=new JoystickButton(rightStick, 2);
@ -21,14 +20,24 @@ OI::OI() {
left3->WhileHeld(new CollectTote());
left4->WhileHeld(new ReleaseTote());
// Elevator
Raise* raise=new Raise();
Lower* lower=new Lower();
JoystickButton *right3=new JoystickButton(rightStick, 3);
JoystickButton *right4=new JoystickButton(rightStick, 4);
JoystickButton *right5=new JoystickButton(rightStick, 5);
JoystickButton *right6=new JoystickButton(rightStick, 6);
right3->WhenPressed(new Lower());
right4->WhenPressed(new Lower());
right5->WhenPressed(new Raise());
right6->WhenPressed(new Raise());
right3->WhenPressed(lower);
right4->WhenPressed(lower);
right3->CancelWhenPressed(raise);
right4->CancelWhenPressed(raise);
right5->WhenPressed(raise);
right6->WhenPressed(raise);
right5->CancelWhenPressed(lower);
right6->CancelWhenPressed(lower);
// Cancel
JoystickButton *right12=new JoystickButton(rightStick, 12);
right12->CancelWhenPressed(raise);
right12->CancelWhenPressed(lower);
}
Joystick* OI::GetRightStick(){
return rightStick;

View File

@ -14,7 +14,6 @@ void Collector::MoveArms(double a){
windowMotorRight->Set(-a);
}
void Collector::MoveRollers(double a){
printf("Collector: %f\n", a);
collectorMotorLeft->Set(a);
collectorMotorRight->Set(-a);
}

View File

@ -12,7 +12,6 @@ Elevator::Elevator(){
void Elevator::InitDefaultCommand(){
}
void Elevator::Run(double power){
printf("Elevator Power: %f\n",power);
motor->Set(power);
}
void Elevator::SetOffset(double ht){