mirror of
https://github.com/team2059/Dent
synced 2024-12-18 20:52:29 -05:00
Stop motors when button is released (untested)
This commit is contained in:
parent
5ac16f85d4
commit
ed2ae766fb
@ -6,12 +6,13 @@ void CloseCollector::Initialize(){
|
||||
SetTimeout(0.5);
|
||||
}
|
||||
void CloseCollector::Execute(){
|
||||
DentRobot::collector->MoveArms(.1);
|
||||
DentRobot::collector->MoveArms(0.1f);
|
||||
}
|
||||
bool CloseCollector::IsFinished(){
|
||||
return DentRobot::collector->ArmSensor();
|
||||
}
|
||||
void CloseCollector::End(){
|
||||
DentRobot::collector->MoveArms(0.0f);
|
||||
}
|
||||
void CloseCollector::Interrupted(){
|
||||
End();
|
||||
|
@ -6,12 +6,13 @@ void CollectTote::Initialize(){
|
||||
}
|
||||
void CollectTote::Execute(){
|
||||
//TODO check this value to move the motors in the right direction
|
||||
DentRobot::collector->MoveRollers(-1);
|
||||
DentRobot::collector->MoveRollers(-1.0);
|
||||
}
|
||||
bool CollectTote::IsFinished(){
|
||||
return DentRobot::collector->BoxCollected();
|
||||
}
|
||||
void CollectTote::End(){
|
||||
DentRobot::collector->MoveRollers(0.0f);
|
||||
}
|
||||
void CollectTote::Interrupted(){
|
||||
End();
|
||||
|
@ -6,12 +6,13 @@ void OpenCollector::Initialize(){
|
||||
}
|
||||
void OpenCollector::Execute(){
|
||||
//TODO check this value to move the motors in the right direction
|
||||
DentRobot::collector->MoveArms(-.1);
|
||||
DentRobot::collector->MoveArms(-0.1);
|
||||
}
|
||||
bool OpenCollector::IsFinished(){
|
||||
return DentRobot::collector->ArmSensor();
|
||||
}
|
||||
void OpenCollector::End(){
|
||||
DentRobot::collector->MoveArms(0.0f);
|
||||
}
|
||||
void OpenCollector::Interrupted(){
|
||||
End();
|
||||
|
@ -6,12 +6,13 @@ void ReleaseTote::Initialize(){
|
||||
}
|
||||
void ReleaseTote::Execute(){
|
||||
//TODO check this value to move the motors in the right direction
|
||||
DentRobot::collector->MoveRollers(1);
|
||||
DentRobot::collector->MoveRollers(1.0f);
|
||||
}
|
||||
bool ReleaseTote::IsFinished(){
|
||||
return DentRobot::collector->BoxCollected();
|
||||
}
|
||||
void ReleaseTote::End(){
|
||||
DentRobot::collector->MoveRollers(0.0f);
|
||||
}
|
||||
void ReleaseTote::Interrupted(){
|
||||
End();
|
||||
|
34
OI.cpp
34
OI.cpp
@ -5,6 +5,8 @@
|
||||
#include "Commands/Collector/CloseCollector.h"
|
||||
#include "Commands/Collector/CollectTote.h"
|
||||
#include "Commands/Collector/ReleaseTote.h"
|
||||
#include "Commands/Collector/StopCollector.h"
|
||||
#include "Commands/Collector/StopArm.h"
|
||||
#include "Commands/Compressor/StartCompressing.h"
|
||||
#include "Commands/Compressor/StopCompressing.h"
|
||||
|
||||
@ -12,22 +14,22 @@ OI::OI() {
|
||||
leftStick=new Joystick(0);
|
||||
rightStick=new Joystick(1);
|
||||
//TODO name these buttons to their functions rather to their number
|
||||
JoystickButton *right1=new JoystickButton(rightStick, 1);
|
||||
JoystickButton *right2=new JoystickButton(rightStick, 2);
|
||||
JoystickButton *right3=new JoystickButton(rightStick, 3);
|
||||
JoystickButton *right4=new JoystickButton(rightStick, 4);
|
||||
JoystickButton *right5=new JoystickButton(rightStick, 5);
|
||||
JoystickButton *right6=new JoystickButton(rightStick, 6);
|
||||
JoystickButton *right7=new JoystickButton(rightStick, 7);
|
||||
JoystickButton *right8=new JoystickButton(rightStick, 8);
|
||||
right1->WhenPressed(new OpenCollector());
|
||||
right2->WhenPressed(new CloseCollector());
|
||||
right3->WhenPressed(new CollectTote());
|
||||
right4->WhenPressed(new ReleaseTote());
|
||||
right5->WhenPressed(new StartCompressing());
|
||||
right6->WhenPressed(new StopCompressing());
|
||||
right7->WhenPressed(new Raise());
|
||||
right8->WhenPressed(new Lower());
|
||||
JoystickButton *left1=new JoystickButton(leftStick, 1);
|
||||
JoystickButton *left2=new JoystickButton(leftStick, 2);
|
||||
JoystickButton *left3=new JoystickButton(leftStick, 3);
|
||||
JoystickButton *left4=new JoystickButton(leftStick, 4);
|
||||
JoystickButton *left5=new JoystickButton(leftStick, 5);
|
||||
JoystickButton *left6=new JoystickButton(leftStick, 6);
|
||||
JoystickButton *left7=new JoystickButton(leftStick, 7);
|
||||
JoystickButton *left8=new JoystickButton(leftStick, 8);
|
||||
left1->WhileHeld(new OpenCollector());
|
||||
left2->WhileHeld(new CloseCollector());
|
||||
left3->WhileHeld(new CollectTote());
|
||||
left4->WhileHeld(new ReleaseTote());
|
||||
left5->WhileHeld(new StartCompressing());
|
||||
left6->WhileHeld(new StopCompressing());
|
||||
left7->WhileHeld(new Raise());
|
||||
left8->WhileHeld(new Lower());
|
||||
}
|
||||
Joystick* OI::GetRightStick(){
|
||||
return rightStick;
|
||||
|
@ -7,10 +7,14 @@ AirCompressor::AirCompressor() : Subsystem("AirCompressor") {
|
||||
void AirCompressor::InitDefaultCommand() {
|
||||
}
|
||||
void AirCompressor::StartCompressing() {
|
||||
printf("Starting compressor\n");
|
||||
compressor->Start();
|
||||
if(compressor->Enabled()){
|
||||
printf("Starting compressor\n");
|
||||
compressor->Start();
|
||||
}
|
||||
}
|
||||
void AirCompressor::StopCompressing() {
|
||||
printf("Stopping compressor\n");
|
||||
compressor->Stop();
|
||||
if(compressor->Enabled()){
|
||||
printf("Stopping compressor\n");
|
||||
compressor->Stop();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user