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_environment(): map = ExpSetting.getBasicMap() fig = MapFigure(map) fig.drawMapByFeatures() fig.setXYLabel(u'距离/mm', u'距离/mm') fig.setXYLim(0, 2500, 0, 3200) fig.showFigure()
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 exp_jiao_drawEstimate(p1, p2, p3, y1, y2): xs = np.arange(1, 11) map = ExpSetting.getBasicMap() fig = MapFigure(map) l1 = fig.drawRadarPoints(xs, p3, 'ro-') l2 = fig.drawRadarPoints(xs, p1, 'g--<') l3 = fig.drawRadarPoints(xs, p2, 'm:d') plt.legend([l1, l2, l3], [u'AAAAA', u'B', 'C'], loc='upper right') fig.setXYLabel(u'数据编号', u'距离/mm') fig.setXYLim(0, 11, y1, y2) 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)
def exp_jiao_drawErrRange(): dats = [[1977, 2007], [1982, 2012], [1993, 2002], [1979, 2006], [1994, 2023], [1992, 2016], [1992, 2015], [1996, 2017], [1983, 2003], [1996, 2014]] x = np.arange(1, 11, 1) y = [] e = [] for i in range(len(dats)): y.append((dats[i][0] + dats[i][1]) / 2.0) e.append(dats[i][1] - y[i]) map = ExpSetting.getBasicMap() fig = MapFigure(map) fig.drawErrorBar(x, y, e, 'k-o') fig.drawRadarPoints(np.arange(0, 12), [2000] * 12, 'r--') fig.setXYLabel(u'数据编号', u'距离/mm') fig.setXYLim(0, 11, 1950, 2050) fig.showFigure()
draw3Dsurface(np.arange(0, h, 1), np.arange(0, w, 1), prob_map.s_grid) ''' xs = [[25, 825], [975, 1575]] ys = [[25, 85], [235, 285], [435, 465], [615, 665], [815, 885]] def genRandPos(x, y, w, h, num): ran1 = RandomNum.createRandom(num) * w + x ran2 = RandomNum.createRandom(num) * h + y return ran1, ran2 w = 1600 h = 900 map = ExpSetting.getBasicMap(w, h, Feas.fea2) fig = MapFigure(map) fig.drawMapByFeatures() # 主通道 #ran1, ran2 = genRandPos(825, 25, 150, 850, 300) # 搜索c #ran1, ran2 = genRandPos(825, 210, 150, 100, 50) # ran1, ran2 = genRandPos(825, 690, 150, 80, 50) fig.drawRadarPoints(ran1, ran2, 'b.') ''' for i in range (len(xs)): for j in range(len(ys)): ran1, ran2 = genRandPos(xs[i][0], ys[j][0], xs[i][1] - xs[i][0], ys[j][1] - ys[j][0], 120) fig.drawRadarPoints(ran1, ran2, 'b.') '''