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:
commit
b5460f9b1e
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,8 +1,9 @@
|
|||||||
*.o
|
*.o
|
||||||
Debug
|
|
||||||
bin
|
bin
|
||||||
wpilib
|
wpilib
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
CMakeFiles
|
CMakeFiles
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
vision
|
vision
|
||||||
|
latex
|
||||||
|
html
|
||||||
|
@ -6,15 +6,45 @@
|
|||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Drives the robot without a joystick
|
||||||
|
*
|
||||||
|
* Drives the robot given a timeout and joystick values
|
||||||
|
*/
|
||||||
class AutoDrive: public Command{
|
class AutoDrive: public Command{
|
||||||
private:
|
private:
|
||||||
double x, y;
|
double x, //<! The x value of the simulated joystick value
|
||||||
|
y; //<! The y value of the simulated joystick value
|
||||||
public:
|
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);
|
AutoDrive(double duration, double xtmp = 0.0, double ytmp = -0.75);
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief Drives the robot
|
||||||
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
|
/**
|
||||||
|
* @brief Checks if the command is finished
|
||||||
|
*
|
||||||
|
* @return True only if the timeout was reached
|
||||||
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief Sets the drivetrain to stop
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,7 +25,7 @@ Autonomous::Autonomous(int seq){
|
|||||||
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
||||||
break;
|
break;
|
||||||
case 2:
|
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 BinLower(0.5));
|
||||||
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Bin Distance"), 0, 0.75));
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Bin Distance"), 0, 0.75));
|
||||||
AddSequential(new BinRaise(1.0));
|
AddSequential(new BinRaise(1.0));
|
||||||
@ -49,16 +49,16 @@ Autonomous::Autonomous(int seq){
|
|||||||
printf("Done");
|
printf("Done");
|
||||||
AddSequential(new CollectTote());
|
AddSequential(new CollectTote());
|
||||||
if(SmartDashboard::GetBoolean("Two totes")){
|
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 AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), 0, 0.75));
|
||||||
AddSequential(new CollectTote());
|
AddSequential(new CollectTote());
|
||||||
AddSequential(new Lower());
|
AddSequential(new Lower(3.0));
|
||||||
AddSequential(new Raise());
|
AddSequential(new Raise(3.5));
|
||||||
if(SmartDashboard::GetBoolean("Three totes")){
|
if(SmartDashboard::GetBoolean("Three totes")){
|
||||||
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), 0, 0.75));
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), 0, 0.75));
|
||||||
AddSequential(new CollectTote());
|
AddSequential(new CollectTote());
|
||||||
AddSequential(new Lower());
|
AddSequential(new Lower(3.0));
|
||||||
AddSequential(new Raise());
|
AddSequential(new Raise(3.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
||||||
|
@ -6,8 +6,27 @@
|
|||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "WPILib.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{
|
class Autonomous: public CommandGroup{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructs Autonomous
|
||||||
|
*
|
||||||
|
* @param int The sequence to run
|
||||||
|
*/
|
||||||
Autonomous(int);
|
Autonomous(int);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,8 +6,16 @@
|
|||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Collects one tote
|
||||||
|
*
|
||||||
|
* Rolls collector wheels in and drives forward in parallel
|
||||||
|
*/
|
||||||
class CollectTote: public CommandGroup{
|
class CollectTote: public CommandGroup{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructs CollectTote
|
||||||
|
*/
|
||||||
CollectTote();
|
CollectTote();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "AutoDrive.h"
|
#include "AutoDrive.h"
|
||||||
#include "../Collector/RollOut.h"
|
#include "../Collector/RollOut.h"
|
||||||
ReleaseTote::ReleaseTote(){
|
ReleaseTote::ReleaseTote(){
|
||||||
AddParallel(new RollOut());
|
AddParallel(new RollOut(2.0));
|
||||||
AddParallel(new AutoDrive(0.5, 0, 0.75));
|
AddParallel(new AutoDrive(0.5, 0, 0.75));
|
||||||
}
|
}
|
||||||
// vim: ts=2:sw=2:et
|
// vim: ts=2:sw=2:et
|
||||||
|
@ -6,8 +6,16 @@
|
|||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Releases one tote
|
||||||
|
*
|
||||||
|
* Rolls collector wheels out and drives backwards in parallel
|
||||||
|
*/
|
||||||
class ReleaseTote: public CommandGroup{
|
class ReleaseTote: public CommandGroup{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructs ReleaseTote
|
||||||
|
*/
|
||||||
ReleaseTote();
|
ReleaseTote();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,15 +6,41 @@
|
|||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Turns the robot
|
||||||
|
*
|
||||||
|
* Turns the robot until a timeout is reached
|
||||||
|
*/
|
||||||
class Turn: public Command{
|
class Turn: public Command{
|
||||||
private:
|
private:
|
||||||
int degrees;
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructs Turn
|
||||||
|
*
|
||||||
|
* @param double Timeout in seconds
|
||||||
|
*/
|
||||||
Turn(double);
|
Turn(double);
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief Turns the robot
|
||||||
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
|
/**
|
||||||
|
* @brief Checks if the command is finished
|
||||||
|
*
|
||||||
|
* @return True only if the timeout was reached
|
||||||
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief Sets the drivetrain to stop
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,13 +4,39 @@
|
|||||||
#include "Commands/Command.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Closes BinElevatorArms (NOT USED)
|
||||||
|
*
|
||||||
|
* Sets the solenoid to close the arms of the BinElevator
|
||||||
|
*/
|
||||||
class BinCloseArms: public Command{
|
class BinCloseArms: public Command{
|
||||||
public:
|
public:
|
||||||
BinCloseArms(double timeout = 0.5);
|
BinCloseArms(double timeout = 0.5);
|
||||||
|
/**
|
||||||
|
* @brief Constructs BinCloseArms
|
||||||
|
*/
|
||||||
|
BinCloseArms();
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief Sets the solenoid to close the arms
|
||||||
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
|
/**
|
||||||
|
* @brief Returns true to prevent solenoid damage
|
||||||
|
*
|
||||||
|
* @return True
|
||||||
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief Ends the command
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "BinLower.h"
|
#include "BinLower.h"
|
||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "../../OI.h"
|
#include "../../OI.h"
|
||||||
BinLower::BinLower(double timeout) : Command("BinLower"){
|
BinLower::BinLower(float timeout) : Command("BinLower"){
|
||||||
SetTimeout(timeout);
|
SetTimeout(timeout);
|
||||||
}
|
}
|
||||||
void BinLower::Initialize(){
|
void BinLower::Initialize(){
|
||||||
|
@ -4,14 +4,40 @@
|
|||||||
#include "Commands/Command.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Lowers the bin elevator until a timeout is reached
|
||||||
|
*/
|
||||||
class BinLower: public Command{
|
class BinLower: public Command{
|
||||||
private:
|
private:
|
||||||
|
float timeout; //<! The timeout
|
||||||
public:
|
public:
|
||||||
BinLower(double);
|
/**
|
||||||
|
* @brief Constructs BinLower
|
||||||
|
*
|
||||||
|
* @param float Timeout in seconds
|
||||||
|
*/
|
||||||
|
BinLower(float);
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief Lowers the bin elevator at -1.0 power
|
||||||
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
|
/**
|
||||||
|
* @brief Checks if the command is finished
|
||||||
|
*
|
||||||
|
* @return True only if the timeout was reached
|
||||||
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief Sets the bin elevator to stop
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,12 +7,32 @@
|
|||||||
class BinOpenArms: public Command{
|
class BinOpenArms: public Command{
|
||||||
public:
|
public:
|
||||||
BinOpenArms(double);
|
BinOpenArms(double);
|
||||||
|
/**
|
||||||
|
* @brief Constructs BinOpenArms
|
||||||
|
*/
|
||||||
|
BinOpenArms();
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief Sets the solenoid to open the arms
|
||||||
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
|
/**
|
||||||
|
* @brief Returns true to prevent solenoid damage
|
||||||
|
*
|
||||||
|
* @return True
|
||||||
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief Ends the command
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// vim: ts=2:sw=2:et
|
// vim: ts=2:sw=2:et
|
||||||
|
@ -4,16 +4,42 @@
|
|||||||
#include "Commands/Command.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Raises the bin elevator until a timeout is reached
|
||||||
|
*/
|
||||||
class BinRaise: public Command{
|
class BinRaise: public Command{
|
||||||
private:
|
private:
|
||||||
|
float timeout; //<! The timeout
|
||||||
public:
|
public:
|
||||||
BinRaise(double);
|
BinRaise(double);
|
||||||
|
/**
|
||||||
|
* @brief Constructs BinRaise
|
||||||
|
*
|
||||||
|
* @param float Timeout in seconds
|
||||||
|
*/
|
||||||
|
BinRaise(float);
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief Raises the bin elevator at 1.0 power
|
||||||
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
|
/**
|
||||||
|
* @brief Checks if the command is finished
|
||||||
|
*
|
||||||
|
* @return True only if the timeout was reached
|
||||||
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief Sets the bin elevator to stop
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// vim: ts=2:sw=2:et
|
// vim: ts=2:sw=2:et
|
||||||
|
@ -6,18 +6,42 @@
|
|||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Rolls collector motors in until a timeout is reached
|
||||||
|
*/
|
||||||
class RollIn: public Command{
|
class RollIn: public Command{
|
||||||
private:
|
private:
|
||||||
double rawSpeed;
|
double rawSpeed; //<! Raw speed of the collector
|
||||||
public:
|
public:
|
||||||
RollIn();
|
RollIn();
|
||||||
|
/**
|
||||||
|
* @brief Constructs RollIn
|
||||||
|
*
|
||||||
|
* @param double Timeout in seconds
|
||||||
|
*/
|
||||||
RollIn(double);
|
RollIn(double);
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief Rolls the four collector motors in
|
||||||
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
|
/**
|
||||||
|
* @brief Checks if the command is finished
|
||||||
|
*
|
||||||
|
* @return True only if the timeout was reached
|
||||||
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief Sets the collector to stop
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// vim: ts=2:sw=2:et
|
// vim: ts=2:sw=2:et
|
||||||
|
@ -6,15 +6,38 @@
|
|||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Rolls collector motors out until a timeout is reached
|
||||||
|
*/
|
||||||
class RollOut: public Command{
|
class RollOut: public Command{
|
||||||
public:
|
public:
|
||||||
RollOut(double timeout = 2.0);
|
RollOut(double timeout = 2.0);
|
||||||
|
/**
|
||||||
|
* @brief Constructs RollOut
|
||||||
|
*/
|
||||||
|
RollOut();
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief Rolls the four collector motors out
|
||||||
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
|
/**
|
||||||
|
* @brief Checks if the command is finished
|
||||||
|
*
|
||||||
|
* @return True only if the timeout was reached
|
||||||
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief Sets the collector to stop
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// vim: ts=2:sw=2:et
|
// vim: ts=2:sw=2:et
|
||||||
|
@ -6,13 +6,38 @@
|
|||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Drives the robot with a joystick
|
||||||
|
*
|
||||||
|
* Uses mechanum drive
|
||||||
|
*/
|
||||||
class Drive: public Command{
|
class Drive: public Command{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructs Drive
|
||||||
|
*/
|
||||||
Drive();
|
Drive();
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief Drives the robot with joysticks from OI
|
||||||
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
|
/**
|
||||||
|
* @brief Checks if the command is finished
|
||||||
|
*
|
||||||
|
* @return False
|
||||||
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief Ends the command
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,13 +4,37 @@
|
|||||||
#include "Commands/Command.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Lowers the elevator until a timeout is reached
|
||||||
|
*/
|
||||||
class Lower: public Command{
|
class Lower: public Command{
|
||||||
public:
|
public:
|
||||||
Lower(double timeout=3.0);
|
Lower(double timeout=3.0);
|
||||||
|
/**
|
||||||
|
* @brief Constructs Lower
|
||||||
|
*/
|
||||||
|
Lower();
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief Lowers the elevator at -1.0 power
|
||||||
|
*/
|
||||||
void Execute();
|
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();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief Sets the elevator to stop
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,15 +4,38 @@
|
|||||||
#include "Commands/Command.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Raises the elevator until a timeout is reached
|
||||||
|
*/
|
||||||
class Raise: public Command{
|
class Raise: public Command{
|
||||||
public:
|
public:
|
||||||
Raise(double timeout=3.5);
|
Raise(double timeout=3.5);
|
||||||
|
/**
|
||||||
|
* @brief Constructs Raise
|
||||||
|
*/
|
||||||
|
Raise();
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief Raises the elevator at 1.0 power
|
||||||
|
*/
|
||||||
void Execute();
|
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();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief Sets the elevator to stop
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// vim: ts=2:sw=2:et
|
// vim: ts=2:sw=2:et
|
||||||
|
@ -6,15 +6,40 @@
|
|||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TODO
|
||||||
|
*/
|
||||||
class CheckDrive: public CommandGroup{
|
class CheckDrive: public CommandGroup{
|
||||||
private:
|
private:
|
||||||
int motor;
|
int motor; //<! TODO
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief TODO
|
||||||
|
*
|
||||||
|
* @param int
|
||||||
|
*/
|
||||||
CheckDrive(int);
|
CheckDrive(int);
|
||||||
|
/**
|
||||||
|
* @brief Initializes the class
|
||||||
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
/**
|
||||||
|
* @brief TODO
|
||||||
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
|
/**
|
||||||
|
* @brief Checks if the command is finished
|
||||||
|
*
|
||||||
|
* @return TODO
|
||||||
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
/**
|
||||||
|
* @brief TODO
|
||||||
|
*/
|
||||||
void End();
|
void End();
|
||||||
|
/**
|
||||||
|
* @brief Calls End()
|
||||||
|
*/
|
||||||
void Interrupted();
|
void Interrupted();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,8 +6,14 @@
|
|||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TODO
|
||||||
|
*/
|
||||||
class CheckRobot: public CommandGroup{
|
class CheckRobot: public CommandGroup{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief TODO
|
||||||
|
*/
|
||||||
CheckRobot();
|
CheckRobot();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
53
DentRobot.h
53
DentRobot.h
@ -8,24 +8,77 @@
|
|||||||
#include "Subsystems/Collector.h"
|
#include "Subsystems/Collector.h"
|
||||||
#include "Subsystems/Pneumatics.h"
|
#include "Subsystems/Pneumatics.h"
|
||||||
#include "Commands/Autonomous/Autonomous.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 {
|
class DentRobot: public IterativeRobot {
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* @brief The default driving command
|
||||||
|
*/
|
||||||
Command *driveCommand = NULL;
|
Command *driveCommand = NULL;
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructs DentRobot
|
||||||
|
*/
|
||||||
DentRobot();
|
DentRobot();
|
||||||
|
/**
|
||||||
|
* @brief The 2-joystick OI
|
||||||
|
*/
|
||||||
static OI* oi;
|
static OI* oi;
|
||||||
|
/**
|
||||||
|
* @brief The 4-motor Collctor
|
||||||
|
*/
|
||||||
static Collector* collector;
|
static Collector* collector;
|
||||||
|
/**
|
||||||
|
* @brief The 4-motor mechanum Drivetrain
|
||||||
|
*/
|
||||||
static Drivetrain* drivetrain;
|
static Drivetrain* drivetrain;
|
||||||
|
/**
|
||||||
|
* @brief The main one-motor Elevator for lifting totes
|
||||||
|
*/
|
||||||
static Elevator* elevator;
|
static Elevator* elevator;
|
||||||
|
/**
|
||||||
|
* @brief The back one-motor Elevator for lifting totes or bins
|
||||||
|
*/
|
||||||
static BinElevator* binElevator;
|
static BinElevator* binElevator;
|
||||||
|
/**
|
||||||
|
* @brief The Pneumatics system (UNUSED)
|
||||||
|
*/
|
||||||
static Pneumatics* pneumatics;
|
static Pneumatics* pneumatics;
|
||||||
|
/**
|
||||||
|
* @brief The Autonomous command
|
||||||
|
*/
|
||||||
static CommandGroup* aut;
|
static CommandGroup* aut;
|
||||||
|
/**
|
||||||
|
* @brief Initializes the robot
|
||||||
|
*/
|
||||||
void RobotInit();
|
void RobotInit();
|
||||||
|
/**
|
||||||
|
* @brief Periodically run when disabled
|
||||||
|
*/
|
||||||
void DisabledPeriodic();
|
void DisabledPeriodic();
|
||||||
|
/**
|
||||||
|
* @brief Initializes the autonomous period
|
||||||
|
*/
|
||||||
void AutonomousInit();
|
void AutonomousInit();
|
||||||
|
/**
|
||||||
|
* @brief Periodically run when enabled in autonomous
|
||||||
|
*/
|
||||||
void AutonomousPeriodic();
|
void AutonomousPeriodic();
|
||||||
|
/**
|
||||||
|
* @brief Initializes the teleop period
|
||||||
|
*/
|
||||||
void TeleopInit();
|
void TeleopInit();
|
||||||
|
/**
|
||||||
|
* @brief Periodically run when enabled in autonomous
|
||||||
|
*/
|
||||||
void TeleopPeriodic();
|
void TeleopPeriodic();
|
||||||
|
/**
|
||||||
|
* @brief Periodically run when enabled in test mode
|
||||||
|
*/
|
||||||
void TestPeriodic();
|
void TestPeriodic();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
6
OI.cpp
6
OI.cpp
@ -18,10 +18,10 @@ OI::OI() {
|
|||||||
JoystickButton *left1=new JoystickButton(leftStick, 1);
|
JoystickButton *left1=new JoystickButton(leftStick, 1);
|
||||||
JoystickButton *left2=new JoystickButton(leftStick, 2);
|
JoystickButton *left2=new JoystickButton(leftStick, 2);
|
||||||
left1->WhileHeld(new RollIn(GetLeftThrottle()));
|
left1->WhileHeld(new RollIn(GetLeftThrottle()));
|
||||||
left2->WhileHeld(new RollOut());
|
left2->WhileHeld(new RollOut(2.0));
|
||||||
// Elevator
|
// Elevator
|
||||||
raise=new Raise();
|
raise=new Raise(3.5);
|
||||||
lower=new Lower();
|
lower=new Lower(3.0);
|
||||||
JoystickButton *right4=new JoystickButton(rightStick, 4);
|
JoystickButton *right4=new JoystickButton(rightStick, 4);
|
||||||
JoystickButton *right6=new JoystickButton(rightStick, 6);
|
JoystickButton *right6=new JoystickButton(rightStick, 6);
|
||||||
right4->WhenPressed(lower);
|
right4->WhenPressed(lower);
|
||||||
|
31
OI.h
31
OI.h
@ -4,16 +4,45 @@
|
|||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
#include "Commands/Command.h"
|
#include "Commands/Command.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Controls the robot with joysticks
|
||||||
|
*/
|
||||||
class OI
|
class OI
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
Joystick *leftStick, *rightStick;
|
Joystick *leftStick, *rightStick;
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructs OI
|
||||||
|
*/
|
||||||
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();
|
Joystick* GetRightStick();
|
||||||
|
/**
|
||||||
|
* @brief Returns the left joystick
|
||||||
|
*
|
||||||
|
* @return The left joystick
|
||||||
|
*/
|
||||||
Joystick* GetLeftStick();
|
Joystick* GetLeftStick();
|
||||||
|
/**
|
||||||
|
* @brief Returns the left joystick throttle
|
||||||
|
*
|
||||||
|
* @return The left joystick throttle
|
||||||
|
*/
|
||||||
double GetLeftThrottle();
|
double GetLeftThrottle();
|
||||||
|
/**
|
||||||
|
* @brief Returns the right joystick throttle
|
||||||
|
*
|
||||||
|
* @return The right joystick throttle
|
||||||
|
*/
|
||||||
double GetRightThrottle();
|
double GetRightThrottle();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,16 +2,46 @@
|
|||||||
#define COLLECTOR_H
|
#define COLLECTOR_H
|
||||||
|
|
||||||
#include "WPILib.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
|
class Collector: public Subsystem
|
||||||
{
|
{
|
||||||
private:
|
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;
|
AnalogInput *sonarAnalog;
|
||||||
|
/**
|
||||||
|
* @brief Digital output for sonar (UNUSED)
|
||||||
|
*/
|
||||||
DigitalOutput *sonarDigital;
|
DigitalOutput *sonarDigital;
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructs Collector
|
||||||
|
*/
|
||||||
Collector();
|
Collector();
|
||||||
|
/**
|
||||||
|
* @brief No action
|
||||||
|
*/
|
||||||
void InitDefaultCommand();
|
void InitDefaultCommand();
|
||||||
|
/**
|
||||||
|
* @brief Moves the collectors
|
||||||
|
*
|
||||||
|
* @param double The speed to run the collectors
|
||||||
|
*/
|
||||||
void MoveRollers(double);
|
void MoveRollers(double);
|
||||||
|
/**
|
||||||
|
* @brief Gets the distance of the sonar (UNUSED)
|
||||||
|
*
|
||||||
|
* @return The sonar distance
|
||||||
|
*/
|
||||||
double GetSonarDistance();
|
double GetSonarDistance();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user