示例#1
0
STATIC_INLINE void handle_periodic_tasks(void)
{
  if (sys_time_check_and_ack_timer(main_periodic_tid)) {
    main_periodic();
  }
  if (sys_time_check_and_ack_timer(modules_tid)) {
    modules_periodic_task();
  }
  if (sys_time_check_and_ack_timer(radio_control_tid)) {
    radio_control_periodic_task();
  }
  if (sys_time_check_and_ack_timer(failsafe_tid)) {
    failsafe_check();
  }
  if (sys_time_check_and_ack_timer(electrical_tid)) {
    electrical_periodic();
  }
  if (sys_time_check_and_ack_timer(telemetry_tid)) {
    telemetry_periodic();
  }
#if USE_BARO_BOARD
  if (sys_time_check_and_ack_timer(baro_tid)) {
    baro_periodic();
  }
#endif
}
示例#2
0
文件: main_fbw.c 项目: AshuLara/lisa
/************* PERIODIC ******************************************************/
void periodic_task_fbw( void ) {
  static uint8_t _10Hz; /* FIXME : sys_time should provide it */
  _10Hz++;
  if (_10Hz >= 6) _10Hz = 0;

#ifdef RADIO_CONTROL
  radio_control_periodic_task();
  if (fbw_mode == FBW_MODE_MANUAL && radio_control.status == RC_REALLY_LOST) {
    fbw_mode = FBW_MODE_AUTO;
  }
#endif

#ifdef INTER_MCU
  inter_mcu_periodic_task();
  if (fbw_mode == FBW_MODE_AUTO && !ap_ok)
  {
    set_failsafe_mode();
  }
#endif

#ifdef DOWNLINK
  fbw_downlink_periodic_task();
#endif

  if (!_10Hz) {
    electrical_periodic();
  }

}
示例#3
0
void radio_control_periodic_handle(void)
{
    radio_control_periodic_task();
    if (fbw_mode == FBW_MODE_MANUAL && radio_control.status == RC_REALLY_LOST) {
        radio_lost_mode();
    }
}
示例#4
0
/************* PERIODIC ******************************************************/
void periodic_task_fbw( void ) {

#ifdef RADIO_CONTROL
  radio_control_periodic_task();
  if (fbw_mode == FBW_MODE_MANUAL && radio_control.status == RC_REALLY_LOST) {
#ifdef OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP
#warning WARNING DANGER: OUTBACK_CHALLENGE RULE RC_LOST_NO_AP defined. If you loose RC you will NOT go to automatically go to AUTO2 Anymore!!
set_failsafe_mode();
#else
    fbw_mode = FBW_MODE_AUTO;
#endif
  }
#endif

#ifdef INTER_MCU
  inter_mcu_periodic_task();
  if (fbw_mode == FBW_MODE_AUTO && !ap_ok)
  {
    set_failsafe_mode();
  }
#endif

#ifdef MCU_UART_LINK
  inter_mcu_fill_fbw_state();
  link_mcu_periodic_task();
#endif

#ifdef DOWNLINK
  fbw_downlink_periodic_task();
#endif

}
示例#5
0
STATIC_INLINE void handle_periodic_tasks(void)
{
    if (sys_time_check_and_ack_timer(main_periodic_tid)) {
        main_periodic();
#if PERIODIC_FREQUENCY == MODULES_FREQUENCY
        /* Use the main periodc freq timer for modules if the freqs are the same
         * This is mainly useful for logging each step.
         */
        modules_periodic_task();
#else
    }
    /* separate timer for modules, since it has a different freq than main */
    if (sys_time_check_and_ack_timer(modules_tid)) {
        modules_periodic_task();
#endif
    }
    if (sys_time_check_and_ack_timer(radio_control_tid)) {
        radio_control_periodic_task();
    }
    if (sys_time_check_and_ack_timer(failsafe_tid)) {
        failsafe_check();
    }
    if (sys_time_check_and_ack_timer(electrical_tid)) {
        electrical_periodic();
    }
    if (sys_time_check_and_ack_timer(telemetry_tid)) {
        telemetry_periodic();
    }
#if USE_BARO_BOARD
    if (sys_time_check_and_ack_timer(baro_tid)) {
        baro_periodic();
    }
#endif
}
示例#6
0
static void csc_main_periodic( void )
{
  PeriodicSendAp(DefaultChannel);
  radio_control_periodic_task();

  cpu_time++;
}
示例#7
0
/************* PERIODIC ******************************************************/
void periodic_task_fbw( void ) {
  static uint8_t _10Hz; /* FIXME : sys_time should provide it */
  _10Hz++;
  if (_10Hz >= 6) _10Hz = 0;

#ifdef RADIO_CONTROL
  radio_control_periodic_task();
  if (radio_control.status == RC_REALLY_LOST)
  {
    fbw_mode = fbw_rc_really_lost_mode;
//    pprz_mode= PPRZ_MODE_HOME;
  }
  if (fbw_mode == FBW_MODE_FAILSAFE)
    set_failsafe_mode();
  if (fbw_mode == FBW_MODE_MANUAL && radio_control.status == RC_REALLY_LOST) {
    fbw_mode = FBW_MODE_AUTO;
  }
#endif
/*if (radio_control.status == RC_REALLY_LOST)
{
   fbw_mode = FBW_MODE_FAILSAFE;
   set_failsafe_mode();
}*/
if (radio_control.status==RC_OK)
{
   if (pprz_mode == PPRZ_MODE_MANUAL)
   {
     fbw_mode = FBW_MODE_MANUAL;
   }
   else
   {
     if ((pprz_mode == PPRZ_MODE_AUTO1) || (pprz_mode == PPRZ_MODE_AUTO2))
       fbw_mode = FBW_MODE_AUTO;
   }
}
   

#ifdef INTER_MCU
  inter_mcu_periodic_task();
  if (fbw_mode == FBW_MODE_AUTO && !ap_ok)
    set_failsafe_mode();
#endif
#ifdef DOWNLINK
  fbw_downlink_periodic_task();
#endif

  if (!_10Hz) {
    electrical_periodic();
  }

#ifdef ACTUATORS
  #ifdef USE_RC_GYRO
  if ((fbw_mode == FBW_MODE_MANUAL) || (fbw_mode==FBW_MODE_AUTO))
  {
    rc_gyro_apply_damping(commands);
    SetActuatorsFromCommands(rc_gyro_damped_commands)
  }
示例#8
0
文件: main.c 项目: BrandoJS/paparazzi
STATIC_INLINE void handle_periodic_tasks( void ) {
  if (sys_time_check_and_ack_timer(main_periodic_tid))
    main_periodic();
  if (sys_time_check_and_ack_timer(radio_control_tid))
    radio_control_periodic_task();
  if (sys_time_check_and_ack_timer(failsafe_tid))
    failsafe_check();
  if (sys_time_check_and_ack_timer(electrical_tid))
    electrical_periodic();
  if (sys_time_check_and_ack_timer(baro_tid))
    baro_periodic();
  if (sys_time_check_and_ack_timer(telemetry_tid))
    telemetry_periodic();
}
示例#9
0
int main(void)
{

  main_init();
  while (1) {
    if (sys_time_check_and_ack_timer(main_periodic_tid)) {
      main_periodic();
    }
    if (sys_time_check_and_ack_timer(radio_control_tid)) {
      radio_control_periodic_task();
    }
    main_event();
  };
  return 0;
}
示例#10
0
/************* PERIODIC ******************************************************/
void periodic_task_rctx( void ) {
  static uint8_t _10Hz = 0;
  static uint8_t _1Hz = 0;

  _10Hz++;
  if (_10Hz >= 6) _10Hz = 0;
  _1Hz++;
  if (_1Hz>=60) _1Hz=0;

#ifdef RADIO_CONTROL
  radio_control_periodic_task();
#endif

#ifdef DOWNLINK
// TODO: needed?  fbw_downlink_periodic_task();
#endif

#ifdef ADC
  if (!_10Hz)
    rctx_vsupply_decivolt = VoltageOfAdc((10*(vsupply_adc_buf.sum/vsupply_adc_buf.av_nb_sample)));

  if (!_1Hz) {
    static uint8_t t = 0;
    if (rctx_vsupply_decivolt < LOW_BATTERY_DECIVOLT) {
      t++;
    } else {
      t = 0;
      rctx_under_voltage = 0;
    }
    if (t >= LOW_BATTERY_DELAY) {
      LED_TOGGLE(1);
      rctx_under_voltage = 1;
    }

    if (0)
    // TODO: send (here) only in auto2
    {
      DOWNLINK_SEND_RC_3CH(
            &rctx_mode,
            &rc_values[RADIO_THROTTLE],
            &rc_values[RADIO_ROLL],
            &rc_values[RADIO_PITCH]);
    }
  }
#endif
}
示例#11
0
/************* PERIODIC ******************************************************/
void periodic_task_fbw(void)
{

#ifdef FBW_DATALINK
  fbw_datalink_periodic();
#endif

#ifdef RADIO_CONTROL
  radio_control_periodic_task();
  if (fbw_mode == FBW_MODE_MANUAL && radio_control.status == RC_REALLY_LOST) {
#if OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP
#warning WARNING DANGER: OUTBACK_CHALLENGE RULE RC_LOST_NO_AP defined. If you loose RC you will NOT go to automatically go to AUTO2 Anymore!!
    set_failsafe_mode();
#if OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP_IRREVERSIBLE
#warning WARNING DANGER: OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP_IRREVERSIBLE defined. If you ever temporarly lost RC while in manual, you will failsafe forever even if RC is restored
    commands[COMMAND_FORCECRASH] = 9600;
#endif
#else
    fbw_mode = FBW_MODE_AUTO;
#endif
  }
#endif

#ifdef INTER_MCU
  inter_mcu_periodic_task();
  if (fbw_mode == FBW_MODE_AUTO && !ap_ok) {
    set_failsafe_mode();
  }
#endif

#ifdef MCU_UART_LINK
  inter_mcu_fill_fbw_state();
  link_mcu_periodic_task();
#endif

#ifdef MCU_CAN_LINK
  inter_mcu_fill_fbw_state();
  link_mcu_periodic_task();
#endif

#if PERIODIC_TELEMETRY
  periodic_telemetry_send_Fbw(&(DefaultChannel).trans_tx, &(DefaultDevice).device);
#endif

}
示例#12
0
STATIC_INLINE void handle_periodic_tasks(void)
{
  if (sys_time_check_and_ack_timer(main_periodic_tid)) {
    main_periodic();
  }
  if (sys_time_check_and_ack_timer(modules_tid)) {
    modules_periodic_task();
  }
  if (sys_time_check_and_ack_timer(radio_control_tid)) {
    radio_control_periodic_task();
  }
  if (sys_time_check_and_ack_timer(electrical_tid)) {
    electrical_periodic();
  }
  if (sys_time_check_and_ack_timer(telemetry_tid)) {
    telemetry_periodic();
  }
}
示例#13
0
STATIC_INLINE void main_periodic( void ) {

  imu_periodic();

  /* run control loops */
  autopilot_periodic();
  /* set actuators     */
  actuators_set(autopilot_motors_on);

  PeriodicPrescaleBy10(                                     \
    {                                                       \
      radio_control_periodic_task();                        \
      if (radio_control.status != RC_OK &&                  \
          autopilot_mode != AP_MODE_KILL &&                 \
          autopilot_mode != AP_MODE_NAV)                    \
        autopilot_set_mode(AP_MODE_FAILSAFE);               \
    },                                                      \
    {                                                       \
      /* booz_fms_periodic(); FIXME */                      \
    },                                                      \
    {                                                       \
示例#14
0
/************* PERIODIC ******************************************************/
void periodic_task_fbw( void ) {
  static uint8_t _10Hz; /* FIXME : sys_time should provide it */
  _10Hz++;
  if (_10Hz >= 6) _10Hz = 0;

#ifdef RADIO_CONTROL
  radio_control_periodic_task();
  if (fbw_mode == FBW_MODE_MANUAL && rc_status == RC_REALLY_LOST) {
    fbw_mode = FBW_MODE_AUTO;
  }
#endif

#ifdef INTER_MCU
  inter_mcu_periodic_task();
  if (fbw_mode == FBW_MODE_AUTO && !ap_ok)
    set_failsafe_mode();
#endif

#ifdef DOWNLINK
  fbw_downlink_periodic_task();
#endif

#ifdef ADC
  if (!_10Hz)
    fbw_vsupply_decivolt = VoltageOfAdc((10*(vsupply_adc_buf.sum/vsupply_adc_buf.av_nb_sample)));
#endif

#ifdef ACTUATORS
#ifdef CTL_GRZ
  if (rc_status == RC_REALLY_LOST) {
    set_failsafe_mode();
  } else {
    ctl_grz_rate_run();
  }
#endif /* CTL_GRZ */
  SetActuatorsFromCommands(commands);
#endif


}
示例#15
0
/************* PERIODIC ******************************************************/
void periodic_task_fbw( void ) {

#ifdef RADIO_CONTROL
  radio_control_periodic_task();
  if (fbw_mode == FBW_MODE_MANUAL && radio_control.status == RC_REALLY_LOST) {
    fbw_mode = FBW_MODE_AUTO;
  }
#endif

#ifdef INTER_MCU
  inter_mcu_periodic_task();
  if (fbw_mode == FBW_MODE_AUTO && !ap_ok)
  {
    set_failsafe_mode();
  }
#endif

#ifdef DOWNLINK
  fbw_downlink_periodic_task();
#endif

}