2
0
mirror of https://github.com/team2059/Dent synced 2025-01-07 22:14:14 -05:00

Robot works, used throttle to control power of collcetor/elevator

This commit is contained in:
Austen Adler 2015-02-04 20:57:33 -05:00
parent ed2ae766fb
commit 578efd7a88
8 changed files with 17 additions and 21 deletions

View File

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

View File

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

View File

@ -5,7 +5,7 @@ Lower::Lower() : Command("Lower"){
void Lower::Initialize(){
}
void Lower::Execute(){
DentRobot::elevator->Run(-0.4f);
DentRobot::elevator->Run((-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
}
bool Lower::IsFinished(){
return false;

View File

@ -1,11 +1,12 @@
#include "Raise.h"
#include "../../DentRobot.h"
#include "../../OI.h"
Raise::Raise(){
}
void Raise::Initialize(){
}
void Raise::Execute(){
DentRobot::elevator->Run(0.4f);
DentRobot::elevator->Run(-(-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
}
bool Raise::IsFinished(){
return false;

11
OI.cpp
View File

@ -5,10 +5,7 @@
#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"
OI::OI() {
leftStick=new Joystick(0);
@ -20,16 +17,12 @@ OI::OI() {
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());
left5->WhileHeld(new Raise());
left6->WhileHeld(new Lower());
}
Joystick* OI::GetRightStick(){
return rightStick;

View File

@ -14,7 +14,8 @@ void Collector::MoveArms(float a){
windowMotorLeft->Set(a);
windowMotorRight->Set(-a);
}
void Collector::MoveRollers(float a){
void Collector::MoveRollers(double a){
printf("Collector: %f\n", a);
collectorMotorLeft->Set(a);
collectorMotorRight->Set(-a);
}
@ -23,5 +24,6 @@ bool Collector::ArmSensor(){
return false;
}
bool Collector::BoxCollected(){
return boxSwitch->Get();
return false;
//return boxSwitch->Get();
}

View File

@ -11,7 +11,7 @@ class Collector: public Subsystem
Collector();
void InitDefaultCommand();
void MoveArms(float);
void MoveRollers(float);
void MoveRollers(double);
bool ArmSensor();
bool BoxCollected();
};

View File

@ -1,4 +1,2 @@
Release for all buttons does not work
raise is pushed, elevator raises, lower is pushed, elevator lowers, raise is pushed, no effect
lower is pushed, elevator lowers, raise is pushed, no effect
dos compressor on compressor start or stop
Compressor isn't in use
(dos compressor on compressor start or stop)?