@Test
public void testGenerateCommand() {

	RobotCommand genCommand;
	Vector<Float> orientation = new Vector<Float>();
	orientation.add((float)0);
	orientation.add((float)0);
	
	// Test SNAKE control type
	ControlType type = ControlType.SNAKE;
	genCommand = testController.generateCommand(null, "", type);
	assertEquals(null, genCommand);
	genCommand = testController.generateCommand(null, "w", type);
	assertEquals(CommandType.MOVE_CONTINUOUS, genCommand.getType());
	// Ensure invalid orientation is ignored
	genCommand = testController.generateCommand(orientation, "a", type);
	assertEquals(CommandType.TURN_ANGLE_LEFT, genCommand.getType());
	// Ensure valid orientation is ignored
	orientation.add((float)1);
	genCommand = testController.generateCommand(orientation, "d", type);
	assertEquals(CommandType.TURN_ANGLE_RIGHT, genCommand.getType());
	genCommand = testController.generateCommand(null, "s", type);
	assertEquals(CommandType.STOP, genCommand.getType());
	genCommand = testController.generateCommand(null, "wa", type);
	assertEquals(CommandType.MOVE_CONTINUOUS, genCommand.getType());
	
	// Test TANK control type
	type = ControlType.TANK;
	orientation = new Vector<Float>();
	orientation.add((float)0);
	
	// Ensure buttons commands override orientation
	genCommand = testController.generateCommand(orientation, "w", type);
	assertEquals(CommandType.MOVE_CONTINUOUS, genCommand.getType());
	genCommand = testController.generateCommand(orientation, "a", type);
	assertEquals(CommandType.ROLLING_TURN, genCommand.getType());
	assertEquals(200, genCommand.getTurnBearing(), 0.05);
	genCommand = testController.generateCommand(orientation, "d", type);
	assertEquals(CommandType.ROLLING_TURN, genCommand.getType());
	assertEquals(-200, genCommand.getTurnBearing(), 0.05);
	genCommand = testController.generateCommand(orientation, "s", type);
	assertEquals(CommandType.STOP, genCommand.getType());
	
	// Ensure invalid orientation is ignored
	genCommand = testController.generateCommand(orientation, "", type);
	assertEquals(null, genCommand);
	orientation.add((float)2);
	orientation.add((float)0);
	genCommand = testController.generateCommand(orientation, "", type);
	assertEquals(null, genCommand);
	orientation.remove(1);
	orientation.add((float)1);
	orientation.add((float)1);
	genCommand = testController.generateCommand(orientation, "", type);
	assertEquals(null, genCommand);
	
	// Ensure valid orientations are processed correctly (with null
	// or non-null button string)
	orientation = new Vector<Float>();
	orientation.add((float)0);
	orientation.add((float)0);
	orientation.add((float)0);
	genCommand = testController.generateCommand(orientation, "", type);
	assertEquals(CommandType.STOP, genCommand.getType());
	orientation.remove(1);
	orientation.add(1, (float)1);
	genCommand = testController.generateCommand(orientation, null, type);
	assertEquals(CommandType.ROLLING_TURN, genCommand.getType());
	assertEquals(RobotCommand.MAX_SPEED, genCommand.getThrottle(), 0.05);
}