42 #include "generated/airframe.h"
47 #ifndef OPTICFLOW_AGL_ID
48 #define OPTICFLOW_AGL_ID ABI_BROADCAST
53 #define OPTICFLOW_FPS 0
56 #ifndef OPTICFLOW_FPS_CAMERA2
57 #define OPTICFLOW_FPS_CAMERA2 0
62 #ifdef OPTICFLOW_CAMERA2
63 #define ACTIVE_CAMERAS 2
65 #define ACTIVE_CAMERAS 1
79 #if PERIODIC_TELEMETRY
89 for (
int idx_camera = 0; idx_camera <
ACTIVE_CAMERAS; idx_camera++) {
91 pprz_msg_send_OPTIC_FLOW_EST(trans,
dev, AC_ID,
113 for (
int idx_camera = 0; idx_camera <
ACTIVE_CAMERAS; idx_camera++) {
119 #ifdef OPTICFLOW_CAMERA2
123 #if PERIODIC_TELEMETRY
137 for (
int idx_camera = 0; idx_camera <
ACTIVE_CAMERAS; idx_camera++) {
Main include for ABI (AirBorneInterface).
#define FLOW_OPTICFLOW_ID
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps, uint8_t id)
Computer vision framework for onboard processing.
uint32_t pprz_ts
The timestamp in us since system startup.
struct FloatEulers eulers
Euler Angles at time of image.
float div_size
Divergence as determined with the size_divergence script.
float surface_roughness
Surface roughness as determined with a linear optical flow fit.
float divergence
Divergence as determined with a linear flow fit.
float noise_measurement
noise of measurement, for state filter
struct FloatVect3 vel_body
The velocity in body frame (m/s) with X positive to the front of the aircraft, Y positive to the righ...
uint8_t camera_id
Camera id as passed to cv_add_to_device.
Encode images with the use of the JPEG encoding.
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
void opticflow_calc_init(struct opticflow_t opticflow[])
Initialize the opticflow calculator.
bool opticflow_calc_frame(struct opticflow_t *opticflow, struct image_t *img, struct opticflow_result_t *result)
Run the optical flow on a new image frame.
static struct opticflow_result_t opticflow_result[ACTIVE_CAMERAS]
The opticflow result.
static pthread_mutex_t opticflow_mutex
Mutex lock fo thread safety.
#define OPTICFLOW_AGL_ID
Default sonar/agl to use in opticflow visual_estimator.
#define OPTICFLOW_FPS_CAMERA2
Default FPS (zero means run at camera fps)
void opticflow_module_init(void)
Initialize the optical flow module for the bottom camera.
static void opticflow_telem_send(struct transport_tx *trans, struct link_device *dev)
Send optical flow telemetry information.
struct opticflow_t opticflow[ACTIVE_CAMERAS]
Opticflow calculations.
void opticflow_module_run(void)
Update the optical flow state for the calculation thread and update the stabilization loops with the ...
static bool opticflow_got_result[ACTIVE_CAMERAS]
When we have an optical flow calculation.
struct image_t * opticflow_module_calc(struct image_t *img, uint8_t camera_id)
The main optical flow calculation thread.
#define OPTICFLOW_FPS
Default FPS (zero means run at camera fps)
optical-flow calculation for Parrot Drones
struct pose_t get_rotation_at_timestamp(uint32_t timestamp)
Given a pprz timestamp in used (obtained with get_sys_time_usec) we return the pose in FloatEulers cl...
struct FloatEulers eulers
Encodes a video stream with RTP Format 26 (Motion JPEG)
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.
Capture images from a V4L2 device (Video for Linux 2)
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.