Skip to content

Commit f5820c7

Browse files
committed
merge
2 parents a6358d9 + 7c0c619 commit f5820c7

23 files changed

+329
-155
lines changed
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
from pathlib import Path
2+
3+
from ament_index_python import get_package_share_directory
4+
from launch.launch_description_sources import PythonLaunchDescriptionSource
5+
from launch import LaunchDescription
6+
from launch.actions import DeclareLaunchArgument
7+
from launch.substitutions import LaunchConfiguration
8+
from launch_ros.actions import Node
9+
from launch.conditions import IfCondition
10+
from launch.actions import IncludeLaunchDescription
11+
12+
13+
def generate_launch_description():
14+
return LaunchDescription([
15+
DeclareLaunchArgument("enable_front_camera",
16+
default_value="true",
17+
description="Включить (true) или отключить (false) ноду нижней камеры"),
18+
DeclareLaunchArgument('front_camera_topic',
19+
default_value='/stingray/topics/camera/front',
20+
description='Топик с изображениями для первой камеры'),
21+
DeclareLaunchArgument("front_camera_info_topic",
22+
default_value='/stingray/topics/camera/front/camera_info'),
23+
DeclareLaunchArgument("front_camera_path",
24+
default_value='/dev/video0'),
25+
DeclareLaunchArgument("front_camera_calibration_path",
26+
default_value="package://sauvc_cam/configs/front_camera.yaml"),
27+
DeclareLaunchArgument('front_camera_output_width',
28+
default_value='640',
29+
description='Ширина видео'),
30+
DeclareLaunchArgument('front_camera_output_height',
31+
default_value='480',
32+
description='Высота видео'),
33+
DeclareLaunchArgument('front_camera_framerate',
34+
default_value='30.0',
35+
description='Частота кадров видео'),
36+
# bottom camera
37+
DeclareLaunchArgument("enable_bottom_camera",
38+
default_value="true",
39+
description="Включить (true) или отключить (false) ноду нижней камеры"),
40+
DeclareLaunchArgument('bottom_camera_topic',
41+
default_value='/stingray/topics/camera/bottom',
42+
description='Топик с изображениями для второй камеры'),
43+
DeclareLaunchArgument("bottom_camera_info_topic",
44+
default_value='/stingray/topics/camera/bottom/camera_info'),
45+
DeclareLaunchArgument("bottom_camera_path",
46+
default_value='/dev/video0'),
47+
DeclareLaunchArgument("bottom_camera_calibration_path",
48+
default_value="package://sauvc_cam/configs/bottom_camera.yaml"),
49+
DeclareLaunchArgument('bottom_camera_output_width',
50+
default_value='640',
51+
description='Ширина видео'),
52+
DeclareLaunchArgument('bottom_camera_output_height',
53+
default_value='480',
54+
description='Высота видео'),
55+
DeclareLaunchArgument('bottom_camera_framerate',
56+
default_value='30.0',
57+
description='Частота кадров видео'),
58+
# recorder
59+
DeclareLaunchArgument("enable_recording_front_camera",
60+
default_value="true",
61+
description="Включить (true) или отключить (false) ноду нижней камеры"),
62+
DeclareLaunchArgument("enable_recording_bottom_camera",
63+
default_value="true",
64+
description="Включить(true) или отключить(false) ноду нижней камеры"),
65+
DeclareLaunchArgument('output_fps',
66+
default_value='30',
67+
description='Частота кадров видео'),
68+
DeclareLaunchArgument('output_format',
69+
default_value='h264',
70+
description='Формат видео (FourCC)'),
71+
DeclareLaunchArgument('record_dir',
72+
default_value='./records/',
73+
description='Путь к папке для сохранения записей'),
74+
DeclareLaunchArgument("enable_recording_topic",
75+
default_value='/stingray/topics/enable_recording'),
76+
77+
IncludeLaunchDescription(
78+
PythonLaunchDescriptionSource(str(Path(
79+
get_package_share_directory('stingray_launch'), 'zbar.launch.py'))),
80+
launch_arguments={
81+
'zbar_camera_topic': LaunchConfiguration("front_camera_topic"),
82+
}.items(),
83+
),
84+
85+
# Нода фронтальной камеры
86+
Node(
87+
package='usb_cam',
88+
executable='usb_cam_node_exe',
89+
name='front_camera_node',
90+
remappings=[
91+
('/image_raw', LaunchConfiguration("front_camera_topic")),
92+
('/camera_info', LaunchConfiguration("front_camera_info_topic")),
93+
],
94+
parameters=[
95+
{'framerate': LaunchConfiguration("front_camera_framerate")},
96+
{'video_device': LaunchConfiguration("front_camera_path")},
97+
{'camera_info_url': LaunchConfiguration(
98+
"front_camera_calibration_path")},
99+
{'camera_name': 'front_camera'},
100+
{'image_width': LaunchConfiguration(
101+
"front_camera_output_width")},
102+
{'image_height': LaunchConfiguration(
103+
"front_camera_output_height")},
104+
],
105+
respawn=True,
106+
respawn_delay=1,
107+
condition=IfCondition(LaunchConfiguration('enable_front_camera'))
108+
),
109+
# Нода нижней камеры (запускается при enable_bottom_camera==true)
110+
Node(
111+
package='usb_cam',
112+
executable='usb_cam_node_exe',
113+
name='bottom_camera_node',
114+
remappings=[
115+
('/image_raw', LaunchConfiguration("bottom_camera_topic")),
116+
('/camera_info', LaunchConfiguration("bottom_camera_info_topic")),
117+
],
118+
parameters=[
119+
{'framerate': LaunchConfiguration("bottom_camera_framerate")},
120+
{'video_device': LaunchConfiguration("bottom_camera_path")},
121+
{'camera_info_url': LaunchConfiguration(
122+
"bottom_camera_calibration_path")},
123+
{'camera_name': 'bottom_camera'},
124+
{'image_width': LaunchConfiguration(
125+
"bottom_camera_output_width")},
126+
{'image_height': LaunchConfiguration(
127+
"bottom_camera_output_height")},
128+
],
129+
respawn=True,
130+
respawn_delay=1,
131+
condition=IfCondition(LaunchConfiguration('enable_bottom_camera'))
132+
),
133+
134+
IncludeLaunchDescription(
135+
PythonLaunchDescriptionSource(str(Path(
136+
get_package_share_directory('stingray_launch'), 'recorder.launch.py'))),
137+
launch_arguments={
138+
'recorder_name': 'front_camera_recorder',
139+
'source_topic': LaunchConfiguration('front_camera_topic'),
140+
'output_width': LaunchConfiguration('front_camera_output_width'),
141+
'output_height': LaunchConfiguration('front_camera_output_height'),
142+
'output_fps': LaunchConfiguration('output_fps'),
143+
'output_format': LaunchConfiguration('output_format'),
144+
'record_dir': LaunchConfiguration('record_dir'),
145+
'enable_recording_topic': LaunchConfiguration('enable_recording_topic'),
146+
}.items(),
147+
condition=IfCondition(LaunchConfiguration('enable_recording_front_camera'))
148+
),
149+
150+
IncludeLaunchDescription(
151+
PythonLaunchDescriptionSource(str(Path(
152+
get_package_share_directory('stingray_launch'), 'recorder.launch.py'))),
153+
launch_arguments={
154+
'recorder_name': 'bottom_camera_recorder',
155+
'source_topic': LaunchConfiguration('bottom_camera_topic'),
156+
'output_width': LaunchConfiguration('bottom_camera_output_width'),
157+
'output_height': LaunchConfiguration('bottom_camera_output_height'),
158+
'output_fps': LaunchConfiguration('output_fps'),
159+
'output_format': LaunchConfiguration('output_format'),
160+
'record_dir': LaunchConfiguration('record_dir'),
161+
'enable_recording_topic': LaunchConfiguration('enable_recording_topic'),
162+
}.items(),
163+
condition=IfCondition(LaunchConfiguration('enable_recording_bottom_camera'))
164+
),
165+
])

