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

Merged documentation from feature/doxygen

This commit is contained in:
Adam Long 2015-03-08 19:32:45 +00:00
commit b5460f9b1e
25 changed files with 2366 additions and 24 deletions

3
.gitignore vendored
View File

@ -1,8 +1,9 @@
*.o
Debug
bin
wpilib
CMakeCache.txt
CMakeFiles
cmake_install.cmake
vision
latex
html

View File

@ -6,15 +6,45 @@
#include "../../DentRobot.h"
#include "WPILib.h"
/**
* @brief Drives the robot without a joystick
*
* Drives the robot given a timeout and joystick values
*/
class AutoDrive: public Command{
private:
double x, y;
double x, //<! The x value of the simulated joystick value
y; //<! The y value of the simulated joystick value
public:
/**
* @brief Constructs AutoDrive
*
* @param double Timeout in seconds
* @param double Joystick x value (default: 0.0)
* @param double Joystick y value (default: 0.75)
*/
AutoDrive(double duration, double xtmp = 0.0, double ytmp = -0.75);
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief Drives the robot
*/
void Execute();
/**
* @brief Checks if the command is finished
*
* @return True only if the timeout was reached
*/
bool IsFinished();
/**
* @brief Sets the drivetrain to stop
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};
#endif

View File

@ -25,7 +25,7 @@ Autonomous::Autonomous(int seq){
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
break;
case 2:
// Lower BinElevator, collect bin, turn, drive to AutoZone (TM)
// Lower BinElevator, collect bin, turn, drive to AutoZone (TM)
AddSequential(new BinLower(0.5));
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Bin Distance"), 0, 0.75));
AddSequential(new BinRaise(1.0));
@ -49,16 +49,16 @@ Autonomous::Autonomous(int seq){
printf("Done");
AddSequential(new CollectTote());
if(SmartDashboard::GetBoolean("Two totes")){
AddSequential(new Raise());
AddSequential(new Raise(3.5));
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), 0, 0.75));
AddSequential(new CollectTote());
AddSequential(new Lower());
AddSequential(new Raise());
AddSequential(new Lower(3.0));
AddSequential(new Raise(3.5));
if(SmartDashboard::GetBoolean("Three totes")){
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), 0, 0.75));
AddSequential(new CollectTote());
AddSequential(new Lower());
AddSequential(new Raise());
AddSequential(new Lower(3.0));
AddSequential(new Raise(3.5));
}
}
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));

View File

@ -6,8 +6,27 @@
#include "../../DentRobot.h"
#include "WPILib.h"
/**
* @brief The autonomous period of the robot
*
* Contains three sequences selectable from the SmartDashboard
* All sequences will wait for the SmartDashboard value "Auto Wait Time"
*
* Sequence 0: Used for testing only
*
* Sequence 1: Drives forward "Auto Zone Distance" at -0.8 power
*
* Sequence 2: Collects a tote, turns, then drives to the auto zone
*
* Sequence 3: Collects two or three totes then drives to auto zone
*/
class Autonomous: public CommandGroup{
public:
/**
* @brief Constructs Autonomous
*
* @param int The sequence to run
*/
Autonomous(int);
};
#endif

View File

@ -6,8 +6,16 @@
#include "../../DentRobot.h"
#include "WPILib.h"
/**
* @brief Collects one tote
*
* Rolls collector wheels in and drives forward in parallel
*/
class CollectTote: public CommandGroup{
public:
/**
* @brief Constructs CollectTote
*/
CollectTote();
};
#endif

View File

@ -3,7 +3,7 @@
#include "AutoDrive.h"
#include "../Collector/RollOut.h"
ReleaseTote::ReleaseTote(){
AddParallel(new RollOut());
AddParallel(new RollOut(2.0));
AddParallel(new AutoDrive(0.5, 0, 0.75));
}
// vim: ts=2:sw=2:et

View File

@ -6,8 +6,16 @@
#include "../../DentRobot.h"
#include "WPILib.h"
/**
* @brief Releases one tote
*
* Rolls collector wheels out and drives backwards in parallel
*/
class ReleaseTote: public CommandGroup{
public:
/**
* @brief Constructs ReleaseTote
*/
ReleaseTote();
};
#endif

View File

@ -6,15 +6,41 @@
#include "../../DentRobot.h"
#include "WPILib.h"
/**
* @brief Turns the robot
*
* Turns the robot until a timeout is reached
*/
class Turn: public Command{
private:
int degrees;
public:
/**
* @brief Constructs Turn
*
* @param double Timeout in seconds
*/
Turn(double);
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief Turns the robot
*/
void Execute();
/**
* @brief Checks if the command is finished
*
* @return True only if the timeout was reached
*/
bool IsFinished();
/**
* @brief Sets the drivetrain to stop
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};
#endif

View File

@ -4,13 +4,39 @@
#include "Commands/Command.h"
#include "WPILib.h"
/**
* @brief Closes BinElevatorArms (NOT USED)
*
* Sets the solenoid to close the arms of the BinElevator
*/
class BinCloseArms: public Command{
public:
BinCloseArms(double timeout = 0.5);
/**
* @brief Constructs BinCloseArms
*/
BinCloseArms();
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief Sets the solenoid to close the arms
*/
void Execute();
/**
* @brief Returns true to prevent solenoid damage
*
* @return True
*/
bool IsFinished();
/**
* @brief Ends the command
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};

View File

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

View File

@ -4,14 +4,40 @@
#include "Commands/Command.h"
#include "WPILib.h"
/**
* @brief Lowers the bin elevator until a timeout is reached
*/
class BinLower: public Command{
private:
float timeout; //<! The timeout
public:
BinLower(double);
/**
* @brief Constructs BinLower
*
* @param float Timeout in seconds
*/
BinLower(float);
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief Lowers the bin elevator at -1.0 power
*/
void Execute();
/**
* @brief Checks if the command is finished
*
* @return True only if the timeout was reached
*/
bool IsFinished();
/**
* @brief Sets the bin elevator to stop
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};
#endif

View File

@ -7,12 +7,32 @@
class BinOpenArms: public Command{
public:
BinOpenArms(double);
/**
* @brief Constructs BinOpenArms
*/
BinOpenArms();
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief Sets the solenoid to open the arms
*/
void Execute();
/**
* @brief Returns true to prevent solenoid damage
*
* @return True
*/
bool IsFinished();
/**
* @brief Ends the command
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};
#endif
// vim: ts=2:sw=2:et

View File

@ -4,16 +4,42 @@
#include "Commands/Command.h"
#include "WPILib.h"
/**
* @brief Raises the bin elevator until a timeout is reached
*/
class BinRaise: public Command{
private:
float timeout; //<! The timeout
public:
BinRaise(double);
/**
* @brief Constructs BinRaise
*
* @param float Timeout in seconds
*/
BinRaise(float);
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief Raises the bin elevator at 1.0 power
*/
void Execute();
/**
* @brief Checks if the command is finished
*
* @return True only if the timeout was reached
*/
bool IsFinished();
/**
* @brief Sets the bin elevator to stop
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};
#endif
// vim: ts=2:sw=2:et

View File

@ -6,18 +6,42 @@
#include "../../DentRobot.h"
#include "WPILib.h"
/**
* @brief Rolls collector motors in until a timeout is reached
*/
class RollIn: public Command{
private:
double rawSpeed;
double rawSpeed; //<! Raw speed of the collector
public:
RollIn();
/**
* @brief Constructs RollIn
*
* @param double Timeout in seconds
*/
RollIn(double);
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief Rolls the four collector motors in
*/
void Execute();
/**
* @brief Checks if the command is finished
*
* @return True only if the timeout was reached
*/
bool IsFinished();
/**
* @brief Sets the collector to stop
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};
#endif
// vim: ts=2:sw=2:et

View File

@ -6,15 +6,38 @@
#include "../../DentRobot.h"
#include "WPILib.h"
/**
* @brief Rolls collector motors out until a timeout is reached
*/
class RollOut: public Command{
public:
RollOut(double timeout = 2.0);
/**
* @brief Constructs RollOut
*/
RollOut();
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief Rolls the four collector motors out
*/
void Execute();
/**
* @brief Checks if the command is finished
*
* @return True only if the timeout was reached
*/
bool IsFinished();
/**
* @brief Sets the collector to stop
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};
#endif
// vim: ts=2:sw=2:et

View File

@ -6,13 +6,38 @@
#include "../../DentRobot.h"
#include "WPILib.h"
/**
* @brief Drives the robot with a joystick
*
* Uses mechanum drive
*/
class Drive: public Command{
public:
/**
* @brief Constructs Drive
*/
Drive();
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief Drives the robot with joysticks from OI
*/
void Execute();
/**
* @brief Checks if the command is finished
*
* @return False
*/
bool IsFinished();
/**
* @brief Ends the command
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};
#endif

View File

@ -4,13 +4,37 @@
#include "Commands/Command.h"
#include "WPILib.h"
/**
* @brief Lowers the elevator until a timeout is reached
*/
class Lower: public Command{
public:
Lower(double timeout=3.0);
/**
* @brief Constructs Lower
*/
Lower();
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief Lowers the elevator at -1.0 power
*/
void Execute();
/**
* @brief Checks if the command is finished
*
* @return True if the timeout was reached or if the bottom elevator sensor was triggered
*/
bool IsFinished();
/**
* @brief Sets the elevator to stop
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};
#endif

View File

@ -4,15 +4,38 @@
#include "Commands/Command.h"
#include "WPILib.h"
/**
* @brief Raises the elevator until a timeout is reached
*/
class Raise: public Command{
public:
Raise(double timeout=3.5);
/**
* @brief Constructs Raise
*/
Raise();
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief Raises the elevator at 1.0 power
*/
void Execute();
/**
* @brief Checks if the command is finished
*
* @return True if the timeout was reached or if the top elevator was triggered or if the middle elevator is triggered
*/
bool IsFinished();
/**
* @brief Sets the elevator to stop
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};
#endif
// vim: ts=2:sw=2:et

View File

@ -6,15 +6,40 @@
#include "../../DentRobot.h"
#include "WPILib.h"
/**
* @brief TODO
*/
class CheckDrive: public CommandGroup{
private:
int motor;
int motor; //<! TODO
public:
/**
* @brief TODO
*
* @param int
*/
CheckDrive(int);
/**
* @brief Initializes the class
*/
void Initialize();
/**
* @brief TODO
*/
void Execute();
/**
* @brief Checks if the command is finished
*
* @return TODO
*/
bool IsFinished();
/**
* @brief TODO
*/
void End();
/**
* @brief Calls End()
*/
void Interrupted();
};
#endif

View File

@ -6,8 +6,14 @@
#include "../../DentRobot.h"
#include "WPILib.h"
/**
* @brief TODO
*/
class CheckRobot: public CommandGroup{
public:
/**
* @brief TODO
*/
CheckRobot();
};
#endif

View File

@ -8,24 +8,77 @@
#include "Subsystems/Collector.h"
#include "Subsystems/Pneumatics.h"
#include "Commands/Autonomous/Autonomous.h"
/**
* @brief The Hitchhikers 2015 robot, Dent
*
* Features a 4-motor collector, 4-motor mecanum drivetrain, two one-motor elevators
*/
class DentRobot: public IterativeRobot {
private:
/**
* @brief The default driving command
*/
Command *driveCommand = NULL;
public:
/**
* @brief Constructs DentRobot
*/
DentRobot();
/**
* @brief The 2-joystick OI
*/
static OI* oi;
/**
* @brief The 4-motor Collctor
*/
static Collector* collector;
/**
* @brief The 4-motor mechanum Drivetrain
*/
static Drivetrain* drivetrain;
/**
* @brief The main one-motor Elevator for lifting totes
*/
static Elevator* elevator;
/**
* @brief The back one-motor Elevator for lifting totes or bins
*/
static BinElevator* binElevator;
/**
* @brief The Pneumatics system (UNUSED)
*/
static Pneumatics* pneumatics;
/**
* @brief The Autonomous command
*/
static CommandGroup* aut;
/**
* @brief Initializes the robot
*/
void RobotInit();
/**
* @brief Periodically run when disabled
*/
void DisabledPeriodic();
/**
* @brief Initializes the autonomous period
*/
void AutonomousInit();
/**
* @brief Periodically run when enabled in autonomous
*/
void AutonomousPeriodic();
/**
* @brief Initializes the teleop period
*/
void TeleopInit();
/**
* @brief Periodically run when enabled in autonomous
*/
void TeleopPeriodic();
/**
* @brief Periodically run when enabled in test mode
*/
void TestPeriodic();
};
#endif

1890
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

6
OI.cpp
View File

@ -18,10 +18,10 @@ OI::OI() {
JoystickButton *left1=new JoystickButton(leftStick, 1);
JoystickButton *left2=new JoystickButton(leftStick, 2);
left1->WhileHeld(new RollIn(GetLeftThrottle()));
left2->WhileHeld(new RollOut());
left2->WhileHeld(new RollOut(2.0));
// Elevator
raise=new Raise();
lower=new Lower();
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);

31
OI.h
View File

@ -4,16 +4,45 @@
#include "WPILib.h"
#include "Commands/Command.h"
/**
* @brief Controls the robot with joysticks
*/
class OI
{
private:
Joystick *leftStick, *rightStick;
public:
/**
* @brief Constructs OI
*/
OI();
Command *raise, *lower, *binLower, *binRaise;
Command *raise, //!< Raise command
*lower, //!< Lower command
*binLower, //!< BinLower command
*binRaise; //!< BinRaise command
/**
* @brief Returns the right joystick
*
* @return The right joystick
*/
Joystick* GetRightStick();
/**
* @brief Returns the left joystick
*
* @return The left joystick
*/
Joystick* GetLeftStick();
/**
* @brief Returns the left joystick throttle
*
* @return The left joystick throttle
*/
double GetLeftThrottle();
/**
* @brief Returns the right joystick throttle
*
* @return The right joystick throttle
*/
double GetRightThrottle();
};
#endif

View File

@ -2,16 +2,46 @@
#define COLLECTOR_H
#include "WPILib.h"
/**
* @brief Collects totes
*
* Uses four motors, two on the sides, one on the bottom, and one on the ramp to collect and eject totes
*/
class Collector: public Subsystem
{
private:
CANTalon *collectorMotorLeft, *collectorMotorBottom, *collectorMotorRamp, *collectorMotorRight;
CANTalon *collectorMotorLeft, //<! Left collector motor
*collectorMotorBottom, //<! Bottom collctor motor
*collectorMotorRamp, //<! Ramp collctor motor
*collectorMotorRight; //<! Right collector motor
/**
* @brief Analog input for sonar (UNUSED)
*/
AnalogInput *sonarAnalog;
/**
* @brief Digital output for sonar (UNUSED)
*/
DigitalOutput *sonarDigital;
public:
/**
* @brief Constructs Collector
*/
Collector();
/**
* @brief No action
*/
void InitDefaultCommand();
/**
* @brief Moves the collectors
*
* @param double The speed to run the collectors
*/
void MoveRollers(double);
/**
* @brief Gets the distance of the sonar (UNUSED)
*
* @return The sonar distance
*/
double GetSonarDistance();
};
#endif