XBee Real Time Remote Control

Hi,

I try to remote control a 4x4 robot via XBee.

I have developed a small java program to send controls to the robot via XBee when I press the arrows on the keyboard.
When I press an arrow, a message is sent multiple times per second.

The first messages are working well. I press an arrow, the robot moves, but after having sent about 20 messages, the robot freezes (I keep sending new messages), the robot is completely frozen sometimes for as long as 30 seconds.

Then suddenly, it moves (like he finally received the messages).

I'm I reaching the serial port limit ? I know serial is not fast, but I saw that the XBee could send up to 250 kbps, so it seems quite a lot when I'm only sending a single char (example: 'A' means go forward, if I don't receive an 'A' for more than 200 milliseconds, I stop the robot).

If needed, here is the arduino code:

void setup() {
  hwSetup();
}

int GBL_MOVE_START = 0;

void loop() {
  if (Serial.available() > 0) {
    char data = Serial.read();

    if (data == 'A') {
      setSpeed(30);
      GBL_MOVE_START = millis();
    }
  }
  
  if (GBL_MOVE_START == 0 || millis() - GBL_MOVE_START >= 200) {
    setSpeed(0);
  }
}

Thanks,