def addObstacle(self,vstate):
     
     # model all sensor errors as Gaussian
     positionErrorSD = 4. * .25 / 2.  # meters
     speedErrorSD = 5.*.447 * .25 / 2. # meters/second
     
     detected = (distance(self.state, vstate) <= self.commRange1 and
                 self.inScope(vstate,self.scope1) ) or (
                 distance(self.state, vstate) <= self.commRange2 and
                 self.inScope(vstate,self.scope2) )
     
     if not detected:
         if self.allowComm:   # using DSRC instead
             positionErrorSD = 4. * 1.1 / 2.
             speedErrorSD = 5.*.447 * 1.1 / 2.
         else:
             return
     
     if self.realign:
         trueObstacle = realignV(self.state, vstate)
     else:
         trueObstacle = vstate.copy()
     trueObstacle.x = random.gauss(trueObstacle.x, positionErrorSD)
     trueObstacle.y = random.gauss(trueObstacle.y, positionErrorSD)
     trueObstacle.speed = random.gauss(trueObstacle.speed, speedErrorSD)
     
     
     self.obstacles.append(trueObstacle)
Exemple #2
0
    def addObstacle(self, vstate):

        # model all sensor errors as Gaussian
        positionErrorSD = 4. * .25 / 2.  # meters
        speedErrorSD = 5. * .447 * .25 / 2.  # meters/second

        detected = (distance(self.state, vstate) <= self.commRange1
                    and self.inScope(vstate, self.scope1)) or (
                        distance(self.state, vstate) <= self.commRange2
                        and self.inScope(vstate, self.scope2))

        if not detected:
            if self.allowComm:  # using DSRC instead
                positionErrorSD = 4. * 1.1 / 2.
                speedErrorSD = 5. * .447 * 1.1 / 2.
            else:
                return

        if self.realign:
            trueObstacle = realignV(self.state, vstate)
        else:
            trueObstacle = vstate.copy()
        trueObstacle.x = random.gauss(trueObstacle.x, positionErrorSD)
        trueObstacle.y = random.gauss(trueObstacle.y, positionErrorSD)
        trueObstacle.speed = random.gauss(trueObstacle.speed, speedErrorSD)

        self.obstacles.append(trueObstacle)
Exemple #3
0
    def addObstacle(self,vstate):
        
        # model all sensor errors as Gaussian
        positionErrorSD = 4. * self.noiseLevel / 2.  # meters
        speedErrorSD = 5.*.447 * self.noiseLevel / 2. # meters/second
        #angleErrorSD = .1 * self.noiseLevel       # radians
        #accelErrorSD = .2 * self.noiseLevel      # meters/second^2
        # not sending acceleration atm...       
        
#        if vstate.vehID == self.state.vehID: # accidentally sensing yourself
#            return
        if distance(self.state, vstate) > self.maxCommunicationRange:
            return
        if random.uniform(0,1) < self.packetLossRate:
            return
        
        if self.realign:
            trueObstacle = realignV(self.state, vstate)
        else:
            trueObstacle = vstate.copy()
        trueObstacle.x = random.gauss(trueObstacle.x, positionErrorSD)
        trueObstacle.y = random.gauss(trueObstacle.y, positionErrorSD)
        trueObstacle.speed = random.gauss(trueObstacle.speed, speedErrorSD)
        # for now ignore angle error, since we're dealing with straight roads
        
        
        self.obstacles.append(trueObstacle)
    def addObstacle(self, vstate):
                # model all sensor errors as Gaussian
        positionErrorSD = 2. * self.noiseLevel / 2.  # meters
        speedErrorSD = 2.*.447 * self.noiseLevel / 2. # meters/second
        #angleErrorSD = .1 * self.noiseLevel       # radians
        #accelErrorSD = .2 * self.noiseLevel      # meters/second^2
        # not sending acceleration atm...       
        
        unitThatWorks = None
        unitsThatWork = (unit for unit in self.units if
                                self._withinRSUrange(unit, vstate))
        try:
            while unitThatWorks is None:
                unit = unitsThatWork.next()
                #unitState = {'x':unit[0], 'y':unit[1], 'angle':unit[2]}
                unitState = Series(unit,index=['x','y','angle'])                
                if distance(self.state, unitState) <= self.maxCommunicationRange:
                    unitThatWorks = unit
        except StopIteration:
            return   # no units detected this vehicle, and can communicate

        if random.uniform(0,1) < self.packetLossRate:
            return
        
        if self.realign:
            trueObstacle = realignV(self.state, vstate)
        else:
            trueObstacle = vstate.copy()
        trueObstacle.x = random.gauss(trueObstacle.x, positionErrorSD)
        trueObstacle.y = random.gauss(trueObstacle.y, positionErrorSD)
        trueObstacle.speed = random.gauss(trueObstacle.speed, speedErrorSD)
        #trueObstacle.Acceleration is same
        # for now ignore angle error, since we're dealing with straight roads
        
        self.obstacles.append(trueObstacle)
 def addObstacle(self,vstate):
     radius = 20   # meters
     positionSD = .25
     
     if vstate.vehID == self.state.vehID:
         return
     if distance(self.state, vstate) > radius:
         return
     trueObstacle = realignV(self.state, vstate)
     trueObstacle.x = random.gauss(trueObstacle.x, positionSD)
     trueObstacle.y = random.gauss(trueObstacle.y, positionSD)
     self.obstacles.append(trueObstacle)
Exemple #6
0
    def addObstacle(self, vstate):
        radius = 20  # meters
        positionSD = .25

        if vstate.vehID == self.state.vehID:
            return
        if distance(self.state, vstate) > radius:
            return
        trueObstacle = realignV(self.state, vstate)
        trueObstacle.x = random.gauss(trueObstacle.x, positionSD)
        trueObstacle.y = random.gauss(trueObstacle.y, positionSD)
        self.obstacles.append(trueObstacle)
Exemple #7
0
 def addObstacle(self,vstate):
     
     # model all sensor errors as Gaussian
     positionErrorSD = 4. * self.noiseLevel / 2.  # meters
     speedErrorSD = 5.*.447 * self.noiseLevel / 2. # meters/second
     
     if distance(self.state, vstate) > self.maxCommunicationRange:
         return
     if not self.inRange(realignV(self.state,vstate)):
         return
     if random.uniform(0,1) < self.packetLossRate:
         return
     
     if self.realign:
         trueObstacle = realignV(self.state, vstate)
     else:
         trueObstacle = vstate.copy()
     trueObstacle.x = random.gauss(trueObstacle.x, positionErrorSD)
     trueObstacle.y = random.gauss(trueObstacle.y, positionErrorSD)
     trueObstacle.speed = random.gauss(trueObstacle.speed, speedErrorSD)
     # for now ignoring angle error
     
     
     self.obstacles.append(trueObstacle)