1 package org
.usfirst
.frc3501
.RiceCatRobot
.commands
;
3 import org
.usfirst
.frc3501
.RiceCatRobot
.Robot
;
4 import org
.usfirst
.frc3501
.RiceCatRobot
.RobotMap
.Direction
;
6 import edu
.wpi
.first
.wpilibj
.Timer
;
7 import edu
.wpi
.first
.wpilibj
.command
.Command
;
8 import edu
.wpi
.first
.wpilibj
.command
.CommandGroup
;
11 * Command to drive an arbitrary sequences of speeds and times. You can use this
12 * to approximate acceleration by driving 0.5 sec at speed 0.1, 0.5 sec at speed
15 public class DriveForTimesSequence
extends CommandGroup
{
20 * an array of speeds and times. Each row represents a time and speed
21 * to drive at. Column 0 represents the time in seconds to drive for
22 * and column 1 represents the speed to drive at. E.g. { {1, 0.5},
23 * {2, 0.75} } will drive at 0.5 for 1 second and 0.75 for 2 seconds
25 public DriveForTimesSequence(double[][] timings
) {
26 for (int i
= 0; i
< timings
.length
; i
++) {
27 double time
= timings
[i
][0];
28 double speed
= timings
[i
][1];
30 addSequential(new DriveForTime(time
, speed
));