Threads and Behaviours

20 downloads 118 Views 194KB Size Report
RoboTcs & Autonomous Systems. A Pracfical Introducfion with NXT and JAVA. Threads and Behaviours. Michael Wooldridge. ([email protected]) ...
Robo$cs  &  Autonomous  Systems     A  Prac'cal  Introduc'on  with  NXT  and  JAVA     Threads  and  Behaviours   Michael  Wooldridge   (mjw @ liv.ac.uk)

Threads  on  NXT  

• More  or  less  impossible  to  do  robot  programming   without  making  use  of  threads  

• Threads  typically  used  e.g.,  to  monitor  sensors  and   ensure  reac= 30) { Thread.sleep(200); } // end while } // end main } // end ProgFive

What  ProgFive  does    

• First  creates  an  instance  of  StandardRobot,  called  “me”   • Then  creates  an  instance  of  RobotMonitor,  called  “rm”   • Sets  the  motors  running   • Invokes  the  start()  method  on  the  robot  monitor   • Loops  un