Protobuf prototype
This commit is contained in:
parent
e277a83c5f
commit
9b567b8c6c
119 changed files with 8599 additions and 0 deletions
50
client_s1/compLib/__init__.py
Normal file
50
client_s1/compLib/__init__.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
__version__ = "0.4.1-1"
|
||||
|
||||
import sys
|
||||
import importlib
|
||||
import compLib.LogstashLogging
|
||||
import compLib.MetricsLogging
|
||||
from compLib.Lock import Lock
|
||||
|
||||
apt_found = importlib.util.find_spec("apt") is not None
|
||||
spi_found = importlib.util.find_spec("spidev") is not None
|
||||
|
||||
|
||||
if apt_found:
|
||||
import apt
|
||||
|
||||
try:
|
||||
__versions = apt.Cache()["python3-complib"].versions
|
||||
if len(__versions) != 1:
|
||||
print(f"Starting compLib! \033[91mVersion: {__version__} is outdated\033[0m\n"
|
||||
f"\033[92m[!] run the command 'sudo apt update && sudo apt install python3-complib' to install the newest version\033[0m")
|
||||
else:
|
||||
print(f"Starting compLib! \033[92mVersion: {__version__} is up to date\033[0m")
|
||||
except Exception as e:
|
||||
compLib.LogstashLogging.Logging.get_logger().error(f"error during checking apt package version -> {str(e)}")
|
||||
print(f"\033[91merror during checking apt package version -> {str(e)}\033[0m\n")
|
||||
else:
|
||||
print("apt is not installed! This is for local development only!")
|
||||
|
||||
if Lock.is_locked():
|
||||
print("Another program using compLib is still running! Delete /root/complib.lock if this is an error. Exiting...")
|
||||
sys.exit()
|
||||
else:
|
||||
Lock.lock()
|
||||
|
||||
if spi_found:
|
||||
from compLib.Spi import Spi
|
||||
from compLib.Reset import Reset
|
||||
from compLib.Encoder import Encoder
|
||||
from compLib.Motor import Motor
|
||||
import logging
|
||||
|
||||
print(f"\033[34mInitializing chipmunk board...\033[0m")
|
||||
Reset.reset_bot()
|
||||
Spi.health_check()
|
||||
Spi.start_health_check_loop()
|
||||
Motor.start_robot_state_loop()
|
||||
Encoder.clear_all()
|
||||
print(f"\033[34mReady\033[0m\n")
|
||||
else:
|
||||
print("spidev is not installed! This is for local development only!")
|
Reference in a new issue