-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_ros.patch
66 lines (64 loc) · 2.42 KB
/
build_ros.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
diff --git a/meson.build b/meson.build
index b57d9b1..0772a29 100644
--- a/meson.build
+++ b/meson.build
@@ -98,6 +98,7 @@ summary({
'egl preview' : enable_egl,
'qt preview' : enable_qt,
'OpenCV postprocessing' : enable_opencv,
+ 'ROS 2 postprocessing' : enable_ros,
'TFLite postprocessing' : enable_tflite,
'Hailo postprocessing' : enable_hailo,
'IMX500 postprocessing' : get_option('enable_imx500'),
diff --git a/meson_options.txt b/meson_options.txt
index 0f24d54..98e2d8b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -23,6 +23,11 @@ option('enable_opencv',
value : 'disabled',
description : 'Enable OpenCV postprocessing support')
+option('enable_ros',
+ type : 'feature',
+ value : 'disabled',
+ description : 'Enable ROS 2 postprocessing support')
+
option('enable_tflite',
type : 'feature',
value : 'disabled',
diff --git a/post_processing_stages/meson.build b/post_processing_stages/meson.build
index aa10141..f45377c 100644
--- a/post_processing_stages/meson.build
+++ b/post_processing_stages/meson.build
@@ -68,6 +68,33 @@ if opencv_dep.found()
enable_opencv = true
endif
+# ROS 2 based postprocessing stages.
+enable_ros = false
+ros_dep = dependency('rclcpp', required : get_option('enable_ros'))
+vision_msgs_dep = dependency('vision_msgs', required : get_option('enable_ros'))
+if ros_dep.found()
+ ros_postproc_src = files([
+ 'object_detect_publish_ros_stage.cpp',
+ ])
+
+ # ROS 2 assets
+ postproc_assets += files([
+ assets_dir / 'sobel_cv.json',
+ assets_dir / 'face_detect_cv.json',
+ assets_dir / 'annotate_cv.json',
+ ])
+
+ ros_postproc_lib = shared_module('ros-postproc', ros_postproc_src,
+ include_directories : '../..',
+ dependencies : [libcamera_dep, ros_dep, vision_msgs_dep],
+ cpp_args : cpp_arguments,
+ install : true,
+ install_dir : posproc_libdir,
+ name_prefix : '',
+ )
+ enable_ros = true
+endif
+
# TFlite based postprocessing stages.
enable_tflite = false
tflite_dep = dependency('tensorflow-lite', required : get_option('enable_tflite'))