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::Execute(){
DentRobot::binCollector->Set(0.75);
End();
DentRobot::binCollector->MoveArms(0.75);
}
bool BinIn::IsFinished(){
if(IsTimedOut()){
printf("Robot stoped collecting bin.\n");
printf("Robot stopped collecting bin.\n");
return true;
}else{
return false;
}
}
void BinIn::End(){
DentRobot::binCollector->MoveArms(0.0);
}
void BinIn::Interrupted(){
End();

View File

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

View File

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

View File

@ -2,15 +2,13 @@
#include "../RobotMap.h"
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::Set(double pos){
binCollectorMotor->Set(pos);
printf("BinCollector angle: %f\n", pos);
}
double BinCollector::Get(){
return binCollectorMotor->Get();
void BinCollector::MoveArms(double speed){
leftBinCollectorMotor->Set(speed);
rightBinCollectorMotor->Set(-speed);
}
// vim: ts=2:sw=2:et

View File

@ -9,7 +9,8 @@
*/
class BinCollector: public Subsystem{
private:
Servo *binCollectorMotor; //<! BinCollector motor
CANTalon *leftBinCollectorMotor, //<<! Left bin collector motor
*rightBinCollectorMotor; //<<! Right bin collector motor
public:
/**
* @brief Constructs BinCollector
@ -20,17 +21,11 @@ class BinCollector: public Subsystem{
*/
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);
/**
* @brief Gets the servo angle
*
* @return The servo angle (0.0 to 1.0)
*/
double Get();
void MoveArms(double speed);
};
#endif
// vim: ts=2:sw=2:et