Robocode keeps a queue for each robot with the "intents" from commands like setAhead(), setTurnLeft(), setFire() etc. but it if multible setAhead() commands are fired within the same turn, the last setAhead() counts.
So if multiple threads are involved in sending commands like setAhead() etc. these will be put into the robot queue in the order they occur based on the time.
Please notice that Robocode divides movement into velocity, direction for body, direction for gun, direction for radar.
So if two threads both give instructions for a new velocity (e.g. one calling setAhead(50) and another setBack(7)), the thread gets to write its instruction in the queue, as the last one, will gets its velocity instruction executed.
Hence, you will need to figure out a way to avoid raise conditions.
I recommend that you have one thread responsible for all movement of the tank - period.
Other threads should have other tasks like e.g. figure out where to aim the gun, pick out a new target, avoid collisions etc.
Cheers,
- Flemming