{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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');
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern