From 3de6e0023c1bb932abd108affd199269867ee426 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 22 Mar 2015 14:29:07 -0400 Subject: [PATCH 1/2] Preparing for releaes v2.1 --- Commands/Autonomous/Autonomous.cpp | 8 ++++---- Commands/Autonomous/Autonomous.h | 12 ++++++++++++ Commands/BinElevator/BinCloseArms.h | 3 +-- Commands/BinElevator/BinLower.h | 1 - Commands/Collector/RollVar.h | 2 +- DentRobot.cpp | 3 +-- Subsystems/Drivetrain.cpp | 1 - 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Commands/Autonomous/Autonomous.cpp b/Commands/Autonomous/Autonomous.cpp index b003300..f298bb9 100644 --- a/Commands/Autonomous/Autonomous.cpp +++ b/Commands/Autonomous/Autonomous.cpp @@ -71,19 +71,19 @@ Autonomous::Autonomous(int seq){ //TODO: Implement this break; case 7: - // Same as auto 4 with (Three|Two) totes checked, collect bin, drive to Auto Zone (TM), release totes + // Same as auto 4, then collect bin, drive to Auto Zone (TM), release totes //TODO: Implement this break; case 8: //Use rear elevator to move tote AddSequential(new Turn(1.8)); - AddSequential(new AutoDrive(2.3,0.0,-0.75)); + AddSequential(new AutoDrive(2.3, 0.0, -0.75)); AddSequential(new Turn(1.8)); break; case 9: //Use rear elevator to move bin - AddSequential(new BinLower(.1)); - AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"),0.0,0.75)); + AddSequential(new BinLower(0.1)); + AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, 0.75)); AddSequential(new Turn(2.1)); break; default: diff --git a/Commands/Autonomous/Autonomous.h b/Commands/Autonomous/Autonomous.h index bafa61c..5080d3d 100644 --- a/Commands/Autonomous/Autonomous.h +++ b/Commands/Autonomous/Autonomous.h @@ -19,6 +19,18 @@ * Sequence 2: Collects a tote, turns, then drives to the auto zone * * Sequence 3: Collects two or three totes then drives to auto zone + * + * Sequence 4: Collect one, two, or three totes, drive to Auto Zone, release totes + * + * Sequence 5: Same as auto 4, but navigate around bins (not implemented) + * + * Sequence 6: Collect 1 bin and 1 tote (not implemented) + * + * Sequence 7: Same as auto 4, then collect bin, drive to auto zone, release totes (not implemented) + * + * Sequence 8: Use rear elevator to move tote + * + * Sequence 9: Use rear elevator to move bin */ class Autonomous: public CommandGroup{ public: diff --git a/Commands/BinElevator/BinCloseArms.h b/Commands/BinElevator/BinCloseArms.h index c00cdde..086b8a9 100644 --- a/Commands/BinElevator/BinCloseArms.h +++ b/Commands/BinElevator/BinCloseArms.h @@ -5,7 +5,7 @@ #include "WPILib.h" /** - * @brief Closes BinElevatorArms (NOT USED) + * @brief Closes BinElevatorArms (unused) * * Sets the solenoid to close the arms of the BinElevator */ @@ -40,6 +40,5 @@ class BinCloseArms: public Command{ */ void Interrupted(); }; - #endif // vim: ts=2:sw=2:et diff --git a/Commands/BinElevator/BinLower.h b/Commands/BinElevator/BinLower.h index f9a6068..811adae 100644 --- a/Commands/BinElevator/BinLower.h +++ b/Commands/BinElevator/BinLower.h @@ -8,7 +8,6 @@ * @brief Lowers the bin elevator until a timeout is reached */ class BinLower: public Command{ - private: public: /** * @brief Constructs BinLower diff --git a/Commands/Collector/RollVar.h b/Commands/Collector/RollVar.h index e0408c7..44e60ed 100644 --- a/Commands/Collector/RollVar.h +++ b/Commands/Collector/RollVar.h @@ -11,7 +11,7 @@ */ class RollVar: public Command{ private: - double speed; //Run(); - //TODO: Calibrate 1.0 to the height we want the elevator to automatically raise if(elevator->GetUseEncoder()&&elevator->GetHeight()<=-1.0){ // Raise the elevator if it dips below elevatorTop oi->raise->Start(); } - SmartDashboard::PutNumber("CollectorThrottle",oi->GetLeftThrottle()); + SmartDashboard::PutNumber("CollectorThrottle", oi->GetLeftThrottle()); } void DentRobot::TestPeriodic(){ } diff --git a/Subsystems/Drivetrain.cpp b/Subsystems/Drivetrain.cpp index 4e368f7..3fdafcf 100644 --- a/Subsystems/Drivetrain.cpp +++ b/Subsystems/Drivetrain.cpp @@ -13,7 +13,6 @@ void Drivetrain::InitDefaultCommand(){ SetDefaultCommand(new Drive()); } void Drivetrain::DriveMecanum(double x, double y, double z, double sensitivity, bool driveStraight){ - //TODO: Find the correct value for kP double kP=SmartDashboard::GetNumber("Gyro kP"); double correctX = -(sensitivity*(pow(x, 3))+(1-sensitivity)*x); double correctY = -(sensitivity*(pow(y, 3))+(1-sensitivity)*y); From d8f39bef0a760b4935581abbfb5da818f6cc5b4e Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Mon, 23 Mar 2015 10:52:02 -0400 Subject: [PATCH 2/2] Documentation, formatting fixes --- Commands/Autonomous/AutoDrive.cpp | 8 ++++---- Commands/Autonomous/AutoDrive.h | 4 ++-- Commands/Autonomous/Autonomous.h | 4 ++-- Commands/Autonomous/Turn.h | 1 - Commands/BinElevator/BinCloseArms.h | 2 +- Commands/BinElevator/BinLower.h | 2 +- Commands/BinElevator/BinOpenArms.h | 2 +- Commands/Collector/RollIn.cpp | 6 +++--- Commands/Collector/RollOut.h | 4 ++-- Commands/Collector/RollVar.cpp | 2 +- Commands/Drivetrain/Drive.cpp | 4 ++-- Commands/Drivetrain/Drive.h | 1 - Commands/Elevator/Lower.h | 4 +++- Commands/Elevator/Raise.cpp | 4 ++-- Commands/Elevator/Raise.h | 4 +++- DentRobot.cpp | 30 +++++++++++++-------------- OI.cpp | 32 ++++++++++++++--------------- OI.h | 11 +++++----- Subsystems/BinElevator.cpp | 8 ++++---- Subsystems/BinElevator.h | 4 +--- Subsystems/Collector.cpp | 10 ++++----- Subsystems/Collector.h | 8 ++++---- Subsystems/Drivetrain.cpp | 2 +- Subsystems/Drivetrain.h | 4 ++-- Subsystems/Elevator.cpp | 14 ++++++------- mainpage.dox | 2 -- 26 files changed, 88 insertions(+), 89 deletions(-) diff --git a/Commands/Autonomous/AutoDrive.cpp b/Commands/Autonomous/AutoDrive.cpp index 143fc06..718a9a9 100644 --- a/Commands/Autonomous/AutoDrive.cpp +++ b/Commands/Autonomous/AutoDrive.cpp @@ -4,10 +4,10 @@ AutoDrive::AutoDrive(double duration, double xtmp, double ytmp, double ztmp, bool useGyro): Command("AutoDrive"){ Requires(DentRobot::drivetrain); SetTimeout(duration); - x=xtmp; - y=ytmp; - z=ztmp; - gyro=useGyro; + x = xtmp; + y = ytmp; + z = ztmp; + gyro = useGyro; } void AutoDrive::Initialize(){ DentRobot::drivetrain->ResetGyro(); diff --git a/Commands/Autonomous/AutoDrive.h b/Commands/Autonomous/AutoDrive.h index e2fa088..dfe3244 100644 --- a/Commands/Autonomous/AutoDrive.h +++ b/Commands/Autonomous/AutoDrive.h @@ -23,9 +23,9 @@ class AutoDrive: public Command{ * * @param duration Timeout in seconds * @param xtmp Joystick x value (default: 0.0) - * @param ytmp Joystick y value (default: 0.75) + * @param ytmp Joystick y value (default: -0.75) * @param ztmp Joystick z value (default: 0.0) - * @param useGyro Use the gyro when driving + * @param useGyro Use the gyro when driving (default: true) */ AutoDrive(double duration, double xtmp = 0.0, double ytmp = -0.75, double ztmp = 0.0, bool useGyro = true); /** diff --git a/Commands/Autonomous/Autonomous.h b/Commands/Autonomous/Autonomous.h index 5080d3d..40c106a 100644 --- a/Commands/Autonomous/Autonomous.h +++ b/Commands/Autonomous/Autonomous.h @@ -37,9 +37,9 @@ class Autonomous: public CommandGroup{ /** * @brief Constructs Autonomous * - * @param seq The sequence to run + * @param seq The sequence to run (default: 0) */ - Autonomous(int seq=0); + Autonomous(int seq = 0); }; #endif // vim: ts=2:sw=2:et diff --git a/Commands/Autonomous/Turn.h b/Commands/Autonomous/Turn.h index 09d0913..21eb9f7 100644 --- a/Commands/Autonomous/Turn.h +++ b/Commands/Autonomous/Turn.h @@ -12,7 +12,6 @@ * Turns the robot until a timeout is reached */ class Turn: public Command{ - private: public: /** * @brief Constructs Turn diff --git a/Commands/BinElevator/BinCloseArms.h b/Commands/BinElevator/BinCloseArms.h index 086b8a9..01df12c 100644 --- a/Commands/BinElevator/BinCloseArms.h +++ b/Commands/BinElevator/BinCloseArms.h @@ -14,7 +14,7 @@ class BinCloseArms: public Command{ /** * @brief Constructs BinCloseArms * - * @param timeout The timeout + * @param timeout Timeout in seconds (default: 0.5) */ BinCloseArms(double timeout = 0.5); /** diff --git a/Commands/BinElevator/BinLower.h b/Commands/BinElevator/BinLower.h index 811adae..2eaede3 100644 --- a/Commands/BinElevator/BinLower.h +++ b/Commands/BinElevator/BinLower.h @@ -12,7 +12,7 @@ class BinLower: public Command{ /** * @brief Constructs BinLower * - * @param timeout The timeout + * @param timeout Timeout in seconds */ BinLower(float timeout); /** diff --git a/Commands/BinElevator/BinOpenArms.h b/Commands/BinElevator/BinOpenArms.h index 22e5d49..0df387a 100644 --- a/Commands/BinElevator/BinOpenArms.h +++ b/Commands/BinElevator/BinOpenArms.h @@ -12,7 +12,7 @@ class BinOpenArms: public Command{ /** * @brief Constructs BinOpenArms * - * @param timeout The timeout + * @param timeout Timeout in seconds */ BinOpenArms(double timeout); /** diff --git a/Commands/Collector/RollIn.cpp b/Commands/Collector/RollIn.cpp index 816aa81..f05920c 100644 --- a/Commands/Collector/RollIn.cpp +++ b/Commands/Collector/RollIn.cpp @@ -1,14 +1,14 @@ #include "RollIn.h" RollIn::RollIn(double speed): Command("RollIn"){ - rawSpeed=speed; + rawSpeed = speed; } void RollIn::Initialize(){ printf("Initialized RollIn\n"); SetTimeout(2.0); } void RollIn::Execute(){ - //double cvt=(rawSpeed)*DentRobot::collector->GetSonarDistance()/0.4; - //if(cvt<=1.0){ + //double cvt = (rawSpeed)*DentRobot::collector->GetSonarDistance()/0.4; + //if(cvt <= 1.0){ // DentRobot::collector->MoveRollers(1.0); //}else{ // DentRobot::collector->MoveRollers(cvt*1.5); diff --git a/Commands/Collector/RollOut.h b/Commands/Collector/RollOut.h index bfa7b70..244d85d 100644 --- a/Commands/Collector/RollOut.h +++ b/Commands/Collector/RollOut.h @@ -14,9 +14,9 @@ class RollOut: public Command{ /** * @brief Constructs RollOut * - * @param timeout The timeout + * @param timeout Timeout in seconds (default: 2.0) */ - RollOut(double timeout=2.0); + RollOut(double timeout = 2.0); /** * @brief Initializes the class */ diff --git a/Commands/Collector/RollVar.cpp b/Commands/Collector/RollVar.cpp index 5066bf1..aa3c701 100644 --- a/Commands/Collector/RollVar.cpp +++ b/Commands/Collector/RollVar.cpp @@ -1,6 +1,6 @@ #include "RollVar.h" RollVar::RollVar(double speedVal): Command("RollVar"){ - speed=speedVal; + speed = speedVal; } void RollVar::Initialize(){ printf("Initialized RollVar\n"); diff --git a/Commands/Drivetrain/Drive.cpp b/Commands/Drivetrain/Drive.cpp index a4717ff..26dc650 100644 --- a/Commands/Drivetrain/Drive.cpp +++ b/Commands/Drivetrain/Drive.cpp @@ -12,10 +12,10 @@ void Drive::Execute(){ z = DentRobot::oi->GetLeftStick()->GetRawAxis(2); // Lock the x axis when not holding button 1 //if(DentRobot::oi->GetLeftStick()->GetRawButton(1)){ - // x=0; + // x = 0; //} //if(DentRobot::oi->GetLeftStick()->GetRawButton(2)){ - // y=0; + // y = 0; //} //X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle) if(DentRobot::oi->GetLeftStick()->GetRawButton(11)){ diff --git a/Commands/Drivetrain/Drive.h b/Commands/Drivetrain/Drive.h index 0b32990..75b289d 100644 --- a/Commands/Drivetrain/Drive.h +++ b/Commands/Drivetrain/Drive.h @@ -3,7 +3,6 @@ #include "Commands/Command.h" #include "../../DentRobot.h" -#include "../../DentRobot.h" #include "WPILib.h" /** diff --git a/Commands/Elevator/Lower.h b/Commands/Elevator/Lower.h index faf46e7..c8f60d8 100644 --- a/Commands/Elevator/Lower.h +++ b/Commands/Elevator/Lower.h @@ -11,8 +11,10 @@ class Lower: public Command{ public: /** * @brief Constructs Lower + * + * @param timeout Timeout in seconds (default: 3.0) */ - Lower(double timeout=3.0); + Lower(double timeout = 3.0); /** * @brief Initializes the class */ diff --git a/Commands/Elevator/Raise.cpp b/Commands/Elevator/Raise.cpp index feaa933..991484c 100644 --- a/Commands/Elevator/Raise.cpp +++ b/Commands/Elevator/Raise.cpp @@ -11,11 +11,11 @@ void Raise::Execute(){ } bool Raise::IsFinished(){ //if(!DentRobot::elevator->GetElevatorMiddle()){ - // DentRobot::elevator->stoppedAtSensor=true; + // DentRobot::elevator->stoppedAtSensor = true; //} //if((DentRobot::elevator->stoppedAtSensor)){ // printf("Stopped at the middle sensor\n"); - // DentRobot::elevator->stoppedAtSensor=false; + // DentRobot::elevator->stoppedAtSensor = false; // return true; //}else if(!DentRobot::elevator->GetElevatorTop()){ if(!DentRobot::elevator->GetElevatorTop()||!DentRobot::elevator->GetElevatorMiddle()||IsTimedOut()){ diff --git a/Commands/Elevator/Raise.h b/Commands/Elevator/Raise.h index 56535d0..0cc0646 100644 --- a/Commands/Elevator/Raise.h +++ b/Commands/Elevator/Raise.h @@ -11,8 +11,10 @@ class Raise: public Command{ public: /** * @brief Constructs Raise + * + * @param timeout Timeout in seconds (default: 3.5) */ - Raise(double timeout=3.5); + Raise(double timeout = 3.5); /** * @brief Initializes the class */ diff --git a/DentRobot.cpp b/DentRobot.cpp index fd1a7f5..605ab24 100644 --- a/DentRobot.cpp +++ b/DentRobot.cpp @@ -2,20 +2,20 @@ #include "OI.h" #include "RobotMap.h" #include "Commands/Autonomous/Autonomous.h" -OI* DentRobot::oi=NULL; -Collector* DentRobot::collector=NULL; -Drivetrain* DentRobot::drivetrain=NULL; -Elevator* DentRobot::elevator=NULL; -BinElevator* DentRobot::binElevator=NULL; -CommandGroup* DentRobot::aut=NULL; -Pneumatics* DentRobot::pneumatics=NULL; +OI* DentRobot::oi = NULL; +Collector* DentRobot::collector = NULL; +Drivetrain* DentRobot::drivetrain = NULL; +Elevator* DentRobot::elevator = NULL; +BinElevator* DentRobot::binElevator = NULL; +CommandGroup* DentRobot::aut = NULL; +Pneumatics* DentRobot::pneumatics = NULL; DentRobot::DentRobot(){ - oi=new OI(); - collector=new Collector(); - drivetrain=new Drivetrain(); - elevator=new Elevator(); - binElevator=new BinElevator(); - pneumatics=new Pneumatics(); + oi = new OI(); + collector = new Collector(); + drivetrain = new Drivetrain(); + elevator = new Elevator(); + binElevator = new BinElevator(); + pneumatics = new Pneumatics(); //CameraServer::GetInstance()->SetQuality(25); //CameraServer::GetInstance()->StartAutomaticCapture("cam0"); printf("The robot is on\n"); @@ -55,7 +55,7 @@ void DentRobot::DisabledPeriodic(){ Scheduler::GetInstance()->Run(); } void DentRobot::AutonomousInit(){ - aut=new Autonomous(SmartDashboard::GetNumber("Auto Sequence")); + aut = new Autonomous(SmartDashboard::GetNumber("Auto Sequence")); printf("Enabling Auto Sequence %f\n", SmartDashboard::GetNumber("Auto Sequence")); if(aut != NULL){ aut->Start(); @@ -72,7 +72,7 @@ void DentRobot::TeleopInit(){ } void DentRobot::TeleopPeriodic(){ Scheduler::GetInstance()->Run(); - if(elevator->GetUseEncoder()&&elevator->GetHeight()<=-1.0){ + if(elevator->GetUseEncoder()&&elevator->GetHeight() <= -1.0){ // Raise the elevator if it dips below elevatorTop oi->raise->Start(); } diff --git a/OI.cpp b/OI.cpp index b21de99..a8fcf1d 100644 --- a/OI.cpp +++ b/OI.cpp @@ -12,40 +12,40 @@ #include "Commands/Autonomous/ReleaseTote.h" OI::OI(){ // Joysticks - leftStick=new Joystick(0); - rightStick=new Joystick(1); + leftStick = new Joystick(0); + rightStick = new Joystick(1); // Collector - JoystickButton *left1=new JoystickButton(leftStick, 1); - JoystickButton *left2=new JoystickButton(leftStick, 2); - JoystickButton *left7=new JoystickButton(leftStick, 7); + JoystickButton *left1 = new JoystickButton(leftStick, 1); + JoystickButton *left2 = new JoystickButton(leftStick, 2); + JoystickButton *left7 = new JoystickButton(leftStick, 7); left1->WhileHeld(new RollIn(GetLeftThrottle())); left2->WhileHeld(new RollOut(2.0)); // 0.8 is the multiplier, so they roll at 80% power left7->WhileHeld(new RollVar(0.8)); // Elevator - raise=new Raise(3.5); - lower=new Lower(3.0); - JoystickButton *right4=new JoystickButton(rightStick, 4); - JoystickButton *right6=new JoystickButton(rightStick, 6); + raise = new Raise(3.5); + lower = new Lower(3.0); + JoystickButton *right4 = new JoystickButton(rightStick, 4); + JoystickButton *right6 = new JoystickButton(rightStick, 6); right4->WhenPressed(lower); right4->CancelWhenPressed(raise); right6->WhenPressed(raise); right6->CancelWhenPressed(lower); // BinElevator - JoystickButton *right3=new JoystickButton(rightStick, 3); - JoystickButton *right5=new JoystickButton(rightStick, 5); - //JoystickButton *right7=new JoystickButton(rightStick, 7); - //JoystickButton *right8=new JoystickButton(rightStick, 8); + JoystickButton *right3 = new JoystickButton(rightStick, 3); + JoystickButton *right5 = new JoystickButton(rightStick, 5); + //JoystickButton *right7 = new JoystickButton(rightStick, 7); + //JoystickButton *right8 = new JoystickButton(rightStick, 8); //right7->WhenPressed(new BinOpenArms()); //right8->WhenPressed(new BinCloseArms()); - binRaise=new BinRaise(3.0); - binLower=new BinLower(2.0); + binRaise = new BinRaise(3.0); + binLower = new BinLower(2.0); right3->WhileHeld(binLower); right3->CancelWhenPressed(binRaise); right5->WhileHeld(binRaise); right5->CancelWhenPressed(binLower); // Cancel - JoystickButton *right12=new JoystickButton(rightStick, 12); + JoystickButton *right12 = new JoystickButton(rightStick, 12); right12->CancelWhenPressed(raise); right12->CancelWhenPressed(lower); } diff --git a/OI.h b/OI.h index 13fb16a..b326de4 100644 --- a/OI.h +++ b/OI.h @@ -9,16 +9,17 @@ */ class OI{ private: - Joystick *leftStick, *rightStick; + Joystick *leftStick, //Get(); } void Elevator::SetUseEncoder(bool use){ - useEncoder=use; + useEncoder = use; } bool Elevator::GetUseEncoder(){ return useEncoder; diff --git a/mainpage.dox b/mainpage.dox index 31dc3c7..7bf6bc2 100644 --- a/mainpage.dox +++ b/mainpage.dox @@ -24,8 +24,6 @@ * -# @ref Autonomous * -# @ref CollectTote * -# @ref ReleaseTote -* -# @ref CheckDrive -* -# @ref CheckRobot * * Note: Recycling containers are referred to bins throughout the project */