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