src/sauvc_launch/launch/missions.launch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
def generate_launch_description():
1818
# object detection
1919
bbox_array_topic_arg = DeclareLaunchArgument(
20-
"bbox_array_topic", default_value='/stingray/topics/front_camera/bbox_array'
20+
"bbox_array_topic", default_value='/stingray/topics/camera/front/bbox_array'
2121
)
2222

2323
# missions
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from pathlib import Path
2+
3+
from ament_index_python import get_package_share_directory
4+
5+
from launch import LaunchDescription
6+
from launch.actions import DeclareLaunchArgument
7+
from launch.actions import IncludeLaunchDescription
8+
from launch.launch_description_sources import PythonLaunchDescriptionSource
9+
from launch.substitutions import LaunchConfiguration
10+
from launch.conditions import IfCondition
11+
12+
13+
def generate_launch_description():
14+
# load ros config
15+
return LaunchDescription([
16+
# object detection
17+
DeclareLaunchArgument("image_topic_list",
18+
default_value='[/stingray/topics/camera/front, /stingray/topics/camera/bottom]'),
19+
DeclareLaunchArgument("camera_info_topic_list",
20+
default_value='[/stingray/topics/camera/front/camera_info, /stingray/topics/camera/bottom/camera_info]'),
21+
DeclareLaunchArgument("weights_pkg_name",
22+
default_value='sauvc_object_detection'),
23+
DeclareLaunchArgument("bbox_attrs_pkg_name",
24+
default_value='sauvc_object_detection'),
25+
DeclareLaunchArgument("debug",
26+
default_value='True'),
27+
28+
IncludeLaunchDescription(
29+
PythonLaunchDescriptionSource(str(Path(
30+
get_package_share_directory('stingray_launch'), 'od.launch.py'))),
31+
launch_arguments={
32+
'weights_pkg_name': LaunchConfiguration("weights_pkg_name"),
33+
'bbox_attrs_pkg_name': LaunchConfiguration("bbox_attrs_pkg_name"),
34+
'image_topic_list': LaunchConfiguration("image_topic_list"),
35+
'camera_info_topic_list': LaunchConfiguration("camera_info_topic_list"),
36+
'debug': LaunchConfiguration("debug"),
37+
}.items(),
38+
),
39+
40+
])
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import os
2+
from launch import LaunchDescription
3+
from launch_ros.actions import Node
4+
from launch.actions import DeclareLaunchArgument
5+
from launch.substitutions import LaunchConfiguration
6+
from launch.conditions import IfCondition
7+
8+
def generate_launch_description():
9+
return LaunchDescription([
10+
# Аргументы для первой камеры
11+
DeclareLaunchArgument('output_width', default_value='640',
12+
description='Ширина видео'),
13+
DeclareLaunchArgument('output_height', default_value='480',
14+
description='Высота видео'),
15+
DeclareLaunchArgument('output_fps', default_value='15',
16+
description='Частота кадров видео'),
17+
DeclareLaunchArgument('output_format', default_value='h264',
18+
description='Формат видео (FourCC)'),
19+
DeclareLaunchArgument('record_dir', default_value='./records/',
20+
description='Путь к папке для сохранения записей'),
21+
# Аргументы для первой камеры
22+
DeclareLaunchArgument('front_camera_topic', default_value='/stingray/topics/camera/front',
23+
description='Топик с изображениями для первой камеры'),
24+
# Аргументы для второй камеры
25+
DeclareLaunchArgument('enable_bottom_camera', default_value='true',
26+
description='Включить (true) или отключить (false) запуск второй камеры'),
27+
DeclareLaunchArgument('bottom_camera_topic', default_value='/stingray/topics/camera/bottom',
28+
description='Топик с изображениями для второй камеры'),
29+
30+
# Нода для первой камеры
31+
Node(
32+
package='stingray_recorder', # замените на имя вашего пакета
33+
executable='video_recorder_node', # имя исполняемого файла ноды
34+
name='front_camera_video_recorder',
35+
parameters=[
36+
{'source_topic': LaunchConfiguration('front_camera_topic')},
37+
{'output_width': LaunchConfiguration('output_width')},
38+
{'output_height': LaunchConfiguration('output_height')},
39+
{'output_fps': LaunchConfiguration('output_fps')},
40+
{'output_format': LaunchConfiguration('output_format')},
41+
{'record_dir': LaunchConfiguration('record_dir')},
42+
]
43+
),
44+
# Нода для второй камеры (запускается только если enable_second_camera == "true")
45+
Node(
46+
package='stingray_recorder', # замените на имя вашего пакета
47+
executable='video_recorder_node',
48+
name='bottom_camera_video_recorder',
49+
parameters=[
50+
{'source_topic': LaunchConfiguration('bottom_camera_topic')},
51+
{'output_width': LaunchConfiguration('output_width')},
52+
{'output_height': LaunchConfiguration('output_height')},
53+
{'output_fps': LaunchConfiguration('output_fps')},
54+
{'output_format': LaunchConfiguration('output_format')},
55+
{'record_dir': LaunchConfiguration('record_dir')},
56+
],
57+
condition=IfCondition(LaunchConfiguration('enable_bottom_camera'))
58+
)
59+
])

src/sauvc_launch/launch/vision_yolov5.launch.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/sauvc_launch/launch/vision_yolov8.launch.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)