OSDN Git Service

lejos_NXJ_win32_0_5_0beta.zip
[nxt-jsp/lejos_nxj.git] / nxtOSEK / lejos_nxj / docs / apidocs / lejos / navigation / Navigator.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--NewPage-->
3 <HTML>
4 <HEAD>
5 <!-- Generated by javadoc (build 1.5.0_09) on Tue Jan 08 20:46:01 GMT 2008 -->
6 <TITLE>
7 Navigator (leJOS NXT API documentation)
8 </TITLE>
9
10 <META NAME="keywords" CONTENT="lejos.navigation.Navigator interface">
11
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
13
14 <SCRIPT type="text/javascript">
15 function windowTitle()
16 {
17     parent.document.title="Navigator (leJOS NXT API documentation)";
18 }
19 </SCRIPT>
20 <NOSCRIPT>
21 </NOSCRIPT>
22
23 </HEAD>
24
25 <BODY BGCOLOR="white" onload="windowTitle();">
26
27
28 <!-- ========= START OF TOP NAVBAR ======= -->
29 <A NAME="navbar_top"><!-- --></A>
30 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
31 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
32 <TR>
33 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
34 <A NAME="navbar_top_firstrow"><!-- --></A>
35 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
36   <TR ALIGN="center" VALIGN="top">
37   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
38   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
39   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
40   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
41   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
42   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
43   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
44   </TR>
45 </TABLE>
46 </TD>
47 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
48 </EM>
49 </TD>
50 </TR>
51
52 <TR>
53 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54 &nbsp;<A HREF="../../lejos/navigation/CompassPilot.html" title="class in lejos.navigation"><B>PREV CLASS</B></A>&nbsp;
55 &nbsp;<A HREF="../../lejos/navigation/Pilot.html" title="class in lejos.navigation"><B>NEXT CLASS</B></A></FONT></TD>
56 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
57   <A HREF="../../index.html?lejos/navigation/Navigator.html" target="_top"><B>FRAMES</B></A>  &nbsp;
58 &nbsp;<A HREF="Navigator.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
59 &nbsp;<SCRIPT type="text/javascript">
60   <!--
61   if(window==top) {
62     document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
63   }
64   //-->
65 </SCRIPT>
66 <NOSCRIPT>
67   <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
68 </NOSCRIPT>
69
70
71 </FONT></TD>
72 </TR>
73 <TR>
74 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
75   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
76 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
77 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
78 </TR>
79 </TABLE>
80 <A NAME="skip-navbar_top"></A>
81 <!-- ========= END OF TOP NAVBAR ========= -->
82
83 <HR>
84 <!-- ======== START OF CLASS DATA ======== -->
85 <H2>
86 <FONT SIZE="-1">
87 lejos.navigation</FONT>
88 <BR>
89 Interface Navigator</H2>
90 <DL>
91 <DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../lejos/navigation/CompassNavigator.html" title="class in lejos.navigation">CompassNavigator</A>, <A HREF="../../lejos/navigation/TachoNavigator.html" title="class in lejos.navigation">TachoNavigator</A></DD>
92 </DL>
93 <HR>
94 <DL>
95 <DT><PRE>public interface <B>Navigator</B></DL>
96 </PRE>
97
98 <P>
99 The Navigator interface contains methods for performing basic navigational
100  movements. Normally the Navigator class is instantiated as an object and
101  methods are called on that object.
102
103  Note: This class will only work for robots using two motors to steer differentially
104  that can rotate within its footprint (i.e. turn on one spot).
105  Modified by Roger Glassey 29 Jan 2007
106 <P>
107
108 <P>
109 <DL>
110 <DT><B>Version:</B></DT>
111   <DD>0.2  - Jan-2007</DD>
112 <DT><B>Author:</B></DT>
113   <DD><a href="mailto:bbagnall@escape.ca">Brian Bagnall</a></DD>
114 </DL>
115 <HR>
116
117 <P>
118
119 <!-- ========== METHOD SUMMARY =========== -->
120
121 <A NAME="method_summary"><!-- --></A>
122 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
123 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
124 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
125 <B>Method Summary</B></FONT></TH>
126 </TR>
127 <TR BGCOLOR="white" CLASS="TableRowColor">
128 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
129 <CODE>&nbsp;float</CODE></FONT></TD>
130 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#angleTo(float, float)">angleTo</A></B>(float&nbsp;x,
131         float&nbsp;y)</CODE>
132
133 <BR>
134 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returns the direction angle (degrees) to the point with coordinates (x,y)</TD>
135 </TR>
136 <TR BGCOLOR="white" CLASS="TableRowColor">
137 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
138 <CODE>&nbsp;void</CODE></FONT></TD>
139 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#backward()">backward</A></B>()</CODE>
140
141 <BR>
142 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Moves the NXT robot backward until stop() is called.</TD>
143 </TR>
144 <TR BGCOLOR="white" CLASS="TableRowColor">
145 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
146 <CODE>&nbsp;float</CODE></FONT></TD>
147 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#distanceTo(float, float)">distanceTo</A></B>(float&nbsp;x,
148            float&nbsp;y)</CODE>
149
150 <BR>
151 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returns the distance from robot to the point with coordinates (x,y) .</TD>
152 </TR>
153 <TR BGCOLOR="white" CLASS="TableRowColor">
154 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
155 <CODE>&nbsp;void</CODE></FONT></TD>
156 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#forward()">forward</A></B>()</CODE>
157
158 <BR>
159 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Moves the NXT robot forward until stop() is called.</TD>
160 </TR>
161 <TR BGCOLOR="white" CLASS="TableRowColor">
162 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
163 <CODE>&nbsp;float</CODE></FONT></TD>
164 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#getAngle()">getAngle</A></B>()</CODE>
165
166 <BR>
167 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the current angle the NXT robot is facing.</TD>
168 </TR>
169 <TR BGCOLOR="white" CLASS="TableRowColor">
170 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
171 <CODE>&nbsp;float</CODE></FONT></TD>
172 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#getX()">getX</A></B>()</CODE>
173
174 <BR>
175 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the current x coordinate of the NXT.</TD>
176 </TR>
177 <TR BGCOLOR="white" CLASS="TableRowColor">
178 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
179 <CODE>&nbsp;float</CODE></FONT></TD>
180 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#getY()">getY</A></B>()</CODE>
181
182 <BR>
183 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the current y coordinate of the NXT.</TD>
184 </TR>
185 <TR BGCOLOR="white" CLASS="TableRowColor">
186 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
187 <CODE>&nbsp;void</CODE></FONT></TD>
188 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#goTo(float, float)">goTo</A></B>(float&nbsp;x,
189      float&nbsp;y)</CODE>
190
191 <BR>
192 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotates the NXT robot towards the target point and moves the required distance.</TD>
193 </TR>
194 <TR BGCOLOR="white" CLASS="TableRowColor">
195 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
196 <CODE>&nbsp;void</CODE></FONT></TD>
197 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#goTo(float, float, boolean)">goTo</A></B>(float&nbsp;x,
198      float&nbsp;y,
199      boolean&nbsp;immediateReturn)</CODE>
200
201 <BR>
202 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotates the NXT robot towards the target point and moves the required distance.</TD>
203 </TR>
204 <TR BGCOLOR="white" CLASS="TableRowColor">
205 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
206 <CODE>&nbsp;boolean</CODE></FONT></TD>
207 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#isMoving()">isMoving</A></B>()</CODE>
208
209 <BR>
210 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returns true iff the robot is moving under power</TD>
211 </TR>
212 <TR BGCOLOR="white" CLASS="TableRowColor">
213 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
214 <CODE>&nbsp;void</CODE></FONT></TD>
215 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#rotate(float)">rotate</A></B>(float&nbsp;angle)</CODE>
216
217 <BR>
218 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotates the NXT robot a specific number of degrees in a direction (+ or -).This
219  method will return once the rotation is complete.</TD>
220 </TR>
221 <TR BGCOLOR="white" CLASS="TableRowColor">
222 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
223 <CODE>&nbsp;void</CODE></FONT></TD>
224 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#rotate(float, boolean)">rotate</A></B>(float&nbsp;angle,
225        boolean&nbsp;immediateReturn)</CODE>
226
227 <BR>
228 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotates the NXT robot a specific number of degrees in a direction (+ or -).</TD>
229 </TR>
230 <TR BGCOLOR="white" CLASS="TableRowColor">
231 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
232 <CODE>&nbsp;void</CODE></FONT></TD>
233 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#rotateLeft()">rotateLeft</A></B>()</CODE>
234
235 <BR>
236 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotates the NXT to the left (increasing angle) until stop() is called;</TD>
237 </TR>
238 <TR BGCOLOR="white" CLASS="TableRowColor">
239 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
240 <CODE>&nbsp;void</CODE></FONT></TD>
241 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#rotateRight()">rotateRight</A></B>()</CODE>
242
243 <BR>
244 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotates the NXT to the right (decreasing angle) until stop() is called;</TD>
245 </TR>
246 <TR BGCOLOR="white" CLASS="TableRowColor">
247 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
248 <CODE>&nbsp;void</CODE></FONT></TD>
249 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#rotateTo(float)">rotateTo</A></B>(float&nbsp;angle)</CODE>
250
251 <BR>
252 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotates the NXT robot to point in a specific direction.</TD>
253 </TR>
254 <TR BGCOLOR="white" CLASS="TableRowColor">
255 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
256 <CODE>&nbsp;void</CODE></FONT></TD>
257 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#rotateTo(float, boolean)">rotateTo</A></B>(float&nbsp;angle,
258          boolean&nbsp;immediateReturn)</CODE>
259
260 <BR>
261 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotates the NXT robot to point in a specific direction.</TD>
262 </TR>
263 <TR BGCOLOR="white" CLASS="TableRowColor">
264 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
265 <CODE>&nbsp;void</CODE></FONT></TD>
266 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#setPosition(float, float, float)">setPosition</A></B>(float&nbsp;x,
267             float&nbsp;y,
268             float&nbsp;directionAngle)</CODE>
269
270 <BR>
271 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets robot location (x,y) and direction angle</TD>
272 </TR>
273 <TR BGCOLOR="white" CLASS="TableRowColor">
274 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
275 <CODE>&nbsp;void</CODE></FONT></TD>
276 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#setSpeed(int)">setSpeed</A></B>(int&nbsp;speed)</CODE>
277
278 <BR>
279 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets the motor speed of the robot, in degrees/second.</TD>
280 </TR>
281 <TR BGCOLOR="white" CLASS="TableRowColor">
282 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
283 <CODE>&nbsp;void</CODE></FONT></TD>
284 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#stop()">stop</A></B>()</CODE>
285
286 <BR>
287 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Halts the NXT robot and calculates new x, y coordinates.</TD>
288 </TR>
289 <TR BGCOLOR="white" CLASS="TableRowColor">
290 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
291 <CODE>&nbsp;void</CODE></FONT></TD>
292 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#travel(float)">travel</A></B>(float&nbsp;distance)</CODE>
293
294 <BR>
295 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Moves the NXT robot a specific distance.</TD>
296 </TR>
297 <TR BGCOLOR="white" CLASS="TableRowColor">
298 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
299 <CODE>&nbsp;void</CODE></FONT></TD>
300 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#travel(float, boolean)">travel</A></B>(float&nbsp;distance,
301        boolean&nbsp;immediateReturn)</CODE>
302
303 <BR>
304 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Moves the NXT robot a specific distance.</TD>
305 </TR>
306 <TR BGCOLOR="white" CLASS="TableRowColor">
307 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
308 <CODE>&nbsp;void</CODE></FONT></TD>
309 <TD><CODE><B><A HREF="../../lejos/navigation/Navigator.html#updatePosition()">updatePosition</A></B>()</CODE>
310
311 <BR>
312 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Updates robot location (x,y) and direction angle.</TD>
313 </TR>
314 </TABLE>
315 &nbsp;
316 <P>
317
318 <!-- ============ METHOD DETAIL ========== -->
319
320 <A NAME="method_detail"><!-- --></A>
321 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
322 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
323 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
324 <B>Method Detail</B></FONT></TH>
325 </TR>
326 </TABLE>
327
328 <A NAME="getX()"><!-- --></A><H3>
329 getX</H3>
330 <PRE>
331 float <B>getX</B>()</PRE>
332 <DL>
333 <DD>Returns the current x coordinate of the NXT.
334  Note: At present it will only give an updated reading when the NXT is stopped.
335 <P>
336 <DD><DL>
337
338 <DT><B>Returns:</B><DD>float Present x coordinate.</DL>
339 </DD>
340 </DL>
341 <HR>
342
343 <A NAME="getY()"><!-- --></A><H3>
344 getY</H3>
345 <PRE>
346 float <B>getY</B>()</PRE>
347 <DL>
348 <DD>Returns the current y coordinate of the NXT.
349  Note: At present it will only give an updated reading when the NXT is stopped.
350 <P>
351 <DD><DL>
352
353 <DT><B>Returns:</B><DD>float Present y coordinate.</DL>
354 </DD>
355 </DL>
356 <HR>
357
358 <A NAME="getAngle()"><!-- --></A><H3>
359 getAngle</H3>
360 <PRE>
361 float <B>getAngle</B>()</PRE>
362 <DL>
363 <DD>Returns the current angle the NXT robot is facing.
364  Note: At present it will only give an updated reading when the NXT is stopped.
365 <P>
366 <DD><DL>
367
368 <DT><B>Returns:</B><DD>float directionAngle in degrees.</DL>
369 </DD>
370 </DL>
371 <HR>
372
373 <A NAME="isMoving()"><!-- --></A><H3>
374 isMoving</H3>
375 <PRE>
376 boolean <B>isMoving</B>()</PRE>
377 <DL>
378 <DD>returns true iff the robot is moving under power
379 <P>
380 <DD><DL>
381 </DL>
382 </DD>
383 </DL>
384 <HR>
385
386 <A NAME="setSpeed(int)"><!-- --></A><H3>
387 setSpeed</H3>
388 <PRE>
389 void <B>setSpeed</B>(int&nbsp;speed)</PRE>
390 <DL>
391 <DD>sets the motor speed of the robot, in degrees/second.
392 <P>
393 <DD><DL>
394 </DL>
395 </DD>
396 </DL>
397 <HR>
398
399 <A NAME="forward()"><!-- --></A><H3>
400 forward</H3>
401 <PRE>
402 void <B>forward</B>()</PRE>
403 <DL>
404 <DD>Moves the NXT robot forward until stop() is called.
405 <P>
406 <DD><DL>
407 <DT><B>See Also:</B><DD><A HREF="../../lejos/navigation/Navigator.html#stop()"><CODE>stop().</CODE></A></DL>
408 </DD>
409 </DL>
410 <HR>
411
412 <A NAME="backward()"><!-- --></A><H3>
413 backward</H3>
414 <PRE>
415 void <B>backward</B>()</PRE>
416 <DL>
417 <DD>Moves the NXT robot backward until stop() is called.
418 <P>
419 <DD><DL>
420 <DT><B>See Also:</B><DD><A HREF="../../lejos/navigation/Navigator.html#stop()"><CODE>stop().</CODE></A></DL>
421 </DD>
422 </DL>
423 <HR>
424
425 <A NAME="stop()"><!-- --></A><H3>
426 stop</H3>
427 <PRE>
428 void <B>stop</B>()</PRE>
429 <DL>
430 <DD>Halts the NXT robot and calculates new x, y coordinates.
431 <P>
432 <DD><DL>
433 <DT><B>See Also:</B><DD><A HREF="../../lejos/navigation/Navigator.html#forward()"><CODE>forward().</CODE></A></DL>
434 </DD>
435 </DL>
436 <HR>
437
438 <A NAME="setPosition(float, float, float)"><!-- --></A><H3>
439 setPosition</H3>
440 <PRE>
441 void <B>setPosition</B>(float&nbsp;x,
442                  float&nbsp;y,
443                  float&nbsp;directionAngle)</PRE>
444 <DL>
445 <DD>sets robot location (x,y) and direction angle
446 <P>
447 <DD><DL>
448 <DT><B>Parameters:</B><DD><CODE>x</CODE> - the x coordinate of the robot<DD><CODE>y</CODE> - the y coordinate of the robot<DD><CODE>directionAngle</CODE> - the angle the robot is heading, measured from the x axis</DL>
449 </DD>
450 </DL>
451 <HR>
452
453 <A NAME="rotateLeft()"><!-- --></A><H3>
454 rotateLeft</H3>
455 <PRE>
456 void <B>rotateLeft</B>()</PRE>
457 <DL>
458 <DD>Rotates the NXT to the left (increasing angle) until stop() is called;
459 <P>
460 <DD><DL>
461 </DL>
462 </DD>
463 </DL>
464 <HR>
465
466 <A NAME="rotateRight()"><!-- --></A><H3>
467 rotateRight</H3>
468 <PRE>
469 void <B>rotateRight</B>()</PRE>
470 <DL>
471 <DD>Rotates the NXT to the right (decreasing angle) until stop() is called;
472 <P>
473 <DD><DL>
474 </DL>
475 </DD>
476 </DL>
477 <HR>
478
479 <A NAME="rotate(float)"><!-- --></A><H3>
480 rotate</H3>
481 <PRE>
482 void <B>rotate</B>(float&nbsp;angle)</PRE>
483 <DL>
484 <DD>Rotates the NXT robot a specific number of degrees in a direction (+ or -).This
485  method will return once the rotation is complete.
486 <P>
487 <DD><DL>
488 <DT><B>Parameters:</B><DD><CODE>angle</CODE> - Angle to rotate in degrees. A positive value rotates left, a negative value right.</DL>
489 </DD>
490 </DL>
491 <HR>
492
493 <A NAME="rotate(float, boolean)"><!-- --></A><H3>
494 rotate</H3>
495 <PRE>
496 void <B>rotate</B>(float&nbsp;angle,
497             boolean&nbsp;immediateReturn)</PRE>
498 <DL>
499 <DD>Rotates the NXT robot a specific number of degrees in a direction (+ or -).
500  If immediateReturn is true, method returns immediately and your code MUST call updatePostion()
501  when the robot has stopped.  Otherwise, the robot position is lost.
502 <P>
503 <DD><DL>
504 <DT><B>Parameters:</B><DD><CODE>angle</CODE> - Angle to rotate in degrees. A positive value rotates left, a negative value right.<DD><CODE>immediateReturn</CODE> - iff true, the method returns immediately, in which case the programmer <br>
505   is responsible for calling updatePosition() before the robot moves again.</DL>
506 </DD>
507 </DL>
508 <HR>
509
510 <A NAME="rotateTo(float)"><!-- --></A><H3>
511 rotateTo</H3>
512 <PRE>
513 void <B>rotateTo</B>(float&nbsp;angle)</PRE>
514 <DL>
515 <DD>Rotates the NXT robot to point in a specific direction. It will take the shortest
516  path necessary to point to the desired angle.
517 <P>
518 <DD><DL>
519 <DT><B>Parameters:</B><DD><CODE>angle</CODE> - The angle to rotate to, in degrees.</DL>
520 </DD>
521 </DL>
522 <HR>
523
524 <A NAME="rotateTo(float, boolean)"><!-- --></A><H3>
525 rotateTo</H3>
526 <PRE>
527 void <B>rotateTo</B>(float&nbsp;angle,
528               boolean&nbsp;immediateReturn)</PRE>
529 <DL>
530 <DD>Rotates the NXT robot to point in a specific direction. It will take the shortest
531  path necessary to point to the desired angle. 
532  If immediateReturnis true, method returns immidiately and your code MUST call updatePostion()
533  when the robot has stopped.  Otherwise, the robot position is lost.
534 <P>
535 <DD><DL>
536 <DT><B>Parameters:</B><DD><CODE>angle</CODE> - The angle to rotate to, in degrees.<DD><CODE>immediateReturn</CODE> - iff true,  method returns immediately and the programmer is responsible for calling 
537  updatePosition() before the robot moves again.</DL>
538 </DD>
539 </DL>
540 <HR>
541
542 <A NAME="travel(float)"><!-- --></A><H3>
543 travel</H3>
544 <PRE>
545 void <B>travel</B>(float&nbsp;distance)</PRE>
546 <DL>
547 <DD>Moves the NXT robot a specific distance. A positive value moves it forward and
548  a negative value moves it backward. Method returns when movement is done.
549 <P>
550 <DD><DL>
551 <DT><B>Parameters:</B><DD><CODE>distance</CODE> - The positive or negative distance to move the robot.</DL>
552 </DD>
553 </DL>
554 <HR>
555
556 <A NAME="travel(float, boolean)"><!-- --></A><H3>
557 travel</H3>
558 <PRE>
559 void <B>travel</B>(float&nbsp;distance,
560             boolean&nbsp;immediateReturn)</PRE>
561 <DL>
562 <DD>Moves the NXT robot a specific distance. A positive value moves it forwards and
563  a negative value moves it backwards. 
564   If immediateReturnis true, method returns immidiately and your code MUST call updatePostion()
565  when the robot has stopped.  Otherwise, the robot position is lost.
566 <P>
567 <DD><DL>
568 <DT><B>Parameters:</B><DD><CODE>distance</CODE> - The positive or negative distance to move the robot, same units as _wheelDiameter<DD><CODE>immediateReturn</CODE> - iff true, the method returns immediately, in which case the programmer <br>
569   is responsible for calling updatePosition() before the robot moves again.</DL>
570 </DD>
571 </DL>
572 <HR>
573
574 <A NAME="goTo(float, float)"><!-- --></A><H3>
575 goTo</H3>
576 <PRE>
577 void <B>goTo</B>(float&nbsp;x,
578           float&nbsp;y)</PRE>
579 <DL>
580 <DD>Rotates the NXT robot towards the target point and moves the required distance.
581 <P>
582 <DD><DL>
583 <DT><B>Parameters:</B><DD><CODE>x</CODE> - The x coordinate to move to.<DD><CODE>y</CODE> - The y coordinate to move to.</DL>
584 </DD>
585 </DL>
586 <HR>
587
588 <A NAME="goTo(float, float, boolean)"><!-- --></A><H3>
589 goTo</H3>
590 <PRE>
591 void <B>goTo</B>(float&nbsp;x,
592           float&nbsp;y,
593           boolean&nbsp;immediateReturn)</PRE>
594 <DL>
595 <DD>Rotates the NXT robot towards the target point and moves the required distance.
596 <P>
597 <DD><DL>
598 <DT><B>Parameters:</B><DD><CODE>x</CODE> - The x coordinate to move to.<DD><CODE>y</CODE> - The y coordinate to move to.<DD><CODE>immediateReturn</CODE> - Indicates whether method should return immediately.</DL>
599 </DD>
600 </DL>
601 <HR>
602
603 <A NAME="distanceTo(float, float)"><!-- --></A><H3>
604 distanceTo</H3>
605 <PRE>
606 float <B>distanceTo</B>(float&nbsp;x,
607                  float&nbsp;y)</PRE>
608 <DL>
609 <DD>returns the distance from robot to the point with coordinates (x,y) .
610 <P>
611 <DD><DL>
612 <DT><B>Parameters:</B><DD><CODE>x</CODE> - coordinate of the point<DD><CODE>y</CODE> - coordinate of the point
613 <DT><B>Returns:</B><DD>the distance from the robot current location to the point</DL>
614 </DD>
615 </DL>
616 <HR>
617
618 <A NAME="angleTo(float, float)"><!-- --></A><H3>
619 angleTo</H3>
620 <PRE>
621 float <B>angleTo</B>(float&nbsp;x,
622               float&nbsp;y)</PRE>
623 <DL>
624 <DD>returns the direction angle (degrees) to the point with coordinates (x,y)
625 <P>
626 <DD><DL>
627 <DT><B>Parameters:</B><DD><CODE>x</CODE> - coordinate of the point<DD><CODE>y</CODE> - coordinate of the point
628 <DT><B>Returns:</B><DD>the direction angle to the point (x,y) from the NXT.  Rotate to this angle to head toward it.</DL>
629 </DD>
630 </DL>
631 <HR>
632
633 <A NAME="updatePosition()"><!-- --></A><H3>
634 updatePosition</H3>
635 <PRE>
636 void <B>updatePosition</B>()</PRE>
637 <DL>
638 <DD>Updates robot location (x,y) and direction angle. Called by stop, and movement commands that terminate when complete.
639  Must be called after a command that returns immediatly, but after robot movement stops, and before another movement method is called.
640 <P>
641 <DD><DL>
642 </DL>
643 </DD>
644 </DL>
645 <!-- ========= END OF CLASS DATA ========= -->
646 <HR>
647
648
649 <!-- ======= START OF BOTTOM NAVBAR ====== -->
650 <A NAME="navbar_bottom"><!-- --></A>
651 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
652 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
653 <TR>
654 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
655 <A NAME="navbar_bottom_firstrow"><!-- --></A>
656 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
657   <TR ALIGN="center" VALIGN="top">
658   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
659   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
660   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
661   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
662   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
663   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
664   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
665   </TR>
666 </TABLE>
667 </TD>
668 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
669 </EM>
670 </TD>
671 </TR>
672
673 <TR>
674 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
675 &nbsp;<A HREF="../../lejos/navigation/CompassPilot.html" title="class in lejos.navigation"><B>PREV CLASS</B></A>&nbsp;
676 &nbsp;<A HREF="../../lejos/navigation/Pilot.html" title="class in lejos.navigation"><B>NEXT CLASS</B></A></FONT></TD>
677 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
678   <A HREF="../../index.html?lejos/navigation/Navigator.html" target="_top"><B>FRAMES</B></A>  &nbsp;
679 &nbsp;<A HREF="Navigator.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
680 &nbsp;<SCRIPT type="text/javascript">
681   <!--
682   if(window==top) {
683     document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
684   }
685   //-->
686 </SCRIPT>
687 <NOSCRIPT>
688   <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
689 </NOSCRIPT>
690
691
692 </FONT></TD>
693 </TR>
694 <TR>
695 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
696   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
697 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
698 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
699 </TR>
700 </TABLE>
701 <A NAME="skip-navbar_bottom"></A>
702 <!-- ======== END OF BOTTOM NAVBAR ======= -->
703
704 <HR>
705
706 </BODY>
707 </HTML>