-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathdriver_node.launch.py
More file actions
216 lines (208 loc) · 7.71 KB
/
Copy pathdriver_node.launch.py
File metadata and controls
216 lines (208 loc) · 7.71 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# -----------------------------------------------------------------------------
# Copyright 2022 Bernd Pfrommer <bernd.pfrommer@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument as LaunchArg
from launch.actions import OpaqueFunction
from launch.substitutions import LaunchConfiguration as LaunchConfig
from launch.substitutions import PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
example_parameters = {
'blackfly_s': {
'debug': False,
'compute_brightness': False,
'adjust_timestamp': True,
'dump_node_map': False,
# set parameters defined in blackfly_s.yaml
'gain_auto': 'Continuous',
# 'pixel_format': 'BayerRG8',
'exposure_auto': 'Continuous',
# to use a user set, do this:
# 'user_set_selector': 'UserSet0',
# 'user_set_load': 'Yes',
# These are useful for GigE cameras
# 'device_link_throughput_limit': 380000000,
# 'gev_scps_packet_size': 9000,
# PTP for GigE cameras
# 'gev_ieee_1588': True,
# 'gev_ieee_1588_mode': 'SlaveOnly', # 'SlaveOnly', #'Auto',
# 'use_ieee_1588' : True,
# ---- to reduce the sensor width and shift the crop
# 'image_width': 1408,
# 'image_height': 1080,
# 'offset_x': 16,
# 'offset_y': 0,
# 'binning_x': 1,
# 'binning_y': 1,
# 'connect_while_subscribed': True,
# 'reverse_x': True,
# 'reverse_y': True,
'frame_rate_auto': 'Off',
'frame_rate': 40.0,
'frame_rate_enable': True,
'buffer_queue_size': 10,
'trigger_mode': 'Off',
'chunk_mode_active': True,
'chunk_selector_frame_id': 'FrameID',
'chunk_enable_frame_id': True,
'chunk_selector_exposure_time': 'ExposureTime',
'chunk_enable_exposure_time': True,
'chunk_selector_gain': 'Gain',
'chunk_enable_gain': True,
'chunk_selector_timestamp': 'Timestamp',
'chunk_enable_timestamp': True,
'diagnostic_period': 1.0,
'diagnostic_min_freq': 39.0,
'diagnostic_max_freq': 41.0
},
'blackfly': {
'debug': False,
'dump_node_map': False,
'gain_auto': 'Continuous',
'pixel_format': 'BayerRG8',
'exposure_auto': 'Continuous',
'frame_rate_auto': 'Off',
'frame_rate': 40.0,
'frame_rate_enable': True,
'buffer_queue_size': 10,
'trigger_mode': 'Off',
# 'stream_buffer_handling_mode': 'NewestFirst',
# 'multicast_monitor_mode': False
},
'chameleon': {
'debug': False,
'compute_brightness': False,
'dump_node_map': False,
# set parameters defined in chameleon.yaml
'gain_auto': 'Continuous',
'exposure_auto': 'Continuous',
'offset_x': 0,
'offset_y': 0,
'image_width': 2048,
'image_height': 1536,
'pixel_format': 'RGB8', # 'BayerRG8, 'RGB8' or 'Mono8'
'frame_rate_continous': True,
'frame_rate': 100.0,
'trigger_mode': 'Off',
'chunk_mode_active': True,
'chunk_selector_frame_id': 'FrameID',
'chunk_enable_frame_id': True,
'chunk_selector_exposure_time': 'ExposureTime',
'chunk_enable_exposure_time': True,
'chunk_selector_gain': 'Gain',
'chunk_enable_gain': True,
'chunk_selector_timestamp': 'Timestamp',
'chunk_enable_timestamp': True,
},
'grasshopper': {
'debug': False,
'compute_brightness': False,
'dump_node_map': False,
# set parameters defined in grasshopper.yaml
'gain_auto': 'Continuous',
'exposure_auto': 'Continuous',
'frame_rate_auto': 'Off',
'frame_rate': 100.0,
'trigger_mode': 'Off',
'chunk_mode_active': True,
'chunk_selector_frame_id': 'FrameID',
'chunk_enable_frame_id': True,
'chunk_selector_exposure_time': 'ExposureTime',
'chunk_enable_exposure_time': True,
'chunk_selector_gain': 'Gain',
'chunk_enable_gain': True,
'chunk_selector_timestamp': 'Timestamp',
'chunk_enable_timestamp': True,
},
'flir_ax5': {
'debug': False,
'compute_brightness': False,
'adjust_timestamp': False,
'dump_node_map': False,
# --- Set parameters defined in flir_ax5.yaml
'pixel_format': 'Mono8',
'gev_scps_packet_size': 576,
'image_width': 640,
'image_height': 512,
'offset_x': 0,
'offset_y': 0,
'sensor_gain_mode': 'HighGainMode', # "HighGainMode" "LowGainMode"
'nuc_mode': 'Automatic', # "Automatic" "External" "Manual"
'sensor_dde_mode': 'Automatic', # "Automatic" "Manual"
'sensor_video_standard': 'NTSC30HZ', # "NTSC30HZ" "PAL25Hz" "NTSC60HZ" "PAL50HZ"
# valid values: "PlateauHistogram" "OnceBright" "AutoBright" "Manual" "Linear"
'image_adjust_method': 'PlateauHistogram',
'video_orientation': 'Normal', # "Normal" "Invert" "Revert" "InvertRevert"
},
}
def launch_setup(context, *args, **kwargs):
"""Launch camera driver node."""
parameter_file = LaunchConfig('parameter_file').perform(context)
camera_type = LaunchConfig('camera_type').perform(context)
if not parameter_file:
parameter_file = PathJoinSubstitution(
[FindPackageShare('spinnaker_camera_driver'), 'config', camera_type + '.yaml']
)
if camera_type not in example_parameters:
raise Exception('no example parameters available for type ' + camera_type)
node = Node(
package='spinnaker_camera_driver',
executable='camera_driver_node',
output='screen',
# prefix=['xterm -e gdb --args'],
name=[LaunchConfig('camera_name')],
parameters=[
example_parameters[camera_type],
{
'flir_camera.image_raw.ffmpeg.encoder': 'libx264',
'flir_camera.image_raw.ffmpeg.bit_rate': 10000000,
'parameter_file': parameter_file,
'serial_number': [LaunchConfig('serial')],
},
],
remappings=[
('~/control', '/exposure_control/control'),
],
)
return [node]
def generate_launch_description():
"""Create composable node by calling opaque function."""
return LaunchDescription(
[
LaunchArg(
'camera_name',
default_value=['flir_camera'],
description='camera name (ros node name)',
),
LaunchArg(
'camera_type',
default_value='blackfly_s',
description='type of camera (blackfly_s, chameleon...)',
),
LaunchArg(
'serial',
default_value="'20435008'",
description='FLIR serial number of camera (in quotes!!)',
),
LaunchArg(
'parameter_file',
default_value='',
description='path to ros parameter definition file (override camera type)',
),
OpaqueFunction(function=launch_setup),
]
)