Skip to content

Commit

Permalink
Imported File IO into main preflight script
Browse files Browse the repository at this point in the history
  • Loading branch information
Josht8601 committed Oct 19, 2023
1 parent e7a4f26 commit f4877b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
5 changes: 5 additions & 0 deletions mil_common/utils/mil_tools/scripts/preflight/preflight.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
import preflightFileIO
import rospy

# Use Rich for nice printing
Expand All @@ -11,3 +12,7 @@
print("Running a Simulation")
else:
print("Running for real")

preflightFileIO.writeTests("SubChecklist.txt", ["dvl", "odom", "testing"])
preflightFileIO.deleteTests("SubChecklist.txt", ["testing"])
print(preflightFileIO.readTests("SubChecklist.txt"))
15 changes: 3 additions & 12 deletions mil_common/utils/mil_tools/scripts/preflight/preflightFileIO.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env python3

# Systems[]
# Global variable that contains all the systems. Used to standardized file name. Ex Subjugator or Navigator

# writeTests(fileName, topicsToCheck[])
# fileName should standardized, this input should be from a selected number of names
# topicsToCheck[] this array should only contain valid topics that we will make sure data is in.
Expand All @@ -18,6 +15,8 @@
# readTests(filename)
# reads and runs all the tests in the file.
# returns whether each test pass or fail


import rospy
import rostopic

Expand Down Expand Up @@ -62,7 +61,6 @@ def readTests(filename):
dataTypes = [] # Create list to store topic datatypes
results = [] # list to store the results of all the tests

print(lines)
# Loop through all the tests
for i in range(len(lines)):
# Fix the formatting of the tests to match topic names
Expand All @@ -81,11 +79,4 @@ def readTests(filename):
except Exception:
results.append(False)

return results


if __name__ == "__main__":
rospy.init_node("topic_publisher_checker")
writeTests("SubChecklist.txt", ["dvl", "odom"])
deleteTests("SubChecklist.txt", ["testing"])
print(readTests("SubChecklist.txt"))
return [lines, results]

0 comments on commit f4877b4

Please sign in to comment.