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

More formatting improvements

This commit is contained in:
Austen Adler 2015-03-09 07:25:11 -04:00
parent 5663ba3fec
commit f71320949d
18 changed files with 30 additions and 30 deletions

View File

@ -10,9 +10,9 @@ Elevator* CommandBase::elevator = NULL;
BinElevator* CommandBase::binElevator = NULL; BinElevator* CommandBase::binElevator = NULL;
Pneumatics* CommandBase::pneumatics=NULL; Pneumatics* CommandBase::pneumatics=NULL;
OI* CommandBase::oi = NULL; OI* CommandBase::oi = NULL;
CommandBase::CommandBase(char const *name) : Command(name){ CommandBase::CommandBase(char const *name): Command(name){
} }
CommandBase::CommandBase() : Command(){ CommandBase::CommandBase(): Command(){
} }
void CommandBase::init(){ void CommandBase::init(){
drivetrain = new Drivetrain(); drivetrain = new Drivetrain();

View File

@ -1,7 +1,7 @@
#include "AutoDrive.h" #include "AutoDrive.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
// Drive for a short while then stop. Just for testing // Drive for a short while then stop. Just for testing
AutoDrive::AutoDrive(double duration, double xtmp, double ytmp) : Command("AutoDrive"){ AutoDrive::AutoDrive(double duration, double xtmp, double ytmp): Command("AutoDrive"){
Requires(DentRobot::drivetrain); Requires(DentRobot::drivetrain);
SetTimeout(duration); SetTimeout(duration);
x=xtmp; x=xtmp;

View File

@ -1,6 +1,6 @@
#include "Turn.h" #include "Turn.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
Turn::Turn(double timeout) : Command("Turn"){ Turn::Turn(double timeout): Command("Turn"){
Requires(DentRobot::drivetrain); Requires(DentRobot::drivetrain);
SetTimeout(timeout); SetTimeout(timeout);
} }

View File

@ -1,7 +1,7 @@
#include "BinCloseArms.h" #include "BinCloseArms.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../../OI.h" #include "../../OI.h"
BinCloseArms::BinCloseArms(double timeout) : Command("BinCloseArms"){ BinCloseArms::BinCloseArms(double timeout): Command("BinCloseArms"){
SetTimeout(timeout); SetTimeout(timeout);
} }
void BinCloseArms::Initialize(){ void BinCloseArms::Initialize(){

View File

@ -1,7 +1,7 @@
#include "BinLower.h" #include "BinLower.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../../OI.h" #include "../../OI.h"
BinLower::BinLower(float timeout) : Command("BinLower"){ BinLower::BinLower(float timeout): Command("BinLower"){
SetTimeout(timeout); SetTimeout(timeout);
} }
void BinLower::Initialize(){ void BinLower::Initialize(){
@ -10,7 +10,7 @@ void BinLower::Execute(){
DentRobot::binElevator->Run(-1.0); DentRobot::binElevator->Run(-1.0);
} }
bool BinLower::IsFinished(){ bool BinLower::IsFinished(){
if (/*!DentRobot::binElevator->GetElevatorBottom()||*/IsTimedOut()){ if(/*!DentRobot::binElevator->GetElevatorBottom()||*/IsTimedOut()){
printf("Robot stoped BinLowering. Sensor based? %d\n", !DentRobot::binElevator->GetElevatorBottom()); printf("Robot stoped BinLowering. Sensor based? %d\n", !DentRobot::binElevator->GetElevatorBottom());
return true; return true;
}else{ }else{

View File

@ -1,7 +1,7 @@
#include "BinOpenArms.h" #include "BinOpenArms.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../../OI.h" #include "../../OI.h"
BinOpenArms::BinOpenArms(double timeout) : Command("BinOpenArms"){ BinOpenArms::BinOpenArms(double timeout): Command("BinOpenArms"){
SetTimeout(timeout); SetTimeout(timeout);
} }
void BinOpenArms::Initialize(){ void BinOpenArms::Initialize(){

View File

@ -1,7 +1,7 @@
#include "BinRaise.h" #include "BinRaise.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../../OI.h" #include "../../OI.h"
BinRaise::BinRaise(double timeout) : Command("BinRaise"){ BinRaise::BinRaise(double timeout): Command("BinRaise"){
SetTimeout(timeout); SetTimeout(timeout);
} }
void BinRaise::Initialize(){ void BinRaise::Initialize(){
@ -10,7 +10,7 @@ void BinRaise::Execute(){
DentRobot::binElevator->Run(1.0); DentRobot::binElevator->Run(1.0);
} }
bool BinRaise::IsFinished(){ bool BinRaise::IsFinished(){
if (/*!DentRobot::binElevator->GetElevatorTop()||*/IsTimedOut()){ if(/*!DentRobot::binElevator->GetElevatorTop()||*/IsTimedOut()){
printf("Robot stoped raising. Sensor based? %d\n", !DentRobot::binElevator->GetElevatorTop()); printf("Robot stoped raising. Sensor based? %d\n", !DentRobot::binElevator->GetElevatorTop());
return true; return true;
}else{ }else{

View File

@ -1,5 +1,5 @@
#include "RollIn.h" #include "RollIn.h"
RollIn::RollIn(double speed) : Command("RollIn"){ RollIn::RollIn(double speed): Command("RollIn"){
rawSpeed=speed; rawSpeed=speed;
} }
void RollIn::Initialize(){ void RollIn::Initialize(){

View File

@ -1,5 +1,5 @@
#include "RollOut.h" #include "RollOut.h"
RollOut::RollOut(double timeout) : Command("RollOut"){ RollOut::RollOut(double timeout): Command("RollOut"){
Requires(DentRobot::collector); Requires(DentRobot::collector);
SetTimeout(timeout); SetTimeout(timeout);
} }
@ -9,7 +9,7 @@ void RollOut::Execute(){
//TODO check this value to move the motors in the right direction //TODO check this value to move the motors in the right direction
// Devide by 2 twice because this speed should be half the collector speed // Devide by 2 twice because this speed should be half the collector speed
DentRobot::collector->MoveRollers(-DentRobot::oi->GetLeftThrottle() * 0.8); DentRobot::collector->MoveRollers(-DentRobot::oi->GetLeftThrottle() * 0.8);
SmartDashboard::PutNumber("DriveThrottle",-DentRobot::oi->GetLeftThrottle()); SmartDashboard::PutNumber("DriveThrottle", -DentRobot::oi->GetLeftThrottle());
} }
bool RollOut::IsFinished(){ bool RollOut::IsFinished(){
return IsTimedOut(); return IsTimedOut();

View File

@ -1,6 +1,6 @@
#include "Drive.h" #include "Drive.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
Drive::Drive() : Command("Drive"){ Drive::Drive(): Command("Drive"){
Requires(DentRobot::drivetrain); Requires(DentRobot::drivetrain);
} }
void Drive::Initialize(){ void Drive::Initialize(){
@ -11,10 +11,10 @@ void Drive::Execute(){
y = -DentRobot::oi->GetLeftStick()->GetRawAxis(1); y = -DentRobot::oi->GetLeftStick()->GetRawAxis(1);
z = DentRobot::oi->GetLeftStick()->GetRawAxis(2); z = DentRobot::oi->GetLeftStick()->GetRawAxis(2);
// Lock the x axis when not holding button 1 // Lock the x axis when not holding button 1
//if (DentRobot::oi->GetLeftStick()->GetRawButton(1)){ //if(DentRobot::oi->GetLeftStick()->GetRawButton(1)){
// x=0; // x=0;
//} //}
//if (DentRobot::oi->GetLeftStick()->GetRawButton(2)){ //if(DentRobot::oi->GetLeftStick()->GetRawButton(2)){
// y=0; // y=0;
//} //}
//X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro //X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro

View File

@ -1,7 +1,7 @@
#include "Lower.h" #include "Lower.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../../OI.h" #include "../../OI.h"
Lower::Lower(double timeout) : Command("Lower"){ Lower::Lower(double timeout): Command("Lower"){
SetTimeout(timeout); SetTimeout(timeout);
} }
void Lower::Initialize(){ void Lower::Initialize(){
@ -10,7 +10,7 @@ void Lower::Execute(){
DentRobot::elevator->Run(-1.0); DentRobot::elevator->Run(-1.0);
} }
bool Lower::IsFinished(){ bool Lower::IsFinished(){
if (!DentRobot::elevator->GetElevatorBottom()||IsTimedOut()){ if(!DentRobot::elevator->GetElevatorBottom()||IsTimedOut()){
printf("Robot stoped lowering. Sensor based? %d\n", !DentRobot::elevator->GetElevatorBottom()); printf("Robot stoped lowering. Sensor based? %d\n", !DentRobot::elevator->GetElevatorBottom());
return true; return true;
}else{ }else{

View File

@ -1,7 +1,7 @@
#include "Raise.h" #include "Raise.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../../OI.h" #include "../../OI.h"
Raise::Raise(double timeout) : Command("Raise"){ Raise::Raise(double timeout): Command("Raise"){
SetTimeout(timeout); SetTimeout(timeout);
} }
void Raise::Initialize(){ void Raise::Initialize(){
@ -13,12 +13,12 @@ bool Raise::IsFinished(){
//if(!DentRobot::elevator->GetElevatorMiddle()){ //if(!DentRobot::elevator->GetElevatorMiddle()){
// DentRobot::elevator->stoppedAtSensor=true; // DentRobot::elevator->stoppedAtSensor=true;
//} //}
//if ((DentRobot::elevator->stoppedAtSensor)){ //if((DentRobot::elevator->stoppedAtSensor)){
// printf("Stopped at the middle sensor\n"); // printf("Stopped at the middle sensor\n");
// DentRobot::elevator->stoppedAtSensor=false; // DentRobot::elevator->stoppedAtSensor=false;
// return true; // return true;
//}else if (!DentRobot::elevator->GetElevatorTop()) { //}else if(!DentRobot::elevator->GetElevatorTop()){
if (!DentRobot::elevator->GetElevatorTop()||!DentRobot::elevator->GetElevatorMiddle()||IsTimedOut()){ if(!DentRobot::elevator->GetElevatorTop()||!DentRobot::elevator->GetElevatorMiddle()||IsTimedOut()){
printf("Robot stopped raising. Sensor based? %d\n", !DentRobot::elevator->GetElevatorTop()||!DentRobot::elevator->GetElevatorMiddle()); printf("Robot stopped raising. Sensor based? %d\n", !DentRobot::elevator->GetElevatorTop()||!DentRobot::elevator->GetElevatorMiddle());
return true; return true;
}else{ }else{

View File

@ -3,7 +3,7 @@
#include "Commands/CommandGroup.h" #include "Commands/CommandGroup.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../../RobotMap.h" #include "../../RobotMap.h"
CheckDrive::CheckDrive(int motorID) : CommandGroup("CheckDrive"){ CheckDrive::CheckDrive(int motorID): CommandGroup("CheckDrive"){
Requires(DentRobot::drivetrain); Requires(DentRobot::drivetrain);
motor = motorID; motor = motorID;
} }

View File

@ -43,7 +43,7 @@ void DentRobot::RobotInit(){
SmartDashboard::PutBoolean("Elevator Bottom", false); SmartDashboard::PutBoolean("Elevator Bottom", false);
SmartDashboard::PutBoolean("Elevator Top", false); SmartDashboard::PutBoolean("Elevator Top", false);
//Drive speed //Drive speed
SmartDashboard::PutNumber("DriveSpeedReductionThresh",2); SmartDashboard::PutNumber("DriveSpeedReductionThresh", 2);
} }
void DentRobot::DisabledPeriodic(){ void DentRobot::DisabledPeriodic(){
Scheduler::GetInstance()->Run(); Scheduler::GetInstance()->Run();
@ -60,7 +60,7 @@ void DentRobot::AutonomousPeriodic(){
Scheduler::GetInstance()->Run(); Scheduler::GetInstance()->Run();
} }
void DentRobot::TeleopInit(){ void DentRobot::TeleopInit(){
if (aut != NULL){ if(aut != NULL){
aut->Cancel(); aut->Cancel();
} }
} }

2
OI.cpp
View File

@ -10,7 +10,7 @@
#include "Commands/Autonomous/CollectTote.h" #include "Commands/Autonomous/CollectTote.h"
#include "Commands/Autonomous/ReleaseTote.h" #include "Commands/Autonomous/ReleaseTote.h"
#include "Commands/Test/CheckRobot.h" #include "Commands/Test/CheckRobot.h"
OI::OI() { OI::OI(){
// Joysticks // Joysticks
leftStick=new Joystick(0); leftStick=new Joystick(0);
rightStick=new Joystick(1); rightStick=new Joystick(1);

View File

@ -1,7 +1,7 @@
#include "Collector.h" #include "Collector.h"
#include "../RobotMap.h" #include "../RobotMap.h"
Collector::Collector() : Subsystem("Collector"){ Collector::Collector(): Subsystem("Collector"){
collectorMotorLeft=new CANTalon(COLLECTOR_LEFT_CAN); collectorMotorLeft=new CANTalon(COLLECTOR_LEFT_CAN);
collectorMotorBottom=new CANTalon(COLLECTOR_BOTTOM_CAN); collectorMotorBottom=new CANTalon(COLLECTOR_BOTTOM_CAN);
collectorMotorRamp=new CANTalon(COLLECTOR_RAMP_CAN); collectorMotorRamp=new CANTalon(COLLECTOR_RAMP_CAN);

View File

@ -2,7 +2,7 @@
#include "../RobotMap.h" #include "../RobotMap.h"
#include "../Commands/Drivetrain/Drive.h" #include "../Commands/Drivetrain/Drive.h"
Drivetrain::Drivetrain() : Subsystem("Drivetrain"){ Drivetrain::Drivetrain(): Subsystem("Drivetrain"){
rightFront = new CANTalon(DRIVE_FRONT_RIGHT_CAN); rightFront = new CANTalon(DRIVE_FRONT_RIGHT_CAN);
leftFront = new CANTalon(DRIVE_FRONT_LEFT_CAN); leftFront = new CANTalon(DRIVE_FRONT_LEFT_CAN);
rightRear = new CANTalon(DRIVE_BACK_RIGHT_CAN); rightRear = new CANTalon(DRIVE_BACK_RIGHT_CAN);
@ -15,7 +15,7 @@ void Drivetrain::DriveMecanum(double x, double y, double z, double sensitivity,
double correctX = -(sensitivity*(pow(x, 3))+(1-sensitivity)*x); 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 * 0.5; double correctZ = -z * 0.5;
if (DentRobot::oi->GetLeftStick()->GetRawButton(9)){ if(DentRobot::oi->GetLeftStick()->GetRawButton(9)){
correctY /= SmartDashboard::GetNumber("DriveSpeedReductionThresh"); correctY /= SmartDashboard::GetNumber("DriveSpeedReductionThresh");
} }
rightFront->Set((-correctX + correctY - correctZ)); rightFront->Set((-correctX + correctY - correctZ));

View File

@ -1,7 +1,7 @@
#include "Pneumatics.h" #include "Pneumatics.h"
#include "../RobotMap.h" #include "../RobotMap.h"
Pneumatics::Pneumatics() : Subsystem("Pneumatics"){ Pneumatics::Pneumatics(): Subsystem("Pneumatics"){
solenoid1 = new Solenoid(BINELEVATOR_SOLDENOID_ONE); solenoid1 = new Solenoid(BINELEVATOR_SOLDENOID_ONE);
solenoid2 = new Solenoid(BINELEVATOR_SOLDENOID_TWO); solenoid2 = new Solenoid(BINELEVATOR_SOLDENOID_TWO);
} }