示例#1
0
  def viewLaserExtension( self, robot, id, data ):
    if id == 'laser' or id == 'laser2':
#      if self.firstData:
#        self.dumpLaserGeometry( robot.laser.pose )
#        self.firstData = False
      if id == 'laser':
        self.dumpLaserGeometry( robot.laser.pose )
      else:
        self.dumpLaserGeometry( robot.laser2.pose )

      if robot.localisation:
        s = 2*self.degStep
        data2 = [ (x == 0 or x > self.distanceLimit*1000) and 100000 or x for x in data]
        if self.sideLimit:
          if len(data) == 541:
            for i in range(90-20, 90+20) + range(540-90-20, 540-90+20):
              if data[i] != 0 and data[i] < self.sideLimit*1000:
                data2[i] = data[i]
          elif len(data) == 271:
            s = self.degStep
          else:
            print "Laser bad data size:", len(data)

        arr = [min(i)/1000.0 for i in [islice(data2, start, start+s) for start in range(0,len(data2),s)]]
        if len(arr) > 0:
          viewlog.dumpSharps( robot.localisation.pose(), arr ) 
示例#2
0
    def viewLaserExtension(self, robot, id, data):
        if id == 'laser' or id == 'laser2':
            #      if self.firstData:
            #        self.dumpLaserGeometry( robot.laser.pose )
            #        self.firstData = False
            if id == 'laser':
                self.dumpLaserGeometry(robot.laser.pose)
            else:
                self.dumpLaserGeometry(robot.laser2.pose)

            if robot.localisation:
                s = 2 * self.degStep
                data2 = [(x == 0 or x > self.distanceLimit * 1000) and 100000
                         or x for x in data]
                if self.sideLimit:
                    if len(data) == 541:
                        for i in range(90 - 20, 90 + 20) + range(
                                540 - 90 - 20, 540 - 90 + 20):
                            if data[i] != 0 and data[i] < self.sideLimit * 1000:
                                data2[i] = data[i]
                    elif len(data) == 271:
                        s = self.degStep
                    else:
                        print "Laser bad data size:", len(data)

                arr = [
                    min(i) / 1000.0 for i in [
                        islice(data2, start, start + s)
                        for start in range(0, len(data2), s)
                    ]
                ]
                if len(arr) > 0:
                    viewlog.dumpSharps(robot.localisation.pose(), arr)
示例#3
0
文件: fre.py 项目: robotika/eduro
def viewLaserExtension( robot, id, data ):
  if id == 'laser':
    if robot.localisation:
      s = 10
      arr = [min(i)/1000.0 for i in [itertools.islice(data, start, start+s) for start in range(0,len(data),s)]]
#      print "arr", len(arr)
#      arr = [x > 1.0 and 10.0 or x for x in arr]
#      arr = [x < 0.3 and 10.0 or x for x in arr]
      viewlog.dumpSharps( robot.localisation.pose(), arr ) 
示例#4
0
def viewLaserExtension(robot, id, data):
    if id == 'laser':
        if robot.localisation:
            s = 10
            arr = [
                min(i) / 1000.0 for i in [
                    itertools.islice(data, start, start + s)
                    for start in range(0, len(data), s)
                ]
            ]
            #      print "arr", len(arr)
            #      arr = [x > 1.0 and 10.0 or x for x in arr]
            #      arr = [x < 0.3 and 10.0 or x for x in arr]
            viewlog.dumpSharps(robot.localisation.pose(), arr)