Commit | Line | Data |
---|---|---|
f139e313 | 1 | package org.usfirst.frc.team3501.util; |
b2640783 | 2 | |
b2640783 LH |
3 | import java.util.HashMap; |
4 | ||
5 | public class AutonData { | |
6 | ||
7 | HashMap<String, Double> speeds; | |
8 | HashMap<String, Double> times; | |
9 | ||
10 | public AutonData() { | |
11 | speeds = new HashMap<String, Double>(); | |
12 | times = new HashMap<String, Double>(); | |
13 | ||
14 | populate(); | |
15 | } | |
16 | ||
17 | public double getSpeed(String key) { | |
18 | Double ret = speeds.get(key); | |
19 | ||
20 | return (ret != null) ? ret : 0; | |
21 | } | |
22 | ||
23 | public double getTime(String key) { | |
24 | Double ret = times.get(key); | |
25 | ||
26 | return (ret != null) ? ret : 0; | |
27 | } | |
28 | ||
29 | public void update() { | |
30 | speeds.clear(); | |
31 | times.clear(); | |
32 | ||
33 | populate(); | |
34 | } | |
35 | ||
36 | private void populate() { | |
f86bcb43 | 37 | populateDefaults(); |
b2640783 LH |
38 | } |
39 | ||
40 | private void populateDefaults() { | |
41 | speeds.clear(); | |
42 | times.clear(); | |
43 | ||
44 | speeds.put("drive_over_step", 0.7); | |
45 | speeds.put("drive_past_step", 0.5); | |
46 | speeds.put("pickup_container", 0.5); | |
47 | ||
48 | times.put("drive_over_step", 1.2); | |
49 | times.put("drive_past_step", 1.5); | |
50 | times.put("pickup_container", 1.4); | |
51 | } | |
b2640783 | 52 | } |