89 lines
2.6 KiB
Python
89 lines
2.6 KiB
Python
# coding:gb2312
|
|
import multiprocessing
|
|
import time
|
|
|
|
import cv2
|
|
|
|
from LSZXPagesLibrary.consensus import *
|
|
from MCamera.camera import *
|
|
from PureBackend.general import BAND_ID, ID
|
|
from PureBackend.global_execrise_backend import GEB
|
|
|
|
if __name__ == "__main__":
|
|
eb = GEB(model="move_net").get_geb()
|
|
# 获取当前链接的WiFi名称
|
|
wifi_name = eb.get_connected_wifi_name()
|
|
print(f"当前链接的WiFi名称:{wifi_name}")
|
|
# 获得当前可链接的WiFi列表
|
|
wifi_list = eb.get_wifi_list()
|
|
print(f"当前可链接的WiFi列表:{wifi_list}")
|
|
# 断开wifi链接
|
|
state = eb.wifi_disconnect()
|
|
print(f"断开wifi链接成功:{state}")
|
|
# 链接指定WiFi
|
|
state = eb.wifi_connect("LiShuZuoXun-DISPLAY")
|
|
print(f"链接指定WiFi成功:{state}")
|
|
# 获得当前训练标准
|
|
train_info = eb.get_train_info()
|
|
print(f"获得当前训练标准:{train_info}")
|
|
# 设置训练标准
|
|
state = eb.set_train_info(train_info)
|
|
print(f"设置训练标准成功:{state}")
|
|
# 更新汇总信息json
|
|
state = eb.update_summary_info()
|
|
print(f"更新汇总信息json成功:{state}")
|
|
# 读取当前考核批次GET
|
|
batch = eb.get_batch()
|
|
print(f"读取当前考核批次GET:{batch}")
|
|
# 生成新的考核批次GET
|
|
batch = eb.set_batch()
|
|
if batch:
|
|
print(f"生成新的考核批次GET:{batch}")
|
|
else:
|
|
print(f"已经是最新批次了!")
|
|
# 获得所有信息
|
|
all_class = eb.get_all_class()
|
|
all_score = eb.get_all_score()
|
|
all_person = eb.get_all_person()
|
|
print(f"所有班级:{all_class}")
|
|
print(f"所有成绩:{all_score}")
|
|
print(f"所有人员:{all_person}")
|
|
print(f"第一个人员的信息:{all_person[0]}")
|
|
print(
|
|
[
|
|
{
|
|
IS_CHOOSE: False,
|
|
NAME: score["name"],
|
|
ID: score["id"],
|
|
SCORE: score['run_bf_score'],
|
|
COUNT: score['run_bf_count'],
|
|
CLASS: score['class'],
|
|
}
|
|
for score in all_score
|
|
]
|
|
)
|
|
# 启动一个蛇形跑考试
|
|
first_person = all_person[0]
|
|
state = eb.active_run_around(band_id=first_person[BAND_ID], person_id=first_person[ID])
|
|
print(f"启动一个蛇形跑考试成功?:{state}")
|
|
# 开始考试
|
|
state = eb.start_exercise()
|
|
print(f"开始考试成功?:{state}")
|
|
# 获得实时成绩
|
|
for frame in eb.get_exercise_video():
|
|
score = eb.get_score()
|
|
print(score)
|
|
had_done = score["had_done"]
|
|
if had_done:
|
|
break
|
|
if frame is None:
|
|
continue
|
|
cv2.imshow("runaround", frame)
|
|
cv2.waitKey(1)
|
|
# 结束考试
|
|
state = eb.stop_exercise()
|
|
print(f"结束考试成功?抢跑时间为:{state}")
|
|
# 更新成绩
|
|
state = eb.update_score()
|
|
print(f"更新成绩成功?:{state}")
|