Paparazzi UAS  v6.0_unstable-20-gfdbd467-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
wedgebug.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) Ralph Rudi schmidt <ralph.r.schmidt@outlook.com>
3 
4  *
5  * This file is part of paparazzi
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, see
19  * <http://www.gnu.org/licenses/>.
20 
21  */
26 #ifndef WEDGEBUG_H
27 #define WEDGEBUG_H
28 
29 
30 
31 // Including library for types
32 #include <stdint.h>
33 #include "modules/computer_vision/lib/vision/image.h"// For image-related structures
34 
35 // Periodic-type functions
36 extern void wedgebug_init(void);
37 extern void wedgebug_periodic(void);
38 
39 
40 // Structures
41 /* Kernel - processes single channel images */
42 struct kernel_C1 {
43  enum image_type type; // Type of image on which kernel is laid onto
44  uint16_t w; //s/< Kernel width
47  void *buf_weights;
48  void *buf_values;
49 };
50 
51 
52 // Global variables - Defines as settings
53 extern int N_disparities;
54 extern int block_size_disparities;
55 extern int min_disparity;
56 extern int max_disparity;
57 
58 
59 extern uint16_t K_median_h; // Height of kernel for the median kernel
60 extern uint16_t K_median_w; // Width of kernel for the median kernel
61 extern int SE_opening_OCV; // SE size for the opening operation
62 extern int SE_closing_OCV; // SE size for the closing operation
63 extern int
64 SE_dilation_OCV_1;// SE size for the first dilation operation (Decides where edges are detected, increase to increase drone safety zone NOTE. This functionality should be replaced with c space expansion)
65 extern int SE_dilation_OCV_2; // SE size for the second dilation operation (see state 6 "WEDGEBUG_START" )
66 extern int
67 SE_erosion_OCV; // SE size for the erosion operation (see state 3 "WEDGEBUG_START" and state 6 "POSITION_EDGE", its needed to "drag" the depth of the foreground objects over the edges detected)
68 
69 
70 // Setting thresholds
71 
72 extern uint16_t
75 
76 extern int
77 threshold_edge_magnitude; // Edges with a magnitude above this value are detected. Above this value, edges are given the value 127, otherwise they are given the value zero.
78 extern float threshold_distance_to_goal; // Above this threshold, the goal is considered reached
79 extern float threshold_distance_to_angle; // Above this threshold, the angle/heading is considered reached
80 extern int16_t max_obstacle_confidence; // This is the max confidence that an obstacle was spotted
81 extern int16_t max_free_path_confidence; // This is the max confidence that an obstacle was not spotted
82 extern int16_t max_position_confidence; // This is the max confidence that a specific position was reached
83 extern int16_t max_heading_confidence; // This is the max confidence that a specific heading was reached
84 extern int16_t max_edge_found_micro_confidence; // This is the max confidence that edges (micro-see above) were found
85 extern int16_t max_edge_found_macro_confidence; // This is the max confidence that edges (macro-see above were found
86 extern int16_t max_no_edge_found_confidence; // This is the max confidence that no edges were found
87 
88 
89 
90 extern int heat_map_type; // Heat map used when saving image
92 
93 
94 
95 // Global functions
96 extern void post_disparity_crop_rect(struct crop_t *_img_cropped_info, struct img_size_t *_original_img_dims,
97  const int disp_n, const int block_size);
98 extern void set_state(uint8_t _state, uint8_t change_allowed);
99 void kernel_create(struct kernel_C1 *kernel, uint16_t width, uint16_t height, enum image_type type);
100 extern void kernel_free(struct kernel_C1 *kernel);
101 extern uint8_t getMedian(uint8_t *a, uint32_t n);
102 
103 
104 
105 
106 
107 
108 
109 
110 #endif // WEDGEBUG_H
void set_state(uint8_t _state, uint8_t change_allowed)
Definition: wedgebug.c:420
uint32_t buf_size
Size of values of weight buffer and values buffer.
Definition: wedgebug.h:46
int16_t max_no_edge_found_confidence
This is the max confidence that edges (macro-see above were found.
Definition: wedgebug.c:167
Definition: image.h:92
int16_t max_edge_found_macro_confidence
This is the max confidence that edges (micro-see above) were found.
Definition: wedgebug.c:166
int16_t max_free_path_confidence
This is the max confidence that an obstacle was spotted.
Definition: wedgebug.c:162
int SE_opening_OCV
Definition: wedgebug.c:106
image_type
Definition: image.h:35
int SE_dilation_OCV_2
SE size for the first dilation operation.
Definition: wedgebug.c:109
enum image_type type
Definition: wedgebug.h:43
int SE_dilation_OCV_1
SE size for the closing operation.
Definition: wedgebug.c:108
uint16_t h
Kernel height.
Definition: wedgebug.h:45
short int16_t
Typedef defining 16 bit short type.
Definition: vl53l1_types.h:93
uint16_t w
Definition: wedgebug.h:44
void post_disparity_crop_rect(struct crop_t *_img_cropped_info, struct img_size_t *_original_img_dims, const int disp_n, const int block_size)
Definition: wedgebug.c:401
int16_t max_position_confidence
This is the max confidence that an obstacle was not spotted.
Definition: wedgebug.c:163
void kernel_create(struct kernel_C1 *kernel, uint16_t width, uint16_t height, enum image_type type)
Definition: wedgebug.c:427
int SE_erosion_OCV
SE size for the second dilation operation (see state 3 "WEDGEBUG_START" and state 6 "POSITION_EDGE" )...
Definition: wedgebug.c:110
int threshold_edge_magnitude
Below this depth (cm) edges are eligible for the WedgeBug algorith.
Definition: wedgebug.c:142
Image helper functions like resizing, color filter, converters...
int16_t max_edge_found_micro_confidence
This is the max confidence that a specific heading was reached.
Definition: wedgebug.c:165
uint16_t K_median_w
SE size for the Sobel operation, to detect edges.
Definition: wedgebug.c:112
int N_disparities
Variable that saves previous mode to control the drone, for some memory.
Definition: wedgebug.c:255
int min_disparity
Block size used for the block matching (SBM) function.
Definition: wedgebug.c:257
void * buf_weights
Kernel weight buffer.
Definition: wedgebug.h:47
void kernel_free(struct kernel_C1 *kernel)
Definition: wedgebug.c:455
void * buf_values
Kernel value buffer. These are the values underneath the kernel.
Definition: wedgebug.h:48
int16_t max_heading_confidence
This is the max confidence that a specific position was reached.
Definition: wedgebug.c:164
int SE_closing_OCV
SE size for the opening operation.
Definition: wedgebug.c:107
uint16_t threshold_depth_of_edges
Below this median depth (cm), an obstacle is considered to block the way (i.e. the blocking obstacle ...
Definition: wedgebug.c:150
float threshold_distance_to_angle
Below this distance (in meters) it is considered that the robot has reached the goal.
Definition: wedgebug.c:146
uint8_t save_images_flag
Set to 1 if control mode of drone is changed, 0 otherwise.
Definition: wedgebug.c:180
void wedgebug_periodic(void)
Definition: wedgebug.c:1837
int heat_map_type
Variable to hold distance from robot to edge to goal (used in EDGE_SCAN (9) state) ...
Definition: wedgebug.c:266
int block_size_disparities
Number of disparity levels (0-this number)
Definition: wedgebug.c:256
float threshold_distance_to_goal
Above this disparity edges are eligible for WedgeBug algorithm (i.e. edges cannot be very far away) ...
Definition: wedgebug.c:145
int max_disparity
void wedgebug_init(void)
Definition: wedgebug.c:1584
uint8_t getMedian(uint8_t *a, uint32_t n)
Definition: wedgebug.c:469
int16_t max_obstacle_confidence
This is the confidence that no edge was found.
Definition: wedgebug.c:161
uint16_t threshold_median_depth
Below this distance (in meters) it is considered that the robot has reached the goal, in DIRECT_CONTROL mode.
Definition: wedgebug.c:149
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
uint16_t K_median_h
Width of kernel for the median kernel.
Definition: wedgebug.c:113
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78