nextDrivingCommand() {
    let command = new DriveMessage();
    let fake = this.COMMANDS[this.index];
    command.makeTurn(fake.turn1);
    command.setSpeed(fake.setSpeed);
    command.driveForward(fake.driveForward);
    command.makeTurn(fake.turn2);
    command.driveBackward(fake.driveBackward);
    
    this.index++;
    if (this.index >= this.COMMANDS.length) {
      this.index = 0;
    }
    return command;
  }
/************************************************************
   Iterate over multiple fake driving commands and add them to the car message
   Input:
   - none
   Output:
   - driving command to be sent to the car
   ************************************************************/
Iterate over multiple fake driving commands and add them to the car message
Input:
none
Output:
driving command to be sent to the car
Iterate over multiple fake driving commands and add them to the car message Input : none Output : driving command to be sent to the car
nextDrivingCommand() {
    let command = new DriveMessage();
    let fake = this.COMMANDS[this.index];
    command.makeTurn(fake.turn1);
    command.setSpeed(fake.setSpeed);
    command.driveForward(fake.driveForward);
    command.makeTurn(fake.turn2);
    command.driveBackward(fake.driveBackward);
    this.index++;
    if (this.index >= this.COMMANDS.length) {
      this.index = 0;
    }
    return command;
  }
nextDrivingCommand ( ) { let command = new DriveMessage ( ) ; let fake = this . COMMANDS [ this . index ] ; command . makeTurn ( fake . turn1 ) ; command . setSpeed ( fake . setSpeed ) ; command . driveForward ( fake . driveForward ) ; command . makeTurn ( fake . turn2 ) ; command . driveBackward ( fake . driveBackward ) ; this . index ++ ; if ( this . index >= this . COMMANDS . length ) { this . index = 0 ; } return command ; }
Iterate over multiple fake driving commands and add them to the car message
Input:
 none
Output:
 driving command to be sent to the car
Iterate over multiple fake driving commands and add them to the car message Input : none Output : driving command to be sent to the car