mirror of
https://github.com/team2059/Dent
synced 2024-12-18 20:52:29 -05:00
Fixes #2. Rename 'bins' to 'containers'.
This commit is contained in:
parent
e82bff8e1b
commit
20a1ce968b
@ -3,8 +3,8 @@
|
|||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
#include "../Elevator/Raise.h"
|
#include "../Elevator/Raise.h"
|
||||||
#include "../Elevator/Lower.h"
|
#include "../Elevator/Lower.h"
|
||||||
#include "../BinElevator/BinRaise.h"
|
#include "../ContainerElevator/ContainerRaise.h"
|
||||||
#include "../BinElevator/BinLower.h"
|
#include "../ContainerElevator/ContainerLower.h"
|
||||||
#include "AutoDrive.h"
|
#include "AutoDrive.h"
|
||||||
#include "Turn.h"
|
#include "Turn.h"
|
||||||
#include "../Collector/RollIn.h"
|
#include "../Collector/RollIn.h"
|
||||||
@ -25,21 +25,21 @@ 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 ContainerElevator, collect container, turn, drive to AutoZone (TM)
|
||||||
AddSequential(new BinLower(0.5));
|
AddSequential(new ContainerLower(0.5));
|
||||||
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Bin Distance"), 0, 0.75));
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Container Distance"), 0, 0.75));
|
||||||
AddSequential(new BinRaise(1.0));
|
AddSequential(new ContainerRaise(1.0));
|
||||||
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
||||||
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, -0.75));
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, -0.75));
|
||||||
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// Collect a tote with BinElevator, turn, drive to Auto Zone (TM)
|
// Collect a tote with ContainerElevator, turn, drive to Auto Zone (TM)
|
||||||
Wait(SmartDashboard::GetNumber("Auto Wait Time"));
|
Wait(SmartDashboard::GetNumber("Auto Wait Time"));
|
||||||
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
||||||
AddSequential(new BinRaise(1.2));
|
AddSequential(new ContainerRaise(1.2));
|
||||||
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, -0.75));
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, -0.75));
|
||||||
AddSequential(new BinLower(1.0));
|
AddSequential(new ContainerLower(1.0));
|
||||||
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
@ -66,15 +66,15 @@ Autonomous::Autonomous(int seq){
|
|||||||
AddSequential(new ReleaseTote());
|
AddSequential(new ReleaseTote());
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
// Same as auto 4, but navigate around bins
|
// Same as auto 4, but navigate around containers
|
||||||
//TODO: Implement this
|
//TODO: Implement this
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
// Collect 1 bin and 1 tote
|
// Collect 1 container and 1 tote
|
||||||
//TODO: Implement this
|
//TODO: Implement this
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
// Same as auto 4 with (Three|Two) totes checked, collect bin, drive to Auto Zone (TM), release totes
|
// Same as auto 4 with (Three|Two) totes checked, collect container, drive to Auto Zone (TM), release totes
|
||||||
//TODO: Implement this
|
//TODO: Implement this
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
#include "BinCloseArms.h"
|
|
||||||
#include "../../DentRobot.h"
|
|
||||||
#include "../../OI.h"
|
|
||||||
BinCloseArms::BinCloseArms(double timeout): Command("BinCloseArms"){
|
|
||||||
SetTimeout(timeout);
|
|
||||||
}
|
|
||||||
void BinCloseArms::Initialize(){
|
|
||||||
}
|
|
||||||
void BinCloseArms::Execute(){
|
|
||||||
DentRobot::pneumatics->SetOpen(false);
|
|
||||||
}
|
|
||||||
bool BinCloseArms::IsFinished(){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
void BinCloseArms::End(){
|
|
||||||
}
|
|
||||||
void BinCloseArms::Interrupted(){
|
|
||||||
End();
|
|
||||||
}
|
|
||||||
// vim: ts=2:sw=2:et
|
|
@ -1,26 +0,0 @@
|
|||||||
#include "BinLower.h"
|
|
||||||
#include "../../DentRobot.h"
|
|
||||||
#include "../../OI.h"
|
|
||||||
BinLower::BinLower(float timeout): Command("BinLower"){
|
|
||||||
SetTimeout(timeout);
|
|
||||||
}
|
|
||||||
void BinLower::Initialize(){
|
|
||||||
}
|
|
||||||
void BinLower::Execute(){
|
|
||||||
DentRobot::binElevator->Run(-1.0);
|
|
||||||
}
|
|
||||||
bool BinLower::IsFinished(){
|
|
||||||
if(/*!DentRobot::binElevator->GetElevatorBottom()||*/IsTimedOut()){
|
|
||||||
printf("Robot stoped BinLowering. Sensor based? %d\n", !DentRobot::binElevator->GetElevatorBottom());
|
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void BinLower::End(){
|
|
||||||
DentRobot::binElevator->Run(0.0f);
|
|
||||||
}
|
|
||||||
void BinLower::Interrupted(){
|
|
||||||
End();
|
|
||||||
}
|
|
||||||
// vim: ts=2:sw=2:et
|
|
@ -1,20 +0,0 @@
|
|||||||
#include "BinOpenArms.h"
|
|
||||||
#include "../../DentRobot.h"
|
|
||||||
#include "../../OI.h"
|
|
||||||
BinOpenArms::BinOpenArms(double timeout): Command("BinOpenArms"){
|
|
||||||
SetTimeout(timeout);
|
|
||||||
}
|
|
||||||
void BinOpenArms::Initialize(){
|
|
||||||
}
|
|
||||||
void BinOpenArms::Execute(){
|
|
||||||
DentRobot::pneumatics->SetOpen(true);
|
|
||||||
}
|
|
||||||
bool BinOpenArms::IsFinished(){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
void BinOpenArms::End(){
|
|
||||||
}
|
|
||||||
void BinOpenArms::Interrupted(){
|
|
||||||
End();
|
|
||||||
}
|
|
||||||
// vim: ts=2:sw=2:et
|
|
@ -1,26 +0,0 @@
|
|||||||
#include "BinRaise.h"
|
|
||||||
#include "../../DentRobot.h"
|
|
||||||
#include "../../OI.h"
|
|
||||||
BinRaise::BinRaise(double timeout): Command("BinRaise"){
|
|
||||||
SetTimeout(timeout);
|
|
||||||
}
|
|
||||||
void BinRaise::Initialize(){
|
|
||||||
}
|
|
||||||
void BinRaise::Execute(){
|
|
||||||
DentRobot::binElevator->Run(1.0);
|
|
||||||
}
|
|
||||||
bool BinRaise::IsFinished(){
|
|
||||||
if(/*!DentRobot::binElevator->GetElevatorTop()||*/IsTimedOut()){
|
|
||||||
printf("Robot stoped raising. Sensor based? %d\n", !DentRobot::binElevator->GetElevatorTop());
|
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void BinRaise::End(){
|
|
||||||
DentRobot::binElevator->Run(0.0f);
|
|
||||||
}
|
|
||||||
void BinRaise::Interrupted(){
|
|
||||||
End();
|
|
||||||
}
|
|
||||||
// vim: ts=2:sw=2:et
|
|
20
Commands/ContainerElevator/ContainerCloseArms.cpp
Normal file
20
Commands/ContainerElevator/ContainerCloseArms.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include "ContainerCloseArms.h"
|
||||||
|
#include "../../DentRobot.h"
|
||||||
|
#include "../../OI.h"
|
||||||
|
ContainerCloseArms::ContainerCloseArms(double timeout): Command("ContainerCloseArms"){
|
||||||
|
SetTimeout(timeout);
|
||||||
|
}
|
||||||
|
void ContainerCloseArms::Initialize(){
|
||||||
|
}
|
||||||
|
void ContainerCloseArms::Execute(){
|
||||||
|
DentRobot::pneumatics->SetOpen(false);
|
||||||
|
}
|
||||||
|
bool ContainerCloseArms::IsFinished(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void ContainerCloseArms::End(){
|
||||||
|
}
|
||||||
|
void ContainerCloseArms::Interrupted(){
|
||||||
|
End();
|
||||||
|
}
|
||||||
|
// vim: ts=2:sw=2:et
|
@ -1,22 +1,22 @@
|
|||||||
#ifndef BINCLOSEARMS_H
|
#ifndef CONTAINER_CLOSEARMS_H
|
||||||
#define BINCLOSEARMS_H
|
#define CONTAINER_CLOSEARMS_H
|
||||||
|
|
||||||
#include "Commands/Command.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Closes BinElevatorArms (NOT USED)
|
* @brief Closes ContainerElevatorArms (NOT USED)
|
||||||
*
|
*
|
||||||
* Sets the solenoid to close the arms of the BinElevator
|
* Sets the solenoid to close the arms of the ContainerElevator
|
||||||
*/
|
*/
|
||||||
class BinCloseArms: public Command{
|
class ContainerCloseArms: public Command{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructs BinCloseArms
|
* @brief Constructs ContainerCloseArms
|
||||||
*
|
*
|
||||||
* @param timeout The timeout
|
* @param timeout The timeout
|
||||||
*/
|
*/
|
||||||
BinCloseArms(double timeout = 0.5);
|
ContainerCloseArms(double timeout = 0.5);
|
||||||
/**
|
/**
|
||||||
* @brief Initializes the class
|
* @brief Initializes the class
|
||||||
*/
|
*/
|
26
Commands/ContainerElevator/ContainerLower.cpp
Normal file
26
Commands/ContainerElevator/ContainerLower.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include "ContainerLower.h"
|
||||||
|
#include "../../DentRobot.h"
|
||||||
|
#include "../../OI.h"
|
||||||
|
ContainerLower::ContainerLower(float timeout): Command("ContainerLower"){
|
||||||
|
SetTimeout(timeout);
|
||||||
|
}
|
||||||
|
void ContainerLower::Initialize(){
|
||||||
|
}
|
||||||
|
void ContainerLower::Execute(){
|
||||||
|
DentRobot::containerElevator->Run(-1.0);
|
||||||
|
}
|
||||||
|
bool ContainerLower::IsFinished(){
|
||||||
|
if(/*!DentRobot::containerElevator->GetElevatorBottom()||*/IsTimedOut()){
|
||||||
|
printf("Robot stoped ContainerLowering. Sensor based? %d\n", !DentRobot::containerElevator->GetElevatorBottom());
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void ContainerLower::End(){
|
||||||
|
DentRobot::containerElevator->Run(0.0f);
|
||||||
|
}
|
||||||
|
void ContainerLower::Interrupted(){
|
||||||
|
End();
|
||||||
|
}
|
||||||
|
// vim: ts=2:sw=2:et
|
@ -1,27 +1,27 @@
|
|||||||
#ifndef BINLOWER_H
|
#ifndef CONTAINER_LOWER_H
|
||||||
#define BINLOWER_H
|
#define CONTAINER_LOWER_H
|
||||||
|
|
||||||
#include "Commands/Command.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Lowers the bin elevator until a timeout is reached
|
* @brief Lowers the container elevator until a timeout is reached
|
||||||
*/
|
*/
|
||||||
class BinLower: public Command{
|
class ContainerLower: public Command{
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructs BinLower
|
* @brief Constructs ContainerLower
|
||||||
*
|
*
|
||||||
* @param timeout The timeout
|
* @param timeout The timeout
|
||||||
*/
|
*/
|
||||||
BinLower(float timeout);
|
ContainerLower(float timeout);
|
||||||
/**
|
/**
|
||||||
* @brief Initializes the class
|
* @brief Initializes the class
|
||||||
*/
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
/**
|
/**
|
||||||
* @brief Lowers the bin elevator at -1.0 power
|
* @brief Lowers the container elevator at -1.0 power
|
||||||
*/
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
/**
|
/**
|
||||||
@ -31,7 +31,7 @@ class BinLower: public Command{
|
|||||||
*/
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
/**
|
/**
|
||||||
* @brief Sets the bin elevator to stop
|
* @brief Sets the container elevator to stop
|
||||||
*/
|
*/
|
||||||
void End();
|
void End();
|
||||||
/**
|
/**
|
20
Commands/ContainerElevator/ContainerOpenArms.cpp
Normal file
20
Commands/ContainerElevator/ContainerOpenArms.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include "ContainerOpenArms.h"
|
||||||
|
#include "../../DentRobot.h"
|
||||||
|
#include "../../OI.h"
|
||||||
|
ContainerOpenArms::ContainerOpenArms(double timeout): Command("ContainerOpenArms"){
|
||||||
|
SetTimeout(timeout);
|
||||||
|
}
|
||||||
|
void ContainerOpenArms::Initialize(){
|
||||||
|
}
|
||||||
|
void ContainerOpenArms::Execute(){
|
||||||
|
DentRobot::pneumatics->SetOpen(true);
|
||||||
|
}
|
||||||
|
bool ContainerOpenArms::IsFinished(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void ContainerOpenArms::End(){
|
||||||
|
}
|
||||||
|
void ContainerOpenArms::Interrupted(){
|
||||||
|
End();
|
||||||
|
}
|
||||||
|
// vim: ts=2:sw=2:et
|
@ -1,24 +1,24 @@
|
|||||||
#ifndef BINOPENARMS_H
|
#ifndef CONTAINER_OPENARMS_H
|
||||||
#define BINOPENARMS_H
|
#define CONTAINER_OPENARMS_H
|
||||||
|
|
||||||
#include "Commands/Command.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Opens bin arms (unused)
|
* @brief Opens container arms (unused)
|
||||||
*/
|
*/
|
||||||
class BinOpenArms: public Command{
|
class ContainerOpenArms: public Command{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructs BinOpenArms
|
* @brief Constructs ContainerOpenArms
|
||||||
*
|
*
|
||||||
* @param timeout The timeout
|
* @param timeout The timeout
|
||||||
*/
|
*/
|
||||||
BinOpenArms(double timeout);
|
ContainerOpenArms(double timeout);
|
||||||
/**
|
/**
|
||||||
* @brief Constructs BinOpenArms
|
* @brief Constructs ContainerOpenArms
|
||||||
*/
|
*/
|
||||||
BinOpenArms();
|
ContainerOpenArms();
|
||||||
/**
|
/**
|
||||||
* @brief Initializes the class
|
* @brief Initializes the class
|
||||||
*/
|
*/
|
26
Commands/ContainerElevator/ContainerRaise.cpp
Normal file
26
Commands/ContainerElevator/ContainerRaise.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include "ContainerRaise.h"
|
||||||
|
#include "../../DentRobot.h"
|
||||||
|
#include "../../OI.h"
|
||||||
|
ContainerRaise::ContainerRaise(double timeout): Command("ContainerRaise"){
|
||||||
|
SetTimeout(timeout);
|
||||||
|
}
|
||||||
|
void ContainerRaise::Initialize(){
|
||||||
|
}
|
||||||
|
void ContainerRaise::Execute(){
|
||||||
|
DentRobot::containerElevator->Run(1.0);
|
||||||
|
}
|
||||||
|
bool ContainerRaise::IsFinished(){
|
||||||
|
if(/*!DentRobot::containerElevator->GetElevatorTop()||*/IsTimedOut()){
|
||||||
|
printf("Robot stoped raising. Sensor based? %d\n", !DentRobot::containerElevator->GetElevatorTop());
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void ContainerRaise::End(){
|
||||||
|
DentRobot::containerElevator->Run(0.0f);
|
||||||
|
}
|
||||||
|
void ContainerRaise::Interrupted(){
|
||||||
|
End();
|
||||||
|
}
|
||||||
|
// vim: ts=2:sw=2:et
|
@ -1,27 +1,27 @@
|
|||||||
#ifndef BINRAISE_H
|
#ifndef CONTAINER_RAISE_H
|
||||||
#define BINRAISE_H
|
#define CONTAINER_RAISE_H
|
||||||
|
|
||||||
#include "Commands/Command.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Raises the bin elevator until a timeout is reached
|
* @brief Raises the container elevator until a timeout is reached
|
||||||
*/
|
*/
|
||||||
class BinRaise: public Command{
|
class ContainerRaise: public Command{
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructs BinRaise
|
* @brief Constructs ContainerRaise
|
||||||
*
|
*
|
||||||
* @param timeout Timeout in seconds
|
* @param timeout Timeout in seconds
|
||||||
*/
|
*/
|
||||||
BinRaise(double timeout);
|
ContainerRaise(double timeout);
|
||||||
/**
|
/**
|
||||||
* @brief Initializes the class
|
* @brief Initializes the class
|
||||||
*/
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
/**
|
/**
|
||||||
* @brief Raises the bin elevator at 1.0 power
|
* @brief Raises the container elevator at 1.0 power
|
||||||
*/
|
*/
|
||||||
void Execute();
|
void Execute();
|
||||||
/**
|
/**
|
||||||
@ -31,7 +31,7 @@ class BinRaise: public Command{
|
|||||||
*/
|
*/
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
/**
|
/**
|
||||||
* @brief Sets the bin elevator to stop
|
* @brief Sets the container elevator to stop
|
||||||
*/
|
*/
|
||||||
void End();
|
void End();
|
||||||
/**
|
/**
|
@ -6,7 +6,7 @@ OI* DentRobot::oi=NULL;
|
|||||||
Collector* DentRobot::collector=NULL;
|
Collector* DentRobot::collector=NULL;
|
||||||
Drivetrain* DentRobot::drivetrain=NULL;
|
Drivetrain* DentRobot::drivetrain=NULL;
|
||||||
Elevator* DentRobot::elevator=NULL;
|
Elevator* DentRobot::elevator=NULL;
|
||||||
BinElevator* DentRobot::binElevator=NULL;
|
ContainerElevator* DentRobot::containerElevator=NULL;
|
||||||
CommandGroup* DentRobot::aut=NULL;
|
CommandGroup* DentRobot::aut=NULL;
|
||||||
Pneumatics* DentRobot::pneumatics=NULL;
|
Pneumatics* DentRobot::pneumatics=NULL;
|
||||||
DentRobot::DentRobot(){
|
DentRobot::DentRobot(){
|
||||||
@ -14,7 +14,7 @@ DentRobot::DentRobot(){
|
|||||||
collector=new Collector();
|
collector=new Collector();
|
||||||
drivetrain=new Drivetrain();
|
drivetrain=new Drivetrain();
|
||||||
elevator=new Elevator();
|
elevator=new Elevator();
|
||||||
binElevator=new BinElevator();
|
containerElevator=new ContainerElevator();
|
||||||
pneumatics=new Pneumatics();
|
pneumatics=new Pneumatics();
|
||||||
//CameraServer::GetInstance()->SetQuality(25);
|
//CameraServer::GetInstance()->SetQuality(25);
|
||||||
//CameraServer::GetInstance()->StartAutomaticCapture("cam0");
|
//CameraServer::GetInstance()->StartAutomaticCapture("cam0");
|
||||||
@ -33,11 +33,11 @@ void DentRobot::RobotInit(){
|
|||||||
SmartDashboard::PutNumber("Auto Zone Distance", 2.1);
|
SmartDashboard::PutNumber("Auto Zone Distance", 2.1);
|
||||||
// Distance (in time) to auto tote (used in sequence 3)
|
// Distance (in time) to auto tote (used in sequence 3)
|
||||||
SmartDashboard::PutNumber("Auto Tote Distance", 0.5);
|
SmartDashboard::PutNumber("Auto Tote Distance", 0.5);
|
||||||
SmartDashboard::PutNumber("Auto Bin Distance", 0.25);
|
SmartDashboard::PutNumber("Auto Container Distance", 0.25);
|
||||||
SmartDashboard::PutNumber("TurnAmount", 1.8);
|
SmartDashboard::PutNumber("TurnAmount", 1.8);
|
||||||
// Elevators
|
// Elevators
|
||||||
SmartDashboard::PutBoolean("Bin Elevator Bottom", false);
|
SmartDashboard::PutBoolean("Container Elevator Bottom", false);
|
||||||
SmartDashboard::PutBoolean("Bin Elevator Top", false);
|
SmartDashboard::PutBoolean("Container Elevator Top", false);
|
||||||
SmartDashboard::PutBoolean("Elevator Bottom", false);
|
SmartDashboard::PutBoolean("Elevator Bottom", false);
|
||||||
SmartDashboard::PutBoolean("Elevator Top", false);
|
SmartDashboard::PutBoolean("Elevator Top", false);
|
||||||
//Drive speed
|
//Drive speed
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
#include "OI.h"
|
#include "OI.h"
|
||||||
#include "Subsystems/Elevator.h"
|
#include "Subsystems/Elevator.h"
|
||||||
#include "Subsystems/BinElevator.h"
|
#include "Subsystems/ContainerElevator.h"
|
||||||
#include "Subsystems/Drivetrain.h"
|
#include "Subsystems/Drivetrain.h"
|
||||||
#include "Subsystems/Collector.h"
|
#include "Subsystems/Collector.h"
|
||||||
#include "Subsystems/Pneumatics.h"
|
#include "Subsystems/Pneumatics.h"
|
||||||
@ -41,9 +41,9 @@ class DentRobot: public IterativeRobot{
|
|||||||
*/
|
*/
|
||||||
static Elevator* elevator;
|
static Elevator* elevator;
|
||||||
/**
|
/**
|
||||||
* @brief The back one-motor Elevator for lifting totes or bins
|
* @brief The back one-motor Elevator for lifting totes or containers
|
||||||
*/
|
*/
|
||||||
static BinElevator* binElevator;
|
static ContainerElevator* containerElevator;
|
||||||
/**
|
/**
|
||||||
* @brief The Pneumatics system (unused)
|
* @brief The Pneumatics system (unused)
|
||||||
*/
|
*/
|
||||||
|
26
OI.cpp
26
OI.cpp
@ -3,10 +3,10 @@
|
|||||||
#include "Commands/Elevator/Raise.h"
|
#include "Commands/Elevator/Raise.h"
|
||||||
#include "Commands/Collector/RollIn.h"
|
#include "Commands/Collector/RollIn.h"
|
||||||
#include "Commands/Collector/RollOut.h"
|
#include "Commands/Collector/RollOut.h"
|
||||||
#include "Commands/BinElevator/BinLower.h"
|
#include "Commands/ContainerElevator/ContainerLower.h"
|
||||||
#include "Commands/BinElevator/BinRaise.h"
|
#include "Commands/ContainerElevator/ContainerRaise.h"
|
||||||
#include "Commands/BinElevator/BinCloseArms.h"
|
#include "Commands/ContainerElevator/ContainerCloseArms.h"
|
||||||
#include "Commands/BinElevator/BinOpenArms.h"
|
#include "Commands/ContainerElevator/ContainerOpenArms.h"
|
||||||
#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"
|
||||||
@ -28,19 +28,19 @@ OI::OI(){
|
|||||||
right4->CancelWhenPressed(raise);
|
right4->CancelWhenPressed(raise);
|
||||||
right6->WhenPressed(raise);
|
right6->WhenPressed(raise);
|
||||||
right6->CancelWhenPressed(lower);
|
right6->CancelWhenPressed(lower);
|
||||||
// BinElevator
|
// ContainerElevator
|
||||||
JoystickButton *right3=new JoystickButton(rightStick, 3);
|
JoystickButton *right3=new JoystickButton(rightStick, 3);
|
||||||
JoystickButton *right5=new JoystickButton(rightStick, 5);
|
JoystickButton *right5=new JoystickButton(rightStick, 5);
|
||||||
//JoystickButton *right7=new JoystickButton(rightStick, 7);
|
//JoystickButton *right7=new JoystickButton(rightStick, 7);
|
||||||
//JoystickButton *right8=new JoystickButton(rightStick, 8);
|
//JoystickButton *right8=new JoystickButton(rightStick, 8);
|
||||||
//right7->WhenPressed(new BinOpenArms());
|
//right7->WhenPressed(new ContainerOpenArms());
|
||||||
//right8->WhenPressed(new BinCloseArms());
|
//right8->WhenPressed(new ContainerCloseArms());
|
||||||
binRaise=new BinRaise(3.0);
|
containerRaise=new ContainerRaise(3.0);
|
||||||
binLower=new BinLower(2.0);
|
containerLower=new ContainerLower(2.0);
|
||||||
right3->WhileHeld(binLower);
|
right3->WhileHeld(containerLower);
|
||||||
right3->CancelWhenPressed(binRaise);
|
right3->CancelWhenPressed(containerRaise);
|
||||||
right5->WhileHeld(binRaise);
|
right5->WhileHeld(containerRaise);
|
||||||
right5->CancelWhenPressed(binLower);
|
right5->CancelWhenPressed(containerLower);
|
||||||
// Cancel
|
// Cancel
|
||||||
JoystickButton *right12=new JoystickButton(rightStick, 12);
|
JoystickButton *right12=new JoystickButton(rightStick, 12);
|
||||||
right12->CancelWhenPressed(raise);
|
right12->CancelWhenPressed(raise);
|
||||||
|
4
OI.h
4
OI.h
@ -17,8 +17,8 @@ class OI{
|
|||||||
OI();
|
OI();
|
||||||
Command *raise, //!< Raise command
|
Command *raise, //!< Raise command
|
||||||
*lower, //!< Lower command
|
*lower, //!< Lower command
|
||||||
*binLower, //!< BinLower command
|
*containerLower, //!< ContainerLower command
|
||||||
*binRaise; //!< BinRaise command
|
*containerRaise; //!< ContainerRaise command
|
||||||
/**
|
/**
|
||||||
* @brief Returns the right joystick
|
* @brief Returns the right joystick
|
||||||
*
|
*
|
||||||
|
28
README.md
28
README.md
@ -6,8 +6,8 @@
|
|||||||
+ [Mecanum drivetrain](Subsystems/Drivetrain.cpp)
|
+ [Mecanum drivetrain](Subsystems/Drivetrain.cpp)
|
||||||
+ [Collector](Subsystems/Collector.cpp) to collect totes in main elevator
|
+ [Collector](Subsystems/Collector.cpp) to collect totes in main elevator
|
||||||
+ [Internal elevator](Subsystems/Elevator.cpp) for totes
|
+ [Internal elevator](Subsystems/Elevator.cpp) for totes
|
||||||
+ [External elevator](Subsystems/BinElevator.cpp) for bins or totes
|
+ [External elevator](Subsystems/ContainerElevator.cpp) for containers or totes
|
||||||
+ [Pneumatics](Subsystems/Pneumatics.cpp) for opening/closing bin elevator arms (unused)
|
+ [Pneumatics](Subsystems/Pneumatics.cpp) for opening/closing container elevator arms (unused)
|
||||||
|
|
||||||
#### Sensors
|
#### Sensors
|
||||||
+ [Ultrasonic](Subsystems/Collector.cpp#L9) to check if a tote is in the robot (unused)
|
+ [Ultrasonic](Subsystems/Collector.cpp#L9) to check if a tote is in the robot (unused)
|
||||||
@ -40,12 +40,12 @@
|
|||||||
+ Button 7 - Check robot
|
+ Button 7 - Check robot
|
||||||
|
|
||||||
#### Right Joystick (USB 1)
|
#### Right Joystick (USB 1)
|
||||||
+ Button 3 - Lowers bin elevator
|
+ Button 3 - Lowers container elevator
|
||||||
+ Button 4 - Lowers main elevator
|
+ Button 4 - Lowers main elevator
|
||||||
+ Button 5 - Raises bin elevator
|
+ Button 5 - Raises container elevator
|
||||||
+ Button 6 - Raises main elevator
|
+ Button 6 - Raises main elevator
|
||||||
+ Button 7 - Opens bin arms (unused)
|
+ Button 7 - Opens container arms (unused)
|
||||||
+ Button 8 - Closes bin arms (unused)
|
+ Button 8 - Closes container arms (unused)
|
||||||
+ Button 12 - Cancel raising and lowering for both elevators
|
+ Button 12 - Cancel raising and lowering for both elevators
|
||||||
|
|
||||||
### Dashboard
|
### Dashboard
|
||||||
@ -56,10 +56,10 @@
|
|||||||
+ Three totes - Collect a third tote if using Auto Sequence 4 or 5 (default: false)
|
+ Three totes - Collect a third tote if using Auto Sequence 4 or 5 (default: false)
|
||||||
+ Auto Zone Distance - Amount of time in seconds to drive to the auto zone (default: 2.1)
|
+ Auto Zone Distance - Amount of time in seconds to drive to the auto zone (default: 2.1)
|
||||||
+ Auto Tote Distance - Amount of time in seconds to drive to a second or third tote if using Auto Sequence 4, 5, or 7 (default: 0.5)
|
+ Auto Tote Distance - Amount of time in seconds to drive to a second or third tote if using Auto Sequence 4, 5, or 7 (default: 0.5)
|
||||||
+ Auto Bin Distance - Amount of time in seconds to drive to a bin if using Auto Sequence 6 or 7 (default: 0.5)
|
+ Auto Container Distance - Amount of time in seconds to drive to a container if using Auto Sequence 6 or 7 (default: 0.5)
|
||||||
+ TurnAmount - Amount of time in seconds to turn the robot (default: 1.8)
|
+ TurnAmount - Amount of time in seconds to turn the robot (default: 1.8)
|
||||||
+ Bin Elevator Bottom - Status of the bottom bin elevator sensor (unused)
|
+ Container Elevator Bottom - Status of the bottom container elevator sensor (unused)
|
||||||
+ Bin Elevator Top - Status of the top bin elevator sensor (unused)
|
+ Container Elevator Top - Status of the top container elevator sensor (unused)
|
||||||
+ Elevator Bottom - Status of the bottom elevator sensor
|
+ Elevator Bottom - Status of the bottom elevator sensor
|
||||||
+ Elevator Top - Status of the top elevator sensor
|
+ Elevator Top - Status of the top elevator sensor
|
||||||
+ DriveSpeedReductionThresh - Maximum y value of the joystick when driving
|
+ DriveSpeedReductionThresh - Maximum y value of the joystick when driving
|
||||||
@ -67,9 +67,9 @@
|
|||||||
|
|
||||||
#### Autonomous
|
#### Autonomous
|
||||||
1. Drive to auto zone, turn
|
1. Drive to auto zone, turn
|
||||||
2. Lower BinElevator, collect bin, turn, drive to AutoZone, turn
|
2. Lower ContainerElevator, collect container, turn, drive to AutoZone, turn
|
||||||
3. Raise BinElevator, turn, drive to AutoZone, turn
|
3. Raise ContainerElevator, turn, drive to AutoZone, turn
|
||||||
4. Collect 1, 2, or 3 totes, turn, drive to AutoZone, turn
|
4. Collect 1, 2, or 3 totes, turn, drive to AutoZone, turn
|
||||||
5. Same as auto 4, but navigate around bins (not implemented)
|
5. Same as auto 4, but navigate around containers (not implemented)
|
||||||
6. Collect 1 bin then 1 tote (not implemented)
|
6. Collect 1 container then 1 tote (not implemented)
|
||||||
7. Collect 3 totes, collect bin, drive to AutoZone (not implemented)
|
7. Collect 3 totes, collect container, drive to AutoZone (not implemented)
|
||||||
|
18
RobotMap.h
18
RobotMap.h
@ -13,15 +13,15 @@
|
|||||||
#define ELEVATOR_ENCODERA 4
|
#define ELEVATOR_ENCODERA 4
|
||||||
#define ELEVATOR_ENCODERB 9
|
#define ELEVATOR_ENCODERB 9
|
||||||
|
|
||||||
// BinElevator
|
// ContainerElevator
|
||||||
#define BINELEVATOR_CAN 10
|
#define CONTAINER_ELEVATOR_CAN 10
|
||||||
#define BINELEVATOR_BOTTOM_DIO 6
|
#define CONTAINER_ELEVATOR_BOTTOM_DIO 6
|
||||||
#define BINELEVATOR_COLELCT_BIN_DIO 7
|
#define CONTAINER_ELEVATOR_COLELCT_CONTAINER__DIO 7
|
||||||
#define BINELEVATOR_TOP_DIO 12
|
#define CONTAINER_ELEVATOR_TOP_DIO 12
|
||||||
#define BINELEVATOR_ENCODERA 10
|
#define CONTAINER_ELEVATOR_ENCODERA 10
|
||||||
#define BINELEVATOR_ENCODERB 11
|
#define CONTAINER_ELEVATOR_ENCODERB 11
|
||||||
#define BINELEVATOR_SOLDENOID_ONE 6
|
#define CONTAINER_ELEVATOR_SOLDENOID_ONE 6
|
||||||
#define BINELEVATOR_SOLDENOID_TWO 7
|
#define CONTAINER_ELEVATOR_SOLDENOID_TWO 7
|
||||||
|
|
||||||
// Drivetrain
|
// Drivetrain
|
||||||
#define DRIVE_FRONT_LEFT_CAN 8
|
#define DRIVE_FRONT_LEFT_CAN 8
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
#include "BinElevator.h"
|
|
||||||
#include "../RobotMap.h"
|
|
||||||
BinElevator::BinElevator(){
|
|
||||||
motor=new CANTalon(BINELEVATOR_CAN);
|
|
||||||
elevatorEncoder=new Encoder(BINELEVATOR_ENCODERA, BINELEVATOR_ENCODERB, false);
|
|
||||||
elevatorBottom=new DigitalInput(BINELEVATOR_BOTTOM_DIO);
|
|
||||||
elevatorTop=new DigitalInput(BINELEVATOR_TOP_DIO);
|
|
||||||
}
|
|
||||||
void BinElevator::InitDefaultCommand(){
|
|
||||||
}
|
|
||||||
void BinElevator::Run(double power){
|
|
||||||
motor->Set(power);
|
|
||||||
}
|
|
||||||
void BinElevator::ResetEncoder(){
|
|
||||||
elevatorEncoder->Reset();
|
|
||||||
}
|
|
||||||
double BinElevator::GetHeight(){
|
|
||||||
return elevatorEncoder->Get();
|
|
||||||
}
|
|
||||||
bool BinElevator::GetElevatorBottom(){
|
|
||||||
SmartDashboard::PutBoolean("Bin Elevator Bottom", elevatorBottom->Get());
|
|
||||||
return elevatorBottom->Get();
|
|
||||||
}
|
|
||||||
bool BinElevator::GetElevatorTop(){
|
|
||||||
SmartDashboard::PutBoolean("Bin Elevator Top", elevatorTop->Get());
|
|
||||||
return elevatorTop->Get();
|
|
||||||
}
|
|
||||||
// vim: ts=2:sw=2:et
|
|
28
Subsystems/ContainerElevator.cpp
Normal file
28
Subsystems/ContainerElevator.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include "ContainerElevator.h"
|
||||||
|
#include "../RobotMap.h"
|
||||||
|
ContainerElevator::ContainerElevator(){
|
||||||
|
motor=new CANTalon(CONTAINER_ELEVATOR_CAN);
|
||||||
|
elevatorEncoder=new Encoder(CONTAINER_ELEVATOR_ENCODERA, CONTAINER_ELEVATOR_ENCODERB, false);
|
||||||
|
elevatorBottom=new DigitalInput(CONTAINER_ELEVATOR_BOTTOM_DIO);
|
||||||
|
elevatorTop=new DigitalInput(CONTAINER_ELEVATOR_TOP_DIO);
|
||||||
|
}
|
||||||
|
void ContainerElevator::InitDefaultCommand(){
|
||||||
|
}
|
||||||
|
void ContainerElevator::Run(double power){
|
||||||
|
motor->Set(power);
|
||||||
|
}
|
||||||
|
void ContainerElevator::ResetEncoder(){
|
||||||
|
elevatorEncoder->Reset();
|
||||||
|
}
|
||||||
|
double ContainerElevator::GetHeight(){
|
||||||
|
return elevatorEncoder->Get();
|
||||||
|
}
|
||||||
|
bool ContainerElevator::GetElevatorBottom(){
|
||||||
|
SmartDashboard::PutBoolean("Container Elevator Bottom", elevatorBottom->Get());
|
||||||
|
return elevatorBottom->Get();
|
||||||
|
}
|
||||||
|
bool ContainerElevator::GetElevatorTop(){
|
||||||
|
SmartDashboard::PutBoolean("Container Elevator Top", elevatorTop->Get());
|
||||||
|
return elevatorTop->Get();
|
||||||
|
}
|
||||||
|
// vim: ts=2:sw=2:et
|
@ -1,30 +1,30 @@
|
|||||||
#ifndef BINELEVATOR_H
|
#ifndef CONTAINER_ELEVATOR_H
|
||||||
#define BINELEVATOR_H
|
#define CONTAINER_ELEVATOR_H
|
||||||
|
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
#include "Commands/PIDSubsystem.h"
|
#include "Commands/PIDSubsystem.h"
|
||||||
/**
|
/**
|
||||||
* @brief Controls the bin elevator
|
* @brief Controls the container elevator
|
||||||
*/
|
*/
|
||||||
class BinElevator{
|
class ContainerElevator{
|
||||||
private:
|
private:
|
||||||
CANTalon *motor; //<! The bin elevator motor
|
CANTalon *motor; //<! The container elevator motor
|
||||||
Encoder *elevatorEncoder; //<! The bin elevator encoder (unused)
|
Encoder *elevatorEncoder; //<! The container elevator encoder (unused)
|
||||||
DigitalInput *elevatorBottom, //<! The bottom bin elevator sensor (unused)
|
DigitalInput *elevatorBottom, //<! The bottom container elevator sensor (unused)
|
||||||
*elevatorTop; //<! The top bin elevator sensor (unused)
|
*elevatorTop; //<! The top container elevator sensor (unused)
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructs BinElevator
|
* @brief Constructs ContainerElevator
|
||||||
*/
|
*/
|
||||||
BinElevator();
|
ContainerElevator();
|
||||||
/**
|
/**
|
||||||
* @brief No action
|
* @brief No action
|
||||||
*/
|
*/
|
||||||
void InitDefaultCommand();
|
void InitDefaultCommand();
|
||||||
/**
|
/**
|
||||||
* @brief Runs the bin elevator
|
* @brief Runs the container elevator
|
||||||
*
|
*
|
||||||
* @param power The power to run the bin elevator
|
* @param power The power to run the container elevator
|
||||||
*
|
*
|
||||||
* Ranges from -1.0 to 1.0
|
* Ranges from -1.0 to 1.0
|
||||||
*/
|
*/
|
||||||
@ -34,9 +34,9 @@ class BinElevator{
|
|||||||
*/
|
*/
|
||||||
void ResetEncoder();
|
void ResetEncoder();
|
||||||
/**
|
/**
|
||||||
* @brief Gets the height of the bin elevator
|
* @brief Gets the height of the container elevator
|
||||||
*
|
*
|
||||||
* @return The height of the bin elevator
|
* @return The height of the container elevator
|
||||||
*/
|
*/
|
||||||
double GetHeight();
|
double GetHeight();
|
||||||
/**
|
/**
|
@ -25,7 +25,7 @@ class Elevator{
|
|||||||
/**
|
/**
|
||||||
* @brief Runs the elevator
|
* @brief Runs the elevator
|
||||||
*
|
*
|
||||||
* @param power The power to run the bin elevator (-1.0 to 1.0)
|
* @param power The power to run the container elevator (-1.0 to 1.0)
|
||||||
*/
|
*/
|
||||||
void Run(double power);
|
void Run(double power);
|
||||||
/**
|
/**
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#include "../RobotMap.h"
|
#include "../RobotMap.h"
|
||||||
|
|
||||||
Pneumatics::Pneumatics(): Subsystem("Pneumatics"){
|
Pneumatics::Pneumatics(): Subsystem("Pneumatics"){
|
||||||
solenoid1 = new Solenoid(BINELEVATOR_SOLDENOID_ONE);
|
solenoid1 = new Solenoid(CONTAINER_ELEVATOR_SOLDENOID_ONE);
|
||||||
solenoid2 = new Solenoid(BINELEVATOR_SOLDENOID_TWO);
|
solenoid2 = new Solenoid(CONTAINER_ELEVATOR_SOLDENOID_TWO);
|
||||||
}
|
}
|
||||||
void Pneumatics::InitDefaultCommand(){
|
void Pneumatics::InitDefaultCommand(){
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
/**
|
/**
|
||||||
* @brief Pneumatics on the robot (unused)
|
* @brief Pneumatics on the robot (unused)
|
||||||
*
|
*
|
||||||
* For opening or closing the bin arms
|
* For opening or closing the container arms
|
||||||
*/
|
*/
|
||||||
class Pneumatics: public Subsystem{
|
class Pneumatics: public Subsystem{
|
||||||
private:
|
private:
|
||||||
|
13
mainpage.dox
13
mainpage.dox
@ -1,20 +1,20 @@
|
|||||||
/**
|
/**
|
||||||
* @mainpage Dent
|
* @mainpage Dent
|
||||||
*
|
*
|
||||||
* The Hitchhikers Team 2015 robot, Dent. Features an elevator, bin elevator, and mecanum drive
|
* The Hitchhikers Team 2015 robot, Dent. Features an elevator, container elevator, and mecanum drive
|
||||||
* @section Subsystems
|
* @section Subsystems
|
||||||
* -# @ref Drivetrain
|
* -# @ref Drivetrain
|
||||||
* -# @ref BinElevator
|
* -# @ref ContainerElevator
|
||||||
* -# @ref Elevator
|
* -# @ref Elevator
|
||||||
* -# @ref Collector
|
* -# @ref Collector
|
||||||
* -# @ref Pneumatics (unused)
|
* -# @ref Pneumatics (unused)
|
||||||
* @section Commands
|
* @section Commands
|
||||||
* -# @ref AutoDrive
|
* -# @ref AutoDrive
|
||||||
* -# @ref Turn
|
* -# @ref Turn
|
||||||
* -# @ref BinCloseArms
|
* -# @ref ContainerCloseArms
|
||||||
* -# @ref BinLower
|
* -# @ref ContainerLower
|
||||||
* -# @ref BinOpenArms
|
* -# @ref ContainerOpenArms
|
||||||
* -# @ref BinRaise
|
* -# @ref ContainerRaise
|
||||||
* -# @ref RollIn
|
* -# @ref RollIn
|
||||||
* -# @ref RollOut
|
* -# @ref RollOut
|
||||||
* -# @ref Drive
|
* -# @ref Drive
|
||||||
@ -27,5 +27,4 @@
|
|||||||
* -# @ref CheckDrive
|
* -# @ref CheckDrive
|
||||||
* -# @ref CheckRobot
|
* -# @ref CheckRobot
|
||||||
*
|
*
|
||||||
* Note: Recycling containers are referred to bins throughout the project
|
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user