⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c1_vehicles.c

📁 多个无人机的群飞行仿真 多个无人机的群飞行仿真
💻 C
📖 第 1 页 / 共 5 页
字号:
          c1_uav5();
          _SFD_CE_CALL(EVENT_AFTER_BROADCAST_TAG,c1_e_event_ta);
          _sfEvent_ = c1_s_previousEvent;
        }
      } else {
        CV_STATE_EVAL(6,18,1);
      }
      if(_sfEvent_ == c1_event_e20) {
        CV_STATE_EVAL(6,19,2);
        {
          uint8_T c1_t_previousEvent;
          c1_t_previousEvent = _sfEvent_;
          _sfEvent_ = c1_e_event_fk;
          _SFD_CE_CALL(EVENT_ENTER_BROADCAST_FUNCTION_TAG,c1_e_event_fk);
          c1_uav5();
          _SFD_CE_CALL(EVENT_AFTER_BROADCAST_TAG,c1_e_event_fk);
          _sfEvent_ = c1_t_previousEvent;
        }
      } else {
        CV_STATE_EVAL(6,19,1);
      }
    }
    _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,6);
  }
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
}

static void c1_uav1(void)
{
  _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,19);
  if(chartInstance.c1_is_active_uav1 != 0) {
    if(CV_TRANSITION_EVAL(13U, (int32_T)_SFD_CCP_CALL(13,0,(_sfEvent_ ==
        c1_event_aa))) != 0) {
      if(sf_debug_transition_conflict_check_enabled()) {
        unsigned int transitionList[4];
        unsigned int numTransitions=1;
        transitionList[0] = 13;
        sf_debug_transition_conflict_check_begin();
        if(_sfEvent_ == c1_event_oa) {
          transitionList[numTransitions] = 22;
          numTransitions++;
        }
        if(_sfEvent_ == c1_event_ta) {
          transitionList[numTransitions] = 0;
          numTransitions++;
        }
        if(_sfEvent_ == c1_event_fk) {
          transitionList[numTransitions] = 9;
          numTransitions++;
        }
        sf_debug_transition_conflict_check_end();
        if(numTransitions>1) {
          _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
        }
      }
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,13);
      c1_exit_internal_uav1();
      if(chartInstance.c1_is_uav1 != c1_IN_ac_avoid) {
        chartInstance.c1_is_uav1 = (uint8_T)c1_IN_ac_avoid;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,20);
        chartInstance.c1_tp_ac_avoid = 1;
        chartInstance.c1_mode_count[0][0]++;
        _SFD_DATA_RANGE_CHECK(chartInstance.c1_mode_count[0][0], 0U);
      }
    } else if(CV_TRANSITION_EVAL(22U, (int32_T)_SFD_CCP_CALL(22,0,(_sfEvent_ ==
        c1_event_oa))) != 0) {
      if(sf_debug_transition_conflict_check_enabled()) {
        unsigned int transitionList[3];
        unsigned int numTransitions=1;
        transitionList[0] = 22;
        sf_debug_transition_conflict_check_begin();
        if(_sfEvent_ == c1_event_ta) {
          transitionList[numTransitions] = 0;
          numTransitions++;
        }
        if(_sfEvent_ == c1_event_fk) {
          transitionList[numTransitions] = 9;
          numTransitions++;
        }
        sf_debug_transition_conflict_check_end();
        if(numTransitions>1) {
          _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
        }
      }
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,22);
      c1_exit_internal_uav1();
      if(chartInstance.c1_is_uav1 != c1_IN_obs_avoid) {
        chartInstance.c1_is_uav1 = (uint8_T)c1_IN_obs_avoid;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,15);
        chartInstance.c1_tp_obs_avoid = 1;
        chartInstance.c1_mode_count[1][0]++;
        _SFD_DATA_RANGE_CHECK(chartInstance.c1_mode_count[1][0], 0U);
      }
    } else if(CV_TRANSITION_EVAL(0U, (int32_T)_SFD_CCP_CALL(0,0,(_sfEvent_ ==
        c1_event_ta))) != 0) {
      if(sf_debug_transition_conflict_check_enabled()) {
        unsigned int transitionList[2];
        unsigned int numTransitions=1;
        transitionList[0] = 0;
        sf_debug_transition_conflict_check_begin();
        if(_sfEvent_ == c1_event_fk) {
          transitionList[numTransitions] = 9;
          numTransitions++;
        }
        sf_debug_transition_conflict_check_end();
        if(numTransitions>1) {
          _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
        }
      }
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,0);
      c1_exit_internal_uav1();
      if(chartInstance.c1_is_uav1 != c1_IN_tgt_aquire) {
        chartInstance.c1_is_uav1 = (uint8_T)c1_IN_tgt_aquire;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,14);
        chartInstance.c1_tp_tgt_aquire = 1;
        chartInstance.c1_mode_count[2][0]++;
        _SFD_DATA_RANGE_CHECK(chartInstance.c1_mode_count[2][0], 0U);
      }
    } else if(CV_TRANSITION_EVAL(9U, (int32_T)_SFD_CCP_CALL(9,0,(_sfEvent_ ==
        c1_event_fk))) != 0) {
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,9);
      c1_exit_internal_uav1();
      if(chartInstance.c1_is_uav1 != c1_IN_form_keep) {
        chartInstance.c1_is_uav1 = (uint8_T)c1_IN_form_keep;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,9);
        chartInstance.c1_tp_form_keep = 1;
        chartInstance.c1_mode_count[3][0]++;
        _SFD_DATA_RANGE_CHECK(chartInstance.c1_mode_count[3][0], 0U);
      }
    } else {
      switch(chartInstance.c1_is_uav1) {
       case c1_IN_ac_avoid:
        CV_STATE_EVAL(19,0,1);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,20);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,20);
        break;
       case c1_IN_form_keep:
        CV_STATE_EVAL(19,0,2);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,9);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,9);
        break;
       case c1_IN_obs_avoid:
        CV_STATE_EVAL(19,0,3);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,15);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,15);
        break;
       case c1_IN_tgt_aquire:
        CV_STATE_EVAL(19,0,4);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,14);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,14);
        break;
       default:
        CV_STATE_EVAL(19,0,0);
        break;
      }
    }
  }
  _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,19);
}

