42 std::function<
void (
BorderClip,
double)> borderClipChangeCallback,
43 std::function<
void (
double)> maxPointCloudRangeCallback,
47 resolution_change_callback_(resolutionChangeCallback),
49 imu_samples_per_message_(0),
50 lighting_supported_(false),
51 motor_supported_(false),
52 crop_mode_changed_(false),
53 ptp_supported_(false),
54 roi_supported_(false),
55 aux_supported_(false),
56 reconfigure_external_calibration_supported_(false),
58 border_clip_value_(0.0),
59 border_clip_change_callback_(borderClipChangeCallback),
60 max_point_cloud_range_callback_(maxPointCloudRangeCallback),
61 extrinsics_callback_(extrinsicsCallback),
62 spline_draw_parameters_callback_(groundSurfaceSplineDrawParametersCallback)
66 std::vector<system::DeviceMode> deviceModes;
72 if (Status_Ok != status) {
73 ROS_ERROR(
"Reconfigure: failed to query version info: %s",
74 Channel::statusString(status));
79 if (Status_Ok != status) {
80 ROS_ERROR(
"Reconfigure: failed to query device info: %s",
81 Channel::statusString(status));
86 if (Status_Ok != status) {
87 ROS_ERROR(
"Reconfigure: failed to query device modes: %s",
88 Channel::statusString(status));
92 const bool ground_surface_supported =
93 std::any_of(deviceModes.begin(), deviceModes.end(), [](
const auto &mode) {
94 return (mode.supportedDataSources & Source_Ground_Surface_Spline_Data) &&
95 (mode.supportedDataSources & Source_Ground_Surface_Class_Image); });
98 system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21 == deviceInfo.
hardwareRevision ||
99 system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21i == deviceInfo.
hardwareRevision)
107 if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_C6S2_S27 == deviceInfo.
hardwareRevision ||
108 system::DeviceInfo::HARDWARE_REV_MULTISENSE_S30 == deviceInfo.
hardwareRevision ||
109 system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21 == deviceInfo.
hardwareRevision ||
110 system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21i == deviceInfo.
hardwareRevision ||
111 system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_VPB == deviceInfo.
hardwareRevision ||
112 system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_STEREO == deviceInfo.
hardwareRevision ||
113 system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_MONOCAM == deviceInfo.
hardwareRevision)
122 if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_C6S2_S27 == deviceInfo.
hardwareRevision ||
123 system::DeviceInfo::HARDWARE_REV_MULTISENSE_S30 == deviceInfo.
hardwareRevision ||
124 system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21i == deviceInfo.
hardwareRevision)
132 ROS_WARN(
"Reconfigure: MultiSense firmware version does not support the updated aux camera exposure controls. "
133 "The ROS driver will work normally, but you will have limited control over aux camera exposure parameters. "
134 "Please use the 2eae444 has of multisene_ros or contact support@carnegierobotics.com for "
135 "a updated firmware version greater than 6.0 to enable aux camera exposure controls.");
149 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::bcam_imx104Config> > (
150 new dynamic_reconfigure::Server<multisense_ros::bcam_imx104Config>(
device_nh_));
152 std::placeholders::_1, std::placeholders::_2));
154 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_ST21 == deviceInfo.
hardwareRevision) {
157 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::st21_sgm_vga_imuConfig> > (
158 new dynamic_reconfigure::Server<multisense_ros::st21_sgm_vga_imuConfig>(
device_nh_));
160 std::placeholders::_1, std::placeholders::_2));
162 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_ST25 == deviceInfo.
hardwareRevision) {
165 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::st25_sgm_imuConfig> > (
166 new dynamic_reconfigure::Server<multisense_ros::st25_sgm_imuConfig>(
device_nh_));
168 std::placeholders::_1, std::placeholders::_2));
170 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_M == deviceInfo.
hardwareRevision) {
173 case system::DeviceInfo::IMAGER_TYPE_CMV2000_GREY:
174 case system::DeviceInfo::IMAGER_TYPE_CMV2000_COLOR:
177 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::mono_cmv2000Config> > (
178 new dynamic_reconfigure::Server<multisense_ros::mono_cmv2000Config>(
device_nh_));
180 std::placeholders::_1, std::placeholders::_2));
183 case system::DeviceInfo::IMAGER_TYPE_CMV4000_GREY:
184 case system::DeviceInfo::IMAGER_TYPE_CMV4000_COLOR:
187 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::mono_cmv4000Config> > (
188 new dynamic_reconfigure::Server<multisense_ros::mono_cmv4000Config>(
device_nh_));
190 std::placeholders::_1, std::placeholders::_2));
194 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_C6S2_S27 == deviceInfo.
hardwareRevision ||
195 system::DeviceInfo::HARDWARE_REV_MULTISENSE_S30 == deviceInfo.
hardwareRevision) {
197 if (ground_surface_supported) {
199 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234_ground_surfaceConfig> > (
200 new dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234_ground_surfaceConfig>(
device_nh_));
202 std::placeholders::_1, std::placeholders::_2));
205 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234Config> > (
206 new dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234Config>(
device_nh_));
208 std::placeholders::_1, std::placeholders::_2));
210 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21 == deviceInfo.
hardwareRevision) {
212 if (ground_surface_supported) {
214 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::ks21_sgm_AR0234_ground_surfaceConfig> > (
215 new dynamic_reconfigure::Server<multisense_ros::ks21_sgm_AR0234_ground_surfaceConfig>(
device_nh_));
217 std::placeholders::_1, std::placeholders::_2));
220 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::ks21_sgm_AR0234Config> > (
221 new dynamic_reconfigure::Server<multisense_ros::ks21_sgm_AR0234Config>(
device_nh_));
223 std::placeholders::_1, std::placeholders::_2));
225 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_KS21i == deviceInfo.
hardwareRevision) {
227 if (ground_surface_supported) {
229 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::ks21i_sgm_AR0234_ground_surfaceConfig> > (
230 new dynamic_reconfigure::Server<multisense_ros::ks21i_sgm_AR0234_ground_surfaceConfig>(
device_nh_));
232 std::placeholders::_1, std::placeholders::_2));
235 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::ks21i_sgm_AR0234Config> > (
236 new dynamic_reconfigure::Server<multisense_ros::ks21i_sgm_AR0234Config>(
device_nh_));
238 std::placeholders::_1, std::placeholders::_2));
240 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_VPB == deviceInfo.
hardwareRevision) {
242 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::remote_head_vpbConfig > > (
243 new dynamic_reconfigure::Server<multisense_ros::remote_head_vpbConfig>(
device_nh_));
245 std::placeholders::_1, std::placeholders::_2));
246 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_STEREO == deviceInfo.
hardwareRevision) {
247 if (ground_surface_supported) {
249 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::remote_head_sgm_AR0234_ground_surfaceConfig > > (
250 new dynamic_reconfigure::Server<multisense_ros::remote_head_sgm_AR0234_ground_surfaceConfig>(
device_nh_));
252 std::placeholders::_1, std::placeholders::_2));
255 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::remote_head_sgm_AR0234Config > > (
256 new dynamic_reconfigure::Server<multisense_ros::remote_head_sgm_AR0234Config>(
device_nh_));
258 std::placeholders::_1, std::placeholders::_2));
260 }
else if (system::DeviceInfo::HARDWARE_REV_MULTISENSE_REMOTE_HEAD_MONOCAM == deviceInfo.
hardwareRevision) {
262 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::remote_head_monocam_AR0234Config > > (
263 new dynamic_reconfigure::Server<multisense_ros::remote_head_monocam_AR0234Config>(
device_nh_));
265 std::placeholders::_1, std::placeholders::_2));
269 case system::DeviceInfo::IMAGER_TYPE_CMV2000_GREY:
270 case system::DeviceInfo::IMAGER_TYPE_CMV2000_COLOR:
273 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv2000Config> > (
274 new dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv2000Config>(
device_nh_));
276 std::placeholders::_1, std::placeholders::_2));
279 case system::DeviceInfo::IMAGER_TYPE_CMV4000_GREY:
280 case system::DeviceInfo::IMAGER_TYPE_CMV4000_COLOR:
283 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv4000Config> > (
284 new dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv4000Config>(
device_nh_));
286 std::placeholders::_1, std::placeholders::_2));
298 case system::DeviceInfo::IMAGER_TYPE_CMV2000_GREY:
299 case system::DeviceInfo::IMAGER_TYPE_CMV2000_COLOR:
302 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv2000_imuConfig> > (
303 new dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv2000_imuConfig>(
device_nh_));
305 std::placeholders::_1, std::placeholders::_2));
308 case system::DeviceInfo::IMAGER_TYPE_CMV4000_GREY:
309 case system::DeviceInfo::IMAGER_TYPE_CMV4000_COLOR:
312 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv4000_imuConfig> > (
313 new dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv4000_imuConfig>(
device_nh_));
315 std::placeholders::_1, std::placeholders::_2));
327 case system::DeviceInfo::IMAGER_TYPE_CMV2000_GREY:
328 case system::DeviceInfo::IMAGER_TYPE_CMV2000_COLOR:
331 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_sgm_cmv2000_imuConfig> > (
332 new dynamic_reconfigure::Server<multisense_ros::sl_sgm_cmv2000_imuConfig>(
device_nh_));
334 std::placeholders::_1, std::placeholders::_2));
337 case system::DeviceInfo::IMAGER_TYPE_CMV4000_GREY:
338 case system::DeviceInfo::IMAGER_TYPE_CMV4000_COLOR:
341 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_sgm_cmv4000_imuConfig> > (
342 new dynamic_reconfigure::Server<multisense_ros::sl_sgm_cmv4000_imuConfig>(
device_nh_));
344 std::placeholders::_1, std::placeholders::_2));
346 case system::DeviceInfo::IMAGER_TYPE_AR0234_GREY:
347 case system::DeviceInfo::IMAGER_TYPE_AR0239_COLOR:
349 if (ground_surface_supported) {
351 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234_ground_surfaceConfig> > (
352 new dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234_ground_surfaceConfig>(
device_nh_));
354 std::placeholders::_1, std::placeholders::_2));
357 std::shared_ptr< dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234Config> > (
358 new dynamic_reconfigure::Server<multisense_ros::s27_sgm_AR0234Config>(
device_nh_));
360 std::placeholders::_1, std::placeholders::_2));
390 if (width ==
static_cast<int32_t
>(cfg.
width()) &&
391 height ==
static_cast<int32_t
>(cfg.
height()) &&
392 disparities ==
static_cast<int32_t
>(cfg.
disparities()))
401 if (Status_Ok != status) {
402 ROS_ERROR(
"Reconfigure: failed to query sensor modes: %s",
403 Channel::statusString(status));
411 bool supported =
false;
412 std::vector<system::DeviceMode>::const_iterator it =
device_modes_.begin();
417 if (width ==
static_cast<int32_t
>(m.
width) &&
418 height ==
static_cast<int32_t
>(m.
height) &&
419 disparities ==
static_cast<int32_t
>(m.
disparities)) {
426 if (
false == supported) {
427 ROS_ERROR(
"Reconfigure: sensor does not support a resolution of: %dx%d (%d disparities)",
428 width, height, disparities);
432 ROS_WARN(
"Reconfigure: changing sensor resolution to %dx%d (%d disparities), from %dx%d "
433 "(%d disparities): reconfiguration may take up to 30 seconds",
434 width, height, disparities,
450 cfg.
setHdr(dyn.hdr_enable);
472 if (Status_Ok != status) {
473 ROS_ERROR(
"Reconfigure: failed to query aux image config: %s",
474 Channel::statusString(status));
481 auxConfig.
setGain(dyn.aux_gain);
483 auxConfig.
setExposure(dyn.aux_exposure_time * 1e6);
493 auxConfig.
setWhiteBalance(dyn.aux_white_balance_red, dyn.aux_white_balance_blue);
499 if (dyn.aux_roi_auto_exposure) {
504 const int32_t maxX = dyn.__getMax__().aux_roi_auto_exposure_x;
505 const int32_t maxY = dyn.__getMax__().aux_roi_auto_exposure_y;
507 const int32_t x = fmax(0, fmin(dyn.aux_roi_auto_exposure_x, maxX));
508 const int32_t y = fmax(0, fmin(dyn.aux_roi_auto_exposure_y, maxY));
511 fmax(0, fmin(dyn.aux_roi_auto_exposure_width, maxX - x)),
512 fmax(0, fmin(dyn.aux_roi_auto_exposure_height, maxY - y)));
514 ROS_WARN(
"Reconfigure: ROI auto exposure is not supported with this firmware version");
523 if (Status_Ok != status)
524 ROS_ERROR(
"Reconfigure: failed to set aux image config: %s",
525 Channel::statusString(status));
533 int32_t width, height, disparities;
534 bool resolutionChange=
false;
540 if (3 != sscanf(dyn.resolution.c_str(),
"%dx%dx%d", &width, &height, &disparities)) {
541 ROS_ERROR(
"Reconfigure: malformed resolution string: \"%s\"", dyn.resolution.c_str());
553 if (Status_Ok != status) {
554 ROS_ERROR(
"Reconfigure: failed to get enabled streams: %s",
555 Channel::statusString(status));
559 if (Status_Ok != status) {
560 ROS_ERROR(
"Reconfigure: failed to stop streams for a resolution change: %s",
561 Channel::statusString(status));
578 if (dyn.roi_auto_exposure) {
583 const int32_t maxX = dyn.__getMax__().roi_auto_exposure_x;
584 const int32_t maxY = dyn.__getMax__().roi_auto_exposure_y;
586 const int32_t x = fmax(0, fmin(dyn.roi_auto_exposure_x, maxX));
587 const int32_t y = fmax(0, fmin(dyn.roi_auto_exposure_y, maxY));
590 fmax(0, fmin(dyn.roi_auto_exposure_width, maxX - x)),
591 fmax(0, fmin(dyn.roi_auto_exposure_height, maxY - y)));
593 ROS_WARN(
"Reconfigure: ROI auto exposure is not supported with this firmware version");
604 if (Status_Ok != status)
605 ROS_ERROR(
"Reconfigure: failed to set image config: %s",
606 Channel::statusString(status));
609 if (Status_Ok != status)
610 ROS_ERROR(
"Reconfigure: failed to query image config: %s",
611 Channel::statusString(status));
618 if (resolutionChange) {
620 if (Status_Ok != status)
621 ROS_ERROR(
"Reconfigure: failed to restart streams after a resolution change: %s",
622 Channel::statusString(status));
642 d.delay = dyn.desired_transmit_delay;
644 if (Status_Ok != status) {
645 ROS_ERROR(
"Reconfigure: failed to set transmit delay: %s",
646 Channel::statusString(status));
657 const float radiansPerSecondToRpm = 9.54929659643;
660 if (Status_Ok != status) {
661 if (Status_Unsupported == status)
664 ROS_ERROR(
"Reconfigure: failed to set motor speed: %s",
665 Channel::statusString(status));
679 if (
false == dyn.lighting) {
688 if (Status_Ok != status) {
689 if (Status_Unsupported == status)
692 ROS_ERROR(
"Reconfigure: failed to set lighting config: %s",
693 Channel::statusString(status));
707 if (
false == dyn.lighting) {
719 if (Status_Ok != status) {
720 if (Status_Unsupported == status)
723 ROS_ERROR(
"Reconfigure: failed to set lighting config: %s",
724 Channel::statusString(status));
734 if (Status_Ok != status) {
735 ROS_ERROR(
"Reconfigure: failed to query IMU config: %s",
736 Channel::statusString(status));
741 std::vector<imu::Config> changedConfigs;
742 std::vector<imu::Config>::iterator it =
imu_configs_.begin();
747 if (
"accelerometer" == c.
name &&
748 (c.
enabled != dyn.accelerometer_enabled ||
752 c.
enabled = dyn.accelerometer_enabled;
755 changedConfigs.push_back(c);
758 if (
"gyroscope" == c.
name &&
759 (c.
enabled != dyn.gyroscope_enabled ||
763 c.
enabled = dyn.gyroscope_enabled;
766 changedConfigs.push_back(c);
769 if (
"magnetometer" == c.
name &&
770 (c.
enabled != dyn.magnetometer_enabled ||
774 c.
enabled = dyn.magnetometer_enabled;
777 changedConfigs.push_back(c);
781 if (changedConfigs.size() > 0 ||
784 ROS_WARN(
"Reconfigure: IMU configuration changes will take effect after all IMU "
785 "topic subscriptions have been closed.");
792 if (Status_Ok != status) {
793 ROS_ERROR(
"Reconfigure: failed to set IMU configuration: %s",
794 Channel::statusString(status));
820 if (Status_Ok != status) {
821 if (Status_Unsupported == status || Status_Unknown == status) {
824 ROS_ERROR(
"Reconfigure: enable PTP time synchronization: %s",
825 Channel::statusString(status));
830 if (dyn.trigger_source != 3 || (
ptp_supported_ && dyn.trigger_source == 3)) {
832 if (Status_Ok != status) {
833 if (Status_Unsupported == status || Status_Unknown == status) {
836 ROS_ERROR(
"Reconfigure: failed to set trigger source: %s",
837 Channel::statusString(status));
866 constexpr
float deg_to_rad = M_PI / 180.0f;
867 if (std::abs(dyn.origin_from_camera_position_x_m -
calibration_.
x) < 1e-3 &&
868 std::abs(dyn.origin_from_camera_position_y_m -
calibration_.
y) < 1e-3 &&
869 std::abs(dyn.origin_from_camera_position_z_m -
calibration_.
z) < 1e-3 &&
870 std::abs(dyn.origin_from_camera_rotation_x_deg * deg_to_rad -
calibration_.
roll) < 1e-3 &&
871 std::abs(dyn.origin_from_camera_rotation_y_deg * deg_to_rad -
calibration_.
pitch) < 1e-3 &&
872 std::abs(dyn.origin_from_camera_rotation_z_deg * deg_to_rad -
calibration_.
yaw) < 1e-3) {
889 if (Status_Ok != status) {
890 ROS_ERROR(
"Reconfigure: failed to set external calibration: %s",
891 Channel::statusString(status));
909 if (dyn.ground_surface_pre_transform_data ==
"Quadratic")
911 else if (dyn.ground_surface_pre_transform_data ==
"Mean")
913 else if (dyn.ground_surface_pre_transform_data ==
"Zero")
932 if (Status_Ok != status) {
933 ROS_ERROR(
"Reconfigure: failed to set ground surface params: %s",
934 Channel::statusString(status));
942 dyn.ground_surface_pointcloud_global_max_z_m,
943 dyn.ground_surface_pointcloud_global_min_z_m,
944 dyn.ground_surface_pointcloud_global_max_x_m,
945 dyn.ground_surface_pointcloud_global_min_x_m,
946 dyn.ground_surface_spline_draw_resolution}
954 ?
static_cast<RemoteHeadChannel>(dyn.sync_group_1_controller) : Remote_Head_Invalid;
956 ?
static_cast<RemoteHeadChannel>(dyn.sync_group_1_responder) : Remote_Head_Invalid;
959 ?
static_cast<RemoteHeadChannel>(dyn.sync_group_2_controller) : Remote_Head_Invalid;
961 ?
static_cast<RemoteHeadChannel>(dyn.sync_group_2_responder) : Remote_Head_Invalid;
963 const std::vector<RemoteHeadSyncGroup> sync_groups{{c1, {r1}}, {c2, {r2}}};
969 if (Status_Ok != status) {
970 ROS_ERROR(
"Reconfigure: failed to set remote head config: %s",
971 Channel::statusString(status));
976 #define GET_CONFIG() \
978 Status status = driver_->getImageConfig(cfg); \
979 if (Status_Ok != status) { \
980 ROS_ERROR("Reconfigure: failed to query image config: %s", \
981 Channel::statusString(status)); \
985 #define SL_BM() do { \
987 configureAutoWhiteBalance(cfg, dyn); \
988 configureCamera(cfg, dyn); \
989 configureMotor(dyn); \
990 configureLeds(dyn); \
991 configureBorderClip(dyn); \
992 configurePointCloudRange(dyn); \
993 configureExtrinsics(dyn); \
996 #define SL_BM_IMU() do { \
998 configureAutoWhiteBalance(cfg, dyn); \
999 configureCamera(cfg, dyn); \
1000 configureMotor(dyn); \
1001 configureLeds(dyn); \
1002 configureImu(dyn); \
1003 configureBorderClip(dyn); \
1004 configurePointCloudRange(dyn); \
1005 configureExtrinsics(dyn); \
1008 #define MONO_BM_IMU() do { \
1010 configureAutoWhiteBalance(cfg, dyn); \
1011 configureCamera(cfg, dyn); \
1012 configureLeds(dyn); \
1013 configureImu(dyn); \
1014 configureExtrinsics(dyn); \
1017 #define SL_SGM_IMU() do { \
1019 configureSgm(cfg, dyn); \
1020 configureHdr(cfg, dyn); \
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 SL_SGM() do { \
1033 configureSgm(cfg, dyn); \
1034 configureHdr(cfg, dyn); \
1035 configureAutoWhiteBalance(cfg, dyn); \
1036 configureCamera(cfg, dyn); \
1037 configureBorderClip(dyn); \
1038 configurePointCloudRange(dyn); \
1039 configureExtrinsics(dyn); \
1042 #define SL_SGM_IMU_CMV4000() do { \
1044 configureSgm(cfg, dyn); \
1045 configureHdr(cfg, dyn); \
1046 configureAutoWhiteBalance(cfg, dyn); \
1047 configureCamera(cfg, dyn); \
1048 configureMotor(dyn); \
1049 configureLeds(dyn); \
1050 configureImu(dyn); \
1051 configureBorderClip(dyn); \
1052 configurePointCloudRange(dyn); \
1053 configureExtrinsics(dyn); \
1056 #define S27_SGM() do { \
1058 configureSgm(cfg, dyn); \
1059 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1060 configureStereoProfile(profile, dyn); \
1061 configureDetailDisparityStereoProfile(profile, dyn); \
1062 configureFullResAuxStereoProfile(profile, dyn); \
1063 cfg.setCameraProfile(profile); \
1064 configureGamma(cfg, dyn); \
1065 configureCamera(cfg, dyn); \
1066 configureBorderClip(dyn); \
1067 configurePtp(dyn); \
1068 configurePointCloudRange(dyn); \
1069 configureExtrinsics(dyn); \
1070 configureAuxCamera(dyn); \
1073 #define KS21_SGM() do { \
1075 configureSgm(cfg, dyn); \
1076 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1077 configureStereoProfile(profile, dyn); \
1078 configureDetailDisparityStereoProfile(profile, dyn); \
1079 cfg.setCameraProfile(profile); \
1080 configureGamma(cfg, dyn); \
1081 configureCamera(cfg, dyn); \
1082 configureBorderClip(dyn); \
1083 configureS19Leds(dyn); \
1084 configurePtp(dyn); \
1085 configurePointCloudRange(dyn); \
1086 configureExtrinsics(dyn); \
1089 #define KS21I_SGM() do { \
1091 configureSgm(cfg, dyn); \
1092 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1093 configureStereoProfile(profile, dyn); \
1094 configureDetailDisparityStereoProfile(profile, dyn); \
1095 configureFullResAuxStereoProfile(profile, dyn); \
1096 cfg.setCameraProfile(profile); \
1097 configureGamma(cfg, dyn); \
1098 configureCamera(cfg, dyn); \
1099 configureBorderClip(dyn); \
1100 configureS19Leds(dyn); \
1101 configurePtp(dyn); \
1102 configurePointCloudRange(dyn); \
1103 configureExtrinsics(dyn); \
1104 configureAuxCamera(dyn); \
1107 #define S27_SGM_GROUND_SURFACE() do { \
1109 configureSgm(cfg, dyn); \
1110 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1111 configureStereoProfile(profile, dyn); \
1112 configureDetailDisparityStereoProfile(profile, dyn); \
1113 configureGroundSurfaceStereoProfile(profile, dyn); \
1114 configureFullResAuxStereoProfile(profile, dyn); \
1115 cfg.setCameraProfile(profile); \
1116 configureGamma(cfg, dyn); \
1117 configureCamera(cfg, dyn); \
1118 configureBorderClip(dyn); \
1119 configurePtp(dyn); \
1120 configurePointCloudRange(dyn); \
1121 configureExtrinsics(dyn); \
1122 configureGroundSurfaceParams(dyn); \
1123 configureAuxCamera(dyn); \
1126 #define KS21_SGM_GROUND_SURFACE() do { \
1128 configureSgm(cfg, dyn); \
1129 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1130 configureStereoProfile(profile, dyn); \
1131 configureDetailDisparityStereoProfile(profile, dyn); \
1132 configureGroundSurfaceStereoProfile(profile, dyn); \
1133 cfg.setCameraProfile(profile); \
1134 configureGamma(cfg, dyn); \
1135 configureCamera(cfg, dyn); \
1136 configureBorderClip(dyn); \
1137 configureS19Leds(dyn); \
1138 configurePtp(dyn); \
1139 configurePointCloudRange(dyn); \
1140 configureExtrinsics(dyn); \
1141 configureGroundSurfaceParams(dyn); \
1144 #define KS21I_SGM_GROUND_SURFACE() do { \
1146 configureSgm(cfg, dyn); \
1147 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1148 configureStereoProfile(profile, dyn); \
1149 configureDetailDisparityStereoProfile(profile, dyn); \
1150 configureGroundSurfaceStereoProfile(profile, dyn); \
1151 configureFullResAuxStereoProfile(profile, dyn); \
1152 cfg.setCameraProfile(profile); \
1153 configureGamma(cfg, dyn); \
1154 configureCamera(cfg, dyn); \
1155 configureBorderClip(dyn); \
1156 configureS19Leds(dyn); \
1157 configurePtp(dyn); \
1158 configurePointCloudRange(dyn); \
1159 configureExtrinsics(dyn); \
1160 configureGroundSurfaceParams(dyn); \
1161 configureAuxCamera(dyn); \
1164 #define REMOTE_HEAD_VPB() do { \
1166 configurePtp(dyn); \
1167 configureExtrinsics(dyn); \
1168 configureRemoteHeadSyncGroups(dyn); \
1171 #define REMOTE_HEAD_SGM_AR0234() do { \
1173 configureSgm(cfg, dyn); \
1174 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1175 configureStereoProfile(profile, dyn); \
1176 configureDetailDisparityStereoProfile(profile, dyn); \
1177 cfg.setCameraProfile(profile); \
1178 configureGamma(cfg, dyn); \
1179 configureCamera(cfg, dyn); \
1180 configureBorderClip(dyn); \
1181 configureS19Leds(dyn); \
1182 configurePtp(dyn); \
1183 configurePointCloudRange(dyn); \
1184 configureExtrinsics(dyn); \
1187 #define REMOTE_HEAD_SGM_AR0234_GROUND_SURFACE() do { \
1189 configureSgm(cfg, dyn); \
1190 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1191 configureStereoProfile(profile, dyn); \
1192 configureDetailDisparityStereoProfile(profile, dyn); \
1193 configureGroundSurfaceStereoProfile(profile, dyn); \
1194 cfg.setCameraProfile(profile); \
1195 configureGamma(cfg, dyn); \
1196 configureCamera(cfg, dyn); \
1197 configureBorderClip(dyn); \
1198 configureS19Leds(dyn); \
1199 configurePtp(dyn); \
1200 configurePointCloudRange(dyn); \
1201 configureExtrinsics(dyn); \
1202 configureGroundSurfaceParams(dyn); \
1205 #define REMOTE_HEAD_MONOCAM_AR0234() do { \
1207 crl::multisense::CameraProfile profile = crl::multisense::User_Control; \
1208 configureStereoProfile(profile, dyn); \
1209 cfg.setCameraProfile(profile); \
1210 configureGamma(cfg, dyn); \
1211 configureCamera(cfg, dyn); \
1212 configureS19Leds(dyn); \
1213 configurePtp(dyn); \
1214 configureExtrinsics(dyn); \
1250 int32_t width, height;
1251 bool resolutionChange=
false;
1256 if (2 != sscanf(dyn.resolution.c_str(),
"%dx%dx", &width, &height)) {
1257 ROS_ERROR(
"Reconfigure: malformed resolution string: \"%s\"", dyn.resolution.c_str());
1270 if (Status_Ok != status) {
1271 ROS_ERROR(
"Reconfigure: failed to get enabled streams: %s",
1272 Channel::statusString(status));
1276 if (Status_Ok != status) {
1277 ROS_ERROR(
"Reconfigure: failed to stop streams for a resolution change: %s",
1278 Channel::statusString(status));
1286 cfg.setFps(
static_cast<float>(dyn.fps));
1287 cfg.setGain(dyn.gain);
1288 cfg.setExposure(dyn.exposure_time * 1e6);
1289 cfg.setAutoExposure(dyn.auto_exposure);
1290 cfg.setAutoExposureMax(dyn.auto_exposure_max_time * 1e6);
1291 cfg.setAutoExposureDecay(dyn.auto_exposure_decay);
1292 cfg.setAutoExposureThresh(dyn.auto_exposure_thresh);
1293 cfg.setWhiteBalance(dyn.white_balance_red,
1294 dyn.white_balance_blue);
1295 cfg.setAutoWhiteBalance(dyn.auto_white_balance);
1296 cfg.setAutoWhiteBalanceDecay(dyn.auto_white_balance_decay);
1297 cfg.setAutoWhiteBalanceThresh(dyn.auto_white_balance_thresh);
1303 if (Status_Ok != status)
1304 ROS_ERROR(
"Reconfigure: failed to set image config: %s",
1305 Channel::statusString(status));
1308 if (Status_Ok != status)
1309 ROS_ERROR(
"Reconfigure: failed to query image config: %s",
1310 Channel::statusString(status));
1317 if (resolutionChange) {
1320 if (Status_Ok != status)
1321 ROS_ERROR(
"Reconfigure: failed to restart streams after a resolution change: %s",
1322 Channel::statusString(status));
1336 int32_t width, height, disparities;
1337 bool resolutionChange=
false;
1344 if (3 != sscanf(dyn.resolution.c_str(),
"%dx%dx%d", &width, &height, &disparities)) {
1345 ROS_ERROR(
"Reconfigure: malformed resolution string: \"%s\"", dyn.resolution.c_str());
1352 if ((resolutionChange =
changeResolution(cfg, width, height, disparities))) {
1358 if (Status_Ok != status) {
1359 ROS_ERROR(
"Reconfigure: failed to get enabled streams: %s",
1360 Channel::statusString(status));
1364 if (Status_Ok != status) {
1365 ROS_ERROR(
"Reconfigure: failed to stop streams for a resolution change: %s",
1366 Channel::statusString(status));
1371 cfg.setFps(dyn.fps);
1380 if (Status_Ok != status)
1381 ROS_ERROR(
"Reconfigure: failed to set image config: %s",
1382 Channel::statusString(status));
1385 if (Status_Ok != status)
1386 ROS_ERROR(
"Reconfigure: failed to query image config: %s",
1387 Channel::statusString(status));
1394 if (resolutionChange) {
1397 if (Status_Ok != status)
1398 ROS_ERROR(
"Reconfigure: failed to restart streams after a resolution change: %s",
1399 Channel::statusString(status));
1416 int32_t width, height, disparities;
1417 bool resolutionChange=
false;
1424 if (3 != sscanf(dyn.resolution.c_str(),
"%dx%dx%d", &width, &height, &disparities)) {
1425 ROS_ERROR(
"Reconfigure: malformed resolution string: \"%s\"", dyn.resolution.c_str());
1432 if ((resolutionChange =
changeResolution(cfg, width, height, disparities))) {
1438 if (Status_Ok != status) {
1439 ROS_ERROR(
"Reconfigure: failed to get enabled streams: %s",
1440 Channel::statusString(status));
1444 if (Status_Ok != status) {
1445 ROS_ERROR(
"Reconfigure: failed to stop streams for a resolution change: %s",
1446 Channel::statusString(status));
1451 cfg.setFps(dyn.fps);
1460 if (Status_Ok != status)
1461 ROS_ERROR(
"Reconfigure: failed to set image config: %s",
1462 Channel::statusString(status));
1465 if (Status_Ok != status)
1466 ROS_ERROR(
"Reconfigure: failed to query image config: %s",
1467 Channel::statusString(status));
1474 if (resolutionChange) {
1477 if (Status_Ok != status)
1478 ROS_ERROR(
"Reconfigure: failed to restart streams after a resolution change: %s",
1479 Channel::statusString(status));