0001 function laserInd= SelectLaserPoints(angleVector,rangeVector)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 dispclstrscore(angleVector,rangeVector,ones(size(angleVector)));
0021 title('Select appropriate region in laser scan - bound 1');
0022 hold on;
0023 p=plot(0,0,'r');
0024 hold off;
0025 set(gcf, 'WindowButtonMotionFcn', {@linedispcallback,p});
0026 set(gcf,'Pointer','crosshair');
0027
0028
0029 b=waitforbuttonpress;
0030 if b~=0
0031 btnprsd=get(gcf,'CurrentCharacter');
0032 if btnprsd=='e'
0033 laserInd=0;
0034 else
0035 laserInd=[];
0036 end
0037 set(gcf, 'WindowButtonMotionFcn', '');
0038 return;
0039 end
0040 pt = get(gca, 'CurrentPoint');
0041 px(1)=pt(1,1);
0042 py(1)=pt(1,2);
0043
0044 title('Select appropriate region in laser scan - bound 2');
0045 b=waitforbuttonpress;
0046 if b~=0
0047 btnprsd=get(gcf,'CurrentCharacter');
0048 if btnprsd=='e'
0049 laserInd=0;
0050 else
0051 laserInd=[];
0052 end
0053 set(gcf, 'WindowButtonMotionFcn', '');
0054 return;
0055 end
0056 pt = get(gca, 'CurrentPoint');
0057 px(2)=pt(1,1);
0058 py(2)=pt(1,2);
0059
0060
0061 ptheta=cart2pol(py,px);
0062 pthetamin=min(ptheta);
0063 pthetamax=max(ptheta);
0064 laserInd = angleVector>pthetamin & angleVector<pthetamax;
0065
0066 set(gcf, 'WindowButtonMotionFcn', '');
0067
0068 function linedispcallback(src,event,p)
0069
0070
0071 pt = get(gca, 'CurrentPoint');
0072 x = pt(1, 1);
0073 y = pt(1, 2);
0074
0075
0076 xLim = get(gca, 'XLim');
0077 yLim = get(gca, 'YLim');
0078 if x < xLim(1)
0079 x=xLim(1);
0080 elseif x > xLim(2)
0081 x=xLim(2);
0082 end
0083 if y < yLim(1)
0084 y=yLim(1);
0085 elseif y>yLim(2)
0086 y=yLim(2);
0087 end
0088 set(p,'XData',[0,x],'YData',[0,y]);
0089
0090 function getcoordscallback(src,event)
0091
0092 pt = get(gca, 'CurrentPoint');
0093 x = pt(1, 1);
0094 y = pt(1, 2);
0095
0096
0097 xLim = get(gca, 'XLim');
0098 yLim = get(gca, 'YLim');
0099 if x < xLim(1)
0100 x=xLim(1);
0101 elseif x > xLim(2)
0102 x=xLim(2);
0103 end
0104 if y < yLim(1)
0105 y=yLim(1);
0106 elseif y>yLim(2)
0107 y=yLim(2);
0108 end
0109