@@ -22,17 +22,18 @@ public static void main(String[] args) throws IOException {
2222 final double BACK_FROM_PEG = -5 ;
2323 //DO NOT TOUCH THE ONES BELOW
2424 final double CARRIAGE_LEN = 3.63 ;
25- final double BLUE_WALL_TO_CENTER_PEG = 113.75 ;
26- final double BLUE_WALL_TO_SIDE_PEG = 130.75 ;
27- final double BLUE_BACK_CORNER_TO_SIDE_PEG = 91. ;
28- final double BLUE_HALF_KEY_LENGTH = 150.5 /2. ;
29- final double BLUE_KEY_CORNER_TO_SIDE_PEG = 15. ;
30- final double RED_WALL_TO_CENTER_PEG = 114. ;
31- final double RED_WALL_TO_SIDE_PEG = 130. ;
32- final double RED_BACK_CORNER_TO_SIDE_PEG = 93.5 ;
33- final double RED_HALF_KEY_LENGTH = 152.5 /2. ;
34- final double RED_KEY_CORNER_TO_SIDE_PEG = 18.75 ;
35- final double AIRSHIP_PARALLEL_OFFSET = 6. ;
25+ final double BLUE_WALL_TO_CENTER_PEG = 114. ;
26+ final double BLUE_WALL_TO_SIDE_PEG = 130.5 ;
27+ final double BLUE_BACK_CORNER_TO_SIDE_PEG = 89. ;
28+ final double BLUE_HALF_KEY_LENGTH = 152. /2. ;
29+ final double BLUE_KEY_CORNER_TO_SIDE_PEG = 16. ;
30+ final double RED_WALL_TO_CENTER_PEG = 113.5 ;
31+ final double RED_WALL_TO_SIDE_PEG = 131. ;
32+ final double RED_BACK_CORNER_TO_SIDE_PEG = 97. ;
33+ final double RED_HALF_KEY_LENGTH = 152. /2. ;
34+ final double RED_KEY_CORNER_TO_SIDE_PEG = 21. ;
35+ final double AIRSHIP_PARALLEL_OFFSET_BLUE = 1. ;
36+ final double AIRSHIP_PARALLEL_OFFSET_RED = 2. ;
3637
3738 final double PEG_BASE_TO_CENTER = CENTER_TO_FRONT + CARRIAGE_LEN + BACK_FROM_PEG ;
3839
@@ -43,14 +44,14 @@ public static void main(String[] args) throws IOException {
4344
4445 Waypoint [] blueLeft = new Waypoint []{
4546 new Waypoint (0 , 0 , 0 ),
46- new Waypoint ((BLUE_WALL_TO_SIDE_PEG -CENTER_TO_BACK - 0.5 *PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET *Math .cos (5. *Math .PI /6. ))/12.
47- ,-(BLUE_BACK_CORNER_TO_SIDE_PEG - CENTER_TO_SIDE - (Math .sqrt (3. )/2. )*PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET *Math .sin (5. *Math .PI /6. ))/12. ,-Math .PI /3. )
47+ new Waypoint ((BLUE_WALL_TO_SIDE_PEG -CENTER_TO_BACK - 0.5 *PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET_BLUE *Math .cos (5. *Math .PI /6. ))/12.
48+ ,-(BLUE_BACK_CORNER_TO_SIDE_PEG - CENTER_TO_SIDE - (Math .sqrt (3. )/2. )*PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET_BLUE *Math .sin (5. *Math .PI /6. ))/12. ,-Math .PI /3. )
4849 };
4950
5051 Waypoint [] blueRight = new Waypoint []{
5152 new Waypoint (0 , 0 , 0 ),
52- new Waypoint ((BLUE_WALL_TO_SIDE_PEG -CENTER_TO_BACK - 0.5 *PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET *Math .cos (5. *Math .PI /6. ))/12.
53- ,(BLUE_BACK_CORNER_TO_SIDE_PEG - CENTER_TO_SIDE - (Math .sqrt (3. )/2. )*PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET *Math .sin (5. *Math .PI /6. ))/12. ,Math .PI /3. )
53+ new Waypoint ((BLUE_WALL_TO_SIDE_PEG -CENTER_TO_BACK - 0.5 *PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET_BLUE *Math .cos (5. *Math .PI /6. ))/12.
54+ ,(BLUE_BACK_CORNER_TO_SIDE_PEG - CENTER_TO_SIDE - (Math .sqrt (3. )/2. )*PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET_BLUE *Math .sin (5. *Math .PI /6. ))/12. ,Math .PI /3. )
5455 };
5556
5657 Waypoint [] blueCenter = new Waypoint []{
@@ -60,14 +61,14 @@ public static void main(String[] args) throws IOException {
6061
6162 Waypoint [] redLeft = new Waypoint []{
6263 new Waypoint (0 , 0 , 0 ),
63- new Waypoint ((RED_WALL_TO_SIDE_PEG -CENTER_TO_BACK - 0.5 *PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET *Math .cos (5. *Math .PI /6. ))/12.
64- ,-(RED_BACK_CORNER_TO_SIDE_PEG - CENTER_TO_SIDE - (Math .sqrt (3. )/2. )*PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET *Math .sin (5. *Math .PI /6. ))/12. ,-Math .PI /3. )
64+ new Waypoint ((RED_WALL_TO_SIDE_PEG -CENTER_TO_BACK - 0.5 *PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET_RED *Math .cos (5. *Math .PI /6. ))/12.
65+ ,-(RED_BACK_CORNER_TO_SIDE_PEG - CENTER_TO_SIDE - (Math .sqrt (3. )/2. )*PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET_RED *Math .sin (5. *Math .PI /6. ))/12. ,-Math .PI /3. )
6566 };
6667
6768 Waypoint [] redRight = new Waypoint []{
6869 new Waypoint (0 , 0 , 0 ),
69- new Waypoint ((RED_WALL_TO_SIDE_PEG -CENTER_TO_BACK - 0.5 *PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET *Math .cos (5. *Math .PI /6. ))/12.
70- ,(RED_BACK_CORNER_TO_SIDE_PEG - CENTER_TO_SIDE - (Math .sqrt (3. )/2. )*PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET *Math .sin (5. *Math .PI /6. ))/12. ,Math .PI /3. )
70+ new Waypoint ((RED_WALL_TO_SIDE_PEG -CENTER_TO_BACK - 0.5 *PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET_RED *Math .cos (5. *Math .PI /6. ))/12.
71+ ,(RED_BACK_CORNER_TO_SIDE_PEG - CENTER_TO_SIDE - (Math .sqrt (3. )/2. )*PEG_BASE_TO_CENTER + AIRSHIP_PARALLEL_OFFSET_RED *Math .sin (5. *Math .PI /6. ))/12. ,Math .PI /3. )
7172 };
7273
7374 Waypoint [] redCenter = new Waypoint []{
@@ -105,24 +106,24 @@ public static void main(String[] args) throws IOException {
105106
106107 Waypoint [] blueLoadingToLoading = new Waypoint []{
107108 new Waypoint (0 , 0 , 0 ),
108- new Waypoint (27 , -5 , 0 )
109+ new Waypoint (22 , -5 , 0 )
109110 };
110111
111112 Waypoint [] blueBoilerToLoading = new Waypoint []{
112113 new Waypoint (0 , 0 , 0 ),
113114 new Waypoint (5 , 0 , 0 ),
114- new Waypoint (27 , -15 , 0 )
115+ new Waypoint (22 , -15 , 0 )
115116 };
116117
117118 Waypoint [] redLoadingToLoading = new Waypoint []{
118119 new Waypoint (0 , 0 , 0 ),
119- new Waypoint (27 , 5 , 0 )
120+ new Waypoint (22 , 5 , 0 )
120121 };
121122
122123 Waypoint [] redBoilerToLoading = new Waypoint []{
123124 new Waypoint (0 , 0 , 0 ),
124125 new Waypoint (5 , 0 , 0 ),
125- new Waypoint (27 , 15 , 0 )
126+ new Waypoint (22 , 15 , 0 )
126127 };
127128
128129 Map <String , Waypoint []> profiles = new HashMap <>();
@@ -136,25 +137,28 @@ public static void main(String[] args) throws IOException {
136137 profiles .put ("BlueShoot" , bluePegToKey );
137138 profiles .put ("RedBackup" , backupRed );
138139 profiles .put ("BlueBackup" , backupBlue );
140+ profiles .put ("forward100In" , points );
141+ profiles .put ("BlueBackup" , backupBlue );
139142 profiles .put ("BlueLoadingToLoading" , blueLoadingToLoading );
140143 profiles .put ("BlueBoilerToLoading" , blueBoilerToLoading );
141144 profiles .put ("RedLoadingToLoading" , redLoadingToLoading );
142145 profiles .put ("RedBoilerToLoading" , redBoilerToLoading );
146+ // profiles.put("forward100In", points);
143147
144148 final String ROBOT_NAME = "calcifer" ;
145149
146150 //Calculated by driving each wheel n inches in opposite directions, then taking the angle moved, θ, and finding
147151 // the circumference of a circle moved by the robot via C = 360 * n / θ
148152 //You then find the diameter via C / π.
149- double balbasaurWheelbase = 33.3 / 12. ;
153+ double balbasaurWheelbase = 30. / 12. ;
150154 //200 in: 29.96
151155 //50 in: 34.2
152156
153157 //433.415
154158 double calciferWheelbase = 26. /12. ;
155159
156160 Trajectory .Config config = new Trajectory .Config (Trajectory .FitMethod .HERMITE_CUBIC , Trajectory .Config .SAMPLES_HIGH ,
157- 0.05 , 5. , 3 , 6 ); //Units are seconds, feet/second, feet/(second^2), and feet/(second^3)
161+ 0.05 , 5. , 4.5 , 9. ); //Units are seconds, feet/second, feet/(second^2), and feet/(second^3)
158162
159163 for (String profile : profiles .keySet ()) {
160164 Trajectory trajectory = Pathfinder .generate (profiles .get (profile ), config );
@@ -168,14 +172,14 @@ public static void main(String[] args) throws IOException {
168172 lfw .write (tm .getLeftTrajectory ().length () + "\n " );
169173 for (int i = 0 ; i < tm .getLeftTrajectory ().length (); i ++) {
170174 lfw .write (tm .getLeftTrajectory ().get (i ).position + ",\t " + tm .getLeftTrajectory ().get (i ).velocity + ",\t "
171- + tm .getLeftTrajectory ().get (i ).dt + "," );
175+ + tm .getLeftTrajectory ().get (i ).acceleration + ",\t " + tm . getLeftTrajectory (). get ( i ). dt );
172176 lfw .write ("\n " );
173177 }
174178
175179 rfw .write (tm .getRightTrajectory ().length () + "\n " );
176180 for (int i = 0 ; i < tm .getRightTrajectory ().length (); i ++) {
177- rfw .write (tm .getRightTrajectory ().get (i ).position + ",\t " + tm .getRightTrajectory ().get (i ).velocity + "," +
178- "\t " + tm .getRightTrajectory ().get (i ).dt + "," );
181+ rfw .write (tm .getRightTrajectory ().get (i ).position + ",\t " + tm .getRightTrajectory ().get (i ).velocity +
182+ ", \t " + tm .getLeftTrajectory ().get (i ).acceleration + ",\t " + tm . getRightTrajectory (). get ( i ). dt );
179183 rfw .write ("\n " );
180184 }
181185
0 commit comments