mirror of
https://github.com/team2059/Dent
synced 2024-12-18 20:52:29 -05:00
changed names, set claw open by default, changed buttons for claw
This commit is contained in:
parent
393bf7704d
commit
e2a614de87
18
Commands/BinCollector/BinCloseClaw.cpp
Normal file
18
Commands/BinCollector/BinCloseClaw.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "BinCloseClaw.h"
|
||||
#include "../../DentRobot.h"
|
||||
#include "../../OI.h"
|
||||
BinCloseClaw::BinCloseClaw(double timeout): Command("BinCloseClaw") {
|
||||
SetTimeout(timeout);
|
||||
}
|
||||
void BinCloseClaw::Initialize() {}
|
||||
void BinCloseClaw::Execute() {
|
||||
DentRobot::pneumatics->SetClawOpen(false);
|
||||
}
|
||||
bool BinCloseClaw::IsFinished() {
|
||||
return true;
|
||||
}
|
||||
void BinCloseClaw::End() {}
|
||||
void BinCloseClaw::Interrupted() {
|
||||
End();
|
||||
}
|
||||
// vim: ts=2:sw=2:et
|
@ -1,30 +1,26 @@
|
||||
#ifndef OPENARM_H
|
||||
#define OPENARM_H
|
||||
#ifndef BINCLOSECLAW_H
|
||||
#define BINCLOSECLAW_H
|
||||
|
||||
#include "Commands/Command.h"
|
||||
#include "WPILib.h"
|
||||
|
||||
/**
|
||||
* @brief Opens bin retaining arm
|
||||
* @brief Closes BinElevatorArms
|
||||
*/
|
||||
class OpenArm: public Command {
|
||||
class BinCloseClaw: public Command {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs OpenArm
|
||||
* @brief Constructs BinCloseClaw
|
||||
*
|
||||
* @param timeout Timeout in seconds
|
||||
* @param timeout Timeout in seconds (default: 0.5)
|
||||
*/
|
||||
OpenArm(double timeout);
|
||||
/**
|
||||
* @brief Constructs OpenArm
|
||||
*/
|
||||
OpenArm();
|
||||
BinCloseClaw(double timeout = 0.5);
|
||||
/**
|
||||
* @brief Initializes the class
|
||||
*/
|
||||
void Initialize();
|
||||
/**
|
||||
* @brief Sets the solenoid to open the arm
|
||||
* @brief Sets the solenoid to close the claw
|
||||
*/
|
||||
void Execute();
|
||||
/**
|
18
Commands/BinCollector/BinOpenClaw.cpp
Normal file
18
Commands/BinCollector/BinOpenClaw.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "BinOpenClaw.h"
|
||||
#include "../../DentRobot.h"
|
||||
#include "../../OI.h"
|
||||
BinOpenClaw::BinOpenClaw(double timeout): Command("BinOpenClaw") {
|
||||
SetTimeout(timeout);
|
||||
}
|
||||
void BinOpenClaw::Initialize() {}
|
||||
void BinOpenClaw::Execute() {
|
||||
DentRobot::pneumatics->SetClawOpen(true);
|
||||
}
|
||||
bool BinOpenClaw::IsFinished() {
|
||||
return true;
|
||||
}
|
||||
void BinOpenClaw::End() {}
|
||||
void BinOpenClaw::Interrupted() {
|
||||
End();
|
||||
}
|
||||
// vim: ts=2:sw=2:et
|
@ -1,30 +1,26 @@
|
||||
#ifndef CLOSEARM_H
|
||||
#define CLOSEARM_H
|
||||
#ifndef BINOPENCLAW_H
|
||||
#define BINOPENCLAW_H
|
||||
|
||||
#include "Commands/Command.h"
|
||||
#include "WPILib.h"
|
||||
|
||||
/**
|
||||
* @brief Closes bin retaining arm
|
||||
* @brief Closes BinElevatorArms
|
||||
*/
|
||||
class CloseArm: public Command {
|
||||
class BinOpenClaw: public Command {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs CloseArm
|
||||
* @brief Constructs BinOpenClaw
|
||||
*
|
||||
* @param timeout Timeout in seconds
|
||||
* @param timeout Timeout in seconds (default: 0.5)
|
||||
*/
|
||||
CloseArm(double timeout);
|
||||
/**
|
||||
* @brief Constructs CloseArm
|
||||
*/
|
||||
CloseArm();
|
||||
BinOpenClaw(double timeout = 0.5);
|
||||
/**
|
||||
* @brief Initializes the class
|
||||
*/
|
||||
void Initialize();
|
||||
/**
|
||||
* @brief Sets the solenoid to close the arm
|
||||
* @brief Sets the solenoid to open the claw
|
||||
*/
|
||||
void Execute();
|
||||
/**
|
@ -1,18 +0,0 @@
|
||||
#include "CloseArm.h"
|
||||
#include "../../DentRobot.h"
|
||||
#include "../../OI.h"
|
||||
CloseArm::CloseArm(double timeout): Command("CloseArm") {
|
||||
SetTimeout(timeout);
|
||||
}
|
||||
void CloseArm::Initialize() {}
|
||||
void CloseArm::Execute() {
|
||||
DentRobot::pneumatics->SetElevatorArmOpen(false);
|
||||
}
|
||||
bool CloseArm::IsFinished() {
|
||||
return true;
|
||||
}
|
||||
void CloseArm::End() {}
|
||||
void CloseArm::Interrupted() {
|
||||
End();
|
||||
}
|
||||
// vim: ts=2:sw=2:et
|
@ -1,18 +0,0 @@
|
||||
#include "OpenArm.h"
|
||||
#include "../../DentRobot.h"
|
||||
#include "../../OI.h"
|
||||
OpenArm::OpenArm(double timeout): Command("OpenArm") {
|
||||
SetTimeout(timeout);
|
||||
}
|
||||
void OpenArm::Initialize() {}
|
||||
void OpenArm::Execute() {
|
||||
DentRobot::pneumatics->SetElevatorArmOpen(true);
|
||||
}
|
||||
bool OpenArm::IsFinished() {
|
||||
return true;
|
||||
}
|
||||
void OpenArm::End() {}
|
||||
void OpenArm::Interrupted() {
|
||||
End();
|
||||
}
|
||||
// vim: ts=2:sw=2:et
|
@ -50,7 +50,7 @@ void DentRobot::RobotInit() {
|
||||
SmartDashboard::PutNumber("Gyro kP", -0.02);
|
||||
printf("Starting compressor\n");
|
||||
pneumatics->SetCompressorEnabled(true);
|
||||
pneumatics->SetElevatorArmOpen(false);
|
||||
pneumatics->SetClawOpen(true);
|
||||
}
|
||||
void DentRobot::DisabledPeriodic() {
|
||||
Scheduler::GetInstance()->Run();
|
||||
|
12
OI.cpp
12
OI.cpp
@ -1,8 +1,6 @@
|
||||
#include "OI.h"
|
||||
#include "Commands/Elevator/Lower.h"
|
||||
#include "Commands/Elevator/Raise.h"
|
||||
#include "Commands/Elevator/OpenArm.h"
|
||||
#include "Commands/Elevator/CloseArm.h"
|
||||
#include "Commands/Elevator/ElevatorCycle.h"
|
||||
#include "Commands/Collector/RollIn.h"
|
||||
#include "Commands/Collector/RollOut.h"
|
||||
@ -11,6 +9,8 @@
|
||||
#include "Commands/BinElevator/BinRaise.h"
|
||||
#include "Commands/BinCollector/BinCloseArms.h"
|
||||
#include "Commands/BinCollector/BinOpenArms.h"
|
||||
#include "Commands/BinCollector/BinCloseClaw.h"
|
||||
#include "Commands/BinCollector/BinOpenClaw.h"
|
||||
#include "Commands/BinCollector/BinIn.h"
|
||||
#include "Commands/BinCollector/BinOut.h"
|
||||
#include "Commands/Autonomous/CollectTote.h"
|
||||
@ -38,12 +38,12 @@ OI::OI() {
|
||||
left10->WhenPressed(new BinCloseArms(2));
|
||||
|
||||
// Elevator
|
||||
JoystickButton *right1 = new JoystickButton(rightStick, 1);
|
||||
JoystickButton *right2 = new JoystickButton(rightStick, 2);
|
||||
JoystickButton *right3 = new JoystickButton(rightStick, 3);
|
||||
JoystickButton *right4 = new JoystickButton(rightStick, 4);
|
||||
JoystickButton *right5 = new JoystickButton(rightStick, 5);
|
||||
JoystickButton *right6 = new JoystickButton(rightStick, 6);
|
||||
JoystickButton *right11 = new JoystickButton(rightStick, 11);
|
||||
JoystickButton *right12 = new JoystickButton(rightStick, 12);
|
||||
|
||||
//Full speed lift
|
||||
right3->WhileHeld(new Lower(3.5,false,0.5));
|
||||
@ -52,8 +52,8 @@ OI::OI() {
|
||||
right4->WhileHeld(new RollIn(1));
|
||||
right6->WhileHeld(new Raise(3.5,false,-1));
|
||||
|
||||
right11->WhenPressed(new OpenArm(2));
|
||||
right12->WhenPressed(new CloseArm(2));
|
||||
right1->WhenPressed(new BinOpenClaw(2));
|
||||
right2->WhenPressed(new BinCloseClaw(2));
|
||||
}
|
||||
Joystick* OI::GetRightStick() {
|
||||
return rightStick;
|
||||
|
@ -8,16 +8,18 @@ Pneumatics::Pneumatics(): Subsystem("Pneumatics") {
|
||||
solenoid3 = new Solenoid(COMPRESSOR_PCM_CAN, BINELEVATOR_SOLENOID_THREE);
|
||||
solenoid4 = new Solenoid(COMPRESSOR_PCM_CAN, BINELEVATOR_SOLENOID_FOUR);
|
||||
armState = false;
|
||||
clawState = true;
|
||||
}
|
||||
void Pneumatics::InitDefaultCommand() {}
|
||||
void Pneumatics::SetArmsOpen(bool state) {
|
||||
solenoid1->Set(state);
|
||||
solenoid2->Set(!state);
|
||||
armState=state;
|
||||
solenoid1->Set(state);
|
||||
solenoid2->Set(!state);
|
||||
armState=state;
|
||||
}
|
||||
void Pneumatics::SetElevatorArmOpen(bool state){
|
||||
void Pneumatics::SetClawOpen(bool state){
|
||||
solenoid3->Set(state);
|
||||
solenoid4->Set(!state);
|
||||
clawState=state;
|
||||
}
|
||||
void Pneumatics::SetCompressorEnabled(bool state) {
|
||||
compressor->SetClosedLoopControl(state);
|
||||
@ -25,6 +27,9 @@ void Pneumatics::SetCompressorEnabled(bool state) {
|
||||
bool Pneumatics::GetArmsOpen() {
|
||||
return armState;
|
||||
}
|
||||
bool Pneumatics::GetClawOpen() {
|
||||
return clawState;
|
||||
}
|
||||
bool Pneumatics::GetCompressorEnabled() {
|
||||
return compressor->Enabled();
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ class Pneumatics: public Subsystem {
|
||||
*solenoid2, //<! Solenoid 2
|
||||
*solenoid3, //<! Solenoid 3
|
||||
*solenoid4; //<! Solenoid 4
|
||||
bool armState; //<! State of the arm
|
||||
bool armState, //<! State of the arm
|
||||
clawState; //<! State of the claw
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs Pneumatics
|
||||
@ -37,22 +38,23 @@ class Pneumatics: public Subsystem {
|
||||
*/
|
||||
void SetCompressorEnabled(bool state);
|
||||
/**
|
||||
* @brief Sets the state of the elevator arm
|
||||
* @brief Sets the state of the bin claw
|
||||
*
|
||||
* @param state State of the arm
|
||||
*/
|
||||
void SetElevatorArmOpen(bool state);
|
||||
void SetClawOpen(bool state);
|
||||
/**
|
||||
* @brief Gets the state of the arms
|
||||
* @brief Gets the state of the front collectors
|
||||
*
|
||||
* @return State of the arms
|
||||
*/
|
||||
bool GetArmsOpen();
|
||||
/**
|
||||
* @brief Gets the state of the compressor
|
||||
* @brief Gets the state of the bin claw
|
||||
*
|
||||
* @return State of the compressor
|
||||
* @return State of the claw
|
||||
*/
|
||||
bool GetClawOpen();
|
||||
bool GetCompressorEnabled();
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user