30 #include "autopilot.h"
31 #include "generated/flight_plan.h"
41 float test_cam_estimator_x;
42 float test_cam_estimator_y;
43 float test_cam_estimator_z;
44 float test_cam_estimator_phi;
45 float test_cam_estimator_theta;
46 float test_cam_estimator_hspeed_dir;
50 #ifdef CAM_PAN_NEUTRAL
51 #if (CAM_PAN_MAX == CAM_PAN_NEUTRAL)
52 #error CAM_PAN_MAX has to be different from CAM_PAN_NEUTRAL
54 #if (CAM_PAN_NEUTRAL == CAM_PAN_MIN)
55 #error CAM_PAN_MIN has to be different from CAM_PAN_NEUTRAL
60 #ifdef CAM_TILT_NEUTRAL
61 #if ((CAM_TILT_MAX) == (CAM_TILT_NEUTRAL))
62 #error CAM_TILT_MAX has to be different from CAM_TILT_NEUTRAL
64 #if (CAM_TILT_NEUTRAL == CAM_TILT_MIN)
65 #error CAM_TILT_MIN has to be different from CAM_TILT_NEUTRAL
71 #define CAM_PAN0 RadOfDeg(0)
77 #define CAM_TILT0 RadOfDeg(0)
89 #define CAM_MODE0 CAM_MODE_OFF
109 pprz_msg_send_CAM(trans, dev, AC_ID, &phi, &theta, &x, &y);
112 #ifdef SHOW_CAM_COORDINATES
115 pprz_msg_send_CAM_POINT(trans, dev, AC_ID,
116 &cam_point_distance_from_home, &cam_point_lat, &cam_point_lon);
125 #ifdef SHOW_CAM_COORDINATES
132 #if defined(CAM_FIXED_FOR_FPV_IN_AUTO1) && CAM_FIXED_FOR_FPV_IN_AUTO1 == 1
172 #if defined(CAM_FIXED_FOR_FPV_IN_AUTO1) && CAM_FIXED_FOR_FPV_IN_AUTO1 == 1
176 #if defined(CAM_TILT_POSITION_FOR_FPV)
177 cam_tilt_c = RadOfDeg(CAM_TILT_POSITION_FOR_FPV);
181 #if defined(CAM_PAN_POSITION_FOR_FPV)
182 cam_pan_c = RadOfDeg(CAM_PAN_POSITION_FOR_FPV);
187 #ifdef SHOW_CAM_COORDINATES
190 cam_point_distance_from_home = 0;
196 #if defined(COMMAND_CAM_PWR_SW)
198 #elif defined(VIDEO_TX_SWITCH)
199 if (video_tx_state) {
LED_OFF(VIDEO_TX_SWITCH); }
else {
LED_ON(VIDEO_TX_SWITCH); }
224 #ifdef CAM_PAN_NEUTRAL
225 float pan_diff =
cam_pan_c - RadOfDeg(CAM_PAN_NEUTRAL);
235 #ifdef CAM_TILT_NEUTRAL
236 float tilt_diff =
cam_tilt_c - RadOfDeg(CAM_TILT_NEUTRAL);
253 #ifdef COMMAND_CAM_PAN
254 ap_state->commands[COMMAND_CAM_PAN] = cam_pan;
256 #ifdef COMMAND_CAM_TILT
257 ap_state->commands[COMMAND_CAM_TILT] = cam_tilt;
265 vPoint(test_cam_estimator_x, test_cam_estimator_y, test_cam_estimator_z,
266 test_cam_estimator_phi, test_cam_estimator_theta, test_cam_estimator_hspeed_dir,
314 #endif // TRAFFIC_INFO
void cam_waypoint_target(void)
Generic transmission transport header.
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
float ground_alt
size == nb_waypoint, waypoint 0 is a dummy waypoint
Periodic telemetry system header (includes downlink utility and generated code).
vector in East North Up coordinates Units: meters
float cam_target_x
Radians, for CAM_MODE_ANGLES mode.
#define CAM_MODE_STABILIZED
#define CAM_MODE_XY_TARGET
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
struct ac_info_ * get_ac_info(uint8_t id)
struct ap_state * ap_state
void cam_periodic(void)
For CAM_MODE_AC_TARGET mode.
#define DefaultPeriodic
Set default periodic telemetry.
void cam_target(void)
Computes the right angles from target_x, target_y, target_alt.
const uint8_t nb_waypoint
static const struct usb_device_descriptor dev
uint8_t cam_target_wp
For CAM_MODE_XY_TARGET mode.
void vPoint(float fPlaneEast, float fPlaneNorth, float fPlaneAltitude, float fRollAngle, float fPitchAngle, float fYawAngle, float fObjectEast, float fObjectNorth, float fAltitude, float *fPan, float *fTilt)
static float stateGetHorizontalSpeedDir_f(void)
Get dir of horizontal ground speed (float).
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
API to get/set the generic vehicle states.
uint8_t cam_target_ac
For CAM_MODE_WP_TARGET mode.
#define CAM_MODE_WP_TARGET
void cam_angles(void)
Computes the servo values from cam_pan_c and cam_tilt_c.
static void send_cam(struct transport_tx *trans, struct link_device *dev)
#define CAM_MODE_AC_TARGET
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Information relative to the other aircrafts.
void cam_nadir(void)
Point straight down.