43 #ifndef OPTICFLOW_AGL_ID
44 #define OPTICFLOW_AGL_ID ABI_BROADCAST
49 #define OPTICFLOW_FPS 0
63 #if PERIODIC_TELEMETRY
72 pthread_mutex_lock(&opticflow_mutex);
73 if (opticflow_result.noise_measurement < 0.8) {
74 pprz_msg_send_OPTIC_FLOW_EST(trans, dev, AC_ID,
75 &opticflow_result.fps, &opticflow_result.corner_cnt,
76 &opticflow_result.tracked_cnt, &opticflow_result.flow_x,
77 &opticflow_result.flow_y, &opticflow_result.flow_der_x,
78 &opticflow_result.flow_der_y, &opticflow_result.vel_body.x,
79 &opticflow_result.vel_body.y, &opticflow_result.vel_body.z,
80 &opticflow_result.div_size, &opticflow_result.surface_roughness,
81 &opticflow_result.divergence);
83 pthread_mutex_unlock(&opticflow_mutex);
93 opticflow_got_result =
false;
98 #if PERIODIC_TELEMETRY
110 pthread_mutex_lock(&opticflow_mutex);
112 if (opticflow_got_result) {
115 opticflow_result.flow_x,
116 opticflow_result.flow_y,
117 opticflow_result.flow_der_x,
118 opticflow_result.flow_der_y,
119 opticflow_result.noise_measurement,
120 opticflow_result.div_size);
122 if (opticflow_result.noise_measurement < 0.8) {
124 opticflow_result.vel_body.x,
125 opticflow_result.vel_body.y,
127 opticflow_result.noise_measurement,
128 opticflow_result.noise_measurement,
132 opticflow_got_result =
false;
134 pthread_mutex_unlock(&opticflow_mutex);
156 pthread_mutex_lock(&opticflow_mutex);
157 opticflow_result = temp_result;
158 opticflow_got_result =
true;
159 pthread_mutex_unlock(&opticflow_mutex);
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.
struct opticflow_t opticflow
Opticflow calculations.
Periodic telemetry system header (includes downlink utility and generated code).
static bool opticflow_got_result
When we have an optical flow calculation.
optical-flow calculation for Parrot Drones
Capture images from a V4L2 device (Video for Linux 2)
Main include for ABI (AirBorneInterface).
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...
#define FLOW_OPTICFLOW_ID
uint32_t pprz_ts
The timestamp in us since system startup.
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps)
void opticflow_module_init(void)
Initialize the optical flow module for the bottom camera.
struct image_t * opticflow_module_calc(struct image_t *img)
The main optical flow calculation thread.
static pthread_mutex_t opticflow_mutex
Mutex lock fo thread safety.
void opticflow_calc_init(struct opticflow_t *opticflow)
Initialize the opticflow calculator.
struct FloatEulers eulers
Computer vision framework for onboard processing.
#define DefaultPeriodic
Set default periodic telemetry.
static struct opticflow_result_t opticflow_result
The opticflow result.
Encode images with the use of the JPEG encoding.
#define OPTICFLOW_FPS
Default FPS (zero means run at camera fps)
static const struct usb_device_descriptor dev
API to get/set the generic vehicle states.
void opticflow_module_run(void)
Update the optical flow state for the calculation thread and update the stabilization loops with the ...
Encodes a video stream with RTP Format 26 (Motion JPEG)
#define OPTICFLOW_AGL_ID
Default sonar/agl to use in opticflow visual_estimator.
struct FloatEulers eulers
Euler Angles at time of image.
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
static void opticflow_telem_send(struct transport_tx *trans, struct link_device *dev)
Send optical flow telemetry information.
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.