@@ -440,7 +440,49 @@ uploadDebugBtn.onchange = function() {
440
440
data = reader . result ;
441
441
// split the data into lines
442
442
const lines = data . split ( '\n' ) ;
443
- // get path points
443
+
444
+ // loop to get path points
445
+ let i = 0 ;
446
+ while ( lines [ i ] != 'debug' ) {
447
+ i ++ ;
448
+ const line = lines [ i ] . split ( ', ' ) ;
449
+ const x = parseFloat ( line [ 0 ] ) ;
450
+ const y = parseFloat ( line [ 1 ] ) ;
451
+ const velocity = parseFloat ( line [ 2 ] ) ;
452
+ const p = new Point ( x , y ) ;
453
+ p . velocity = velocity ;
454
+ debugPath . push ( p ) ;
455
+ }
456
+
457
+
458
+ /*
459
+ * Debug Data Format
460
+ * timestamp, rbtX, rbtY, rbtH, closestX, closestY, lookaheadX, lookaheadY,
461
+ * curvature, targetVel, leftTargetVel, rightTargetVel,
462
+ * leftVel, rightVel
463
+ */
464
+ // loop to get debug data
465
+ for ( i ++ ; i < lines . length ; i ++ ) {
466
+ const line = lines [ i ] . split ( ', ' ) ;
467
+ const timestamp = parseFloat ( line [ 0 ] ) ;
468
+ const rbtX = parseFloat ( line [ 1 ] ) ;
469
+ const rbtY = parseFloat ( line [ 2 ] ) ;
470
+ const rbtH = parseFloat ( line [ 3 ] ) ;
471
+ const closestX = parseFloat ( line [ 4 ] ) ;
472
+ const closestY = parseFloat ( line [ 5 ] ) ;
473
+ const lookaheadX = parseFloat ( line [ 6 ] ) ;
474
+ const lookaheadY = parseFloat ( line [ 7 ] ) ;
475
+ const curvature = parseFloat ( line [ 8 ] ) ;
476
+ const targetVel = parseFloat ( line [ 9 ] ) ;
477
+ const leftTargetVel = parseFloat ( line [ 10 ] ) ;
478
+ const rightTargetVel = parseFloat ( line [ 11 ] ) ;
479
+ const leftVel = parseFloat ( line [ 12 ] ) ;
480
+ const rightVel = parseFloat ( line [ 13 ] ) ;
481
+ const debugData = new DebugData ( timestamp , rbtX , rbtY , rbtH , closestX ,
482
+ closestY , lookaheadX , lookaheadY , curvature , targetVel ,
483
+ leftTargetVel , rightTargetVel , leftVel , rightVel ) ;
484
+ debugDataList . push ( debugData ) ;
485
+ }
444
486
} ;
445
487
} ;
446
488
@@ -449,5 +491,16 @@ uploadDebugBtn.onchange = function() {
449
491
* @brief mode button clicked
450
492
*/
451
493
modeBtn . onclick = function ( ) {
452
-
494
+ const cols = document . getElementsByClassName ( 'sliderContainer' ) ;
495
+ if ( cols [ 0 ] . style . display === 'none' ) {
496
+ mode = 0 ;
497
+ for ( i = 0 ; i < cols . length ; i ++ ) {
498
+ cols [ i ] . style . display = 'flex' ;
499
+ }
500
+ } else {
501
+ mode = 1 ;
502
+ for ( i = 0 ; i < cols . length ; i ++ ) {
503
+ cols [ i ] . style . display = 'none' ;
504
+ }
505
+ }
453
506
} ;
0 commit comments