Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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
kernel_C1
Definition: wedgebug.h:42
uint16_t
unsigned short uint16_t
Definition: types.h:16
max_heading_confidence
int16_t max_heading_confidence
This is the max confidence that a specific position was reached.
Definition: wedgebug.c:164
kernel_C1::buf_size
uint32_t buf_size
Size of values of weight buffer and values buffer.
Definition: wedgebug.h:46
kernel_C1::buf_weights
void * buf_weights
Kernel weight buffer.
Definition: wedgebug.h:47
K_median_h
uint16_t K_median_h
Width of kernel for the median kernel.
Definition: wedgebug.c:113
SE_erosion_OCV
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
wedgebug_periodic
void wedgebug_periodic(void)
heat_map_type
int heat_map_type
Variable to hold distance from robot to edge to goal (used in EDGE_SCAN (9) state)
Definition: wedgebug.c:266
kernel_C1::buf_values
void * buf_values
Kernel value buffer. These are the values underneath the kernel.
Definition: wedgebug.h:48
SE_dilation_OCV_2
int SE_dilation_OCV_2
SE size for the first dilation operation.
Definition: wedgebug.c:109
uint32_t
unsigned long uint32_t
Definition: types.h:18
max_no_edge_found_confidence
int16_t max_no_edge_found_confidence
This is the max confidence that edges (macro-see above were found.
Definition: wedgebug.c:167
SE_opening_OCV
int SE_opening_OCV
Definition: wedgebug.c:106
min_disparity
int min_disparity
Block size used for the block matching (SBM) function.
Definition: wedgebug.c:257
threshold_depth_of_edges
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
kernel_C1::type
enum image_type type
Definition: wedgebug.h:43
threshold_edge_magnitude
int threshold_edge_magnitude
Below this depth (cm) edges are eligible for the WedgeBug algorith.
Definition: wedgebug.c:142
max_edge_found_macro_confidence
int16_t max_edge_found_macro_confidence
This is the max confidence that edges (micro-see above) were found.
Definition: wedgebug.c:166
threshold_distance_to_angle
float threshold_distance_to_angle
Below this distance (in meters) it is considered that the robot has reached the goal.
Definition: wedgebug.c:146
crop_t
Definition: image.h:92
wedgebug_init
void wedgebug_init(void)
getMedian
uint8_t getMedian(uint8_t *a, uint32_t n)
int16_t
signed short int16_t
Definition: types.h:17
uint8_t
unsigned char uint8_t
Definition: types.h:14
image.h
kernel_C1::w
uint16_t w
Definition: wedgebug.h:44
max_free_path_confidence
int16_t max_free_path_confidence
This is the max confidence that an obstacle was spotted.
Definition: wedgebug.c:162
K_median_w
uint16_t K_median_w
SE size for the Sobel operation, to detect edges.
Definition: wedgebug.c:112
kernel_create
void kernel_create(struct kernel_C1 *kernel, uint16_t width, uint16_t height, enum image_type type)
post_disparity_crop_rect
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)
img_size_t
Definition: image.h:86
kernel_C1::h
uint16_t h
Kernel height.
Definition: wedgebug.h:45
max_position_confidence
int16_t max_position_confidence
This is the max confidence that an obstacle was not spotted.
Definition: wedgebug.c:163
image_type
image_type
Definition: image.h:35
SE_dilation_OCV_1
int SE_dilation_OCV_1
SE size for the closing operation.
Definition: wedgebug.c:108
max_edge_found_micro_confidence
int16_t max_edge_found_micro_confidence
This is the max confidence that a specific heading was reached.
Definition: wedgebug.c:165
kernel_free
void kernel_free(struct kernel_C1 *kernel)
type
timer subsystem type(config options) --------------------------------------------(advanced timers using RCC_APB1) TIM1 adc(if USE_AD_TIM1) radio_control/ppm(if USE_PPM_TIM1
max_obstacle_confidence
int16_t max_obstacle_confidence
This is the confidence that no edge was found.
Definition: wedgebug.c:161
block_size_disparities
int block_size_disparities
Number of disparity levels (0-this number)
Definition: wedgebug.c:256
max_disparity
int max_disparity
SE_closing_OCV
int SE_closing_OCV
SE size for the opening operation.
Definition: wedgebug.c:107
threshold_distance_to_goal
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
threshold_median_depth
uint16_t threshold_median_depth
Below this distance (in meters) it is considered that the robot has reached the goal,...
Definition: wedgebug.c:149
save_images_flag
uint8_t save_images_flag
Set to 1 if control mode of drone is changed, 0 otherwise.
Definition: wedgebug.c:180
N_disparities
int N_disparities
Variable that saves previous mode to control the drone, for some memory.
Definition: wedgebug.c:255
set_state
void set_state(uint8_t _state, uint8_t change_allowed)