static void c1_exit_internal_uav1(void)
{
  switch(chartInstance.c1_is_uav1) {
   case c1_IN_ac_avoid:
    CV_STATE_EVAL(19,1,1);
    chartInstance.c1_tp_ac_avoid = 0;
    chartInstance.c1_is_uav1 = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,20);
    break;
   case c1_IN_form_keep:
    CV_STATE_EVAL(19,1,2);
    chartInstance.c1_tp_form_keep = 0;
    chartInstance.c1_is_uav1 = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,9);
    break;
   case c1_IN_obs_avoid:
    CV_STATE_EVAL(19,1,3);
    chartInstance.c1_tp_obs_avoid = 0;
    chartInstance.c1_is_uav1 = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,15);
    break;
   case c1_IN_tgt_aquire:
    CV_STATE_EVAL(19,1,4);
    chartInstance.c1_tp_tgt_aquire = 0;
    chartInstance.c1_is_uav1 = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,14);
    break;
   default:
    CV_STATE_EVAL(19,1,0);
    break;
  }
}

static void c1_uav2(void)
{
  _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,24);
  if(chartInstance.c1_is_active_uav2 != 0) {
    if(CV_TRANSITION_EVAL(19U, (int32_T)_SFD_CCP_CALL(19,0,(_sfEvent_ ==
        c1_b_event_aa))) != 0) {
      if(sf_debug_transition_conflict_check_enabled()) {
        unsigned int transitionList[4];
        unsigned int numTransitions=1;
        transitionList[0] = 19;
        sf_debug_transition_conflict_check_begin();
        if(_sfEvent_ == c1_b_event_oa) {
          transitionList[numTransitions] = 23;
          numTransitions++;
        }
        if(_sfEvent_ == c1_b_event_ta) {
          transitionList[numTransitions] = 6;
          numTransitions++;
        }
        if(_sfEvent_ == c1_b_event_fk) {
          transitionList[numTransitions] = 7;
          numTransitions++;
        }
        sf_debug_transition_conflict_check_end();
        if(numTransitions>1) {
          _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
        }
      }
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,19);
      c1_exit_internal_uav2();
      if(chartInstance.c1_is_uav2 != c1_IN_ac_avoid) {
        chartInstance.c1_is_uav2 = (uint8_T)c1_IN_ac_avoid;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,18);
        chartInstance.c1_b_tp_ac_avoid = 1;
        chartInstance.c1_mode_count[0][1]++;
        _SFD_DATA_RANGE_CHECK(chartInstance.c1_mode_count[0][1], 0U);
      }
    } else if(CV_TRANSITION_EVAL(23U, (int32_T)_SFD_CCP_CALL(23,0,(_sfEvent_ ==
        c1_b_event_oa))) != 0) {
      if(sf_debug_transition_conflict_check_enabled()) {
        unsigned int transitionList[3];
        unsigned int numTransitions=1;
        transitionList[0] = 23;
        sf_debug_transition_conflict_check_begin();
        if(_sfEvent_ == c1_b_event_ta) {
          transitionList[numTransitions] = 6;
          numTransitions++;
        }
        if(_sfEvent_ == c1_b_event_fk) {
          transitionList[numTransitions] = 7;
          numTransitions++;
        }
        sf_debug_transition_conflict_check_end();
        if(numTransitions>1) {
          _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
        }
      }
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,23);
      c1_exit_internal_uav2();
      if(chartInstance.c1_is_uav2 != c1_IN_obs_avoid) {
        chartInstance.c1_is_uav2 = (uint8_T)c1_IN_obs_avoid;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,3);
        chartInstance.c1_b_tp_obs_avoid = 1;
        chartInstance.c1_mode_count[1][1]++;
        _SFD_DATA_RANGE_CHECK(chartInstance.c1_mode_count[1][1], 0U);
      }
    } else if(CV_TRANSITION_EVAL(6U, (int32_T)_SFD_CCP_CALL(6,0,(_sfEvent_ ==
        c1_b_event_ta))) != 0) {
      if(sf_debug_transition_conflict_check_enabled()) {
        unsigned int transitionList[2];
        unsigned int numTransitions=1;
        transitionList[0] = 6;
        sf_debug_transition_conflict_check_begin();
        if(_sfEvent_ == c1_b_event_fk) {
          transitionList[numTransitions] = 7;
          numTransitions++;
        }
        sf_debug_transition_conflict_check_end();
        if(numTransitions>1) {
          _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
        }
      }
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,6);
      c1_exit_internal_uav2();
      if(chartInstance.c1_is_uav2 != c1_IN_tgt_aquire) {
        chartInstance.c1_is_uav2 = (uint8_T)c1_IN_tgt_aquire;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,2);
        chartInstance.c1_b_tp_tgt_aquire = 1;
        chartInstance.c1_mode_count[2][1]++;
        _SFD_DATA_RANGE_CHECK(chartInstance.c1_mode_count[2][1], 0U);
      }
    } else if(CV_TRANSITION_EVAL(7U, (int32_T)_SFD_CCP_CALL(7,0,(_sfEvent_ ==
        c1_b_event_fk))) != 0) {
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,7);
      c1_exit_internal_uav2();
      if(chartInstance.c1_is_uav2 != c1_IN_form_keep) {
        chartInstance.c1_is_uav2 = (uint8_T)c1_IN_form_keep;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,13);
        chartInstance.c1_b_tp_form_keep = 1;
        chartInstance.c1_mode_count[3][1]++;
        _SFD_DATA_RANGE_CHECK(chartInstance.c1_mode_count[3][1], 0U);
      }
    } else {
      switch(chartInstance.c1_is_uav2) {
       case c1_IN_ac_avoid:
        CV_STATE_EVAL(24,0,1);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,18);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,18);
        break;
       case c1_IN_form_keep:
        CV_STATE_EVAL(24,0,2);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,13);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,13);
        break;
       case c1_IN_obs_avoid:
        CV_STATE_EVAL(24,0,3);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,3);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,3);
        break;
       case c1_IN_tgt_aquire:
        CV_STATE_EVAL(24,0,4);
        _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,2);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,2);
        break;
       default:
        CV_STATE_EVAL(24,0,0);
        break;
      }
    }
  }
  _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,24);
}

