修改单双杠

This commit is contained in:
渣渣和 2024-09-25 11:50:27 +08:00
parent cf2d997b43
commit ece635b61f
3 changed files with 26 additions and 22 deletions

View File

@ -179,7 +179,7 @@ class PullUp_1(BaseExercise):
self.speak_driver.add_speak('摆幅过大')
self.body_state = 1
if elbow_1 > 157 and elbow_2 > 157 and head_1_y > hand_1_y and head_2_y > hand_2_y:
if elbow_1 > 155 and elbow_2 > 155 and head_1_y > hand_1_y and head_2_y > hand_2_y:
self.feedback = "上升"
self.state = 0
if self.direction == 0:

View File

@ -79,8 +79,14 @@ class Tricep_dip_1(BaseExercise):
cv2.rectangle(img, (self.corner[2], self.corner[0]), (self.corner[3], self.corner[1]), (0, 255, 0), 2)
# 绘制状态条
cv2.rectangle(img, (650 - 100, 60), (650 - 80, 282), (255, 255, 255), 2)
self.detector.drawPoint_more(img, [9, 11, 13, 19, 25], bias_x=self.corner[2], bias_y=self.corner[0])
self.detector.drawPoint_more(img, [10, 12, 14, 20, 26], bias_x=self.corner[2], bias_y=self.corner[0])
if self.dir == 0:
self.detector.drawPoint_more(img, [9, 11, 13, 19, 25], bias_x=self.corner[2], bias_y=self.corner[0])
self.detector.drawPoint_more(img, [10, 12, 14, 20, 26], bias_x=self.corner[2], bias_y=self.corner[0])
elif self.dir == 1:
self.detector.drawPoint_more(img, [9, 11, 13, 19, 25], bias_x=self.corner[2], bias_y=self.corner[0])
elif self.dir == 2:
self.detector.drawPoint_more(img, [10, 12, 14, 20, 26], bias_x=self.corner[2], bias_y=self.corner[0])
if self.bar and self.per:
cv2.rectangle(img, (650 - 98, int(self.bar)), (650 - 82, 280), (102, 106, 233),
cv2.FILLED)
@ -141,7 +147,7 @@ class Tricep_dip_1(BaseExercise):
self.heel = heel_y
self.speak_driver.add_speak("上杠,听到提示声后开始考试")
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 - 50:
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 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
if self.time_0 > 30:
@ -168,59 +174,57 @@ class Tricep_dip_1(BaseExercise):
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)
if wrist_2_y - self.initial_wrist_2_y > 50 or wrist_1_y - self.initial_wrist_1_y > 50 or heel_y < self.heel - 5:
if wrist_1_y - self.initial_wrist_1_y > 50 or heel_y > self.heel:
self.end_test += 1
if self.end_test > 2:
if self.end_test > 10:
self.speak_driver.add_speak("双手已离开双杠,考试结束")
self.pre_pos = 2
self.had_done = True
if elbow_1 <= 100 or shoulder_1_y >= elbow_1_y:
if elbow_1 <= 102 or shoulder_1_y >= elbow_1_y:
self.feedback = "上升"
if self.state == 1:
self.time += 1
if self.time > 1:
if self.time > 2:
self.count += 0.5
self.state = 0
self.time = 0
if elbow_1 >= 160 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:
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:
self.feedback = "下落"
if self.state == 0:
self.time += 1
if self.time > 1:
if self.time > 2:
self.count += 0.5
self.state = 1
self.end_test = 0
self.speak_driver.add_speak("{}".format(int(self.count)))
if self.count == 1:
self.initial_wrist_1_y = wrist_1_y
self.initial_wrist_2_y = wrist_2_y
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)
if wrist_2_y - self.initial_wrist_2_y > 50 or wrist_1_y - self.initial_wrist_1_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
if self.end_test > 2:
if self.end_test > 10:
self.speak_driver.add_speak("双手已离开双杠,考试结束")
self.pre_pos = 2
self.had_done = True
if elbow_2 <= 100 or shoulder_2_y >= elbow_2_y:
if elbow_2 <= 102 or shoulder_2_y >= elbow_2_y :
self.feedback = "上升"
if self.state == 1:
self.time += 1
if self.time > 1:
if self.time > 2:
self.count += 0.5
self.state = 0
self.time = 0
if elbow_2 >= 160 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:
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:
self.feedback = "下落"
if self.state == 0:
self.time += 1
if self.time > 1:
if self.time > 2:
self.count += 0.5
self.state = 1
self.end_test = 0
self.speak_driver.add_speak("{}".format(int(self.count)))
if self.count == 1:
self.initial_wrist_1_y = wrist_1_y
self.initial_wrist_2_y = wrist_2_y

Binary file not shown.