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:
parent
4c6e75969e
commit
1ebb5661b0
@ -7,7 +7,6 @@ void CollectTote::Initialize(){
|
|||||||
}
|
}
|
||||||
void CollectTote::Execute(){
|
void CollectTote::Execute(){
|
||||||
//TODO check this value to move the motors in the right direction
|
//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);
|
DentRobot::collector->MoveRollers(-(-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
|
||||||
}
|
}
|
||||||
bool CollectTote::IsFinished(){
|
bool CollectTote::IsFinished(){
|
||||||
|
@ -7,7 +7,6 @@ void ReleaseTote::Initialize(){
|
|||||||
}
|
}
|
||||||
void ReleaseTote::Execute(){
|
void ReleaseTote::Execute(){
|
||||||
//TODO check this value to move the motors in the right direction
|
//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
|
// 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);
|
DentRobot::collector->MoveRollers((-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2/2);
|
||||||
}
|
}
|
||||||
|
19
OI.cpp
19
OI.cpp
@ -10,7 +10,6 @@ OI::OI() {
|
|||||||
// Joysticks
|
// Joysticks
|
||||||
leftStick=new Joystick(0);
|
leftStick=new Joystick(0);
|
||||||
rightStick=new Joystick(1);
|
rightStick=new Joystick(1);
|
||||||
|
|
||||||
// Collector
|
// Collector
|
||||||
JoystickButton *right1=new JoystickButton(rightStick, 1);
|
JoystickButton *right1=new JoystickButton(rightStick, 1);
|
||||||
JoystickButton *right2=new JoystickButton(rightStick, 2);
|
JoystickButton *right2=new JoystickButton(rightStick, 2);
|
||||||
@ -21,14 +20,24 @@ OI::OI() {
|
|||||||
left3->WhileHeld(new CollectTote());
|
left3->WhileHeld(new CollectTote());
|
||||||
left4->WhileHeld(new ReleaseTote());
|
left4->WhileHeld(new ReleaseTote());
|
||||||
// Elevator
|
// Elevator
|
||||||
|
Raise* raise=new Raise();
|
||||||
|
Lower* lower=new Lower();
|
||||||
JoystickButton *right3=new JoystickButton(rightStick, 3);
|
JoystickButton *right3=new JoystickButton(rightStick, 3);
|
||||||
JoystickButton *right4=new JoystickButton(rightStick, 4);
|
JoystickButton *right4=new JoystickButton(rightStick, 4);
|
||||||
JoystickButton *right5=new JoystickButton(rightStick, 5);
|
JoystickButton *right5=new JoystickButton(rightStick, 5);
|
||||||
JoystickButton *right6=new JoystickButton(rightStick, 6);
|
JoystickButton *right6=new JoystickButton(rightStick, 6);
|
||||||
right3->WhenPressed(new Lower());
|
right3->WhenPressed(lower);
|
||||||
right4->WhenPressed(new Lower());
|
right4->WhenPressed(lower);
|
||||||
right5->WhenPressed(new Raise());
|
right3->CancelWhenPressed(raise);
|
||||||
right6->WhenPressed(new 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(){
|
Joystick* OI::GetRightStick(){
|
||||||
return rightStick;
|
return rightStick;
|
||||||
|
@ -14,7 +14,6 @@ void Collector::MoveArms(double a){
|
|||||||
windowMotorRight->Set(-a);
|
windowMotorRight->Set(-a);
|
||||||
}
|
}
|
||||||
void Collector::MoveRollers(double a){
|
void Collector::MoveRollers(double a){
|
||||||
printf("Collector: %f\n", a);
|
|
||||||
collectorMotorLeft->Set(a);
|
collectorMotorLeft->Set(a);
|
||||||
collectorMotorRight->Set(-a);
|
collectorMotorRight->Set(-a);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ Elevator::Elevator(){
|
|||||||
void Elevator::InitDefaultCommand(){
|
void Elevator::InitDefaultCommand(){
|
||||||
}
|
}
|
||||||
void Elevator::Run(double power){
|
void Elevator::Run(double power){
|
||||||
printf("Elevator Power: %f\n",power);
|
|
||||||
motor->Set(power);
|
motor->Set(power);
|
||||||
}
|
}
|
||||||
void Elevator::SetOffset(double ht){
|
void Elevator::SetOffset(double ht){
|
||||||
|
Loading…
Reference in New Issue
Block a user