mirror of
https://github.com/team2059/Dent
synced 2025-01-27 22:21:07 -05:00
Added default command for drivetrain
This commit is contained in:
parent
4c24ac3206
commit
300dfaafc9
@ -1,5 +1,5 @@
|
|||||||
#include "Collect.h"
|
#include "Collect.h"
|
||||||
Collect::Collect(){
|
Collect::Collect() : Command("Collect"){
|
||||||
}
|
}
|
||||||
void Collect::Initialize(){
|
void Collect::Initialize(){
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef COLLECT_H
|
#ifndef COLLECT_H
|
||||||
#define COLLECT_H
|
#define COLLECT_H
|
||||||
|
|
||||||
#include "../CommandBase.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
class Collect: public CommandBase{
|
class Collect: public Command{
|
||||||
public:
|
public:
|
||||||
Collect();
|
Collect();
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
16
src/Commands/Drive.cpp
Normal file
16
src/Commands/Drive.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "Drive.h"
|
||||||
|
#include "../DentRobot.h"
|
||||||
|
Drive::Drive() : Command("Drive"){
|
||||||
|
}
|
||||||
|
void Drive::Initialize(){
|
||||||
|
}
|
||||||
|
void Drive::Execute(){
|
||||||
|
DentRobot::drivetrain->DriveMecanum(DentRobot::oi->GetLeftStick()->GetRawAxis(2), DentRobot::oi->GetLeftStick()->GetRawAxis(1), DentRobot::oi->GetLeftStick()->GetRawAxis(0));
|
||||||
|
}
|
||||||
|
bool Drive::IsFinished(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
void Drive::End(){
|
||||||
|
}
|
||||||
|
void Drive::Interrupted(){
|
||||||
|
}
|
16
src/Commands/Drive.h
Normal file
16
src/Commands/Drive.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef DRIVE_H
|
||||||
|
#define DRIVE_H
|
||||||
|
|
||||||
|
#include "Commands/Command.h"
|
||||||
|
#include "WPILib.h"
|
||||||
|
|
||||||
|
class Drive: public Command{
|
||||||
|
public:
|
||||||
|
Drive();
|
||||||
|
void Initialize();
|
||||||
|
void Execute();
|
||||||
|
bool IsFinished();
|
||||||
|
void End();
|
||||||
|
void Interrupted();
|
||||||
|
};
|
||||||
|
#endif
|
@ -1,11 +1,12 @@
|
|||||||
#include "Eject.h"
|
#include "Eject.h"
|
||||||
#include "../DentRobot.h"
|
#include "../DentRobot.h"
|
||||||
Eject::Eject(){
|
Eject::Eject() : Command("Eject"){
|
||||||
|
Requires(DentRobot::collector);
|
||||||
}
|
}
|
||||||
void Eject::Initialize(){
|
void Eject::Initialize(){
|
||||||
}
|
}
|
||||||
void Eject::Execute(){
|
void Eject::Execute(){
|
||||||
DentRobot::collector->Set(oi->GetLeftStick()->GetThrottle());
|
DentRobot::collector->Set(DentRobot::oi->GetLeftStick()->GetThrottle());
|
||||||
}
|
}
|
||||||
bool Eject::IsFinished(){
|
bool Eject::IsFinished(){
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef EJECT_H
|
#ifndef EJECT_H
|
||||||
#define EJECT_H
|
#define EJECT_H
|
||||||
|
|
||||||
#include "../CommandBase.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
class Eject: public CommandBase{
|
class Eject: public Command{
|
||||||
public:
|
public:
|
||||||
Eject();
|
Eject();
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "Lower.h"
|
#include "Lower.h"
|
||||||
Lower::Lower(){
|
Lower::Lower() : Command("Lower"){
|
||||||
}
|
}
|
||||||
void Lower::Initialize(){
|
void Lower::Initialize(){
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef LOWER_H
|
#ifndef LOWER_H
|
||||||
#define LOWER_H
|
#define LOWER_H
|
||||||
|
|
||||||
#include "../CommandBase.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
class Lower: public CommandBase{
|
class Lower: public Command{
|
||||||
public:
|
public:
|
||||||
Lower();
|
Lower();
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef RAISE_H
|
#ifndef RAISE_H
|
||||||
#define RAISE_H
|
#define RAISE_H
|
||||||
|
|
||||||
#include "../CommandBase.h"
|
#include "Commands/Command.h"
|
||||||
#include "WPILib.h"
|
#include "WPILib.h"
|
||||||
|
|
||||||
class Raise: public CommandBase{
|
class Raise: public Command{
|
||||||
public:
|
public:
|
||||||
Raise();
|
Raise();
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "Drivetrain.h"
|
#include "Drivetrain.h"
|
||||||
#include "../RobotMap.h"
|
#include "../RobotMap.h"
|
||||||
|
#include "../Commands/Drive.h"
|
||||||
|
|
||||||
Drivetrain::Drivetrain() : Subsystem("Drivetrain"){
|
Drivetrain::Drivetrain() : Subsystem("Drivetrain"){
|
||||||
frontLeft=new Talon(0);
|
frontLeft=new Talon(0);
|
||||||
@ -9,6 +10,7 @@ Drivetrain::Drivetrain() : Subsystem("Drivetrain"){
|
|||||||
drive=new RobotDrive(frontLeft, frontRight, backLeft, backRight);
|
drive=new RobotDrive(frontLeft, frontRight, backLeft, backRight);
|
||||||
}
|
}
|
||||||
void Drivetrain::InitDefaultCommand(){
|
void Drivetrain::InitDefaultCommand(){
|
||||||
|
SetDefaultCommand(new Drive());
|
||||||
}
|
}
|
||||||
void Drivetrain::DriveMecanum(float x, float y, float rotation){
|
void Drivetrain::DriveMecanum(float x, float y, float rotation){
|
||||||
drive->MecanumDrive_Cartesian(x, y, rotation);
|
drive->MecanumDrive_Cartesian(x, y, rotation);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user