1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5 <!-- Generated by javadoc (build 1.5.0_09) on Tue Jan 08 20:46:01 GMT 2008 -->
7 Pilot (leJOS NXT API documentation)
10 <META NAME="keywords" CONTENT="lejos.navigation.Pilot class">
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
14 <SCRIPT type="text/javascript">
15 function windowTitle()
17 parent.document.title="Pilot (leJOS NXT API documentation)";
25 <BODY BGCOLOR="white" onload="windowTitle();">
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="">
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> </TD>
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
39 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
47 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
53 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54 <A HREF="../../lejos/navigation/Navigator.html" title="interface in lejos.navigation"><B>PREV CLASS</B></A>
55 <A HREF="../../lejos/navigation/TachoNavigator.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/Pilot.html" target="_top"><B>FRAMES</B></A>
58 <A HREF="Pilot.html" target="_top"><B>NO FRAMES</B></A>
59 <SCRIPT type="text/javascript">
62 document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
67 <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
74 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
75 SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
76 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
77 DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
80 <A NAME="skip-navbar_top"></A>
81 <!-- ========= END OF TOP NAVBAR ========= -->
84 <!-- ======== START OF CLASS DATA ======== -->
87 lejos.navigation</FONT>
91 <A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
92 <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>lejos.navigation.Pilot</B>
95 <DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../lejos/navigation/CompassPilot.html" title="class in lejos.navigation">CompassPilot</A></DD>
99 <DT><PRE>public class <B>Pilot</B><DT>extends <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></DL>
103 The Pilot class is a software abstraction of the Pilot mechanism of a NXT robot. It contains methods to control robot movents: travel forward or backward in a straight line or a circular path or rotate to a new direction. <br>
104 Note: this class will only work with two independently controlled Pilot motors to steer differentially, so it can rotate within its own footprint (i.e. turn on one spot).<br>
105 It can be used with robots that have reversed motor design: the robot moves in the direction opposite to the the dirction of motor rotation.
106 Uses the Motor class, which regulates motor speed using the NXT motor's built in tachometer. <br>
107 Some methods optionally return immediately so the thread that called the method can monitor sensors and call stop() if necessary. <br>
108 Uses the smoothAcceleration property of Motors to improve motor symchronication
111 Pilot pilot = new Pilot(2.1f,4.4f,Motor.A, Motor.C,true);
112 pilot.setSpeed(720);// 2 RPM
115 pilot.travel(-12,true);
116 while(pilot.isMoving())Thread.yield();
119 pilot.steer(-50,180,true);
120 while(pilot.isMoving())Thread.yield();
122 try{Thread.sleep(1000);}
123 catch(InterruptedException e){}
132 <!-- =========== FIELD SUMMARY =========== -->
134 <A NAME="field_summary"><!-- --></A>
135 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
136 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
137 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
138 <B>Field Summary</B></FONT></TH>
140 <TR BGCOLOR="white" CLASS="TableRowColor">
141 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
142 <CODE> float</CODE></FONT></TD>
143 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#_degPerDistance">_degPerDistance</A></B></CODE>
146 motor degrees per unit of travel</TD>
148 <TR BGCOLOR="white" CLASS="TableRowColor">
149 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
150 <CODE>protected <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A></CODE></FONT></TD>
151 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#_left">_left</A></B></CODE>
154 left motor</TD>
156 <TR BGCOLOR="white" CLASS="TableRowColor">
157 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
158 <CODE>protected <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A></CODE></FONT></TD>
159 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#_right">_right</A></B></CODE>
162 right motor</TD>
164 <TR BGCOLOR="white" CLASS="TableRowColor">
165 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
166 <CODE>protected int</CODE></FONT></TD>
167 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#_speed">_speed</A></B></CODE>
170 motor speed degrees per second.</TD>
172 <TR BGCOLOR="white" CLASS="TableRowColor">
173 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
174 <CODE> float</CODE></FONT></TD>
175 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#_trackWidth">_trackWidth</A></B></CODE>
178 distance between wheels - used in steer()</TD>
180 <TR BGCOLOR="white" CLASS="TableRowColor">
181 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
182 <CODE> float</CODE></FONT></TD>
183 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#_wheelDiameter">_wheelDiameter</A></B></CODE>
186 diameter of tires</TD>
190 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
192 <A NAME="constructor_summary"><!-- --></A>
193 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
194 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
195 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
196 <B>Constructor Summary</B></FONT></TH>
198 <TR BGCOLOR="white" CLASS="TableRowColor">
199 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#Pilot(float, float, lejos.nxt.Motor, lejos.nxt.Motor)">Pilot</A></B>(float wheelDiameter,
200 float trackWidth,
201 <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> leftMotor,
202 <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> rightMotor)</CODE>
205 Allocates a Pilot object, and sets the physical parameters of the NXT robot.</TD>
207 <TR BGCOLOR="white" CLASS="TableRowColor">
208 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#Pilot(float, float, lejos.nxt.Motor, lejos.nxt.Motor, boolean)">Pilot</A></B>(float wheelDiameter,
209 float trackWidth,
210 <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> leftMotor,
211 <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> rightMotor,
212 boolean reverse)</CODE>
215 Allocates a Pilot object, and sets the physical parameters of the NXT robot.</TD>
219 <!-- ========== METHOD SUMMARY =========== -->
221 <A NAME="method_summary"><!-- --></A>
222 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
223 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
224 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
225 <B>Method Summary</B></FONT></TH>
227 <TR BGCOLOR="white" CLASS="TableRowColor">
228 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
229 <CODE> void</CODE></FONT></TD>
230 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#backward()">backward</A></B>()</CODE>
233 Moves the NXT robot backward until stop() is called.</TD>
235 <TR BGCOLOR="white" CLASS="TableRowColor">
236 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
237 <CODE> void</CODE></FONT></TD>
238 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#forward()">forward</A></B>()</CODE>
241 Moves the NXT robot forward until stop() is called.</TD>
243 <TR BGCOLOR="white" CLASS="TableRowColor">
244 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
245 <CODE> int</CODE></FONT></TD>
246 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#getAngle()">getAngle</A></B>()</CODE>
249 returns the angle of rotation of the robot since last call to reset of tacho count;</TD>
251 <TR BGCOLOR="white" CLASS="TableRowColor">
252 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
253 <CODE> <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A></CODE></FONT></TD>
254 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#getLeft()">getLeft</A></B>()</CODE>
257 returns left motor</TD>
259 <TR BGCOLOR="white" CLASS="TableRowColor">
260 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
261 <CODE> int</CODE></FONT></TD>
262 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#getLeftActualSpeed()">getLeftActualSpeed</A></B>()</CODE>
265 returns actual speed of left motor in degrees per second; a negative value if motor is rotating backwards <br>
266 Updated avery 100 ms.</TD>
268 <TR BGCOLOR="white" CLASS="TableRowColor">
269 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
270 <CODE> int</CODE></FONT></TD>
271 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#getLeftCount()">getLeftCount</A></B>()</CODE>
274 returns tachoCount of left motor; Positive value means motor has moved the robot forward;</TD>
276 <TR BGCOLOR="white" CLASS="TableRowColor">
277 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
278 <CODE> <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A></CODE></FONT></TD>
279 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#getRight()">getRight</A></B>()</CODE>
282 returns right motor</TD>
284 <TR BGCOLOR="white" CLASS="TableRowColor">
285 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
286 <CODE> int</CODE></FONT></TD>
287 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#getRightActualSpeed()">getRightActualSpeed</A></B>()</CODE>
290 returns actual speed of right motor in deg/sec; a negative value if motor is rotating backwards.</TD>
292 <TR BGCOLOR="white" CLASS="TableRowColor">
293 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
294 <CODE> int</CODE></FONT></TD>
295 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#getRightCount()">getRightCount</A></B>()</CODE>
298 returns tachoCount of the right motor; Positive value means motor has moved the robot forward;</TD>
300 <TR BGCOLOR="white" CLASS="TableRowColor">
301 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
302 <CODE> int</CODE></FONT></TD>
303 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#getSpeed()">getSpeed</A></B>()</CODE>
306 return current speed setting</TD>
308 <TR BGCOLOR="white" CLASS="TableRowColor">
309 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
310 <CODE> float</CODE></FONT></TD>
311 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#getTravelDistance()">getTravelDistance</A></B>()</CODE>
314 returns distance taveled since last reset of tacho count</TD>
316 <TR BGCOLOR="white" CLASS="TableRowColor">
317 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
318 <CODE> float</CODE></FONT></TD>
319 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#getTurnRatio()">getTurnRatio</A></B>()</CODE>
322 return ratatio of Motor revolutions per 360 degree rotation of the robot</TD>
324 <TR BGCOLOR="white" CLASS="TableRowColor">
325 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
326 <CODE> boolean</CODE></FONT></TD>
327 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#isMoving()">isMoving</A></B>()</CODE>
330 returns true iff the NXT robot is moving</TD>
332 <TR BGCOLOR="white" CLASS="TableRowColor">
333 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
334 <CODE> void</CODE></FONT></TD>
335 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#regulateSpeed(boolean)">regulateSpeed</A></B>(boolean yes)</CODE>
338 Sets motor speed regulation on = true (default) or off = false; <br>
339 Allows steer() method to be called by (for example)
340 a line tracker or compass navigator so direction control is from sensor inputs</TD>
342 <TR BGCOLOR="white" CLASS="TableRowColor">
343 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
344 <CODE> void</CODE></FONT></TD>
345 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#resetTachoCount()">resetTachoCount</A></B>()</CODE>
348 resets tacho count for both motors</TD>
350 <TR BGCOLOR="white" CLASS="TableRowColor">
351 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
352 <CODE> void</CODE></FONT></TD>
353 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#rotate(int)">rotate</A></B>(int angle)</CODE>
356 Rotates the NXT robot through a specific angle; Rotates left if angle is positive, right if negative,
357 Returns when angle is reached.</TD>
359 <TR BGCOLOR="white" CLASS="TableRowColor">
360 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
361 <CODE> void</CODE></FONT></TD>
362 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#rotate(int, boolean)">rotate</A></B>(int angle,
363 boolean immediateReturn)</CODE>
366 Rotates the NXT robot through a specific angle; Rotates left if angle is positive, right if negative;
367 Returns immediately iff immediateReturn is true.</TD>
369 <TR BGCOLOR="white" CLASS="TableRowColor">
370 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
371 <CODE> void</CODE></FONT></TD>
372 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#setSpeed(int)">setSpeed</A></B>(int speed)</CODE>
375 Sets speed of both motors, degrees/sec; also sets retulate speed true</TD>
377 <TR BGCOLOR="white" CLASS="TableRowColor">
378 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
379 <CODE> void</CODE></FONT></TD>
380 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#steer(int)">steer</A></B>(int turnRate)</CODE>
383 Moves the NXT robot in a circular path at a specific turn rate.</TD>
385 <TR BGCOLOR="white" CLASS="TableRowColor">
386 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
387 <CODE> void</CODE></FONT></TD>
388 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#steer(int, int)">steer</A></B>(int turnRate,
389 int angle)</CODE>
392 Moves the NXT robot in a circular path through a specific angle; <br>
393 Negative turnRate means center of turning circle is on right side of the robot; <br>
394 Range of turnRate values : -200 : 200 ;
395 Robot will stop when total rotation equals angle.</TD>
397 <TR BGCOLOR="white" CLASS="TableRowColor">
398 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
399 <CODE> void</CODE></FONT></TD>
400 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#steer(int, int, boolean)">steer</A></B>(int turnRate,
402 boolean immediateReturn)</CODE>
405 Moves the NXT robot in a circular path, and stops when the direction it is facing has changed by a specific angle; <br>
406 Returns immediately if immediateReturn is true.</TD>
408 <TR BGCOLOR="white" CLASS="TableRowColor">
409 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
410 <CODE> void</CODE></FONT></TD>
411 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#stop()">stop</A></B>()</CODE>
414 Stops the NXT robot</TD>
416 <TR BGCOLOR="white" CLASS="TableRowColor">
417 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
418 <CODE> void</CODE></FONT></TD>
419 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#travel(float)">travel</A></B>(float distance)</CODE>
422 Moves the NXT robot a specific distance;<br>
423 A positive distance causes forward motion; negative distance moves backward.</TD>
425 <TR BGCOLOR="white" CLASS="TableRowColor">
426 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
427 <CODE> void</CODE></FONT></TD>
428 <TD><CODE><B><A HREF="../../lejos/navigation/Pilot.html#travel(float, boolean)">travel</A></B>(float distance,
429 boolean immediateReturn)</CODE>
432 Moves the NXT robot a specific distance; if immediateReturn is true, method returns immediately.</TD>
435 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
436 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
437 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
438 <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TH>
440 <TR BGCOLOR="white" CLASS="TableRowColor">
441 <TD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A></CODE></TD>
447 <!-- ============ FIELD DETAIL =========== -->
449 <A NAME="field_detail"><!-- --></A>
450 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
451 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
452 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
453 <B>Field Detail</B></FONT></TH>
457 <A NAME="_left"><!-- --></A><H3>
460 protected <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> <B>_left</B></PRE>
469 <A NAME="_right"><!-- --></A><H3>
472 protected <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> <B>_right</B></PRE>
481 <A NAME="_degPerDistance"><!-- --></A><H3>
484 public final float <B>_degPerDistance</B></PRE>
486 <DD>motor degrees per unit of travel
493 <A NAME="_speed"><!-- --></A><H3>
496 protected int <B>_speed</B></PRE>
498 <DD>motor speed degrees per second. Used by all methods that cause movememt
505 <A NAME="_trackWidth"><!-- --></A><H3>
508 public final float <B>_trackWidth</B></PRE>
510 <DD>distance between wheels - used in steer()
517 <A NAME="_wheelDiameter"><!-- --></A><H3>
520 public final float <B>_wheelDiameter</B></PRE>
522 <DD>diameter of tires
528 <!-- ========= CONSTRUCTOR DETAIL ======== -->
530 <A NAME="constructor_detail"><!-- --></A>
531 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
532 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
533 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
534 <B>Constructor Detail</B></FONT></TH>
538 <A NAME="Pilot(float, float, lejos.nxt.Motor, lejos.nxt.Motor)"><!-- --></A><H3>
541 public <B>Pilot</B>(float wheelDiameter,
542 float trackWidth,
543 <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> leftMotor,
544 <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> rightMotor)</PRE>
546 <DD>Allocates a Pilot object, and sets the physical parameters of the NXT robot. <br>
547 Assumes Motor.forward() causes the robot to move forward);
550 <DT><B>Parameters:</B><DD><CODE>wheelDiameter</CODE> - Diameter of the tire, in any convenient units. (The diameter in mm is usually printed on the tire).<DD><CODE>trackWidth</CODE> - Distance between center of right tire and center of left tire, in same units as wheelDiameter</DL>
554 <A NAME="Pilot(float, float, lejos.nxt.Motor, lejos.nxt.Motor, boolean)"><!-- --></A><H3>
557 public <B>Pilot</B>(float wheelDiameter,
558 float trackWidth,
559 <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> leftMotor,
560 <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> rightMotor,
561 boolean reverse)</PRE>
563 <DD>Allocates a Pilot object, and sets the physical parameters of the NXT robot. <br>
566 <DT><B>Parameters:</B><DD><CODE>wheelDiameter</CODE> - Diameter of the tire, in any convenient units. (The diameter in mm is usually printed on the tire).<DD><CODE>trackWidth</CODE> - Distance between center of right tire and center of left tire, in the same units as wheelDiameter<DD><CODE>reverse</CODE> - if true, the NXT robot moves forward when the motors are running backward.</DL>
569 <!-- ============ METHOD DETAIL ========== -->
571 <A NAME="method_detail"><!-- --></A>
572 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
573 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
574 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
575 <B>Method Detail</B></FONT></TH>
579 <A NAME="getLeft()"><!-- --></A><H3>
582 public <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> <B>getLeft</B>()</PRE>
584 <DD>returns left motor
588 <DT><B>Returns:</B><DD>left motor</DL>
593 <A NAME="getRight()"><!-- --></A><H3>
596 public <A HREF="../../lejos/nxt/Motor.html" title="class in lejos.nxt">Motor</A> <B>getRight</B>()</PRE>
598 <DD>returns right motor
602 <DT><B>Returns:</B><DD>right motor</DL>
607 <A NAME="getLeftCount()"><!-- --></A><H3>
610 public int <B>getLeftCount</B>()</PRE>
612 <DD>returns tachoCount of left motor; Positive value means motor has moved the robot forward;
620 <A NAME="getRightCount()"><!-- --></A><H3>
623 public int <B>getRightCount</B>()</PRE>
625 <DD>returns tachoCount of the right motor; Positive value means motor has moved the robot forward;
633 <A NAME="getLeftActualSpeed()"><!-- --></A><H3>
634 getLeftActualSpeed</H3>
636 public int <B>getLeftActualSpeed</B>()</PRE>
638 <DD>returns actual speed of left motor in degrees per second; a negative value if motor is rotating backwards <br>
639 Updated avery 100 ms.
647 <A NAME="getRightActualSpeed()"><!-- --></A><H3>
648 getRightActualSpeed</H3>
650 public int <B>getRightActualSpeed</B>()</PRE>
652 <DD>returns actual speed of right motor in deg/sec; a negative value if motor is rotating backwards. <br>
653 Updated avery 100 ms.
661 <A NAME="getTurnRatio()"><!-- --></A><H3>
664 public float <B>getTurnRatio</B>()</PRE>
666 <DD>return ratatio of Motor revolutions per 360 degree rotation of the robot
674 <A NAME="getSpeed()"><!-- --></A><H3>
677 public int <B>getSpeed</B>()</PRE>
679 <DD>return current speed setting
683 <DT><B>Returns:</B><DD>current speed</DL>
688 <A NAME="setSpeed(int)"><!-- --></A><H3>
691 public void <B>setSpeed</B>(int speed)</PRE>
693 <DD>Sets speed of both motors, degrees/sec; also sets retulate speed true
701 <A NAME="forward()"><!-- --></A><H3>
704 public void <B>forward</B>()</PRE>
706 <DD>Moves the NXT robot forward until stop() is called.
714 <A NAME="backward()"><!-- --></A><H3>
717 public void <B>backward</B>()</PRE>
719 <DD>Moves the NXT robot backward until stop() is called.
727 <A NAME="rotate(int)"><!-- --></A><H3>
730 public void <B>rotate</B>(int angle)</PRE>
732 <DD>Rotates the NXT robot through a specific angle; Rotates left if angle is positive, right if negative,
733 Returns when angle is reached.
734 Wheels turn in opposite directions producing a zero radius turn.
737 <DT><B>Parameters:</B><DD><CODE>angle</CODE> - degrees. Positive angle rotates to the left (clockwise); negative to the right. <br>Requires correct values for wheel diameter and track width.</DL>
742 <A NAME="rotate(int, boolean)"><!-- --></A><H3>
745 public void <B>rotate</B>(int angle,
746 boolean immediateReturn)</PRE>
748 <DD>Rotates the NXT robot through a specific angle; Rotates left if angle is positive, right if negative;
749 Returns immediately iff immediateReturn is true.
750 Wheels turn in opposite directions producing a zero radius turn.
753 <DT><B>Parameters:</B><DD><CODE>angle</CODE> - degrees. Positive angle rotates to the left; negative to the right. <br>Requires correct values for wheel diameter and track width.<DD><CODE>immediateReturn</CODE> - if true this method returns immediately</DL>
758 <A NAME="getAngle()"><!-- --></A><H3>
761 public int <B>getAngle</B>()</PRE>
763 <DD>returns the angle of rotation of the robot since last call to reset of tacho count;
771 <A NAME="stop()"><!-- --></A><H3>
774 public void <B>stop</B>()</PRE>
776 <DD>Stops the NXT robot
784 <A NAME="isMoving()"><!-- --></A><H3>
787 public boolean <B>isMoving</B>()</PRE>
789 <DD>returns true iff the NXT robot is moving
797 <A NAME="resetTachoCount()"><!-- --></A><H3>
800 public void <B>resetTachoCount</B>()</PRE>
802 <DD>resets tacho count for both motors
810 <A NAME="getTravelDistance()"><!-- --></A><H3>
811 getTravelDistance</H3>
813 public float <B>getTravelDistance</B>()</PRE>
815 <DD>returns distance taveled since last reset of tacho count
823 <A NAME="travel(float)"><!-- --></A><H3>
826 public void <B>travel</B>(float distance)</PRE>
828 <DD>Moves the NXT robot a specific distance;<br>
829 A positive distance causes forward motion; negative distance moves backward.
832 <DT><B>Parameters:</B><DD><CODE>distance</CODE> - of robot movement. Unit of measure for distance must be same as wheelDiameter and trackWidth</DL>
837 <A NAME="travel(float, boolean)"><!-- --></A><H3>
840 public void <B>travel</B>(float distance,
841 boolean immediateReturn)</PRE>
843 <DD>Moves the NXT robot a specific distance; if immediateReturn is true, method returns immediately. <br>
844 A positive distance causes forward motion; negative distance moves backward.
847 <DT><B>Parameters:</B><DD><CODE>immediateReturn</CODE> - If true, method returns immediately, and robot stops after traveling the distance. If false, method returns immediately.</DL>
852 <A NAME="steer(int)"><!-- --></A><H3>
855 public void <B>steer</B>(int turnRate)</PRE>
857 <DD>Moves the NXT robot in a circular path at a specific turn rate. <br>
858 The center of the turning circle is on the right side of the robot iff parameter turnRate is negative; <br>
859 turnRate values are between -200 and +200;
862 <DT><B>Parameters:</B><DD><CODE>turnRate</CODE> - If positive, the left wheel is on the inside of the turn. If negative, the left wheel is on the outside.
863 This parameter determines the ratio of inner wheel speed to outer wheel speed (as a percent). <br>
864 <I>Formula:</i> ratio = 100 - abs(turnRate). When the ratio is negative, the outer and inner wheels rotate in opposite directions.<br>
865 Examples: <UL><LI> steer(25)-> inner wheel turns at 75% of the speed of the outer wheel <br>
866 <li>steer(100) -> inner wheel stops.<br>
867 <li>steer(200) -> means that the inner wheel turns at the same speed as the outer wheel - a zero radius turn. <br></UL></DL>
872 <A NAME="steer(int, int)"><!-- --></A><H3>
875 public void <B>steer</B>(int turnRate,
876 int angle)</PRE>
878 <DD>Moves the NXT robot in a circular path through a specific angle; <br>
879 Negative turnRate means center of turning circle is on right side of the robot; <br>
880 Range of turnRate values : -200 : 200 ;
881 Robot will stop when total rotation equals angle. If angle is negative, robot will move travel backwards.
884 <DT><B>Parameters:</B><DD><CODE>turnRate</CODE> - If positive, the left wheel is on the inside of the turn. If negative, the left wheel is on the outside.
885 This parameter determines the ratio of inner wheel speed to outer wheel speed (as a percent). <br><DD><CODE>angle</CODE> - the angle through which the robot will rotate and then stop. If negative, robot traces the turning circle backwards.</DL>
890 <A NAME="steer(int, int, boolean)"><!-- --></A><H3>
893 public void <B>steer</B>(int turnRate,
895 boolean immediateReturn)</PRE>
897 <DD>Moves the NXT robot in a circular path, and stops when the direction it is facing has changed by a specific angle; <br>
898 Returns immediately if immediateReturn is true. The robot will stop automatically when the turm is complete.
899 The center of the turning circle is on right side of the robot iff parameter turnRate is negative <br>
900 turnRate values are between -200 and +200;
903 <DT><B>Parameters:</B><DD><CODE>turnRate</CODE> - If positive, the left wheel is on the inside of the turn. If negative, the left wheel is on the outside.
904 This parameter determines the ratio of inner wheel speed to outer wheel speed (as a percent). <br><DD><CODE>angle</CODE> - the angle through which the robot will rotate and then stop. If negative, robot traces the turning circle backwards.<DD><CODE>immediateReturn</CODE> - iff true, method returns immedediately.</DL>
909 <A NAME="regulateSpeed(boolean)"><!-- --></A><H3>
912 public void <B>regulateSpeed</B>(boolean yes)</PRE>
914 <DD>Sets motor speed regulation on = true (default) or off = false; <br>
915 Allows steer() method to be called by (for example)
916 a line tracker or compass navigator so direction control is from sensor inputs
922 <!-- ========= END OF CLASS DATA ========= -->
926 <!-- ======= START OF BOTTOM NAVBAR ====== -->
927 <A NAME="navbar_bottom"><!-- --></A>
928 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
929 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
931 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
932 <A NAME="navbar_bottom_firstrow"><!-- --></A>
933 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
934 <TR ALIGN="center" VALIGN="top">
935 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
936 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
937 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
938 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
939 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
940 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
941 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
945 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
951 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
952 <A HREF="../../lejos/navigation/Navigator.html" title="interface in lejos.navigation"><B>PREV CLASS</B></A>
953 <A HREF="../../lejos/navigation/TachoNavigator.html" title="class in lejos.navigation"><B>NEXT CLASS</B></A></FONT></TD>
954 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
955 <A HREF="../../index.html?lejos/navigation/Pilot.html" target="_top"><B>FRAMES</B></A>
956 <A HREF="Pilot.html" target="_top"><B>NO FRAMES</B></A>
957 <SCRIPT type="text/javascript">
960 document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
965 <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
972 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
973 SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
974 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
975 DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
978 <A NAME="skip-navbar_bottom"></A>
979 <!-- ======== END OF BOTTOM NAVBAR ======= -->