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

Updated bin collector code to reflect electrical changes made to board.

This commit is contained in:
Adam Long 2015-04-18 09:03:06 +00:00
parent 4a967bc892
commit c2047f33b1
5 changed files with 19 additions and 26 deletions

View File

@ -7,18 +7,18 @@ BinIn::BinIn(float timeout): Command("BinIn"){
void BinIn::Initialize(){ void BinIn::Initialize(){
} }
void BinIn::Execute(){ void BinIn::Execute(){
DentRobot::binCollector->Set(0.75); DentRobot::binCollector->MoveArms(0.75);
End();
} }
bool BinIn::IsFinished(){ bool BinIn::IsFinished(){
if(IsTimedOut()){ if(IsTimedOut()){
printf("Robot stoped collecting bin.\n"); printf("Robot stopped collecting bin.\n");
return true; return true;
}else{ }else{
return false; return false;
} }
} }
void BinIn::End(){ void BinIn::End(){
DentRobot::binCollector->MoveArms(0.0);
} }
void BinIn::Interrupted(){ void BinIn::Interrupted(){
End(); End();

View File

@ -7,18 +7,18 @@ BinOut::BinOut(double timeout): Command("BinOut"){
void BinOut::Initialize(){ void BinOut::Initialize(){
} }
void BinOut::Execute(){ void BinOut::Execute(){
DentRobot::binCollector->Set(0.1); DentRobot::binCollector->MoveArms(-0.1);
End();
} }
bool BinOut::IsFinished(){ bool BinOut::IsFinished(){
if(IsTimedOut()){ if(IsTimedOut()){
printf("Robot stoped ejecting bin.\n"); printf("Robot stopped ejecting bin.\n");
return true; return true;
}else{ }else{
return false; return false;
} }
} }
void BinOut::End(){ void BinOut::End(){
DentRobot::binCollector->MoveArms(0.0);
} }
void BinOut::Interrupted(){ void BinOut::Interrupted(){
End(); End();

View File

@ -17,7 +17,6 @@
#define BINELEVATOR_LEFT_CAN 13 #define BINELEVATOR_LEFT_CAN 13
#define BINELEVATOR_RIGHT_CAN 14 #define BINELEVATOR_RIGHT_CAN 14
#define BINELEVATOR_BOTTOM_DIO 6 #define BINELEVATOR_BOTTOM_DIO 6
#define BINELEVATOR_COLELCT_BIN_DIO 7
#define BINELEVATOR_TOP_DIO 12 #define BINELEVATOR_TOP_DIO 12
#define BINELEVATOR_ENCODERA 10 #define BINELEVATOR_ENCODERA 10
#define BINELEVATOR_ENCODERB 11 #define BINELEVATOR_ENCODERB 11
@ -39,7 +38,8 @@
#define COLLECTOR_SONAR_ANALOG 3 #define COLLECTOR_SONAR_ANALOG 3
// BinCollector // BinCollector
#define BINCOLLECTOR 0 #define BINCOLLECTOR_RIGHT_CAN 6
#define BINCOLLECTOR_LEFT_CAN 10
#endif #endif
// vim: ts=2:sw=2:et // vim: ts=2:sw=2:et

View File

@ -2,15 +2,13 @@
#include "../RobotMap.h" #include "../RobotMap.h"
BinCollector::BinCollector(): Subsystem("BinCollector"){ BinCollector::BinCollector(): Subsystem("BinCollector"){
binCollectorMotor = new Servo(BINCOLLECTOR); leftBinCollectorMotor = new CANTalon(BINCOLLECTOR_LEFT_CAN);
rightBinCollectorMotor = new CANTalon(BINCOLLECTOR_RIGHT_CAN);
} }
void BinCollector::InitDefaultCommand(){ void BinCollector::InitDefaultCommand(){
} }
void BinCollector::Set(double pos){ void BinCollector::MoveArms(double speed){
binCollectorMotor->Set(pos); leftBinCollectorMotor->Set(speed);
printf("BinCollector angle: %f\n", pos); rightBinCollectorMotor->Set(-speed);
}
double BinCollector::Get(){
return binCollectorMotor->Get();
} }
// vim: ts=2:sw=2:et // vim: ts=2:sw=2:et

View File

@ -4,12 +4,13 @@
#include "WPILib.h" #include "WPILib.h"
/** /**
* @brief Collects bins * @brief Collects bins
* *
* Collects bins with a servo * Collects bins with a servo
*/ */
class BinCollector: public Subsystem{ class BinCollector: public Subsystem{
private: private:
Servo *binCollectorMotor; //<! BinCollector motor CANTalon *leftBinCollectorMotor, //<<! Left bin collector motor
*rightBinCollectorMotor; //<<! Right bin collector motor
public: public:
/** /**
* @brief Constructs BinCollector * @brief Constructs BinCollector
@ -20,17 +21,11 @@ class BinCollector: public Subsystem{
*/ */
void InitDefaultCommand(); void InitDefaultCommand();
/** /**
* @brief Sets the servo angle * @brief Moves bin collector arms at given speed
* *
* @param pos The angle of the servo (0.0 to 1.0) * @param speed the speed to move the bin collector arms
*/ */
void Set(double pos); void MoveArms(double speed);
/**
* @brief Gets the servo angle
*
* @return The servo angle (0.0 to 1.0)
*/
double Get();
}; };
#endif #endif
// vim: ts=2:sw=2:et // vim: ts=2:sw=2:et