mirror of
https://github.com/team2059/Dent
synced 2024-12-18 20:52:29 -05:00
potential auto fixes maybe idk rlly
This commit is contained in:
parent
d2c4205bbc
commit
5d1b61a109
@ -1,16 +1,17 @@
|
|||||||
#include "AutoDrive.h"
|
#include "AutoDrive.h"
|
||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
// Drive for a short while then stop. Just for testing
|
// Drive for a short while then stop. Just for testing
|
||||||
AutoDrive::AutoDrive(double duration, double p=-0.75) : Command("AutoDrive"){
|
AutoDrive::AutoDrive(double duration, double xtmp=-0.75, double ytmp=0) : Command("AutoDrive"){
|
||||||
Requires(DentRobot::drivetrain);
|
Requires(DentRobot::drivetrain);
|
||||||
SetTimeout(duration);
|
SetTimeout(duration);
|
||||||
power=p;
|
speed=xtmp;
|
||||||
|
strafe=ytmp;
|
||||||
}
|
}
|
||||||
void AutoDrive::Initialize(){
|
void AutoDrive::Initialize(){
|
||||||
}
|
}
|
||||||
void AutoDrive::Execute(){
|
void AutoDrive::Execute(){
|
||||||
//X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro
|
//X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro
|
||||||
DentRobot::drivetrain->DriveMecanum(0.0,power,0.0,0.9,0.0);
|
DentRobot::drivetrain->DriveMecanum(strafe,speed,0.0,0.9,0.0);
|
||||||
}
|
}
|
||||||
bool AutoDrive::IsFinished(){
|
bool AutoDrive::IsFinished(){
|
||||||
return IsTimedOut();
|
return IsTimedOut();
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
class AutoDrive: public Command{
|
class AutoDrive: public Command{
|
||||||
private:
|
private:
|
||||||
double power;
|
double speed, strafe;
|
||||||
public:
|
public:
|
||||||
AutoDrive(double);
|
AutoDrive(double);
|
||||||
AutoDrive(double, double);
|
AutoDrive(double, double,double);
|
||||||
void Initialize();
|
void Initialize();
|
||||||
void Execute();
|
void Execute();
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
@ -13,13 +13,12 @@ Autonomous::Autonomous(int seq){
|
|||||||
switch(seq){
|
switch(seq){
|
||||||
case 0:
|
case 0:
|
||||||
// Just for testing
|
// Just for testing
|
||||||
AddSequential(new CollectTote());
|
AddSequential(new AutoDrive(.5,0,.25));
|
||||||
AddSequential(new Turn(90));
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// Wait a desigated value, drive to Auto Zone (TM)
|
// Wait a desigated value, drive to Auto Zone (TM)
|
||||||
Wait(SmartDashboard::GetNumber("Auto Wait Time"));
|
Wait(SmartDashboard::GetNumber("Auto Wait Time"));
|
||||||
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), -0.75));
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), -0.75,0));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// Get one tote and go to Auto Zone (TM)
|
// Get one tote and go to Auto Zone (TM)
|
||||||
@ -32,22 +31,22 @@ Autonomous::Autonomous(int seq){
|
|||||||
printf("Waiting: %f\n",SmartDashboard::GetNumber("Auto Wait Time"));
|
printf("Waiting: %f\n",SmartDashboard::GetNumber("Auto Wait Time"));
|
||||||
Wait(SmartDashboard::GetNumber("Auto Wait Time"));
|
Wait(SmartDashboard::GetNumber("Auto Wait Time"));
|
||||||
printf("Done");
|
printf("Done");
|
||||||
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), -0.75));
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), -0.75,0));
|
||||||
AddSequential(new CollectTote());
|
AddSequential(new CollectTote());
|
||||||
AddSequential(new Raise());
|
AddSequential(new Raise());
|
||||||
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), -0.75));
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), -0.75,0));
|
||||||
AddSequential(new CollectTote());
|
AddSequential(new CollectTote());
|
||||||
AddSequential(new Lower());
|
AddSequential(new Lower());
|
||||||
AddSequential(new Raise());
|
AddSequential(new Raise());
|
||||||
printf("Three totes?: %d\n",SmartDashboard::GetBoolean("Three totes"));
|
printf("Three totes?: %d\n",SmartDashboard::GetBoolean("Three totes"));
|
||||||
if(SmartDashboard::GetBoolean("Three totes")){
|
if(SmartDashboard::GetBoolean("Three totes")){
|
||||||
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), -0.75));
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), -0.75,0));
|
||||||
AddSequential(new CollectTote());
|
AddSequential(new CollectTote());
|
||||||
AddSequential(new Lower());
|
AddSequential(new Lower());
|
||||||
AddSequential(new Raise());
|
AddSequential(new Raise());
|
||||||
}
|
}
|
||||||
AddSequential(new Turn(90));
|
AddSequential(new Turn(90));
|
||||||
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), -0.75));
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), -0.75,0));
|
||||||
AddSequential(new ReleaseTote());
|
AddSequential(new ReleaseTote());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "AutoDrive.h"
|
#include "AutoDrive.h"
|
||||||
#include "../Collector/RollIn.h"
|
#include "../Collector/RollIn.h"
|
||||||
CollectTote::CollectTote(){
|
CollectTote::CollectTote(){
|
||||||
AddParallel(new AutoDrive(1.0, -0.75));
|
AddParallel(new AutoDrive(1.0, -0.75,0));
|
||||||
AddSequential(new RollIn(1.0));
|
AddSequential(new RollIn(1.0));
|
||||||
}
|
}
|
||||||
// vim: ts=2:sw=2:et
|
// vim: ts=2:sw=2:et
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
#include "../Collector/RollOut.h"
|
#include "../Collector/RollOut.h"
|
||||||
ReleaseTote::ReleaseTote(){
|
ReleaseTote::ReleaseTote(){
|
||||||
AddParallel(new RollOut());
|
AddParallel(new RollOut());
|
||||||
AddParallel(new AutoDrive(0.5, 0.75));
|
AddParallel(new AutoDrive(0.5, 0.75,0));
|
||||||
}
|
}
|
||||||
// vim: ts=2:sw=2:et
|
// vim: ts=2:sw=2:et
|
||||||
|
Loading…
Reference in New Issue
Block a user