Create a class that implements interface Runnable, like this:
Code:
public class MyTask implements Runnable {
public void run () {
// Do stuff in here
}
}
Then, in the main robot class, create a thread:
Code:
public Thread myThread = new Thread(new MyTask());
Start the thread in robotInit():
Code:
myThread.start(); // Will call MyTask.run() in a separate task
I think this is what you were thinking of already, no?