def getRadarData(start, end, step, r_idx): # 创建地图、增加两个货包块 map = ExpSetting.getBasicMap() radar = ExpSetting.getBasicRadar() ret = [] ret.append(getGroupData(radar, map, [0, 0, 0], r_idx)) for i in range(start, end, step): ret.append(getGroupData(radar, map, [500, i, 0], 1)) return ret
def exp_jiao_radardata(radar_pos): map = ExpSetting.getBasicMap() fig = MapFigure(map) radar = ExpSetting.getBasicRadar() radar_data = radar.getMeasureData(map, radar_pos) rag = DBSCAN.getFeatureRange(radar_data, radar_pos) colors = ['b.', 'r.', 'g.'] xs = [x[0] for x in radar_data] ys = [x[1] for x in radar_data] for i in range(len(rag)): s = rag[i][0] e = rag[i][1] fig.drawRadarPoints(xs[s:e], ys[s:e], colors[i]) fig.setXYLabel(u'距离/mm', u'距离/mm') fig.setXYLim(0, 2500, 0, 3200) fig.showFigure()
def estimateLine2(): # 创建地图、增加两个货包块 map = ExpSetting.getBasicMap() # 创建激光雷达、设置位置、扫描数据 radar = ExpSetting.getBasicRadar() radar_pos = [0, 0, 0] radar_data = radar.getMeasureData(map, radar_pos) # 获取 rag = DBSCAN.getFeatureRange(radar_data, radar_pos) mid = Split.getSingleSplitPoint(radar_data, rag[1]) theta, p_val = LeastSquare.normalCal(radar_data, rag[1][0], mid - 2) ls = LeastSquare(theta, p_val) for i in range(1000, 2000, 100): radar_pos = [500, i, 0] radar_data = radar.getMeasureData(map, radar_pos) rag = DBSCAN.getFeatureRange(radar_data, radar_pos) print rag mid = Split.getSingleSplitPoint(radar_data, rag[1]) print ls.recursiveCal(radar_data, rag[1][0], mid - 5, 0.98)