/** Actually writes the data to file */ private void writeDataToFile() { m_fileWriter = new FileWriter(m_sFile); m_fileWriter.writeInt(m_Index); for (int iPos = 0; iPos < m_Index; iPos++) { m_botDataAuto.setValues((BotData) m_List.elementAt(iPos)); m_fileWriter.writeDouble(m_botDataAuto.getTime()); m_fileWriter.writeDouble(m_botDataAuto.getMtLeft()); m_fileWriter.writeDouble(m_botDataAuto.getMtRight()); m_fileWriter.writeBoolean(m_botDataAuto.getCannonUp()); } m_fileWriter.close(); }
/** * Records bots movements to specified file * * @param sFileName */ public void record(String sFileName) { if (!m_bRecStarted) { m_sFile = sFileName; m_tmRecorder.start(); m_bRecStarted = true; } if (!m_bRecDone) { m_Index++; m_botDataAuto = new BotData(); m_botDataAuto.setValues(m_tmRecorder.get(), m_bot); m_List.addElement(m_botDataAuto); } else { Vars.fnDisableDrive(); m_bot.stopRobot(); m_tmRecorder.stop(); m_tmRecorder.reset(); } }