MobileRobotAnimXYH - hold on; CrossHair = [-0.1 0.1 0.0 0.0...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function out=MobileRobotAnimXYH(Input) f global TrackingFigHandle global TargetShape TargetHandle TargetShapeLength global CrossHair CrossHairHandle CrossHairLength g TargetVector = Input(1:2); TargetHeading= Input(3); CrossHairVector = Input(4:5); C %---------------------------------------------------------------------------------- ---- % INITIALIZE GRAPHICS %---------------------------------------------------------------------------------- ---- % Check whether the 3D graphic figure already exists if isempty(TrackingFigHandle), TrackingFigHandle = figure; end; % Start a new figure if there is no handle yet. set(gcf,'position',[10 400 400 300]); if sum(get(TrackingFigHandle,'name')) ~= 2013, %% DRAW GRAPHICS for the FIRST TIME ONLY TargetShape = [ 2 1 -1 -1 1 2; 0 1 1 -1 -1 0]*1; TargetShapeLength=ones(1,max(size(TargetShape))); TargetPos = TargetShape + TargetVector*TargetShapeLength; TargetHandle = fill(TargetPos(1,:),TargetPos(2,:),'r');
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: hold on; CrossHair = [-0.1 0.1 0.0 0.0 0.0; 0.0 0.0 0.0 0.1 -0.1]*5; CrossHairLength=ones(1,max(size(CrossHair))); CrossHairPos = CrossHair+CrossHairVector*CrossHairLength; CrossHairHandle = plot(CrossHairPos,'y'); drawnow; hold off; axis('equal'); set(gca,'xlim',[-15 15],'ylim',[-15 15],. .. 'drawmode','fast','color','k','xcolor','w','ycolor','w'); set(TrackingFigHandle,'number','off','name','Mobile Robot (Top View)','color',0.4*[1 1 1]) out = 0; else %% LOOP & UPDATE GRAPHICS cH = cos(TargetHeading); sH = sin(TargetHeading); TargetShapeYawed = [cH -sH ; sH cH]*TargetShape; TargetPos = TargetShapeYawed + TargetVector*TargetShapeLength; CrossHairPos = CrossHair+CrossHairVector*CrossHairLength; set(TargetHandle,'xdata',TargetPos(1,:),'ydata',TargetPos(2,:)); set(CrossHairHandle,'xdata',CrossHairPos(1,:),'ydata',CrossHairPos(2,:)); %drawnow; out=0; end; e...
View Full Document

This note was uploaded on 04/17/2011 for the course SYS 635 taught by Professor Re during the Spring '11 term at Albany College of Pharmacy and Health Sciences.

Ask a homework question - tutors are online