it is a matlab file foe develop SLAM localization this is a toolbox for develop develop realtime e

源代码在线查看: draw.m

软件大小: 7457 K
上传用户: cnnotes
关键词: develop localization realtime toolbox
下载地址: 免注册下载 普通下载 VIP

相关代码

				%DRAW   Draw map.
%   DRAW(M,IDS,ELLIS,NEWFIG,COLOR) plots the map M. Enable and
%   disable display of feature identifiers with IDS = 0/1 and
%   uncertainty ellipses with ELLIS = 0/1. If NEWFIG = 0, DRAW
%   displays the map into the current figure, otherwise it opens
%   a new figure window. COLOR is a [r g b]-vector or a Matlab
%   color string such as 'r' or 'g'. It determines the color of
%   all map entities.
%
%   H = DRAW(...) returns a column vector of handles to all
%   graphic objects of the map drawing. Remember that not all
%   graphic properties apply to all types of graphic objects.
%   Use FINDOBJ to find and access the individual objects.
%
%   See also MAP/DRAWCORR.

% Copyright (c) 2004, CAS-KTH. See licence file for more info.
% v.1.0, Nov. 2003, Kai Arras

function h = draw(M,ids,ellis,newfig,color);

if (isa(M,'map')) & ((ids==0)|(ids==1)) & ...
   ((ellis==0)|(ellis==1)) & ((newfig==0)|(newfig==1)),

  % Constants
  LEVEL  = 0.95;  % probability level of elliptic regions

  if newfig,
    figure; clf; zoom on; set(gca,'Box','On'); axis equal;
    xlabel('x [m]'); ylabel('y [m]'); title(['Map: "',get(M,'name'), '"']);
  end;
  
  % Set hold on, save hold status
  held = ishold; hold on;
  
  % Test on special cases of global and local map
  if strcmp(M.name,'global map'),
    str = 'W';
  elseif strcmp(M.name,'local map'),
    str = 'R';
  else
    str = 'M';
  end;
  h1 = drawreference(zeros(3,1),str,1,color);

  % Plot map entities, concantenate graphic handles
  h = [];
  n = length(M.X);
  for i = 1:n,
    if ~isa(M.X{i},'robot'),
      hi = draw(M.X{i},ids,color);
    else
      hi = draw(M.X{i},0,color);
    end;
    if ellis & ~isa(M.X{i},'arlinefeature'),
      x = get(M.X{i},'x');
      C = get(M.X{i},'c');
      he = drawprobellipse(x,C,LEVEL,'b');
    else
      he = [];
    end;
    h = cat(1,h,cat(1,hi,he));
  end;
  h = cat(1,h1,h);
  
  % Restore hold status
  if ~held, hold off; end;

else
  disp('map/draw: Wrong input. Check your arguments.')
end;
			

相关资源