mirror of
https://github.com/team2059/Dent
synced 2025-01-17 22:19:21 -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);
|
SetTimeout(0.5);
|
||||||
}
|
}
|
||||||
void CloseCollector::Execute(){
|
void CloseCollector::Execute(){
|
||||||
DentRobot::collector->MoveArms(.1);
|
DentRobot::collector->MoveArms(0.1f);
|
||||||
}
|
}
|
||||||
bool CloseCollector::IsFinished(){
|
bool CloseCollector::IsFinished(){
|
||||||
return DentRobot::collector->ArmSensor();
|
return DentRobot::collector->ArmSensor();
|
||||||
}
|
}
|
||||||
void CloseCollector::End(){
|
void CloseCollector::End(){
|
||||||
|
DentRobot::collector->MoveArms(0.0f);
|
||||||
}
|
}
|
||||||
void CloseCollector::Interrupted(){
|
void CloseCollector::Interrupted(){
|
||||||
End();
|
End();
|
||||||
|
@ -6,12 +6,13 @@ 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
|
||||||
DentRobot::collector->MoveRollers(-1);
|
DentRobot::collector->MoveRollers(-1.0);
|
||||||
}
|
}
|
||||||
bool CollectTote::IsFinished(){
|
bool CollectTote::IsFinished(){
|
||||||
return DentRobot::collector->BoxCollected();
|
return DentRobot::collector->BoxCollected();
|
||||||
}
|
}
|
||||||
void CollectTote::End(){
|
void CollectTote::End(){
|
||||||
|
DentRobot::collector->MoveRollers(0.0f);
|
||||||
}
|
}
|
||||||
void CollectTote::Interrupted(){
|
void CollectTote::Interrupted(){
|
||||||
End();
|
End();
|
||||||
|
@ -6,12 +6,13 @@ void OpenCollector::Initialize(){
|
|||||||
}
|
}
|
||||||
void OpenCollector::Execute(){
|
void OpenCollector::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
|
||||||
DentRobot::collector->MoveArms(-.1);
|
DentRobot::collector->MoveArms(-0.1);
|
||||||
}
|
}
|
||||||
bool OpenCollector::IsFinished(){
|
bool OpenCollector::IsFinished(){
|
||||||
return DentRobot::collector->ArmSensor();
|
return DentRobot::collector->ArmSensor();
|
||||||
}
|
}
|
||||||
void OpenCollector::End(){
|
void OpenCollector::End(){
|
||||||
|
DentRobot::collector->MoveArms(0.0f);
|
||||||
}
|
}
|
||||||
void OpenCollector::Interrupted(){
|
void OpenCollector::Interrupted(){
|
||||||
End();
|
End();
|
||||||
|
@ -6,12 +6,13 @@ 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
|
||||||
DentRobot::collector->MoveRollers(1);
|
DentRobot::collector->MoveRollers(1.0f);
|
||||||
}
|
}
|
||||||
bool ReleaseTote::IsFinished(){
|
bool ReleaseTote::IsFinished(){
|
||||||
return DentRobot::collector->BoxCollected();
|
return DentRobot::collector->BoxCollected();
|
||||||
}
|
}
|
||||||
void ReleaseTote::End(){
|
void ReleaseTote::End(){
|
||||||
|
DentRobot::collector->MoveRollers(0.0f);
|
||||||
}
|
}
|
||||||
void ReleaseTote::Interrupted(){
|
void ReleaseTote::Interrupted(){
|
||||||
End();
|
End();
|
||||||
|
34
OI.cpp
34
OI.cpp
@ -5,6 +5,8 @@
|
|||||||
#include "Commands/Collector/CloseCollector.h"
|
#include "Commands/Collector/CloseCollector.h"
|
||||||
#include "Commands/Collector/CollectTote.h"
|
#include "Commands/Collector/CollectTote.h"
|
||||||
#include "Commands/Collector/ReleaseTote.h"
|
#include "Commands/Collector/ReleaseTote.h"
|
||||||
|
#include "Commands/Collector/StopCollector.h"
|
||||||
|
#include "Commands/Collector/StopArm.h"
|
||||||
#include "Commands/Compressor/StartCompressing.h"
|
#include "Commands/Compressor/StartCompressing.h"
|
||||||
#include "Commands/Compressor/StopCompressing.h"
|
#include "Commands/Compressor/StopCompressing.h"
|
||||||
|
|
||||||
@ -12,22 +14,22 @@ OI::OI() {
|
|||||||
leftStick=new Joystick(0);
|
leftStick=new Joystick(0);
|
||||||
rightStick=new Joystick(1);
|
rightStick=new Joystick(1);
|
||||||
//TODO name these buttons to their functions rather to their number
|
//TODO name these buttons to their functions rather to their number
|
||||||
JoystickButton *right1=new JoystickButton(rightStick, 1);
|
JoystickButton *left1=new JoystickButton(leftStick, 1);
|
||||||
JoystickButton *right2=new JoystickButton(rightStick, 2);
|
JoystickButton *left2=new JoystickButton(leftStick, 2);
|
||||||
JoystickButton *right3=new JoystickButton(rightStick, 3);
|
JoystickButton *left3=new JoystickButton(leftStick, 3);
|
||||||
JoystickButton *right4=new JoystickButton(rightStick, 4);
|
JoystickButton *left4=new JoystickButton(leftStick, 4);
|
||||||
JoystickButton *right5=new JoystickButton(rightStick, 5);
|
JoystickButton *left5=new JoystickButton(leftStick, 5);
|
||||||
JoystickButton *right6=new JoystickButton(rightStick, 6);
|
JoystickButton *left6=new JoystickButton(leftStick, 6);
|
||||||
JoystickButton *right7=new JoystickButton(rightStick, 7);
|
JoystickButton *left7=new JoystickButton(leftStick, 7);
|
||||||
JoystickButton *right8=new JoystickButton(rightStick, 8);
|
JoystickButton *left8=new JoystickButton(leftStick, 8);
|
||||||
right1->WhenPressed(new OpenCollector());
|
left1->WhileHeld(new OpenCollector());
|
||||||
right2->WhenPressed(new CloseCollector());
|
left2->WhileHeld(new CloseCollector());
|
||||||
right3->WhenPressed(new CollectTote());
|
left3->WhileHeld(new CollectTote());
|
||||||
right4->WhenPressed(new ReleaseTote());
|
left4->WhileHeld(new ReleaseTote());
|
||||||
right5->WhenPressed(new StartCompressing());
|
left5->WhileHeld(new StartCompressing());
|
||||||
right6->WhenPressed(new StopCompressing());
|
left6->WhileHeld(new StopCompressing());
|
||||||
right7->WhenPressed(new Raise());
|
left7->WhileHeld(new Raise());
|
||||||
right8->WhenPressed(new Lower());
|
left8->WhileHeld(new Lower());
|
||||||
}
|
}
|
||||||
Joystick* OI::GetRightStick(){
|
Joystick* OI::GetRightStick(){
|
||||||
return rightStick;
|
return rightStick;
|
||||||
|
@ -7,10 +7,14 @@ AirCompressor::AirCompressor() : Subsystem("AirCompressor") {
|
|||||||
void AirCompressor::InitDefaultCommand() {
|
void AirCompressor::InitDefaultCommand() {
|
||||||
}
|
}
|
||||||
void AirCompressor::StartCompressing() {
|
void AirCompressor::StartCompressing() {
|
||||||
printf("Starting compressor\n");
|
if(compressor->Enabled()){
|
||||||
compressor->Start();
|
printf("Starting compressor\n");
|
||||||
|
compressor->Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void AirCompressor::StopCompressing() {
|
void AirCompressor::StopCompressing() {
|
||||||
printf("Stopping compressor\n");
|
if(compressor->Enabled()){
|
||||||
compressor->Stop();
|
printf("Stopping compressor\n");
|
||||||
|
compressor->Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user