Exemplo n.º 1
0
void cam_periodic( void ) {
  ap_state->commands[COMMAND_CAM_SWITCH] = -9600+(pprz_t)cam_switch*19200;
  
  switch (cam_mode) {
  case CAM_MODE_OFF:
    break;
  case CAM_MODE_ANGLES:
    cam_angles();
    break;
  case CAM_MODE_NADIR:
    cam_nadir();
    break;
  case CAM_MODE_XY_TARGET:
    cam_target();
    break;
  case CAM_MODE_WP_TARGET:
    cam_waypoint_target();
    break;
  case CAM_MODE_AC_TARGET:
    cam_ac_target();
    break;
  }
}
Exemplo n.º 2
0
void cam_periodic(void)
{
#if defined(CAM_FIXED_FOR_FPV_IN_AUTO1) && CAM_FIXED_FOR_FPV_IN_AUTO1 == 1
  //Position the camera for straight view.
  if (pprz_mode == PPRZ_MODE_AUTO2) {
#endif
    switch (cam_mode) {
      case CAM_MODE_OFF:
        cam_pan_c = RadOfDeg(CAM_PAN0);
        cam_tilt_c = RadOfDeg(CAM_TILT0);
        cam_angles();
        break;
      case CAM_MODE_ANGLES:
        cam_angles();
        break;
      case CAM_MODE_NADIR:
        cam_nadir();
        break;
      case CAM_MODE_XY_TARGET:
        cam_target();
        break;
      case CAM_MODE_WP_TARGET:
        cam_waypoint_target();
        break;
      case CAM_MODE_AC_TARGET:
        cam_ac_target();
        break;
        // In this mode the target coordinates are calculated continuously from the pan and tilt radio channels.
        // The "TARGET" waypoint coordinates are not used.
        // If the "-DSHOW_CAM_COORDINATES" is defined then the coordinates of where the camera is looking are calculated.
      case CAM_MODE_STABILIZED:
        cam_waypoint_target();
        break;
        // In this mode the angles come from the pan and tilt radio channels.
        // The "TARGET" waypoint coordinates are not used but i need to call the "cam_waypoint_target()" function
        // in order to calculate the coordinates of where the camera is looking.
      case CAM_MODE_RC:
        cam_waypoint_target();
        break;
      default:
        break;
    }
#if defined(CAM_FIXED_FOR_FPV_IN_AUTO1) && CAM_FIXED_FOR_FPV_IN_AUTO1 == 1
  } else if (pprz_mode == PPRZ_MODE_AUTO1) {
    //Position the camera for straight view.

#if defined(CAM_TILT_POSITION_FOR_FPV)
    cam_tilt_c = RadOfDeg(CAM_TILT_POSITION_FOR_FPV);
#else
    cam_tilt_c = RadOfDeg(90);
#endif
#if defined(CAM_PAN_POSITION_FOR_FPV)
    cam_pan_c = RadOfDeg(CAM_PAN_POSITION_FOR_FPV);
#else
    cam_pan_c = RadOfDeg(0);
#endif
    cam_angles();
#ifdef SHOW_CAM_COORDINATES
    cam_point_lon = 0;
    cam_point_lat = 0;
    cam_point_distance_from_home = 0;
#endif
  }
#endif


#if defined(COMMAND_CAM_PWR_SW)
  if (video_tx_state) { ap_state->commands[COMMAND_CAM_PWR_SW] = MAX_PPRZ; } else { ap_state->commands[COMMAND_CAM_PWR_SW] = MIN_PPRZ; }
#elif defined(VIDEO_TX_SWITCH)
  if (video_tx_state) { LED_OFF(VIDEO_TX_SWITCH); } else { LED_ON(VIDEO_TX_SWITCH); }
#endif
}