Enhance Battery and Motor Diagnostics: Add standard deviation calculation and motor diagnostics functionality

This commit is contained in:
alkadienePhoton
2025-12-07 16:57:28 -06:00
parent e00b6f1b2c
commit e4e9ef988b
3 changed files with 113 additions and 5 deletions

View File

@@ -5,7 +5,9 @@ from pybricks.robotics import DriveBase
from pybricks.tools import wait, StopWatch
hub = PrimeHub()
from BatteryDiagnostics import BatteryDiagnostics
from MotorDiagnostics import MotorDiagnostics
battery = BatteryDiagnostics()
motor = MotorDiagnostics()
clearConfirmation = input("Do you want to clear the console before proceeding? Y/N (default: yes): ")
if(clearConfirmation == "Y" or clearConfirmation == "y" or clearConfirmation == "yes" or clearConfirmation == ""):
print("Clearing console... \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
@@ -20,12 +22,14 @@ while True:
if choice == "b":
print("-----------------------BATTERY DIAGNOSTICS-----------------------")
print("This test will check the battery voltage and current. It will measure the voltage and current over a period of 3 seconds and provide average values and deviation values. Your voltage should be above 7800 mV for optimal performance.")
input("Press Enter to begin the battery diagnostics.")
battery.printAll()
elif choice == "m":
print("------------------------MOTOR DIAGNOSTICS------------------------")
# motor.printAll() # call your motor diagnostics here
print("Motor diagnostics would run here.")
motor.fullTest()
print("Motor diagnostics completed.")
elif choice == "q":
print("Diagnostics completed successfully. Exiting with code 0. Good luck in the robot game!")