@@ -1316,7 +1316,10 @@ public boolean truncateEnvelope(int robotID, boolean ensureDynamicFeasibility) {
1316
1316
}
1317
1317
1318
1318
TrajectoryEnvelope te = this .getCurrentTrajectoryEnvelope (robotID );
1319
- AbstractTrajectoryEnvelopeTracker tet = this .trackers .get (robotID );
1319
+ AbstractTrajectoryEnvelopeTracker tet = null ;
1320
+ synchronized (trackers ) {
1321
+ tet = this .trackers .get (robotID );
1322
+ }
1320
1323
1321
1324
int earliestStoppingPathIndex = -1 ;
1322
1325
@@ -1326,10 +1329,7 @@ public boolean truncateEnvelope(int robotID, boolean ensureDynamicFeasibility) {
1326
1329
1327
1330
//Check if you were already slowing down to stop in your critical point.
1328
1331
int lastCommunicatedCP = -1 ;
1329
- synchronized (trackers ) {
1330
- //if (breakingPathIndex == 0) trackers.get(robotID).resetStartingTimeInMillis();
1331
- lastCommunicatedCP = communicatedCPs .get (trackers .get (robotID )).getFirst ();
1332
- }
1332
+ lastCommunicatedCP = communicatedCPs .get (tet ).getFirst ();
1333
1333
earliestStoppingPathIndex = (lastCommunicatedCP != -1 ) ? Math .min (lastCommunicatedCP , earliestStoppingPathIndex ) : earliestStoppingPathIndex ;
1334
1334
1335
1335
//Compute and add new TE, remove old TE (both driving and final parking)
@@ -1359,18 +1359,18 @@ public boolean reverseEnvelope(int robotID) {
1359
1359
}
1360
1360
1361
1361
TrajectoryEnvelope te = this .getCurrentTrajectoryEnvelope (robotID );
1362
- AbstractTrajectoryEnvelopeTracker tet = this .trackers .get (robotID );
1362
+ AbstractTrajectoryEnvelopeTracker tet = null ;
1363
+ synchronized (trackers ) {
1364
+ tet = this .trackers .get (robotID );
1365
+ }
1363
1366
1364
1367
int earliestStoppingPathIndex = -1 ;
1365
1368
1366
1369
if (!(tet instanceof TrajectoryEnvelopeTrackerDummy )) {
1367
1370
earliestStoppingPathIndex = this .getForwardModel (robotID ).getEarliestStoppingPathIndex (te , this .getRobotReport (robotID ));
1368
1371
//Check if you were already slowing down to stop in your critical point.
1369
1372
int lastCommunicatedCP = -1 ;
1370
- synchronized (trackers ) {
1371
- //if (breakingPathIndex == 0) trackers.get(robotID).resetStartingTimeInMillis();
1372
- lastCommunicatedCP = communicatedCPs .get (trackers .get (robotID )).getFirst ();
1373
- }
1373
+ lastCommunicatedCP = communicatedCPs .get (tet ).getFirst ();
1374
1374
earliestStoppingPathIndex = (lastCommunicatedCP != -1 ) ? Math .min (lastCommunicatedCP , earliestStoppingPathIndex ) : earliestStoppingPathIndex ;
1375
1375
1376
1376
if (earliestStoppingPathIndex != -1 ) {
0 commit comments