diff --git a/cflib_groundstation/LogfileHandler.py b/cflib_groundstation/LogfileHandler.py index fe61aacd8bb6013b8b0797ba56833b324abb5238..4dca8f9244e239668cda07156626d5414148ddb9 100644 --- a/cflib_groundstation/LogfileHandler.py +++ b/cflib_groundstation/LogfileHandler.py @@ -61,10 +61,10 @@ class LogfileHandler: def refresh_logging_configs(self): - raise Exception + return self.read_all_active_blocks() - def load_logging_configs() : - raise Exception + def load_logging_configs(self): + return self.read_all_active_blocks() def clear_logging_configs(self): """ Stop logging and clear configuration. Used when refreshing @@ -115,17 +115,29 @@ class LogfileHandler: if len(formatLine) == 0 or formatLine[0] == '#': continue elif formatLine == "START BLOCK": - print(line) data = [] - for i in range(0,6): - newLine = logBlockFile.readline().strip() + i = 0 + newLine = logBlockFile.readline().strip() + while newLine != "END BLOCK": + print(newLine) if newLine == "" or newLine == "END BLOCK": + print("New Line: " + newLine) raise Exception("loggingBlocks.txt is not formatted correctly") + if i == 0 or i == 2: data.append(int(newLine)) else: data.append(newLine) - if len(data) != 6 or logBlockFile.readline().strip() != "END BLOCK": + newLine = logBlockFile.readline().strip() + i += 1 + if logBlockFile.readline().strip() == "START BLOCK": + print(data) raise Exception("loggingBlocks.txt is not formatted correctly") + config = LogConfig(data[1], data[2]) + for i in range(3, len(data)): + config.add_variable(data[i]) + config.create() + active_blocks.append(config) + return active_blocks diff --git a/cflib_groundstation/__pycache__/LogfileHandler.cpython-38.pyc b/cflib_groundstation/__pycache__/LogfileHandler.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7fcdd75366634ed8a67ceb0bc0249148df63257c Binary files /dev/null and b/cflib_groundstation/__pycache__/LogfileHandler.cpython-38.pyc differ diff --git a/cflib_groundstation/__pycache__/SetpointHandler.cpython-38.pyc b/cflib_groundstation/__pycache__/SetpointHandler.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0c7e0a74ab5cc30a12251e4bb5914b570dbe5755 Binary files /dev/null and b/cflib_groundstation/__pycache__/SetpointHandler.cpython-38.pyc differ diff --git a/cflib_groundstation/__pycache__/crazyflie_connection.cpython-38.pyc b/cflib_groundstation/__pycache__/crazyflie_connection.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c0374ef88a85fc8fd2568c1ec8d3a508f778406b Binary files /dev/null and b/cflib_groundstation/__pycache__/crazyflie_connection.cpython-38.pyc differ diff --git a/cflib_groundstation/__pycache__/groundstation_socket.cpython-38.pyc b/cflib_groundstation/__pycache__/groundstation_socket.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c7682e1b85a3353b38ec590272b6af5937d17a5e Binary files /dev/null and b/cflib_groundstation/__pycache__/groundstation_socket.cpython-38.pyc differ diff --git a/cflib_groundstation/__pycache__/uCartCommander.cpython-38.pyc b/cflib_groundstation/__pycache__/uCartCommander.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80519f2ef307568ffdfa9785fe9f2aa52894b146 Binary files /dev/null and b/cflib_groundstation/__pycache__/uCartCommander.cpython-38.pyc differ diff --git a/cflib_groundstation/main.py b/cflib_groundstation/main.py index 0c3e2198f63119892f5388d7b8878387e7f601e3..212ed6b46ae07712e7716922fcb8971f15c2bae8 100644 --- a/cflib_groundstation/main.py +++ b/cflib_groundstation/main.py @@ -4,6 +4,7 @@ from queue import Queue from threading import Thread from groundstation_socket import GroundstationSocket, MessageTypeID from crazyflie_connection import CrazyflieConnection +from LogfileHandler import LogfileHandler class main(): @@ -75,6 +76,8 @@ class main(): if __name__ == '__main__': - main().start() + lf = LogfileHandler() + lf.read_all_active_blocks() + #main().start() \ No newline at end of file