取消单双杠下杠判断
This commit is contained in:
parent
9a00408ac3
commit
e9642b4763
|
@ -45,7 +45,7 @@ class PullUp_1(BaseExercise):
|
||||||
self.initial_wrist_2_y = 0
|
self.initial_wrist_2_y = 0
|
||||||
|
|
||||||
# 引体向上参数
|
# 引体向上参数
|
||||||
self.corner = (0, 480, 240, 400)
|
self.corner = (0, 480, 250, 410)
|
||||||
MediapipeAlgorithmPlugin.set_corner(corner=self.corner)
|
MediapipeAlgorithmPlugin.set_corner(corner=self.corner)
|
||||||
MediapipeAlgorithmPlugin.set_config(config=self.config)
|
MediapipeAlgorithmPlugin.set_config(config=self.config)
|
||||||
|
|
||||||
|
@ -165,12 +165,12 @@ class PullUp_1(BaseExercise):
|
||||||
# height_left = math.sqrt(math.pow(shoulder_2_x - hip_2_x, 2) + math.pow(shoulder_2_y - hip_2_y, 2))
|
# height_left = math.sqrt(math.pow(shoulder_2_x - hip_2_x, 2) + math.pow(shoulder_2_y - hip_2_y, 2))
|
||||||
# height_right = math.sqrt(math.pow(shoulder_1_x - hip_1_x, 2) + math.pow(shoulder_1_y - hip_1_y, 2))
|
# height_right = math.sqrt(math.pow(shoulder_1_x - hip_1_x, 2) + math.pow(shoulder_1_y - hip_1_y, 2))
|
||||||
|
|
||||||
if wrist_1_y - self.initial_wrist_1_y > 50 and wrist_2_y - self.initial_wrist_2_y > 50 and self.pre_pos == 1:
|
# if wrist_1_y - self.initial_wrist_1_y > 50 and wrist_2_y - self.initial_wrist_2_y > 50 and self.pre_pos == 1:
|
||||||
self.end_test += 1
|
# self.end_test += 1
|
||||||
if self.end_test > 10:
|
# if self.end_test > 10:
|
||||||
self.speak_driver.add_speak("双手已离开单杠,考试结束")
|
# self.speak_driver.add_speak("双手已离开单杠,考试结束")
|
||||||
self.pre_pos = 2
|
# self.pre_pos = 2
|
||||||
self.had_done = True
|
# self.had_done = True
|
||||||
|
|
||||||
# if height_left < self.initial_height_left and height_right < self.initial_height_right:
|
# if height_left < self.initial_height_left and height_right < self.initial_height_right:
|
||||||
# self.t += 1
|
# self.t += 1
|
||||||
|
@ -192,7 +192,7 @@ class PullUp_1(BaseExercise):
|
||||||
self._time = 0
|
self._time = 0
|
||||||
self.body_state = 0
|
self.body_state = 0
|
||||||
|
|
||||||
if (head_1_y < hand_1_y or head_2_y < hand_2_y) and wrist_1_y - self.initial_wrist_1_y < 50 and wrist_2_y - self.initial_wrist_2_y < 50 and not self.had_done:
|
if (head_1_y <= hand_1_y or head_2_y <= hand_2_y) and wrist_1_y - self.initial_wrist_1_y < 50 and wrist_2_y - self.initial_wrist_2_y < 50:
|
||||||
self.feedback = "下落"
|
self.feedback = "下落"
|
||||||
if self.state == 0:
|
if self.state == 0:
|
||||||
if self.direction == 1:
|
if self.direction == 1:
|
||||||
|
|
|
@ -147,10 +147,9 @@ class Tricep_dip_1(BaseExercise):
|
||||||
self.heel = heel_y
|
self.heel = heel_y
|
||||||
self.speak_driver.add_speak("上杠,听到提示声后开始考试")
|
self.speak_driver.add_speak("上杠,听到提示声后开始考试")
|
||||||
if self.readiness_state == 1:
|
if self.readiness_state == 1:
|
||||||
if elbow_1 > 157 and eye_1_y < wrist_1_y and eye_2_y < wrist_2_y and (shoulder_1 < 30 or shoulder_2 < 30) and heel_y < self.heel - 30:
|
if (elbow_1 > 157 or elbow_2 > 157)and eye_1_y < wrist_1_y and eye_2_y < wrist_2_y and (shoulder_1 < 30 or shoulder_2 < 30) and heel_y < self.heel - 30:
|
||||||
# if elbow_1 > 157 and eye_1_y < wrist_1_y and eye_2_y < wrist_2_y and (shoulder_1 < 30 or shoulder_2 < 30):
|
|
||||||
self.time_0 += 1
|
self.time_0 += 1
|
||||||
if self.time_0 > 30:
|
if self.time_0 > 15:
|
||||||
if vis_shoulder_1 > 0.8 and vis_shoulder_1 > vis_shoulder_2:
|
if vis_shoulder_1 > 0.8 and vis_shoulder_1 > vis_shoulder_2:
|
||||||
self.time_1 += 1
|
self.time_1 += 1
|
||||||
if self.time_1 > 3:
|
if self.time_1 > 3:
|
||||||
|
@ -174,14 +173,14 @@ class Tricep_dip_1(BaseExercise):
|
||||||
|
|
||||||
if self.dir == 1 and self.pre_pos == 1 and self.form == 1:
|
if self.dir == 1 and self.pre_pos == 1 and self.form == 1:
|
||||||
shoulder_angle = self.detector.findIncludedAngle(elbow_1_x, elbow_1_y, wrist_1_x, wrist_1_x)
|
shoulder_angle = self.detector.findIncludedAngle(elbow_1_x, elbow_1_y, wrist_1_x, wrist_1_x)
|
||||||
if wrist_1_y - self.initial_wrist_1_y > 50 or heel_y > self.heel:
|
# if wrist_1_y - self.initial_wrist_1_y > 50 or heel_y > self.heel- 5:
|
||||||
self.end_test += 1
|
# self.end_test += 1
|
||||||
if self.end_test > 10:
|
# if self.end_test > 10:
|
||||||
self.speak_driver.add_speak("双手已离开双杠,考试结束")
|
# self.speak_driver.add_speak("双手已离开双杠,考试结束")
|
||||||
self.pre_pos = 2
|
# self.pre_pos = 2
|
||||||
self.had_done = True
|
# self.had_done = True
|
||||||
|
|
||||||
if elbow_1 <= 102 or shoulder_1_y >= elbow_1_y:
|
if elbow_1 <= 97 and shoulder_1_y >= elbow_1_y - 5:
|
||||||
self.feedback = "上升"
|
self.feedback = "上升"
|
||||||
if self.state == 1:
|
if self.state == 1:
|
||||||
self.time += 1
|
self.time += 1
|
||||||
|
@ -190,7 +189,7 @@ class Tricep_dip_1(BaseExercise):
|
||||||
self.state = 0
|
self.state = 0
|
||||||
self.time = 0
|
self.time = 0
|
||||||
|
|
||||||
if elbow_1 >= 146 and shoulder_1_y < elbow_1_y and shoulder_1_y < self.initial_wrist_1_y - 60 and shoulder_angle > 60 and not self.had_done and self.count > 0 and wrist_1_y - self.initial_wrist_1_y < 50 and heel_y < self.heel - 5:
|
if elbow_1 >= 146 and shoulder_1_y < elbow_1_y and shoulder_1_y < self.initial_wrist_1_y - 60 and shoulder_angle > 60 and self.count > 0 and wrist_1_y - self.initial_wrist_1_y < 50 and heel_y < self.heel - 5:
|
||||||
self.feedback = "下落"
|
self.feedback = "下落"
|
||||||
if self.state == 0:
|
if self.state == 0:
|
||||||
self.time += 1
|
self.time += 1
|
||||||
|
@ -203,14 +202,14 @@ class Tricep_dip_1(BaseExercise):
|
||||||
|
|
||||||
elif self.dir == 2 and self.pre_pos == 1 and self.form == 1:
|
elif self.dir == 2 and self.pre_pos == 1 and self.form == 1:
|
||||||
shoulder_angle = self.detector.findIncludedAngle(elbow_2_x, elbow_2_y, wrist_2_x, wrist_2_x)
|
shoulder_angle = self.detector.findIncludedAngle(elbow_2_x, elbow_2_y, wrist_2_x, wrist_2_x)
|
||||||
if wrist_2_y - self.initial_wrist_2_y > 50 or heel_y > self.heel -5:
|
# if wrist_2_y - self.initial_wrist_2_y > 50 or heel_y > self.heel - 5:
|
||||||
self.end_test += 1
|
# self.end_test += 1
|
||||||
if self.end_test > 10:
|
# if self.end_test > 10:
|
||||||
self.speak_driver.add_speak("双手已离开双杠,考试结束")
|
# self.speak_driver.add_speak("双手已离开双杠,考试结束")
|
||||||
self.pre_pos = 2
|
# self.pre_pos = 2
|
||||||
self.had_done = True
|
# self.had_done = True
|
||||||
|
|
||||||
if elbow_2 <= 102 or shoulder_2_y >= elbow_2_y :
|
if elbow_2 <= 97 and shoulder_2_y >= elbow_2_y - 5:
|
||||||
self.feedback = "上升"
|
self.feedback = "上升"
|
||||||
if self.state == 1:
|
if self.state == 1:
|
||||||
self.time += 1
|
self.time += 1
|
||||||
|
@ -219,7 +218,7 @@ class Tricep_dip_1(BaseExercise):
|
||||||
self.state = 0
|
self.state = 0
|
||||||
self.time = 0
|
self.time = 0
|
||||||
|
|
||||||
if elbow_2 >= 146 and shoulder_2_y < elbow_2_y and shoulder_2_y < self.initial_wrist_2_y - 60 and shoulder_angle > 60 and not self.had_done and self.count > 0 and wrist_2_y - self.initial_wrist_2_y < 50 and heel_y < self.heel - 5:
|
if elbow_2 >= 146 and shoulder_2_y < elbow_2_y and shoulder_2_y < self.initial_wrist_2_y - 60 and shoulder_angle > 60 and self.count > 0 and wrist_2_y - self.initial_wrist_2_y < 50 and heel_y < self.heel - 5:
|
||||||
self.feedback = "下落"
|
self.feedback = "下落"
|
||||||
if self.state == 0:
|
if self.state == 0:
|
||||||
self.time += 1
|
self.time += 1
|
||||||
|
|
|
@ -488,7 +488,7 @@ class ExerciseBackend(LSZXBackend.base_driver.BaseDriver):
|
||||||
video_name = self.project.info[ID] + '_' + self.project.info[
|
video_name = self.project.info[ID] + '_' + self.project.info[
|
||||||
"name"] + '_' + self.project.exercise_type + '_' + 'unknow'
|
"name"] + '_' + self.project.exercise_type + '_' + 'unknow'
|
||||||
# 开始屏幕录制
|
# 开始屏幕录制
|
||||||
# video_recorder.write_start(video_name)
|
video_recorder.write_start(video_name)
|
||||||
self.project.start()
|
self.project.start()
|
||||||
self.project.waiting_for_start()
|
self.project.waiting_for_start()
|
||||||
# 清空传送管理端的成绩
|
# 清空传送管理端的成绩
|
||||||
|
@ -578,6 +578,13 @@ class ExerciseBackend(LSZXBackend.base_driver.BaseDriver):
|
||||||
self.send_sql_score_signal.set()
|
self.send_sql_score_signal.set()
|
||||||
_count = count
|
_count = count
|
||||||
_score = real_score
|
_score = real_score
|
||||||
|
elif self.exercise_tag in {PULLUP, TRICEDIP} and had_done == False:
|
||||||
|
# 结束屏幕录制
|
||||||
|
video_name = self.project.info[ID] + '_' + self.project.info[
|
||||||
|
"name"] + '_' + self.project.exercise_type + '_' + str(real_score)
|
||||||
|
video_recorder.write_stop(video_name)
|
||||||
|
_count = count
|
||||||
|
_score = real_score
|
||||||
else:
|
else:
|
||||||
_count = -1
|
_count = -1
|
||||||
_score = 0
|
_score = 0
|
||||||
|
@ -590,9 +597,7 @@ class ExerciseBackend(LSZXBackend.base_driver.BaseDriver):
|
||||||
_record = float(_result[0]['record'])
|
_record = float(_result[0]['record'])
|
||||||
_score = float(_result[0]['score'])
|
_score = float(_result[0]['score'])
|
||||||
if self.exercise_tag in {PUSHUP, PULLUP, SITUP, OVERHANG, TRICEDIP}:
|
if self.exercise_tag in {PUSHUP, PULLUP, SITUP, OVERHANG, TRICEDIP}:
|
||||||
print(111111)
|
|
||||||
if float(count) > _record or real_score > _score:
|
if float(count) > _record or real_score > _score:
|
||||||
print(self.exercise_tag)
|
|
||||||
response_code = self.manager.update_counting_score(record=count, score=real_score,
|
response_code = self.manager.update_counting_score(record=count, score=real_score,
|
||||||
person_id=person_id,
|
person_id=person_id,
|
||||||
score_type=self.exercise_tag)
|
score_type=self.exercise_tag)
|
||||||
|
|
Loading…
Reference in New Issue