diff --git a/DentRobot.cpp b/DentRobot.cpp index d43ffb8..f5eafec 100644 --- a/DentRobot.cpp +++ b/DentRobot.cpp @@ -13,8 +13,7 @@ DentRobot::DentRobot(){ elevator=new Elevator(); binElevator=new BinElevator(); aut=new Autonomous(); - CameraServer::GetInstance()->SetQuality(50); - //the camera name (ex "cam0") can be found through the roborio web interface + CameraServer::GetInstance()->SetQuality(25); CameraServer::GetInstance()->StartAutomaticCapture("cam0"); printf("Initialized"); } diff --git a/RobotMap.h b/RobotMap.h index 8a7a765..a3abe10 100644 --- a/RobotMap.h +++ b/RobotMap.h @@ -9,12 +9,16 @@ #define ELEVATOR_COLELCT_TOTE_DIO 1 #define ELEVATOR_READY_TOTE_DIO 2 #define ELEVATOR_TOP_DIO 5 +#define ELEVATOR_ENCODERA 0 +#define ELEVATOR_ENCODERB 1 // BinElevator #define BINELEVATOR_CAN 11 #define BINELEVATOR_BOTTOM_DIO 6 #define BINELEVATOR_COLELCT_BIN_DIO 7 #define BINELEVATOR_TOP_DIO 8 +#define BINELEVATOR_ENCODERA 2 +#define BINELEVATOR_ENCODERB 3 // Drivetrain #define DRIVE_FRONT_LEFT_CAN 2 diff --git a/Subsystems/BinElevator.cpp b/Subsystems/BinElevator.cpp index 1692361..119bfb8 100644 --- a/Subsystems/BinElevator.cpp +++ b/Subsystems/BinElevator.cpp @@ -2,7 +2,7 @@ #include "../RobotMap.h" BinElevator::BinElevator(){ motor=new CANTalon(BINELEVATOR_CAN); - elevatorEncoder=new Encoder(0,1,false); + elevatorEncoder=new Encoder(BINELEVATOR_ENCODERA,BINELEVATOR_ENCODERB,false); offset=0; height=0; elevatorBottom=new DigitalInput(BINELEVATOR_BOTTOM_DIO); diff --git a/Subsystems/Elevator.cpp b/Subsystems/Elevator.cpp index e02c4ff..9264b4a 100644 --- a/Subsystems/Elevator.cpp +++ b/Subsystems/Elevator.cpp @@ -2,26 +2,20 @@ #include "../RobotMap.h" Elevator::Elevator(){ motor=new CANTalon(ELEVATOR_CAN); - elevatorEncoder=new Encoder(0,1,false); - offset=0; - height=0; + elevatorEncoder=new Encoder(ELEVATOR_ENCODERA,ELEVATOR_ENCODERB,false); elevatorBottom=new DigitalInput(ELEVATOR_BOTTOM_DIO); elevatorTop=new DigitalInput(ELEVATOR_TOP_DIO); - //SetAbsoluteTolerance(0.004); } void Elevator::InitDefaultCommand(){ } void Elevator::Run(double power){ motor->Set(power); } -void Elevator::SetOffset(double ht){ - offset=ht; -} void Elevator::ResetEncoder(){ elevatorEncoder->Reset(); } double Elevator::GetHeight(){ - return elevatorEncoder->Get()+offset; + return elevatorEncoder->Get(); } bool Elevator::GetElevatorBottom(){ return elevatorBottom->Get(); diff --git a/Subsystems/Elevator.h b/Subsystems/Elevator.h index c6facaf..bdc0c8d 100644 --- a/Subsystems/Elevator.h +++ b/Subsystems/Elevator.h @@ -8,13 +8,11 @@ class Elevator{ CANTalon *motor; Encoder *elevatorEncoder; static constexpr double kP_real=4, kI_real=.0f, kP_simulation=18, kI_simulation=.2; - double offset, height; DigitalInput *elevatorBottom, *elevatorTop; public: Elevator(); void InitDefaultCommand(); void Run(double); - void SetOffset(double); void ResetEncoder(); double GetHeight(); bool GetElevatorTop();