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

Camera works, untested binelevator changes

This commit is contained in:
Austen Adler 2015-02-11 19:22:59 -05:00
parent c77ee7a548
commit 0831c1084b
5 changed files with 8 additions and 13 deletions

View File

@ -13,8 +13,7 @@ DentRobot::DentRobot(){
elevator=new Elevator(); elevator=new Elevator();
binElevator=new BinElevator(); binElevator=new BinElevator();
aut=new Autonomous(); aut=new Autonomous();
CameraServer::GetInstance()->SetQuality(50); CameraServer::GetInstance()->SetQuality(25);
//the camera name (ex "cam0") can be found through the roborio web interface
CameraServer::GetInstance()->StartAutomaticCapture("cam0"); CameraServer::GetInstance()->StartAutomaticCapture("cam0");
printf("Initialized"); printf("Initialized");
} }

View File

@ -9,12 +9,16 @@
#define ELEVATOR_COLELCT_TOTE_DIO 1 #define ELEVATOR_COLELCT_TOTE_DIO 1
#define ELEVATOR_READY_TOTE_DIO 2 #define ELEVATOR_READY_TOTE_DIO 2
#define ELEVATOR_TOP_DIO 5 #define ELEVATOR_TOP_DIO 5
#define ELEVATOR_ENCODERA 0
#define ELEVATOR_ENCODERB 1
// BinElevator // BinElevator
#define BINELEVATOR_CAN 11 #define BINELEVATOR_CAN 11
#define BINELEVATOR_BOTTOM_DIO 6 #define BINELEVATOR_BOTTOM_DIO 6
#define BINELEVATOR_COLELCT_BIN_DIO 7 #define BINELEVATOR_COLELCT_BIN_DIO 7
#define BINELEVATOR_TOP_DIO 8 #define BINELEVATOR_TOP_DIO 8
#define BINELEVATOR_ENCODERA 2
#define BINELEVATOR_ENCODERB 3
// Drivetrain // Drivetrain
#define DRIVE_FRONT_LEFT_CAN 2 #define DRIVE_FRONT_LEFT_CAN 2

View File

@ -2,7 +2,7 @@
#include "../RobotMap.h" #include "../RobotMap.h"
BinElevator::BinElevator(){ BinElevator::BinElevator(){
motor=new CANTalon(BINELEVATOR_CAN); motor=new CANTalon(BINELEVATOR_CAN);
elevatorEncoder=new Encoder(0,1,false); elevatorEncoder=new Encoder(BINELEVATOR_ENCODERA,BINELEVATOR_ENCODERB,false);
offset=0; offset=0;
height=0; height=0;
elevatorBottom=new DigitalInput(BINELEVATOR_BOTTOM_DIO); elevatorBottom=new DigitalInput(BINELEVATOR_BOTTOM_DIO);

View File

@ -2,26 +2,20 @@
#include "../RobotMap.h" #include "../RobotMap.h"
Elevator::Elevator(){ Elevator::Elevator(){
motor=new CANTalon(ELEVATOR_CAN); motor=new CANTalon(ELEVATOR_CAN);
elevatorEncoder=new Encoder(0,1,false); elevatorEncoder=new Encoder(ELEVATOR_ENCODERA,ELEVATOR_ENCODERB,false);
offset=0;
height=0;
elevatorBottom=new DigitalInput(ELEVATOR_BOTTOM_DIO); elevatorBottom=new DigitalInput(ELEVATOR_BOTTOM_DIO);
elevatorTop=new DigitalInput(ELEVATOR_TOP_DIO); elevatorTop=new DigitalInput(ELEVATOR_TOP_DIO);
//SetAbsoluteTolerance(0.004);
} }
void Elevator::InitDefaultCommand(){ void Elevator::InitDefaultCommand(){
} }
void Elevator::Run(double power){ void Elevator::Run(double power){
motor->Set(power); motor->Set(power);
} }
void Elevator::SetOffset(double ht){
offset=ht;
}
void Elevator::ResetEncoder(){ void Elevator::ResetEncoder(){
elevatorEncoder->Reset(); elevatorEncoder->Reset();
} }
double Elevator::GetHeight(){ double Elevator::GetHeight(){
return elevatorEncoder->Get()+offset; return elevatorEncoder->Get();
} }
bool Elevator::GetElevatorBottom(){ bool Elevator::GetElevatorBottom(){
return elevatorBottom->Get(); return elevatorBottom->Get();

View File

@ -8,13 +8,11 @@ class Elevator{
CANTalon *motor; CANTalon *motor;
Encoder *elevatorEncoder; Encoder *elevatorEncoder;
static constexpr double kP_real=4, kI_real=.0f, kP_simulation=18, kI_simulation=.2; static constexpr double kP_real=4, kI_real=.0f, kP_simulation=18, kI_simulation=.2;
double offset, height;
DigitalInput *elevatorBottom, *elevatorTop; DigitalInput *elevatorBottom, *elevatorTop;
public: public:
Elevator(); Elevator();
void InitDefaultCommand(); void InitDefaultCommand();
void Run(double); void Run(double);
void SetOffset(double);
void ResetEncoder(); void ResetEncoder();
double GetHeight(); double GetHeight();
bool GetElevatorTop(); bool GetElevatorTop();