44 #ifndef OPTICFLOW_AGL_ID
45 #define OPTICFLOW_AGL_ID ABI_BROADCAST
49 #ifndef OPTICFLOW_SENDER_ID
50 #define OPTICFLOW_SENDER_ID 1
65 #if PERIODIC_TELEMETRY
74 pthread_mutex_lock(&opticflow_mutex);
76 pprz_msg_send_OPTIC_FLOW_EST(trans, dev, AC_ID,
84 pthread_mutex_unlock(&opticflow_mutex);
101 opticflow_got_result =
false;
105 #if PERIODIC_TELEMETRY
117 pthread_mutex_lock(&opticflow_mutex);
119 if (opticflow_got_result) {
138 opticflow_got_result =
false;
140 pthread_mutex_unlock(&opticflow_mutex);
163 pthread_mutex_lock(&opticflow_mutex);
165 opticflow_got_result =
true;
176 pthread_mutex_unlock(&opticflow_mutex);
Event structure to store callbacks in a linked list.
float vel_body_x
The velocity in the x direction (body fixed coordinates)
int16_t flow_y
Flow in y direction from the camera (in subpixels)
int16_t flow_der_y
The derotated flow calculation in the y direction (in subpixels)
float div_size
Divergence as determined with the size_divergence script.
struct opticflow_t opticflow
Opticflow calculations.
Periodic telemetry system header (includes downlink utility and generated code).
struct FloatRates rates
Body rates.
static bool opticflow_got_result
When we have an optical flow calculation.
static struct opticflow_state_t opticflow_state
State of the drone to communicate with the opticflow.
optical-flow calculation for Parrot Drones
static abi_event opticflow_agl_ev
The altitude ABI event.
Capture images from a V4L2 device (Video for Linux 2)
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func)
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 FLOAT_RATES_ZERO(_r)
uint32_t pprz_ts
The timestamp in us since system startup.
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.
float agl
height above ground [m]
static pthread_mutex_t opticflow_mutex
Mutex lock fo thread safety.
void opticflow_calc_frame(struct opticflow_t *opticflow, struct opticflow_state_t *state, struct image_t *img, struct opticflow_result_t *result)
Run the optical flow on a new image frame.
uint16_t tracked_cnt
The amount of tracked corners.
float vel_body_y
The velocity in the y direction (body fixed coordinates)
Computer vision framework for onboard processing.
#define DefaultPeriodic
Set default periodic telemetry.
static struct opticflow_result_t opticflow_result
The opticflow result.
#define OPTICFLOW_SENDER_ID
Encode images with the use of the JPEG encoding.
static const struct usb_device_descriptor dev
float vel_x
The velocity in the x direction (image coordinates)
uint16_t corner_cnt
The amount of coners found by FAST9.
float vel_y
The velocity in the y direction (image coordinates)
float fps
Frames per second of the optical flow calculation.
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 vide stream with RTP (JPEG)
int16_t flow_x
Flow in x direction from the camera (in subpixels)
#define OPTICFLOW_AGL_ID
Default sonar/agl to use in opticflow visual_estimator.
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
float noise_measurement
noise of measurement, for state filter
float divergence
Divergence as determined with a linear flow fit.
static void opticflow_agl_cb(uint8_t sender_id, float distance)
Callback function of the ground altitude.
float surface_roughness
Surface roughness as determined with a linear optical flow fit.
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.
int16_t flow_der_x
The derotated flow calculation in the x direction (in subpixels)