static void c1_exit_internal_uav2(void)
{
  switch(chartInstance.c1_is_uav2) {
   case c1_IN_ac_avoid:
    CV_STATE_EVAL(24,1,1);
    chartInstance.c1_b_tp_ac_avoid = 0;
    chartInstance.c1_is_uav2 = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,18);
    break;
   case c1_IN_form_keep:
    CV_STATE_EVAL(24,1,2);
    chartInstance.c1_b_tp_form_keep = 0;
    chartInstance.c1_is_uav2 = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,13);
    break;
   case c1_IN_obs_avoid:
    CV_STATE_EVAL(24,1,3);
    chartInstance.c1_b_tp_obs_avoid = 0;
    chartInstance.c1_is_uav2 = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,3);
    break;
   case c1_IN_tgt_aquire:
    CV_STATE_EVAL(24,1,4);
    chartInstance.c1_b_tp_tgt_aquire = 0;
    chartInstance.c1_is_uav2 = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
    _SFD_CS_CALL(STATE_INACTIVE_TAG,2);
    break;
   default:
    CV_STATE_EVAL(24,1,0);
    break;
  }
}

static void c1_uav3(void)
{
  _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,5);
  if(chartInstance.c1_is_active_uav3 != 0) {
    if(CV_TRANSITION_EVAL(12U, (int32_T)_SFD_CCP_CALL(12,0,(_sfEvent_ ==
        c1_c_event_aa))) != 0) {
      if(sf_debug_transition_conflict_check_enabled()) {
        unsigned int transitionList[4];
        unsigned int numTransitions=1;
        transitionList[0] = 12;
        sf_debug_transition_conflict_check_begin();
        if(_sfEvent_ == c1_c_event_oa) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -