예제 #1
0
 def __init__(self, params, scenario, vehicle):
     self.params = params
     self.scenario = scenario
     self.vehicle = vehicle
     self.pathLines = []
     startPoint = self.scenario.startPoint
     waypoints = self.scenario.wayPoints
     self.avgSpeed = calcs.length(self.scenario.startVelocity)
     for i in range(len(waypoints)):
         distance = calcs.length(waypoints[i] - startPoint)
         self.pathLines.append(
             (distance / self.avgSpeed, startPoint, waypoints[i]))
         startPoint = waypoints[i]
예제 #2
0
    def _advanceGoal(self, position):
        if self.scenario is None:
            return

        while len(self.scenario.wayPoints) > 0 and calcs.length(
                self.scenario.wayPoints[0] -
                position) <= COURSE_WAYPOINT_RADIUS:
            self.scenario.wayPoints = self.scenario.wayPoints[1:]
예제 #3
0
 def _detectSignificantPathChange(self, path):
     """
     For debugging only.  If path changes significantly, then the rate of simulation drops automatically.
     """
     if self._path is not None and len(path.pathWaypoints) > 0:
         (goal, radius) = self._currentPathWaypoint()
         if goal is not None and calcs.length(
                 goal - path.pathWaypoints[0].position) < 1.0:
             return False
     return True
예제 #4
0
 def _pathPointReached(self, position, goal, radius):
     return goal is not None and calcs.length(position - goal) <= radius
예제 #5
0
 def isPointLegal(self, point):
     return calcs.length(point - self.scenario.startPoint
                         ) * 1.2 > self.nfzGenerator._maxSize