Ejemplo n.º 1
0
STATIC_INLINE void main_periodic(void)
{

#if USE_IMU
  imu_periodic();
#endif

  //FIXME: temporary hack, remove me
#ifdef InsPeriodic
  InsPeriodic();
#endif

  /* run control loops */
  autopilot_periodic();
  /* set actuators     */
  //actuators_set(autopilot_motors_on);
  SetActuatorsFromCommands(commands, autopilot_mode);

  if (autopilot_in_flight) {
    RunOnceEvery(PERIODIC_FREQUENCY, autopilot_flight_time++);
  }

#if defined DATALINK || defined SITL
  RunOnceEvery(PERIODIC_FREQUENCY, datalink_time++);
#endif

  RunOnceEvery(10, LED_PERIODIC());
}
Ejemplo n.º 2
0
STATIC_INLINE void main_periodic(void)
{
#if INTER_MCU_AP
    /* Inter-MCU watchdog */
    intermcu_periodic();
#endif

    /* run control loops */
    autopilot_periodic();
    /* set actuators     */
    //actuators_set(autopilot_motors_on);
#ifndef INTER_MCU_AP
    SetActuatorsFromCommands(commands, autopilot_mode);
#else
    intermcu_set_actuators(commands, autopilot_mode);
#endif

    if (autopilot_in_flight) {
        RunOnceEvery(PERIODIC_FREQUENCY, autopilot_flight_time++);
    }

#if defined DATALINK || defined SITL
    RunOnceEvery(PERIODIC_FREQUENCY, datalink_time++);
#endif

    RunOnceEvery(10, LED_PERIODIC());
}
Ejemplo n.º 3
0
static inline void autopilot_main_periodic( void ) {
  static uint8_t _cnt = 0;

  /* read analog baro */
  analog_periodic_task();
  altimeter_periodic_task();

  /* read imu */
  imu_periodic_task();

  /* run control loops */
  autopilot_periodic();
  /* set actuators     */
  autopilot_set_actuators();

  /* Run the following tasks 10x times slower than the periodic rate */
  _cnt++;
  if (_cnt >= 10)
    _cnt = 0;
  switch (_cnt)
  {
    case 0:
        rc_periodic_task();
        if (rc_status == RC_OK) {
            led_on(LED_RC);
        } else {
            led_off(LED_RC);
            autopilot_set_mode(AP_MODE_FAILSAFE);
        }
        break;
    case 1:
        comm_periodic_task(COMM_TELEMETRY);
#if !HARDWARE_ENABLED_GPS
        comm_periodic_task(COMM_0);
#endif
        break;
    case 2:
        fms_periodic_task();
        break;
#if BOMB_ENABLED
    case 3:
        bomb_periodic_task();
        break;
#endif
  }

  /* flash leds... */
  led_periodic_task();

  if (ahrs_status == STATUS_INITIALIZING) {
    RunOnceEvery(50, {
      led_toggle(LED_AHRS);
    });
Ejemplo n.º 4
0
STATIC_INLINE void main_periodic( void ) {

  imu_periodic();

  /* run control loops */
  autopilot_periodic();
  /* set actuators     */
  //actuators_set(autopilot_motors_on);
  SetActuatorsFromCommands(commands, autopilot_mode);

  if (autopilot_in_flight) {
    RunOnceEvery(PERIODIC_FREQUENCY, { autopilot_flight_time++; datalink_time++; });
  }
Ejemplo n.º 5
0
STATIC_INLINE void main_periodic( void ) {

  imu_periodic();

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

  modules_periodic_task();

  if (autopilot_in_flight) {
    RunOnceEvery(PERIODIC_FREQUENCY, { autopilot_flight_time++; datalink_time++; });
  }
Ejemplo n.º 6
0
value sim_periodic_task(value unit)
{
  sensors_task();
#if USE_GENERATED_AUTOPILOT
  autopilot_periodic();
#else
  attitude_loop();
#endif
  reporting_task();
  modules_periodic_task();
  periodic_task_fbw();
  electrical_periodic();
  event_task_ap();
  event_task_fbw();
  return unit;
}
static inline void main_periodic(void) {
	uint16_t v1 = 123;
	uint16_t v2 = 123;

  imu_periodic();
#ifdef PASSTHROUGH_CYGNUS
	autopilot_periodic();
#endif
	OveroLinkPeriodic(on_overo_link_lost);

	RunOnceEvery(10, {
			LED_PERIODIC();
			DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
			radio_control_periodic();
			check_radio_lost();
			DOWNLINK_SEND_BARO_RAW(DefaultChannel, &baro.absolute, &baro.differential);
		});
Ejemplo n.º 8
0
void handle_periodic_tasks_ap(void)
{

  if (sys_time_check_and_ack_timer(sensors_tid)) {
    sensors_task();
  }

#if USE_BARO_BOARD
  if (sys_time_check_and_ack_timer(baro_tid)) {
    baro_periodic();
  }
#endif

#if USE_GENERATED_AUTOPILOT
  if (sys_time_check_and_ack_timer(attitude_tid)) {
    autopilot_periodic();
  }
#else
  // static autopilot
  if (sys_time_check_and_ack_timer(navigation_tid)) {
    navigation_task();
  }

#ifndef AHRS_TRIGGERED_ATTITUDE_LOOP
  if (sys_time_check_and_ack_timer(attitude_tid)) {
    attitude_loop();
  }
#endif

#endif

  if (sys_time_check_and_ack_timer(modules_tid)) {
    modules_periodic_task();
  }

  if (sys_time_check_and_ack_timer(monitor_tid)) {
    monitor_task();
  }

  if (sys_time_check_and_ack_timer(telemetry_tid)) {
    reporting_task();
    LED_PERIODIC();
  }

}
Ejemplo n.º 9
0
void main_periodic(void)
{
  /* run control loops */
  autopilot_periodic();
  /* set actuators     */
  //actuators_set(autopilot_get_motors_on());
  SetActuatorsFromCommands(commands, autopilot_get_mode());

  if (autopilot_in_flight()) {
    RunOnceEvery(PERIODIC_FREQUENCY, autopilot.flight_time++);
  }

#if defined DATALINK || defined SITL
  RunOnceEvery(PERIODIC_FREQUENCY, datalink_time++);
#endif

  RunOnceEvery(10, LED_PERIODIC());
}
Ejemplo n.º 10
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 */                      \
    },                                                      \
    {                                                       \