Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Optical-flow estimation module. More...
#include "opticflow_module.h"
#include <stdio.h>
#include <pthread.h>
#include "state.h"
#include "subsystems/abi.h"
#include "lib/v4l/v4l2.h"
#include "lib/encoding/jpeg.h"
#include "lib/encoding/rtp.h"
#include "errno.h"
#include "cv.h"
#include "subsystems/datalink/telemetry.h"
Go to the source code of this file.
Macros | |
#define | OPTICFLOW_AGL_ID ABI_BROADCAST |
Default sonar/agl to use in opticflow visual_estimator. More... | |
#define | OPTICFLOW_FPS 0 |
Default FPS (zero means run at camera fps) More... | |
#define | OPTICFLOW_FPS_CAMERA2 0 |
Default FPS (zero means run at camera fps) More... | |
#define | ACTIVE_CAMERAS 1 |
Functions | |
struct image_t * | opticflow_module_calc (struct image_t *img, uint8_t camera_id) |
The main optical flow calculation thread. More... | |
static void | opticflow_telem_send (struct transport_tx *trans, struct link_device *dev) |
Send optical flow telemetry information. More... | |
void | opticflow_module_init (void) |
Initialize the optical flow module for the bottom camera. More... | |
void | opticflow_module_run (void) |
Update the optical flow state for the calculation thread and update the stabilization loops with the newest result. More... | |
Variables | |
struct opticflow_t | opticflow [ACTIVE_CAMERAS] |
Opticflow calculations. More... | |
static struct opticflow_result_t | opticflow_result [ACTIVE_CAMERAS] |
The opticflow result. More... | |
static bool | opticflow_got_result [ACTIVE_CAMERAS] |
When we have an optical flow calculation. More... | |
static pthread_mutex_t | opticflow_mutex |
Mutex lock fo thread safety. More... | |
Optical-flow estimation module.
Definition in file opticflow_module.c.
#define ACTIVE_CAMERAS 1 |
Definition at line 61 of file opticflow_module.c.
#define OPTICFLOW_AGL_ID ABI_BROADCAST |
Default sonar/agl to use in opticflow visual_estimator.
Definition at line 44 of file opticflow_module.c.
#define OPTICFLOW_FPS 0 |
Default FPS (zero means run at camera fps)
Definition at line 49 of file opticflow_module.c.
#define OPTICFLOW_FPS_CAMERA2 0 |
Default FPS (zero means run at camera fps)
Definition at line 53 of file opticflow_module.c.
The main optical flow calculation thread.
The main optical flow calculation thread This thread passes the images trough the optical flow calculator.
[in] | *img | The image_t structure of the captured image |
[in] | camera_id | The camera index id |
Definition at line 167 of file opticflow_module.c.
References ACTIVE_CAMERAS, opticflow_result_t::camera_id, pose_t::eulers, image_t::eulers, get_rotation_at_timestamp(), opticflow, opticflow_calc_frame(), opticflow_got_result, opticflow_mutex, opticflow_result, and image_t::pprz_ts.
Referenced by opticflow_module_init().
void opticflow_module_init | ( | void | ) |
Initialize the optical flow module for the bottom camera.
Definition at line 105 of file opticflow_module.c.
References ACTIVE_CAMERAS, cv_add_to_device(), DefaultPeriodic, opticflow, opticflow_calc_init(), OPTICFLOW_FPS, OPTICFLOW_FPS_CAMERA2, opticflow_got_result, opticflow_module_calc(), opticflow_telem_send(), and register_periodic_telemetry().
void opticflow_module_run | ( | void | ) |
Update the optical flow state for the calculation thread and update the stabilization loops with the newest result.
Definition at line 128 of file opticflow_module.c.
References ACTIVE_CAMERAS, FLOW_OPTICFLOW_ID, get_sys_time_usec(), opticflow_result_t::noise_measurement, opticflow_got_result, opticflow_mutex, opticflow_result, opticflow_result_t::vel_body, VEL_OPTICFLOW_ID, and FloatVect3::y.
|
static |
Send optical flow telemetry information.
[in] | *trans | The transport structure to send the information over |
[in] | *dev | The link to send the data over |
Definition at line 81 of file opticflow_module.c.
References ACTIVE_CAMERAS, opticflow_result_t::camera_id, dev, opticflow_result_t::div_size, opticflow_result_t::divergence, opticflow_mutex, opticflow_result, opticflow_result_t::surface_roughness, opticflow_result_t::vel_body, FloatVect3::y, and FloatVect3::z.
Referenced by opticflow_module_init().
struct opticflow_t opticflow[ACTIVE_CAMERAS] |
Opticflow calculations.
Definition at line 65 of file opticflow_module.c.
Referenced by calc_edgeflow_tot(), calc_fast9_lukas_kanade(), calc_previous_frame_nr(), manage_flow_features(), opticflow_calc_frame(), opticflow_calc_init(), opticflow_module_calc(), opticflow_module_init(), and predict_flow_vectors().
|
static |
When we have an optical flow calculation.
Definition at line 68 of file opticflow_module.c.
Referenced by opticflow_module_calc(), opticflow_module_init(), and opticflow_module_run().
|
static |
Mutex lock fo thread safety.
Definition at line 69 of file opticflow_module.c.
Referenced by opticflow_module_calc(), opticflow_module_run(), and opticflow_telem_send().
|
static |
The opticflow result.
Definition at line 66 of file opticflow_module.c.
Referenced by opticflow_module_calc(), opticflow_module_run(), and opticflow_telem_send().