42 std::function<
void (
BorderClip,
double)> borderClipChangeCallback,
43 std::function<
void (
double)> maxPointCloudRangeCallback,
46 std::function<
void (
bool, int32_t)> timeSyncChangedCallback):
48 resolution_change_callback_(resolutionChangeCallback),
50 imu_samples_per_message_(0),
51 lighting_supported_(false),
52 motor_supported_(false),
53 crop_mode_changed_(false),
54 ptp_supported_(false),
55 roi_supported_(false),
56 aux_supported_(false),
57 reconfigure_external_calibration_supported_(false),
58 origin_from_camera_calibration_initialized_(false),
60 border_clip_value_(0.0),
61 border_clip_change_callback_(borderClipChangeCallback),
62 max_point_cloud_range_callback_(maxPointCloudRangeCallback),
63 extrinsics_callback_(extrinsicsCallback),
64 spline_draw_parameters_callback_(groundSurfaceSplineDrawParametersCallback),
65 time_sync_callback_(timeSyncChangedCallback)
69 std::vector<system::DeviceMode> deviceModes;
75 if (Status_Ok != status) {
76 ROS_ERROR(
"Reconfigure: failed to query version info: %s",
77 Channel::statusString(status));
82 if (Status_Ok != status) {
83 ROS_ERROR(
"Reconfigure: failed to query device info: %s",
84 Channel::statusString(status));
89 if (Status_Ok != status) {
90 ROS_ERROR(
"Reconfigure: failed to query device modes: %s",
91 Channel::statusString(status));
95 const bool ground_surface_supported =
96 std::any_of(deviceModes.begin(), deviceModes.end(), [](
const auto &mode) {
97 return (mode.supportedDataSources & Source_Ground_Surface_Spline_Data) &&
98 (mode.supportedDataSources & Source_Ground_Surface_Class_Image); });
101 system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21 == deviceInfo.
hardwareRevision ||
102 system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21i == deviceInfo.
hardwareRevision)
110 if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_C6S2_S27 == deviceInfo.
hardwareRevision ||
111 system::DeviceInfo::HARDWARE_REV_MULTISENSE_S30 == deviceInfo.
hardwareRevision ||
112 system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21 == deviceInfo.
hardwareRevision ||
113 system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21i == deviceInfo.
hardwareRevision ||
114 system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_VPB == deviceInfo.
hardwareRevision ||
115 system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_STEREO == deviceInfo.
hardwareRevision ||
116 system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_MONOCAM == deviceInfo.
hardwareRevision)
125 if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_C6S2_S27 == deviceInfo.
hardwareRevision ||
126 system::DeviceInfo::HARDWARE_REV_MULTISENSE_S30 == deviceInfo.
hardwareRevision ||
127 system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21i == deviceInfo.
hardwareRevision)
135 ROS_WARN(
"Reconfigure: MultiSense firmware version does not support the updated aux camera exposure controls. "
136 "The ROS driver will work normally, but you will have limited control over aux camera exposure parameters. "
137 "Please use the 2eae444 has of multisene_ros or contact support@carnegierobotics.com for "
138 "a updated firmware version greater than 6.0 to enable aux camera exposure controls.");
152 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::bcam_imx104Config> > (
153 new dynamic_reconfigure::Server<multisense_ros::bcam_imx104Config>(
device_nh_));
155 std::placeholders::_1, std::placeholders::_2));
157 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_ST21 == deviceInfo.
hardwareRevision) {
160 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::st21_sgm_vga_imuConfig> > (
161 new dynamic_reconfigure::Server<multisense_ros::st21_sgm_vga_imuConfig>(
device_nh_));
163 std::placeholders::_1, std::placeholders::_2));
165 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_ST25 == deviceInfo.
hardwareRevision) {
168 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::st25_sgm_imuConfig> > (
169 new dynamic_reconfigure::Server<multisense_ros::st25_sgm_imuConfig>(
device_nh_));
171 std::placeholders::_1, std::placeholders::_2));
173 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_M == deviceInfo.
hardwareRevision) {
176 case system::DeviceInfo::IMAGER_TYPE_CMV2000_GREY:
177 case system::DeviceInfo::IMAGER_TYPE_CMV2000_COLOR:
180 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::mono_cmv2000Config> > (
181 new dynamic_reconfigure::Server<multisense_ros::mono_cmv2000Config>(
device_nh_));
183 std::placeholders::_1, std::placeholders::_2));
186 case system::DeviceInfo::IMAGER_TYPE_CMV4000_GREY:
187 case system::DeviceInfo::IMAGER_TYPE_CMV4000_COLOR:
190 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::mono_cmv4000Config> > (
191 new dynamic_reconfigure::Server<multisense_ros::mono_cmv4000Config>(
device_nh_));
193 std::placeholders::_1, std::placeholders::_2));
197 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_C6S2_S27 == deviceInfo.
hardwareRevision ||
198 system::DeviceInfo::HARDWARE_REV_MULTISENSE_S30 == deviceInfo.
hardwareRevision) {
200 if (ground_surface_supported) {
202 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234_ground_surfaceConfig> > (
203 new dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234_ground_surfaceConfig>(
device_nh_));
205 std::placeholders::_1, std::placeholders::_2));
208 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234Config> > (
209 new dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234Config>(
device_nh_));
211 std::placeholders::_1, std::placeholders::_2));
213 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21 == deviceInfo.
hardwareRevision) {
215 if (ground_surface_supported) {
217 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::ks21_sgm_AR0234_ground_surfaceConfig> > (
218 new dynamic_reconfigure::Server<multisense_ros::ks21_sgm_AR0234_ground_surfaceConfig>(
device_nh_));
220 std::placeholders::_1, std::placeholders::_2));
223 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::ks21_sgm_AR0234Config> > (
224 new dynamic_reconfigure::Server<multisense_ros::ks21_sgm_AR0234Config>(
device_nh_));
226 std::placeholders::_1, std::placeholders::_2));
228 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21i == deviceInfo.
hardwareRevision) {
230 if (ground_surface_supported) {
232 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::ks21i_sgm_AR0234_ground_surfaceConfig> > (
233 new dynamic_reconfigure::Server<multisense_ros::ks21i_sgm_AR0234_ground_surfaceConfig>(
device_nh_));
235 std::placeholders::_1, std::placeholders::_2));
238 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::ks21i_sgm_AR0234Config> > (
239 new dynamic_reconfigure::Server<multisense_ros::ks21i_sgm_AR0234Config>(
device_nh_));
241 std::placeholders::_1, std::placeholders::_2));
243 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_VPB == deviceInfo.
hardwareRevision) {
245 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::remote_head_vpbConfig > > (
246 new dynamic_reconfigure::Server<multisense_ros::remote_head_vpbConfig>(
device_nh_));
248 std::placeholders::_1, std::placeholders::_2));
249 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_STEREO == deviceInfo.
hardwareRevision) {
250 if (ground_surface_supported) {
252 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::remote_head_sgm_AR0234_ground_surfaceConfig > > (
253 new dynamic_reconfigure::Server<multisense_ros::remote_head_sgm_AR0234_ground_surfaceConfig>(
device_nh_));
255 std::placeholders::_1, std::placeholders::_2));
258 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::remote_head_sgm_AR0234Config > > (
259 new dynamic_reconfigure::Server<multisense_ros::remote_head_sgm_AR0234Config>(
device_nh_));
261 std::placeholders::_1, std::placeholders::_2));
263 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_MONOCAM == deviceInfo.
hardwareRevision) {
265 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::remote_head_monocam_AR0234Config > > (
266 new dynamic_reconfigure::Server<multisense_ros::remote_head_monocam_AR0234Config>(
device_nh_));
268 std::placeholders::_1, std::placeholders::_2));
272 case system::DeviceInfo::IMAGER_TYPE_CMV2000_GREY:
273 case system::DeviceInfo::IMAGER_TYPE_CMV2000_COLOR:
276 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv2000Config> > (
277 new dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv2000Config>(
device_nh_));
279 std::placeholders::_1, std::placeholders::_2));
282 case system::DeviceInfo::IMAGER_TYPE_CMV4000_GREY:
283 case system::DeviceInfo::IMAGER_TYPE_CMV4000_COLOR:
286 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv4000Config> > (
287 new dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv4000Config>(
device_nh_));
289 std::placeholders::_1, std::placeholders::_2));
301 case system::DeviceInfo::IMAGER_TYPE_CMV2000_GREY:
302 case system::DeviceInfo::IMAGER_TYPE_CMV2000_COLOR:
305 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv2000_imuConfig> > (
306 new dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv2000_imuConfig>(
device_nh_));
308 std::placeholders::_1, std::placeholders::_2));
311 case system::DeviceInfo::IMAGER_TYPE_CMV4000_GREY:
312 case system::DeviceInfo::IMAGER_TYPE_CMV4000_COLOR:
315 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv4000_imuConfig> > (
316 new dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv4000_imuConfig>(
device_nh_));
318 std::placeholders::_1, std::placeholders::_2));
330 case system::DeviceInfo::IMAGER_TYPE_CMV2000_GREY:
331 case system::DeviceInfo::IMAGER_TYPE_CMV2000_COLOR:
334 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_sgm_cmv2000_imuConfig> > (
335 new dynamic_reconfigure::Server<multisense_ros::sl_sgm_cmv2000_imuConfig>(
device_nh_));
337 std::placeholders::_1, std::placeholders::_2));
340 case system::DeviceInfo::IMAGER_TYPE_CMV4000_GREY:
341 case system::DeviceInfo::IMAGER_TYPE_CMV4000_COLOR:
344 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_sgm_cmv4000_imuConfig> > (
345 new dynamic_reconfigure::Server<multisense_ros::sl_sgm_cmv4000_imuConfig>(
device_nh_));
347 std::placeholders::_1, std::placeholders::_2));
349 case system::DeviceInfo::IMAGER_TYPE_AR0234_GREY:
350 case system::DeviceInfo::IMAGER_TYPE_AR0239_COLOR:
352 if (ground_surface_supported) {
354 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234_ground_surfaceConfig> > (
355 new dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234_ground_surfaceConfig>(
device_nh_));
357 std::placeholders::_1, std::placeholders::_2));
360 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234Config> > (
361 new dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234Config>(
device_nh_));
363 std::placeholders::_1, std::placeholders::_2));
392 if (width ==
static_cast<int32_t
>(cfg.
width()) &&
393 height ==
static_cast<int32_t
>(cfg.
height()) &&
394 disparities ==
static_cast<int32_t
>(cfg.
disparities()))
403 if (Status_Ok != status) {
404 ROS_ERROR(
"Reconfigure: failed to query sensor modes: %s",
405 Channel::statusString(status));
413 bool supported =
false;
414 std::vector<system::DeviceMode>::const_iterator it =
device_modes_.begin();
419 if (width ==
static_cast<int32_t
>(m.
width) &&
420 height ==
static_cast<int32_t
>(m.
height) &&
421 disparities ==
static_cast<int32_t
>(m.
disparities)) {
428 if (
false == supported) {
429 ROS_ERROR(
"Reconfigure: sensor does not support a resolution of: %dx%d (%d disparities)",
430 width, height, disparities);
434 ROS_WARN(
"Reconfigure: changing sensor resolution to %dx%d (%d disparities), from %dx%d "
435 "(%d disparities): reconfiguration may take up to 30 seconds",
436 width, height, disparities,
452 cfg.
setHdr(dyn.hdr_enable);
474 if (Status_Ok != status) {
475 ROS_ERROR(
"Reconfigure: failed to query aux image config: %s",
476 Channel::statusString(status));
483 auxConfig.
setGain(dyn.aux_gain);
485 auxConfig.
setExposure(dyn.aux_exposure_time * 1e6);
495 auxConfig.
setWhiteBalance(dyn.aux_white_balance_red, dyn.aux_white_balance_blue);
501 if (dyn.aux_roi_auto_exposure) {
506 const int32_t maxX = dyn.__getMax__().aux_roi_auto_exposure_x;
507 const int32_t maxY = dyn.__getMax__().aux_roi_auto_exposure_y;
509 const int32_t x = fmax(0, fmin(dyn.aux_roi_auto_exposure_x, maxX));
510 const int32_t y = fmax(0, fmin(dyn.aux_roi_auto_exposure_y, maxY));
513 fmax(0, fmin(dyn.aux_roi_auto_exposure_width, maxX - x)),
514 fmax(0, fmin(dyn.aux_roi_auto_exposure_height, maxY - y)));
516 ROS_WARN(
"Reconfigure: ROI auto exposure is not supported with this firmware version");
525 if (Status_Ok != status)
526 ROS_ERROR(
"Reconfigure: failed to set aux image config: %s",
527 Channel::statusString(status));
535 int32_t width, height, disparities;
536 bool resolutionChange=
false;
542 if (3 != sscanf(dyn.resolution.c_str(),
"%dx%dx%d", &width, &height, &disparities)) {
543 ROS_ERROR(
"Reconfigure: malformed resolution string: \"%s\"", dyn.resolution.c_str());
555 if (Status_Ok != status) {
556 ROS_ERROR(
"Reconfigure: failed to get enabled streams: %s",
557 Channel::statusString(status));
561 if (Status_Ok != status) {
562 ROS_ERROR(
"Reconfigure: failed to stop streams for a resolution change: %s",
563 Channel::statusString(status));
580 if (dyn.roi_auto_exposure) {
585 const int32_t maxX = dyn.__getMax__().roi_auto_exposure_x;
586 const int32_t maxY = dyn.__getMax__().roi_auto_exposure_y;
588 const int32_t x = fmax(0, fmin(dyn.roi_auto_exposure_x, maxX));
589 const int32_t y = fmax(0, fmin(dyn.roi_auto_exposure_y, maxY));
592 fmax(0, fmin(dyn.roi_auto_exposure_width, maxX - x)),
593 fmax(0, fmin(dyn.roi_auto_exposure_height, maxY - y)));
595 ROS_WARN(
"Reconfigure: ROI auto exposure is not supported with this firmware version");
606 if (Status_Ok != status)
607 ROS_ERROR(
"Reconfigure: failed to set image config: %s",
608 Channel::statusString(status));
611 if (Status_Ok != status)
612 ROS_ERROR(
"Reconfigure: failed to query image config: %s",
613 Channel::statusString(status));
620 if (resolutionChange) {
622 if (Status_Ok != status)
623 ROS_ERROR(
"Reconfigure: failed to restart streams after a resolution change: %s",
624 Channel::statusString(status));
644 d.delay = dyn.desired_transmit_delay;
646 if (Status_Ok != status) {
647 ROS_ERROR(
"Reconfigure: failed to set transmit delay: %s",
648 Channel::statusString(status));
659 const float radiansPerSecondToRpm = 9.54929659643;
662 if (Status_Ok != status) {
663 if (Status_Unsupported == status)
666 ROS_ERROR(
"Reconfigure: failed to set motor speed: %s",
667 Channel::statusString(status));
681 if (
false == dyn.lighting) {
690 if (Status_Ok != status) {
691 if (Status_Unsupported == status)
694 ROS_ERROR(
"Reconfigure: failed to set lighting config: %s",
695 Channel::statusString(status));
709 if (
false == dyn.lighting) {
721 if (Status_Ok != status) {
722 if (Status_Unsupported == status)
725 ROS_ERROR(
"Reconfigure: failed to set lighting config: %s",
726 Channel::statusString(status));
736 if (Status_Ok != status) {
737 ROS_ERROR(
"Reconfigure: failed to query IMU config: %s",
738 Channel::statusString(status));
743 std::vector<imu::Config> changedConfigs;
744 std::vector<imu::Config>::iterator it =
imu_configs_.begin();
749 if (
"accelerometer" == c.
name &&
750 (c.
enabled != dyn.accelerometer_enabled ||
754 c.
enabled = dyn.accelerometer_enabled;
757 changedConfigs.push_back(c);
760 if (
"gyroscope" == c.
name &&
761 (c.
enabled != dyn.gyroscope_enabled ||
765 c.
enabled = dyn.gyroscope_enabled;
768 changedConfigs.push_back(c);
771 if (
"magnetometer" == c.
name &&
772 (c.
enabled != dyn.magnetometer_enabled ||
776 c.
enabled = dyn.magnetometer_enabled;
779 changedConfigs.push_back(c);
783 if (changedConfigs.size() > 0 ||
786 ROS_WARN(
"Reconfigure: IMU configuration changes will take effect after all IMU "
787 "topic subscriptions have been closed.");
794 if (Status_Ok != status) {
795 ROS_ERROR(
"Reconfigure: failed to set IMU configuration: %s",
796 Channel::statusString(status));
822 if (Status_Ok != status) {
823 if (Status_Unsupported == status || Status_Unknown == status) {
826 ROS_ERROR(
"Reconfigure: enable PTP time synchronization: %s",
827 Channel::statusString(status));
836 if (dyn.trigger_source != 3 || (
ptp_supported_ && dyn.trigger_source == 3)) {
838 if (Status_Ok != status) {
839 if (Status_Unsupported == status || Status_Unknown == status) {
842 ROS_ERROR(
"Reconfigure: failed to set trigger source: %s",
843 Channel::statusString(status));
872 if (!dyn.enable_origin_from_camera_configuration)
891 constexpr
float deg_to_rad = M_PI / 180.0f;
892 if (std::abs(dyn.origin_from_camera_position_x_m -
calibration_.
x) < 1e-3 &&
893 std::abs(dyn.origin_from_camera_position_y_m -
calibration_.
y) < 1e-3 &&
894 std::abs(dyn.origin_from_camera_position_z_m -
calibration_.
z) < 1e-3 &&
895 std::abs(dyn.origin_from_camera_rotation_x_deg * deg_to_rad -
calibration_.
roll) < 1e-3 &&
896 std::abs(dyn.origin_from_camera_rotation_y_deg * deg_to_rad -
calibration_.
pitch) < 1e-3 &&
897 std::abs(dyn.origin_from_camera_rotation_z_deg * deg_to_rad -
calibration_.
yaw) < 1e-3) {
913 if (Status_Ok != status) {
914 ROS_ERROR(
"Reconfigure: failed to set external calibration: %s",
915 Channel::statusString(status));
932 if (dyn.ground_surface_pre_transform_data ==
"Quadratic")
934 else if (dyn.ground_surface_pre_transform_data ==
"Mean")
936 else if (dyn.ground_surface_pre_transform_data ==
"Zero")
955 if (Status_Ok != status) {
956 ROS_ERROR(
"Reconfigure: failed to set ground surface params: %s",
957 Channel::statusString(status));
965 dyn.ground_surface_pointcloud_global_max_z_m,
966 dyn.ground_surface_pointcloud_global_min_z_m,
967 dyn.ground_surface_pointcloud_global_max_x_m,
968 dyn.ground_surface_pointcloud_global_min_x_m,
969 dyn.ground_surface_spline_draw_resolution}
977 ?
static_cast<RemoteHeadChannel>(dyn.sync_group_1_controller) : Remote_Head_Invalid;
979 ?
static_cast<RemoteHeadChannel>(dyn.sync_group_1_responder) : Remote_Head_Invalid;
982 ?
static_cast<RemoteHeadChannel>(dyn.sync_group_2_controller) : Remote_Head_Invalid;
984 ?
static_cast<RemoteHeadChannel>(dyn.sync_group_2_responder) : Remote_Head_Invalid;
986 const std::vector<RemoteHeadSyncGroup> sync_groups{{c1, {r1}}, {c2, {r2}}};
992 if (Status_Ok != status) {
993 ROS_ERROR(
"Reconfigure: failed to set remote head config: %s",
994 Channel::statusString(status));
999 #define GET_CONFIG() \
1000 image::Config cfg; \
1001 Status status = driver_->getImageConfig(cfg); \
1002 if (Status_Ok != status) { \
1003 ROS_ERROR("Reconfigure: failed to query image config: %s", \
1004 Channel::statusString(status)); \
1008 #define SL_BM() do { \
1010 configureAutoWhiteBalance(cfg, dyn); \
1011 configureCamera(cfg, dyn); \
1012 configureMotor(dyn); \
1013 configureLeds(dyn); \
1014 configureBorderClip(dyn); \
1015 configurePointCloudRange(dyn); \
1016 configureExtrinsics(dyn); \
1019 #define SL_BM_IMU() do { \
1021 configureAutoWhiteBalance(cfg, dyn); \
1022 configureCamera(cfg, dyn); \
1023 configureMotor(dyn); \
1024 configureLeds(dyn); \
1025 configureImu(dyn); \
1026 configureBorderClip(dyn); \
1027 configurePointCloudRange(dyn); \
1028 configureExtrinsics(dyn); \
1031 #define MONO_BM_IMU() do { \
1033 configureAutoWhiteBalance(cfg, dyn); \
1034 configureCamera(cfg, dyn); \
1035 configureLeds(dyn); \
1036 configureImu(dyn); \
1037 configureExtrinsics(dyn); \
1040 #define SL_SGM_IMU() do { \
1042 configureSgm(cfg, dyn); \
1043 configureHdr(cfg, dyn); \
1044 configureAutoWhiteBalance(cfg, dyn); \
1045 configureCamera(cfg, dyn); \
1046 configureMotor(dyn); \
1047 configureLeds(dyn); \
1048 configureImu(dyn); \
1049 configureBorderClip(dyn); \
1050 configurePointCloudRange(dyn); \
1051 configureExtrinsics(dyn); \
1054 #define SL_SGM() do { \
1056 configureSgm(cfg, dyn); \
1057 configureHdr(cfg, dyn); \
1058 configureAutoWhiteBalance(cfg, dyn); \
1059 configureCamera(cfg, dyn); \
1060 configureBorderClip(dyn); \
1061 configurePointCloudRange(dyn); \
1062 configureExtrinsics(dyn); \
1065 #define SL_SGM_IMU_CMV4000() do { \
1067 configureSgm(cfg, dyn); \
1068 configureHdr(cfg, dyn); \
1069 configureAutoWhiteBalance(cfg, dyn); \
1070 configureCamera(cfg, dyn); \
1071 configureMotor(dyn); \
1072 configureLeds(dyn); \
1073 configureImu(dyn); \
1074 configureBorderClip(dyn); \
1075 configurePointCloudRange(dyn); \
1076 configureExtrinsics(dyn); \
1079 #define S27_SGM() do { \
1081 configureSgm(cfg, dyn); \
1082 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1083 configureStereoProfile(profile, dyn); \
1084 configureDetailDisparityStereoProfile(profile, dyn); \
1085 configureFullResAuxStereoProfile(profile, dyn); \
1086 cfg.setCameraProfile(profile); \
1087 configureGamma(cfg, dyn); \
1088 configureCamera(cfg, dyn); \
1089 configureBorderClip(dyn); \
1090 configurePtp(dyn); \
1091 configurePointCloudRange(dyn); \
1092 configureExtrinsics(dyn); \
1093 configureAuxCamera(dyn); \
1096 #define KS21_SGM() do { \
1098 configureSgm(cfg, dyn); \
1099 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1100 configureStereoProfile(profile, dyn); \
1101 configureDetailDisparityStereoProfile(profile, dyn); \
1102 cfg.setCameraProfile(profile); \
1103 configureGamma(cfg, dyn); \
1104 configureCamera(cfg, dyn); \
1105 configureBorderClip(dyn); \
1106 configureS19Leds(dyn); \
1107 configurePtp(dyn); \
1108 configurePointCloudRange(dyn); \
1109 configureExtrinsics(dyn); \
1112 #define KS21I_SGM() do { \
1114 configureSgm(cfg, dyn); \
1115 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1116 configureStereoProfile(profile, dyn); \
1117 configureDetailDisparityStereoProfile(profile, dyn); \
1118 configureFullResAuxStereoProfile(profile, dyn); \
1119 cfg.setCameraProfile(profile); \
1120 configureGamma(cfg, dyn); \
1121 configureCamera(cfg, dyn); \
1122 configureBorderClip(dyn); \
1123 configureS19Leds(dyn); \
1124 configurePtp(dyn); \
1125 configurePointCloudRange(dyn); \
1126 configureExtrinsics(dyn); \
1127 configureAuxCamera(dyn); \
1130 #define S27_SGM_GROUND_SURFACE() do { \
1132 configureSgm(cfg, dyn); \
1133 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1134 configureStereoProfile(profile, dyn); \
1135 configureDetailDisparityStereoProfile(profile, dyn); \
1136 configureGroundSurfaceStereoProfile(profile, dyn); \
1137 configureFullResAuxStereoProfile(profile, dyn); \
1138 cfg.setCameraProfile(profile); \
1139 configureGamma(cfg, dyn); \
1140 configureCamera(cfg, dyn); \
1141 configureBorderClip(dyn); \
1142 configurePtp(dyn); \
1143 configurePointCloudRange(dyn); \
1144 configureExtrinsics(dyn); \
1145 configureGroundSurfaceParams(dyn); \
1146 configureAuxCamera(dyn); \
1149 #define KS21_SGM_GROUND_SURFACE() do { \
1151 configureSgm(cfg, dyn); \
1152 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1153 configureStereoProfile(profile, dyn); \
1154 configureDetailDisparityStereoProfile(profile, dyn); \
1155 configureGroundSurfaceStereoProfile(profile, dyn); \
1156 cfg.setCameraProfile(profile); \
1157 configureGamma(cfg, dyn); \
1158 configureCamera(cfg, dyn); \
1159 configureBorderClip(dyn); \
1160 configureS19Leds(dyn); \
1161 configurePtp(dyn); \
1162 configurePointCloudRange(dyn); \
1163 configureExtrinsics(dyn); \
1164 configureGroundSurfaceParams(dyn); \
1167 #define KS21I_SGM_GROUND_SURFACE() do { \
1169 configureSgm(cfg, dyn); \
1170 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1171 configureStereoProfile(profile, dyn); \
1172 configureDetailDisparityStereoProfile(profile, dyn); \
1173 configureGroundSurfaceStereoProfile(profile, dyn); \
1174 configureFullResAuxStereoProfile(profile, dyn); \
1175 cfg.setCameraProfile(profile); \
1176 configureGamma(cfg, dyn); \
1177 configureCamera(cfg, dyn); \
1178 configureBorderClip(dyn); \
1179 configureS19Leds(dyn); \
1180 configurePtp(dyn); \
1181 configurePointCloudRange(dyn); \
1182 configureExtrinsics(dyn); \
1183 configureGroundSurfaceParams(dyn); \
1184 configureAuxCamera(dyn); \
1187 #define REMOTE_HEAD_VPB() do { \
1189 configurePtp(dyn); \
1190 configureExtrinsics(dyn); \
1191 configureRemoteHeadSyncGroups(dyn); \
1194 #define REMOTE_HEAD_SGM_AR0234() do { \
1196 configureSgm(cfg, dyn); \
1197 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1198 configureStereoProfile(profile, dyn); \
1199 configureDetailDisparityStereoProfile(profile, dyn); \
1200 cfg.setCameraProfile(profile); \
1201 configureGamma(cfg, dyn); \
1202 configureCamera(cfg, dyn); \
1203 configureBorderClip(dyn); \
1204 configureS19Leds(dyn); \
1205 configurePtp(dyn); \
1206 configurePointCloudRange(dyn); \
1207 configureExtrinsics(dyn); \
1210 #define REMOTE_HEAD_SGM_AR0234_GROUND_SURFACE() do { \
1212 configureSgm(cfg, dyn); \
1213 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1214 configureStereoProfile(profile, dyn); \
1215 configureDetailDisparityStereoProfile(profile, dyn); \
1216 configureGroundSurfaceStereoProfile(profile, dyn); \
1217 cfg.setCameraProfile(profile); \
1218 configureGamma(cfg, dyn); \
1219 configureCamera(cfg, dyn); \
1220 configureBorderClip(dyn); \
1221 configureS19Leds(dyn); \
1222 configurePtp(dyn); \
1223 configurePointCloudRange(dyn); \
1224 configureExtrinsics(dyn); \
1225 configureGroundSurfaceParams(dyn); \
1228 #define REMOTE_HEAD_MONOCAM_AR0234() do { \
1230 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1231 configureStereoProfile(profile, dyn); \
1232 cfg.setCameraProfile(profile); \
1233 configureGamma(cfg, dyn); \
1234 configureCamera(cfg, dyn); \
1235 configureS19Leds(dyn); \
1236 configurePtp(dyn); \
1237 configureExtrinsics(dyn); \
1273 int32_t width, height;
1274 bool resolutionChange=
false;
1279 if (2 != sscanf(dyn.resolution.c_str(),
"%dx%dx", &width, &height)) {
1280 ROS_ERROR(
"Reconfigure: malformed resolution string: \"%s\"", dyn.resolution.c_str());
1293 if (Status_Ok != status) {
1294 ROS_ERROR(
"Reconfigure: failed to get enabled streams: %s",
1295 Channel::statusString(status));
1299 if (Status_Ok != status) {
1300 ROS_ERROR(
"Reconfigure: failed to stop streams for a resolution change: %s",
1301 Channel::statusString(status));
1309 cfg.setFps(
static_cast<float>(dyn.fps));
1310 cfg.setGain(dyn.gain);
1311 cfg.setExposure(dyn.exposure_time * 1e6);
1312 cfg.setAutoExposure(dyn.auto_exposure);
1313 cfg.setAutoExposureMax(dyn.auto_exposure_max_time * 1e6);
1314 cfg.setAutoExposureDecay(dyn.auto_exposure_decay);
1315 cfg.setAutoExposureThresh(dyn.auto_exposure_thresh);
1316 cfg.setWhiteBalance(dyn.white_balance_red,
1317 dyn.white_balance_blue);
1318 cfg.setAutoWhiteBalance(dyn.auto_white_balance);
1319 cfg.setAutoWhiteBalanceDecay(dyn.auto_white_balance_decay);
1320 cfg.setAutoWhiteBalanceThresh(dyn.auto_white_balance_thresh);
1326 if (Status_Ok != status)
1327 ROS_ERROR(
"Reconfigure: failed to set image config: %s",
1328 Channel::statusString(status));
1331 if (Status_Ok != status)
1332 ROS_ERROR(
"Reconfigure: failed to query image config: %s",
1333 Channel::statusString(status));
1340 if (resolutionChange) {
1343 if (Status_Ok != status)
1344 ROS_ERROR(
"Reconfigure: failed to restart streams after a resolution change: %s",
1345 Channel::statusString(status));
1359 int32_t width, height, disparities;
1360 bool resolutionChange=
false;
1367 if (3 != sscanf(dyn.resolution.c_str(),
"%dx%dx%d", &width, &height, &disparities)) {
1368 ROS_ERROR(
"Reconfigure: malformed resolution string: \"%s\"", dyn.resolution.c_str());
1375 if ((resolutionChange =
changeResolution(cfg, width, height, disparities))) {
1381 if (Status_Ok != status) {
1382 ROS_ERROR(
"Reconfigure: failed to get enabled streams: %s",
1383 Channel::statusString(status));
1387 if (Status_Ok != status) {
1388 ROS_ERROR(
"Reconfigure: failed to stop streams for a resolution change: %s",
1389 Channel::statusString(status));
1394 cfg.setFps(dyn.fps);
1403 if (Status_Ok != status)
1404 ROS_ERROR(
"Reconfigure: failed to set image config: %s",
1405 Channel::statusString(status));
1408 if (Status_Ok != status)
1409 ROS_ERROR(
"Reconfigure: failed to query image config: %s",
1410 Channel::statusString(status));
1417 if (resolutionChange) {
1420 if (Status_Ok != status)
1421 ROS_ERROR(
"Reconfigure: failed to restart streams after a resolution change: %s",
1422 Channel::statusString(status));
1439 int32_t width, height, disparities;
1440 bool resolutionChange=
false;
1447 if (3 != sscanf(dyn.resolution.c_str(),
"%dx%dx%d", &width, &height, &disparities)) {
1448 ROS_ERROR(
"Reconfigure: malformed resolution string: \"%s\"", dyn.resolution.c_str());
1455 if ((resolutionChange =
changeResolution(cfg, width, height, disparities))) {
1461 if (Status_Ok != status) {
1462 ROS_ERROR(
"Reconfigure: failed to get enabled streams: %s",
1463 Channel::statusString(status));
1467 if (Status_Ok != status) {
1468 ROS_ERROR(
"Reconfigure: failed to stop streams for a resolution change: %s",
1469 Channel::statusString(status));
1474 cfg.setFps(dyn.fps);
1483 if (Status_Ok != status)
1484 ROS_ERROR(
"Reconfigure: failed to set image config: %s",
1485 Channel::statusString(status));
1488 if (Status_Ok != status)
1489 ROS_ERROR(
"Reconfigure: failed to query image config: %s",
1490 Channel::statusString(status));
1497 if (resolutionChange) {
1500 if (Status_Ok != status)
1501 ROS_ERROR(
"Reconfigure: failed to restart streams after a resolution change: %s",
1502 Channel::statusString(status));