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

updated can id's to match hardware updates, reversed motors

This commit is contained in:
Adam Long 2015-10-05 20:29:33 +00:00
parent 455ecba25a
commit b3ee49e903
5 changed files with 23 additions and 23 deletions

View File

@ -10,11 +10,11 @@ void Lower::Execute() {
DentRobot::elevator->Run(DentRobot::oi->GetRightThrottle()*1.0);
}
bool Lower::IsFinished() {
if(softLimits) {
if(!DentRobot::elevator->GetElevatorBottom()) {
return true;
}
}
// if(softLimits) {
// if(!DentRobot::elevator->GetElevatorBottom()) {
// return true;
// }
// }
if(IsTimedOut()) {
return true;
} else {

View File

@ -7,14 +7,14 @@ Raise::Raise(double timeout, bool useSoftLimits): Command("Raise") {
}
void Raise::Initialize() {}
void Raise::Execute() {
DentRobot::elevator->Run(DentRobot::oi->GetRightThrottle()*1.0);
DentRobot::elevator->Run(DentRobot::oi->GetRightThrottle()*-1.0);
}
bool Raise::IsFinished() {
if(softLimits) {
if(!DentRobot::elevator->GetElevatorTop()||!DentRobot::elevator->GetElevatorMiddle()) {
return true;
}
}
// if(softLimits) {
// if(!DentRobot::elevator->GetElevatorTop()||!DentRobot::elevator->GetElevatorMiddle()) {
// return true;
// }
// }
if(IsTimedOut()) {
return true;
} else {
@ -23,9 +23,9 @@ bool Raise::IsFinished() {
}
void Raise::End() {
// If the elevator is at the top
if(DentRobot::elevator->GetElevatorTop()) {
DentRobot::elevator->SetUseEncoder(true);
}
// if(DentRobot::elevator->GetElevatorTop()) {
// DentRobot::elevator->SetUseEncoder(true);
// }
DentRobot::elevator->Run(0.0f);
}
void Raise::Interrupted() {

4
OI.cpp
View File

@ -35,8 +35,8 @@ OI::OI() {
JoystickButton *right10 = new JoystickButton(rightStick, 10);
JoystickButton *right11 = new JoystickButton(rightStick, 11);
JoystickButton *right12 = new JoystickButton(rightStick, 12);
right4->WhenPressed(lower);
right6->WhenPressed(raise);
right4->WhileHeld(lower);
right6->WhileHeld(raise);
right7->WhenPressed(cycle);
right10->WhenPressed(new BinCloseArms(2));
right11->WhenPressed(new BinOpenArms(2));

View File

@ -6,7 +6,7 @@
#define CODE_VERSION 2.1
// Elevator
#define ELEVATOR_CAN 1
#define ELEVATOR_CAN 11
#define ELEVATOR_BOTTOM_DIO 9
#define ELEVATOR_MIDDLE_DIO 8
#define ELEVATOR_TOP_DIO 7
@ -23,16 +23,16 @@
// Drivetrain
#define DRIVE_FRONT_LEFT_CAN 8
#define DRIVE_BACK_LEFT_CAN 3
#define DRIVE_BACK_LEFT_CAN 2
#define DRIVE_FRONT_RIGHT_CAN 4
#define DRIVE_BACK_RIGHT_CAN 5
#define DRIVE_BACK_RIGHT_CAN 3
#define DRIVE_GYRO_ANALOG 0
// Collector
#define COLLECTOR_RAMP_CAN 7
#define COLLECTOR_LEFT_CAN 2
#define COLLECTOR_BOTTOM_CAN 11
#define COLLECTOR_RIGHT_CAN 9
#define COLLECTOR_LEFT_CAN 8
#define COLLECTOR_BOTTOM_CAN 20
#define COLLECTOR_RIGHT_CAN 10
#define COLLECTOR_SONAR_ANALOG 3
// BinCollector

View File

@ -13,7 +13,7 @@ void Drivetrain::InitDefaultCommand() {
void Drivetrain::DriveArcade(double x, double y, double z, double sensitivity, bool driveStraight) {
double kP = SmartDashboard::GetNumber("Gyro kP");
double correctX = -(sensitivity*(pow(x, 3))+(1-sensitivity)*x);
double correctY = -(sensitivity*(pow(y, 3))+(1-sensitivity)*y);
double correctY = (sensitivity*(pow(y, 3))+(1-sensitivity)*y);
double correctZ = z;
if(driveStraight) {
printf("Driving straight at: %f\n", -gyro->GetAngle()*kP);