31 #include "generated/flight_plan.h"
40 float test_cam_estimator_x;
41 float test_cam_estimator_y;
42 float test_cam_estimator_z;
43 float test_cam_estimator_phi;
44 float test_cam_estimator_theta;
45 float test_cam_estimator_hspeed_dir;
49 #ifdef CAM_PAN_NEUTRAL
50 #if (CAM_PAN_MAX == CAM_PAN_NEUTRAL)
51 #error CAM_PAN_MAX has to be different from CAM_PAN_NEUTRAL
53 #if (CAM_PAN_NEUTRAL == CAM_PAN_MIN)
54 #error CAM_PAN_MIN has to be different from CAM_PAN_NEUTRAL
59 #ifdef CAM_TILT_NEUTRAL
60 #if ((CAM_TILT_MAX) == (CAM_TILT_NEUTRAL))
61 #error CAM_TILT_MAX has to be different from CAM_TILT_NEUTRAL
63 #if (CAM_TILT_NEUTRAL == CAM_TILT_MIN)
64 #error CAM_TILT_MIN has to be different from CAM_TILT_NEUTRAL
70 #define CAM_PAN0 RadOfDeg(0)
76 #define CAM_TILT0 RadOfDeg(0)
88 #define CAM_MODE0 CAM_MODE_OFF
102 static void send_cam(
struct transport_tx *trans,
struct link_device *
dev)
108 pprz_msg_send_CAM(trans,
dev, AC_ID, &phi, &theta, &x, &y);
111 #ifdef SHOW_CAM_COORDINATES
112 static void send_cam_point(
struct transport_tx *trans,
struct link_device *
dev)
114 pprz_msg_send_CAM_POINT(trans,
dev, AC_ID,
115 &cam_point_distance_from_home, &cam_point_lat, &cam_point_lon);
124 #ifdef SHOW_CAM_COORDINATES
131 #if defined(CAM_FIXED_FOR_FPV_IN_AUTO1) && CAM_FIXED_FOR_FPV_IN_AUTO1 == 1
171 #if defined(CAM_FIXED_FOR_FPV_IN_AUTO1) && CAM_FIXED_FOR_FPV_IN_AUTO1 == 1
175 #if defined(CAM_TILT_POSITION_FOR_FPV)
176 cam_tilt_c = RadOfDeg(CAM_TILT_POSITION_FOR_FPV);
180 #if defined(CAM_PAN_POSITION_FOR_FPV)
181 cam_pan_c = RadOfDeg(CAM_PAN_POSITION_FOR_FPV);
186 #ifdef SHOW_CAM_COORDINATES
189 cam_point_distance_from_home = 0;
195 #if defined(COMMAND_CAM_PWR_SW)
196 if (video_tx_state) { command_set(COMMAND_CAM_PWR_SW,
MAX_PPRZ); }
else { command_set(COMMAND_CAM_PWR_SW,
MIN_PPRZ); }
197 #elif defined(VIDEO_TX_SWITCH)
198 if (video_tx_state) {
LED_OFF(VIDEO_TX_SWITCH); }
else {
LED_ON(VIDEO_TX_SWITCH); }
223 #ifdef CAM_PAN_NEUTRAL
224 float pan_diff =
cam_pan_c - RadOfDeg(CAM_PAN_NEUTRAL);
234 #ifdef CAM_TILT_NEUTRAL
235 float tilt_diff =
cam_tilt_c - RadOfDeg(CAM_TILT_NEUTRAL);
252 #ifdef COMMAND_CAM_PAN
253 command_set(COMMAND_CAM_PAN, cam_pan);
255 #ifdef COMMAND_CAM_TILT
256 command_set(COMMAND_CAM_TILT, cam_tilt);
264 vPoint(test_cam_estimator_x, test_cam_estimator_y, test_cam_estimator_z,
265 test_cam_estimator_phi, test_cam_estimator_theta, test_cam_estimator_hspeed_dir,
uint8_t autopilot_get_mode(void)
get autopilot mode
Core autopilot interface common to all firmwares.
void cam_periodic(void)
For CAM_MODE_AC_TARGET mode.
static void send_cam(struct transport_tx *trans, struct link_device *dev)
void cam_angles(void)
Computes the servo values from cam_pan_c and cam_tilt_c.
uint8_t cam_target_wp
For CAM_MODE_XY_TARGET mode.
void cam_waypoint_target(void)
uint8_t cam_target_ac
For CAM_MODE_WP_TARGET mode.
void cam_nadir(void)
Point straight down.
void cam_target(void)
Computes the right angles from target_x, target_y, target_alt.
float cam_target_x
Radians, for CAM_MODE_ANGLES mode.
#define CAM_MODE_XY_TARGET
#define CAM_MODE_STABILIZED
#define CAM_MODE_AC_TARGET
#define CAM_MODE_WP_TARGET
float ground_alt
size == nb_waypoint, waypoint 0 is a dummy waypoint
const uint8_t nb_waypoint
static struct EnuCoor_f * acInfoGetPositionEnu_f(uint8_t ac_id)
Get position in local ENU coordinates (float).
static struct UtmCoor_f * acInfoGetPositionUtm_f(uint8_t ac_id)
Get position from UTM coordinates (float).
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
static float stateGetHorizontalSpeedDir_f(void)
Get dir of horizontal ground speed (float).
void vPoint(float fPlaneEast, float fPlaneNorth, float fPlaneAltitude, float fRollAngle, float fPitchAngle, float fYawAngle, float fObjectEast, float fObjectNorth, float fAltitude, float *fPan, float *fTilt)
float alt
in meters (above WGS84 reference ellipsoid or above MSL)
vector in East North Up coordinates Units: meters
API to get/set the generic vehicle states.
static const struct usb_device_descriptor dev
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.