if
(squat) {
if
(Math.abs(leftHip.getPosition().x - leftKnee.getPosition().x) <
30
){
chk_squat =
0
;
knee_check =
0
;
sit_check =
0
;
}
if
(leftHeel.getPosition().x > leftFootIndex.getPosition().x){
if
(knee_check ==
0
&& leftKnee.getPosition().x < leftFootIndex.getPosition().x || rightKnee.getPosition().x < rightFootIndex.getPosition().x) {
knee_check++;
tts1.speak(
"무릎을 넣어주세요."
, TextToSpeech.QUEUE_FLUSH,
null
);
}
else
if
(sit_check ==
0
&& chk_squat <
7
&& Math.abs(leftHip.getPosition().x - leftKnee.getPosition().x) >
30
&& (leftKnee.getPosition().y - leftHip.getPosition().y >
0
&& leftKnee.getPosition().y - leftHip.getPosition().y <=
45
)){
sit_check++;
tts1.speak(
"더 앉아주세요."
, TextToSpeech.QUEUE_FLUSH,
null
);
chk_squat++;
}
}
else
{
if
(Math.abs(rightHip.getPosition().x - rightKnee.getPosition().x) <
30
){
chk_squat =
0
;
knee_check =
0
;
sit_check =
0
;
}
if
(knee_check ==
0
&& leftKnee.getPosition().x > leftFootIndex.getPosition().x +
40
|| rightKnee.getPosition().x > rightFootIndex.getPosition().x +
40
) {
knee_check++;
tts1.speak(
"무릎을 넣어주세요."
, TextToSpeech.QUEUE_FLUSH,
null
);
}
else
if
(sit_check ==
0
&& chk_squat <
7
&& Math.abs(rightHip.getPosition().x - rightKnee.getPosition().x) >
30
&& (rightKnee.getPosition().y - rightHip.getPosition().y >
0
&& rightKnee.getPosition().y - rightHip.getPosition().y <=
45
)) {
sit_check++;
tts1.speak(
"더 앉아주세요"
, TextToSpeech.QUEUE_FLUSH,
null
);
chk_squat++;
}
}
}