BarrelPath

Co-Authored-By: Nirvan Bhalala <78400306+nbhalala27@users.noreply.github.com>
This commit is contained in:
Aarav Shah
2021-03-25 19:33:36 -06:00
parent b7465a0029
commit c4132c16be
4 changed files with 23 additions and 25 deletions
+10 -12
View File
@@ -1,14 +1,12 @@
X,Y,Tangent X,Tangent Y,Fixed Theta,Name
1.1943219738452617,-2.286,1.0,0.0,true,
3.396233460027056,-2.2025005475745667,1.6761741931327716,0.12370289248212352,true,
4.466263479997423,-3.0436802164530046,0.15462861560265395,-1.1071408877150035,true,
3.618898666494878,-3.6374541003671967,-1.2555843586935511,0.21029491721960936,true,
3.4951957740127546,-2.530313212652193,1.2184734909489143,0.8226242350061197,true,
6.105326805385555,-2.208685692198673,1.5215455775301168,0.4824412806802809,true,
6.847544160278296,-1.5035792050505696,0.08040688011338037,0.6679956194034656,true,
6.1362525285060885,-0.8788795980158475,-1.261769503317658,0.012370289248212263,true,
5.4868123429749405,-1.7757255685112412,0.42058983443921694,-0.9030311151194992,true,
6.760952135540809,-3.3405671584101007,1.7689513624943638,-0.7174767763963148,true,
8.096943374347742,-3.3900483154029506,0.6061441731624058,0.4824412806802809,true,
8.053647361978998,-2.4375360432906006,-0.7360322102686343,0.5690333054177668,true,
5.598144946208851,-2.190130258326354,-5.115114604135798,0.06803659086516767,true,
3.1673831089351285,-2.3571291631772207,0.24740578496424614,-0.04948115699284905,true,
4.237413128905495,-2.7839041422405457,0.4391452683115382,-0.7793282226373774,true,
3.736416414352895,-3.55086207562971,-1.1442517554596408,0.20410977259550345,true,
3.581787798750241,-2.6354606712619977,0.6679956194034653,0.6679956194034657,true,
6.476435482831926,-1.7571701346389224,0.5752184500418727,0.8844756812471817,true,
6.117697094633767,-0.7737321394060425,-1.168992333956064,-0.012370289248212263,true,
5.802254718804354,-1.95509476261032,0.6432550409070421,-1.2184734909489143,true,
7.020728209753269,-3.3096414352895698,1.6019524576434971,-0.8164390903820133,true,
8.239201700702182,-3.0746059395735355,0.2102949172196098,0.5009967145525991,true,
7.608316949043354,-2.286,-2.245,0.73,true,
File diff suppressed because one or more lines are too long
@@ -27,7 +27,7 @@ public class BarrelStart extends SequentialCommandGroup {
addCommands(
paths[0],
//new Wait(drive, 0.01, 1),
new TankDriveVelocity(drive, 3, 3, 1) //my life be like oooooo aaaaaa ooooo aaaa
new TankDriveVelocity(drive, 5, 5, 1.2) //my life be like oooooo aaaaaa ooooo aaaa
);
}
@@ -15,10 +15,10 @@ public class TankDriveVelocity extends CommandBase {
double m_leftTargetVel;
double m_rightTargetVel;
double m_targetTime;
double m_firstTimeSec;
double m_currentTimeSec;
double m_diffSec;
long m_targetTime;
long m_firstTime;
long m_currentTime;
long m_diffTime;
/**
* Creates a new TankDriveVelocity.
@@ -28,24 +28,24 @@ public class TankDriveVelocity extends CommandBase {
m_drive = subsystem;
m_leftTargetVel = leftTargetVel;
m_rightTargetVel = rightTargetVel;
m_targetTime = targetTime;
m_targetTime = (long) (targetTime * 1000);
addRequirements(subsystem);
}
// Called when the command is initially scheduled.
@Override
public void initialize() {
m_firstTimeSec = (System.currentTimeMillis() / 1000);
m_diffSec = 0;
m_firstTime = System.currentTimeMillis();
m_diffTime = 0;
}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
m_currentTimeSec = (System.currentTimeMillis() / 1000);
m_diffSec = m_currentTimeSec - m_firstTimeSec;
m_currentTime = System.currentTimeMillis();
m_diffTime = m_currentTime - m_firstTime;
if (m_diffSec < m_targetTime) {
if (m_diffTime < m_targetTime) {
m_drive.tankDriveVelocity(m_leftTargetVel, m_rightTargetVel);
}
@@ -59,7 +59,7 @@ public class TankDriveVelocity extends CommandBase {
// Returns true when the command should end.
@Override
public boolean isFinished() {
if (m_diffSec >= m_targetTime) {
if (m_diffTime >= m_targetTime) {
return true;
}
return false;