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) { imcu_set_command(COMMAND_CAM_PWR_SW,
MAX_PPRZ); }
else { imcu_set_command(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 imcu_set_command(COMMAND_CAM_PAN, cam_pan);
255 #ifdef COMMAND_CAM_TILT
256 imcu_set_command(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,
318 #endif // TRAFFIC_INFO
static struct UtmCoor_f * acInfoGetPositionUtm_f(uint8_t ac_id)
Get position from UTM coordinates (float).
void cam_waypoint_target(void)
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
float alt
in meters (above WGS84 reference ellipsoid or above MSL)
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).
static struct EnuCoor_f * acInfoGetPositionEnu_f(uint8_t ac_id)
Get position in local ENU coordinates (float).
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.
Core autopilot interface common to all firmwares.
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.
uint8_t autopilot_get_mode(void)
get autopilot mode
void cam_nadir(void)
Point straight down.