by lawrie » Sun Mar 29, 2009 6:35 pm
It sounds as if your problem is how to combine local autonomous behavior with remote control commands. This is really no different from deciding on which behavior to execute from different sensor input. The commands from the PC are just like another stream of sensor data. You can read the commands in a separate thread or poll them periodically in your main thread. A separate thread is probably the best approach. You then need to decide what priority to give your commands over local sensor input or local autonomous behavior.
There are lots of ways of doing this. You could do your local actions in a loop and before executing any of them, check to see if there is a remote command that might override the local action. You could use Behavior programming using the lejos.subsumption package, but I am not sure how easy it is to write a remote control behavior. Using the immediate return versions of the Pilot commands makes it easier to stop them if an overriding command comes in.