2
0
mirror of https://github.com/team2059/Dent synced 2024-12-18 20:52:29 -05:00
dent/Commands/Drive.cpp

34 lines
832 B
C++
Raw Normal View History

2015-01-17 12:55:51 -05:00
#include "Drive.h"
#include <cmath>
2015-01-17 12:55:51 -05:00
#include "../DentRobot.h"
Drive::Drive() : Command("Drive"){
2015-01-18 09:03:41 -05:00
Requires(DentRobot::drivetrain);
2015-01-17 12:55:51 -05:00
}
void Drive::Initialize(){
}
void Drive::Execute(){
2015-01-19 12:08:25 -05:00
double x,y,z;
//Code to lock the x axis when not holding button 1
if (DentRobot::oi->GetLeftStick()->GetRawButton(1)){
x = DentRobot::oi->GetLeftStick()->GetRawAxis(0);
x /= 1.3;
}else{
x = 0;
}
2015-01-19 12:08:25 -05:00
z = DentRobot::oi->GetLeftStick()->GetRawAxis(2);
y = DentRobot::oi->GetLeftStick()->GetRawAxis(1);
if (DentRobot::oi->GetLeftStick()->GetRawAxis(3)<=0.5){
y /= 2;
z /= 2;
}
//X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro
DentRobot::drivetrain->DriveMecanum(x,y,z,0.9,0);
2015-01-17 12:55:51 -05:00
}
bool Drive::IsFinished(){
return false;
}
void Drive::End(){
}
void Drive::Interrupted(){
}