main.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include "asj_pe_situp_warpper.h"
  2. int main()
  3. {
  4. SitUp_ST situp_t;
  5. situp_t.knee_angle_min = 45.0;
  6. situp_t.knee_angle_max = 90.0;
  7. situp_t.knee_elbow_distance = 15.0;
  8. situp_t.knee_hip_shoulder_angle = 160.0;
  9. situp_t.hip_shoulder_angle = 15.0;
  10. situp_t.leg_bend_flag = 1;
  11. situp_t.hands_on_head_flag = 1;
  12. situp_t.hip_lift_flag = 1;
  13. situp_t.body_lying_flag = 1;
  14. situp_t.leave_pad_end_flag = 1;
  15. void* situp = situp_create();
  16. int init_ret = situp_examInit(situp, situp_t);
  17. printf("[%s Line:%d] ------init_ret:%d\n", __FUNCTION__, __LINE__, init_ret);
  18. {
  19. int prepareStatus = 0;
  20. sampleRunJoint_RESULT_S *mResult;
  21. mResult = (sampleRunJoint_RESULT_S*)malloc(sizeof(sampleRunJoint_RESULT_S));
  22. mResult->nObjectSize = 0;
  23. for(int i = 0;i < 12;i++)
  24. {
  25. int processPrepare_ret = situp_processPrepare(situp, mResult, &prepareStatus);
  26. printf("[%s Line:%d] ------processPrepare_ret:%d\n", __FUNCTION__, __LINE__, processPrepare_ret);
  27. printf("[%s Line:%d] ------prepareStatus:%d\n", __FUNCTION__, __LINE__, prepareStatus);
  28. }
  29. }
  30. {
  31. SitUpResult_ST *result;
  32. result = (SitUpResult_ST*)malloc(sizeof(SitUpResult_ST));
  33. sampleRunJoint_RESULT_S *mResult;
  34. mResult = (sampleRunJoint_RESULT_S*)malloc(sizeof(sampleRunJoint_RESULT_S));
  35. mResult->nObjectSize = 0;
  36. for(int i = 0;i < 12;i++)
  37. {
  38. int processExam_ret = situp_processExam(situp, mResult, result);
  39. printf("[%s Line:%d] ------processExam_ret:%d\n", __FUNCTION__, __LINE__, processExam_ret);
  40. printf("[%s Line:%d] ------score:%d illegal_flag:%d\n", __FUNCTION__, __LINE__, result->sitUpCount, result->situp_illegal_flag);
  41. }
  42. }
  43. printf("[%s Line:%d] ------------Prepare------------\n", __FUNCTION__, __LINE__);
  44. printf("[%s Line:%d] ------%s\n", __FUNCTION__, __LINE__, SitUpPrepareCode2String(SITUP_PREPARE_NOHUMAN));
  45. printf("[%s Line:%d] ------%s\n", __FUNCTION__, __LINE__, SitUpPrepareCode2String(SITUP_PREPARE_NOTLIEFALT));
  46. printf("[%s Line:%d] ------%s\n", __FUNCTION__, __LINE__, SitUpPrepareCode2String(SITUP_PREPARE_KNEEANGLEILLEGAL));
  47. printf("[%s Line:%d] ------%s\n", __FUNCTION__, __LINE__, SitUpPrepareCode2String(SITUP_PREPARE_HANDNOTCLOSEHEAD));
  48. printf("[%s Line:%d] ------%s\n", __FUNCTION__, __LINE__, SitUpPrepareCode2String(SITUP_PREPARE_SUCCESS));
  49. printf("[%s Line:%d] ------------Exam------------\n", __FUNCTION__, __LINE__);
  50. printf("[%s Line:%d] ------%s\n", __FUNCTION__, __LINE__, SitUpExamCode2String(SITUP_EXAM_KNEEANGLEILLEGAL));
  51. printf("[%s Line:%d] ------%s\n", __FUNCTION__, __LINE__, SitUpExamCode2String(SITUP_EXAM_ELBOWNOTTOUCHKNEE));
  52. printf("[%s Line:%d] ------%s\n", __FUNCTION__, __LINE__, SitUpExamCode2String(SITUP_EXAM_NOTLIEFALT));
  53. printf("[%s Line:%d] ------%s\n", __FUNCTION__, __LINE__, SitUpExamCode2String(SITUP_EXAM_HIPLEAVEPAD));
  54. printf("[%s Line:%d] ------%s\n", __FUNCTION__, __LINE__, SitUpExamCode2String(SITUP_EXAM_HANDNOTCLOSEHEAD));
  55. return 0;
  56. }