-
Notifications
You must be signed in to change notification settings - Fork 391
/
zed_wrapper_nodelet.cpp
5800 lines (4869 loc) · 193 KB
/
zed_wrapper_nodelet.cpp
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2023, STEREOLABS.
//
// All rights reserved.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
#include <chrono>
#include <csignal>
#include <sstream>
#include "zed_wrapper_nodelet.hpp"
#include "zed_wrapper_nodelet.hpp"
#ifndef NDEBUG
#include <ros/console.h>
#endif
#include <zed_interfaces/Object.h>
#include <zed_interfaces/ObjectsStamped.h>
#include <zed_interfaces/PlaneStamped.h>
#include <zed_interfaces/PosTrackStatus.h>
//#define DEBUG_SENS_TS 1
namespace zed_nodelets
{
#ifndef DEG2RAD
#define DEG2RAD 0.017453293
#define RAD2DEG 57.295777937
#endif
#define MAG_FREQ 50.
#define BARO_FREQ 25.
ZEDWrapperNodelet::ZEDWrapperNodelet() : Nodelet()
{
}
ZEDWrapperNodelet::~ZEDWrapperNodelet()
{
// std::cerr << "Destroying " << getName() << std::endl;
if (mDevicePollThread.joinable())
{
mDevicePollThread.join();
}
if (mPcThread.joinable())
{
mPcThread.join();
}
if (mSensThread.joinable())
{
mSensThread.join();
}
if (mZed.isOpened())
{
mZed.close();
}
std::cerr << "ZED " << mZedSerialNumber << " closed." << std::endl;
// std::cerr << "ZED Nodelet '" << getName().c_str() << "' correctly stopped" << std::endl;
}
void ZEDWrapperNodelet::onInit()
{
// Node handlers
mNh = getMTNodeHandle();
mNhNs = getMTPrivateNodeHandle();
mStopNode = false;
mPcDataReady = false;
#ifndef NDEBUG
if (ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, ros::console::levels::Debug))
{
ros::console::notifyLoggerLevelsChanged();
}
#endif
NODELET_INFO("********** Starting nodelet '%s' **********", getName().c_str());
std::string ver = sl_tools::getSDKVersion(mVerMajor, mVerMinor, mVerSubMinor);
NODELET_INFO_STREAM("SDK version: " << ver);
if (mVerMajor < 3)
{
NODELET_ERROR("This version of the ZED ROS Wrapper is designed to be used with ZED SDK v3.x");
ros::shutdown();
raise(SIGINT);
raise(SIGABRT);
exit(-1);
}
readParameters();
initTransforms();
// Set the video topic names
std::string rgbTopicRoot = "rgb";
std::string rightTopicRoot = "right";
std::string leftTopicRoot = "left";
std::string stereoTopicRoot = "stereo";
std::string img_topic = "/image_rect_color";
std::string img_raw_topic = "/image_raw_color";
std::string img_gray_topic = "/image_rect_gray";
std::string img_raw_gray_topic_ = "/image_raw_gray";
std::string raw_suffix = "_raw";
std::string left_topic = leftTopicRoot + img_topic;
std::string left_raw_topic = leftTopicRoot + raw_suffix + img_raw_topic;
std::string right_topic = rightTopicRoot + img_topic;
std::string right_raw_topic = rightTopicRoot + raw_suffix + img_raw_topic;
std::string rgb_topic = rgbTopicRoot + img_topic;
std::string rgb_raw_topic = rgbTopicRoot + raw_suffix + img_raw_topic;
std::string stereo_topic = stereoTopicRoot + img_topic;
std::string stereo_raw_topic = stereoTopicRoot + raw_suffix + img_raw_topic;
std::string left_gray_topic = leftTopicRoot + img_gray_topic;
std::string left_raw_gray_topic = leftTopicRoot + raw_suffix + img_raw_gray_topic_;
std::string right_gray_topic = rightTopicRoot + img_gray_topic;
std::string right_raw_gray_topic = rightTopicRoot + raw_suffix + img_raw_gray_topic_;
std::string rgb_gray_topic = rgbTopicRoot + img_gray_topic;
std::string rgb_raw_gray_topic = rgbTopicRoot + raw_suffix + img_raw_gray_topic_;
// Set the disparity topic name
std::string disparityTopic = "disparity/disparity_image";
// Set the depth topic names
std::string depth_topic_root = "depth";
if (mOpenniDepthMode)
{
NODELET_INFO_STREAM("Openni depth mode activated -> Units: mm, Encoding: TYPE_16UC1");
}
depth_topic_root += "/depth_registered";
std::string pointcloud_topic = "point_cloud/cloud_registered";
std::string pointcloud_fused_topic = "mapping/fused_cloud";
std::string object_det_topic_root = "obj_det";
std::string object_det_topic = object_det_topic_root + "/objects";
std::string confImgRoot = "confidence";
std::string conf_map_topic_name = "confidence_map";
std::string conf_map_topic = confImgRoot + "/" + conf_map_topic_name;
// Set the positional tracking topic names
std::string poseTopic = "pose";
std::string pose_cov_topic;
pose_cov_topic = poseTopic + "_with_covariance";
std::string odometryTopic = "odom";
std::string odom_path_topic = "path_odom";
std::string map_path_topic = "path_map";
std::string odomStatusTopic = odometryTopic + "/status";
std::string poseStatusTopic = poseTopic + "/status";
// Extracted plane topics
std::string marker_topic = "plane_marker";
std::string plane_topic = "plane";
// Create camera info
mRgbCamInfoMsg.reset(new sensor_msgs::CameraInfo());
mLeftCamInfoMsg.reset(new sensor_msgs::CameraInfo());
mRightCamInfoMsg.reset(new sensor_msgs::CameraInfo());
mRgbCamInfoRawMsg.reset(new sensor_msgs::CameraInfo());
mLeftCamInfoRawMsg.reset(new sensor_msgs::CameraInfo());
mRightCamInfoRawMsg.reset(new sensor_msgs::CameraInfo());
mDepthCamInfoMsg.reset(new sensor_msgs::CameraInfo());
// Initialization transformation listener
mTfBuffer.reset(new tf2_ros::Buffer);
mTfListener.reset(new tf2_ros::TransformListener(*mTfBuffer));
mZedParams.coordinate_system = sl::COORDINATE_SYSTEM::RIGHT_HANDED_Z_UP_X_FWD;
NODELET_INFO_STREAM(" * Camera coordinate system\t-> " << sl::toString(mZedParams.coordinate_system));
// Try to initialize the ZED
std::stringstream ss; // Input mode info for logging
std::string cam_id;
if (!mSvoFilepath.empty() || !mRemoteStreamAddr.empty())
{
if (!mSvoFilepath.empty())
{
mZedParams.input.setFromSVOFile(mSvoFilepath.c_str());
mZedParams.svo_real_time_mode = mSvoRealtime;
// Input mode info for logging
ss << "SVO - " << mSvoFilepath.c_str();
cam_id = ss.str();
}
else if (!mRemoteStreamAddr.empty())
{
std::vector<std::string> configStream = sl_tools::split_string(mRemoteStreamAddr, ':');
sl::String ip = sl::String(configStream.at(0).c_str());
if (configStream.size() == 2)
{
mZedParams.input.setFromStream(ip, atoi(configStream.at(1).c_str()));
}
else
{
mZedParams.input.setFromStream(ip);
}
// Input mode info for logging
ss << "NETWORK STREAM - " << mRemoteStreamAddr.c_str();
cam_id = ss.str();
}
mSvoMode = true;
}
else
{
mZedParams.camera_fps = mCamFrameRate;
mZedParams.grab_compute_capping_fps = static_cast<float>(mPubFrameRate);
mZedParams.camera_resolution = mCamResol;
if (mZedSerialNumber == 0)
{
mZedParams.input.setFromCameraID(mZedId);
// Input mode info for logging
ss << "LIVE CAMERA with ID " << mZedId;
cam_id = ss.str();
}
else
{
mZedParams.input.setFromSerialNumber(mZedSerialNumber);
// Input mode info for logging
ss << "LIVE CAMERA with SN " << mZedSerialNumber;
cam_id = ss.str();
}
}
mZedParams.async_grab_camera_recovery = true;
mZedParams.coordinate_units = sl::UNIT::METER;
mZedParams.depth_mode = static_cast<sl::DEPTH_MODE>(mDepthMode);
mZedParams.sdk_verbose = mSdkVerbose;
mZedParams.sdk_gpu_id = mGpuId;
mZedParams.depth_stabilization = mDepthStabilization;
mZedParams.camera_image_flip = mCameraFlip;
mZedParams.depth_minimum_distance = static_cast<float>(mCamMinDepth);
mZedParams.depth_maximum_distance = static_cast<float>(mCamMaxDepth);
mZedParams.camera_disable_self_calib = !mCameraSelfCalib;
mZedParams.open_timeout_sec = 10.0f;
mZedParams.enable_image_enhancement = true; // Always active
mDiagUpdater.add("ZED Diagnostic", this, &ZEDWrapperNodelet::callback_updateDiagnostic);
mDiagUpdater.setHardwareID("ZED camera");
mConnStatus = sl::ERROR_CODE::CAMERA_NOT_DETECTED;
NODELET_INFO_STREAM(" *** Opening " << sl::toString(mZedUserCamModel) << " - " << ss.str().c_str() << " ***");
while (mConnStatus != sl::ERROR_CODE::SUCCESS)
{
mConnStatus = mZed.open(mZedParams);
NODELET_INFO_STREAM("ZED connection [" << cam_id.c_str() << "]: " << sl::toString(mConnStatus));
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
if (!mNhNs.ok())
{
mStopNode = true;
std::lock_guard<std::mutex> lock(mCloseZedMutex);
NODELET_INFO_STREAM("Closing ZED " << mZedSerialNumber << "...");
if (mRecording)
{
mRecording = false;
mZed.disableRecording();
}
if (mZed.isOpened())
{
mZed.close();
}
NODELET_INFO_STREAM("... ZED " << mZedSerialNumber << " closed.");
NODELET_DEBUG("ZED pool thread finished");
return;
}
mDiagUpdater.update();
}
NODELET_INFO_STREAM(" ... " << sl::toString(mZedRealCamModel) << " ready");
// CUdevice devid;
cuCtxGetDevice(&mGpuId);
NODELET_INFO_STREAM("ZED SDK running on GPU #" << mGpuId);
// Disable AEC_AGC and Auto Whitebalance to trigger it if use set to automatic
mZed.setCameraSettings(sl::VIDEO_SETTINGS::AEC_AGC, 0);
mZed.setCameraSettings(sl::VIDEO_SETTINGS::WHITEBALANCE_AUTO, 0);
mZedRealCamModel = mZed.getCameraInformation().camera_model;
if (mZedRealCamModel == sl::MODEL::ZED)
{
if (mZedUserCamModel != mZedRealCamModel)
{
NODELET_WARN(
"Camera model does not match user parameter. Please modify "
"the value of the parameter 'camera_model' to 'zed'");
}
}
else if (mZedRealCamModel == sl::MODEL::ZED_M)
{
if (mZedUserCamModel != mZedRealCamModel)
{
NODELET_WARN(
"Camera model does not match user parameter. Please modify "
"the value of the parameter 'camera_model' to 'zedm'");
}
mSlCamImuTransf = mZed.getCameraInformation().sensors_configuration.camera_imu_transform;
NODELET_INFO("Camera-IMU Transform: \n %s", mSlCamImuTransf.getInfos().c_str());
}
else if (mZedRealCamModel == sl::MODEL::ZED2)
{
if (mZedUserCamModel != mZedRealCamModel)
{
NODELET_WARN(
"Camera model does not match user parameter. Please modify "
"the value of the parameter 'camera_model' to 'zed2'");
}
mSlCamImuTransf = mZed.getCameraInformation().sensors_configuration.camera_imu_transform;
NODELET_INFO("Camera-IMU Transform: \n %s", mSlCamImuTransf.getInfos().c_str());
}
else if (mZedRealCamModel == sl::MODEL::ZED2i)
{
if (mZedUserCamModel != mZedRealCamModel)
{
NODELET_WARN(
"Camera model does not match user parameter. Please modify "
"the value of the parameter 'camera_model' to 'zed2i'");
}
mSlCamImuTransf = mZed.getCameraInformation().sensors_configuration.camera_imu_transform;
NODELET_INFO("Camera-IMU Transform: \n %s", mSlCamImuTransf.getInfos().c_str());
}
else if (mZedRealCamModel == sl::MODEL::ZED_X)
{
if (mZedUserCamModel != mZedRealCamModel)
{
NODELET_WARN(
"Camera model does not match user parameter. Please modify "
"the value of the parameter 'camera_model' to 'zedx'");
}
mSlCamImuTransf = mZed.getCameraInformation().sensors_configuration.camera_imu_transform;
NODELET_INFO("Camera-IMU Transform: \n %s", mSlCamImuTransf.getInfos().c_str());
}
else if (mZedRealCamModel == sl::MODEL::ZED_XM)
{
if (mZedUserCamModel != mZedRealCamModel)
{
NODELET_WARN(
"Camera model does not match user parameter. Please modify "
"the value of the parameter 'camera_model' to 'zedxm'");
}
mSlCamImuTransf = mZed.getCameraInformation().sensors_configuration.camera_imu_transform;
NODELET_INFO("Camera-IMU Transform: \n %s", mSlCamImuTransf.getInfos().c_str());
}
NODELET_INFO_STREAM(" * CAMERA MODEL\t-> " << sl::toString(mZedRealCamModel).c_str());
mZedSerialNumber = mZed.getCameraInformation().serial_number;
NODELET_INFO_STREAM(" * Serial Number: " << mZedSerialNumber);
if (!mSvoMode)
{
mCamFwVersion = mZed.getCameraInformation().camera_configuration.firmware_version;
NODELET_INFO_STREAM(" * Camera FW Version: " << mCamFwVersion);
if (mZedRealCamModel != sl::MODEL::ZED)
{
mSensFwVersion = mZed.getCameraInformation().sensors_configuration.firmware_version;
NODELET_INFO_STREAM(" * Sensors FW Version: " << mSensFwVersion);
}
}
// Set the IMU topic names using real camera model
std::string imu_topic;
std::string imu_topic_raw;
std::string imu_temp_topic;
std::string imu_mag_topic;
// std::string imu_mag_topic_raw;
std::string pressure_topic;
std::string temp_topic_root = "temperature";
std::string temp_topic_left = temp_topic_root + "/left";
std::string temp_topic_right = temp_topic_root + "/right";
if (mZedRealCamModel != sl::MODEL::ZED)
{
std::string imuTopicRoot = "imu";
std::string imu_topic_name = "data";
std::string imu_topic_raw_name = "data_raw";
std::string imu_topic_mag_name = "mag";
// std::string imu_topic_mag_raw_name = "mag_raw";
std::string pressure_topic_name = "atm_press";
imu_topic = imuTopicRoot + "/" + imu_topic_name;
imu_topic_raw = imuTopicRoot + "/" + imu_topic_raw_name;
imu_temp_topic = temp_topic_root + "/" + imuTopicRoot;
imu_mag_topic = imuTopicRoot + "/" + imu_topic_mag_name;
// imu_mag_topic_raw = imuTopicRoot + "/" + imu_topic_mag_raw_name;
pressure_topic = /*imuTopicRoot + "/" +*/ pressure_topic_name;
}
mDiagUpdater.setHardwareIDf("%s - s/n: %d [GPU #%d]", sl::toString(mZedRealCamModel).c_str(), mZedSerialNumber,
mGpuId);
// ----> Dynamic Reconfigure parameters
mDynRecServer = boost::make_shared<dynamic_reconfigure::Server<zed_nodelets::ZedConfig>>(mDynServerMutex);
dynamic_reconfigure::Server<zed_nodelets::ZedConfig>::CallbackType f;
f = boost::bind(&ZEDWrapperNodelet::callback_dynamicReconf, this, _1, _2);
mDynRecServer->setCallback(f);
// Update parameters
zed_nodelets::ZedConfig config;
mDynRecServer->getConfigDefault(config);
mDynServerMutex.lock();
mDynRecServer->updateConfig(config);
mDynServerMutex.unlock();
updateDynamicReconfigure();
// <---- Dynamic Reconfigure parameters
// ----> Publishers
NODELET_INFO("*** PUBLISHERS ***");
// Image publishers
image_transport::ImageTransport it_zed(mNhNs);
mPubRgb = it_zed.advertiseCamera(rgb_topic, 1); // rgb
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRgb.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRgb.getInfoTopic());
mPubRawRgb = it_zed.advertiseCamera(rgb_raw_topic, 1); // rgb raw
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawRgb.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawRgb.getInfoTopic());
mPubLeft = it_zed.advertiseCamera(left_topic, 1); // left
NODELET_INFO_STREAM(" * Advertised on topic " << mPubLeft.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubLeft.getInfoTopic());
mPubRawLeft = it_zed.advertiseCamera(left_raw_topic, 1); // left raw
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawLeft.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawLeft.getInfoTopic());
mPubRight = it_zed.advertiseCamera(right_topic, 1); // right
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRight.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRight.getInfoTopic());
mPubRawRight = it_zed.advertiseCamera(right_raw_topic, 1); // right raw
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawRight.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawRight.getInfoTopic());
mPubRgbGray = it_zed.advertiseCamera(rgb_gray_topic, 1); // rgb
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRgbGray.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRgbGray.getInfoTopic());
mPubRawRgbGray = it_zed.advertiseCamera(rgb_raw_gray_topic, 1); // rgb raw
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawRgbGray.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawRgbGray.getInfoTopic());
mPubLeftGray = it_zed.advertiseCamera(left_gray_topic, 1); // left
NODELET_INFO_STREAM(" * Advertised on topic " << mPubLeftGray.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubLeftGray.getInfoTopic());
mPubRawLeftGray = it_zed.advertiseCamera(left_raw_gray_topic, 1); // left raw
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawLeftGray.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawLeftGray.getInfoTopic());
mPubRightGray = it_zed.advertiseCamera(right_gray_topic, 1); // right
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRightGray.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRightGray.getInfoTopic());
mPubRawRightGray = it_zed.advertiseCamera(right_raw_gray_topic, 1); // right raw
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawRightGray.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawRightGray.getInfoTopic());
mPubStereo = it_zed.advertise(stereo_topic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubStereo.getTopic());
mPubRawStereo = it_zed.advertise(stereo_raw_topic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubRawStereo.getTopic());
// Detected planes publisher
mPubPlane = mNhNs.advertise<zed_interfaces::PlaneStamped>(plane_topic, 1);
if (!mDepthDisabled)
{
mPubDepth = it_zed.advertiseCamera(depth_topic_root, 1); // depth
NODELET_INFO_STREAM(" * Advertised on topic " << mPubDepth.getTopic());
NODELET_INFO_STREAM(" * Advertised on topic " << mPubDepth.getInfoTopic());
// Confidence Map publisher
mPubConfMap = mNhNs.advertise<sensor_msgs::Image>(conf_map_topic, 1); // confidence map
NODELET_INFO_STREAM(" * Advertised on topic " << mPubConfMap.getTopic());
// Disparity publisher
mPubDisparity = mNhNs.advertise<stereo_msgs::DisparityImage>(disparityTopic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubDisparity.getTopic());
// PointCloud publishers
mPubCloud = mNhNs.advertise<sensor_msgs::PointCloud2>(pointcloud_topic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubCloud.getTopic());
if (mMappingEnabled)
{
mPubFusedCloud = mNhNs.advertise<sensor_msgs::PointCloud2>(pointcloud_fused_topic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubFusedCloud.getTopic() << " @ " << mFusedPcPubFreq << " Hz");
}
// Object detection publishers
if (mObjDetEnabled)
{
mPubObjDet = mNhNs.advertise<zed_interfaces::ObjectsStamped>(object_det_topic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubObjDet.getTopic());
}
// Odometry and Pose publisher
mPubPose = mNhNs.advertise<geometry_msgs::PoseStamped>(poseTopic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubPose.getTopic());
mPubPoseCov = mNhNs.advertise<geometry_msgs::PoseWithCovarianceStamped>(pose_cov_topic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubPoseCov.getTopic());
mPubOdom = mNhNs.advertise<nav_msgs::Odometry>(odometryTopic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubOdom.getTopic());
mPubOdomStatus = mNhNs.advertise<zed_interfaces::PosTrackStatus>(odomStatusTopic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubOdomStatus.getTopic());
mPubPoseStatus = mNhNs.advertise<zed_interfaces::PosTrackStatus>(poseStatusTopic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubPoseStatus.getTopic());
// Rviz markers publisher
mPubMarker = mNhNs.advertise<visualization_msgs::Marker>(marker_topic, 10, true);
// Camera Path
if (mPathPubRate > 0)
{
mPubOdomPath = mNhNs.advertise<nav_msgs::Path>(odom_path_topic, 1, true);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubOdomPath.getTopic());
mPubMapPath = mNhNs.advertise<nav_msgs::Path>(map_path_topic, 1, true);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubMapPath.getTopic());
mPathTimer = mNhNs.createTimer(ros::Duration(1.0 / mPathPubRate), &ZEDWrapperNodelet::callback_pubPath, this);
if (mPathMaxCount != -1)
{
NODELET_DEBUG_STREAM("Path vectors reserved " << mPathMaxCount << " poses.");
mOdomPath.reserve(mPathMaxCount);
mMapPath.reserve(mPathMaxCount);
NODELET_DEBUG_STREAM("Path vector sizes: " << mOdomPath.size() << " " << mMapPath.size());
}
}
else
{
NODELET_INFO_STREAM("Path topics not published -> mPathPubRate: " << mPathPubRate);
}
}
// Sensor publishers
if (!sl_tools::isZED(mZedRealCamModel))
{
// IMU Publishers
mPubImu = mNhNs.advertise<sensor_msgs::Imu>(imu_topic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubImu.getTopic());
mPubImuRaw = mNhNs.advertise<sensor_msgs::Imu>(imu_topic_raw, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubImuRaw.getTopic());
if (mZedRealCamModel != sl::MODEL::ZED_M)
{
// IMU temperature sensor
mPubImuTemp = mNhNs.advertise<sensor_msgs::Temperature>(imu_temp_topic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubImuTemp.getTopic());
}
if (mZedRealCamModel == sl::MODEL::ZED2 || mZedRealCamModel == sl::MODEL::ZED2i)
{
mPubImuMag = mNhNs.advertise<sensor_msgs::MagneticField>(imu_mag_topic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubImuMag.getTopic());
// Atmospheric pressure
mPubPressure = mNhNs.advertise<sensor_msgs::FluidPressure>(pressure_topic, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubPressure.getTopic());
// CMOS sensor temperatures
mPubTempL = mNhNs.advertise<sensor_msgs::Temperature>(temp_topic_left, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubTempL.getTopic());
mPubTempR = mNhNs.advertise<sensor_msgs::Temperature>(temp_topic_right, 1);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubTempR.getTopic());
}
// Publish camera imu transform in a latched topic
if (mZedRealCamModel != sl::MODEL::ZED)
{
std::string cam_imu_tr_topic = "left_cam_imu_transform";
mPubCamImuTransf = mNhNs.advertise<geometry_msgs::Transform>(cam_imu_tr_topic, 1, true);
sl::Orientation sl_rot = mSlCamImuTransf.getOrientation();
sl::Translation sl_tr = mSlCamImuTransf.getTranslation();
mCameraImuTransfMgs = boost::make_shared<geometry_msgs::Transform>();
mCameraImuTransfMgs->rotation.x = sl_rot.ox;
mCameraImuTransfMgs->rotation.y = sl_rot.oy;
mCameraImuTransfMgs->rotation.z = sl_rot.oz;
mCameraImuTransfMgs->rotation.w = sl_rot.ow;
mCameraImuTransfMgs->translation.x = sl_tr.x;
mCameraImuTransfMgs->translation.y = sl_tr.y;
mCameraImuTransfMgs->translation.z = sl_tr.z;
NODELET_DEBUG("Camera-IMU Rotation: \n %s", sl_rot.getRotationMatrix().getInfos().c_str());
NODELET_DEBUG("Camera-IMU Translation: \n %g %g %g", sl_tr.x, sl_tr.y, sl_tr.z);
mPubCamImuTransf.publish(mCameraImuTransfMgs);
NODELET_INFO_STREAM(" * Advertised on topic " << mPubCamImuTransf.getTopic() << " [LATCHED]");
}
if (!mSvoMode && !mSensTimestampSync)
{
mFrameTimestamp = ros::Time::now();
mSensPeriodMean_usec.reset(new sl_tools::CSmartMean(mSensPubRate / 2));
}
else
{
mSensPeriodMean_usec.reset(new sl_tools::CSmartMean(mCamFrameRate / 2));
}
}
// <---- Publishers
// ----> Subscribers
NODELET_INFO("*** SUBSCRIBERS ***");
mClickedPtSub = mNhNs.subscribe(mClickedPtTopic, 10, &ZEDWrapperNodelet::clickedPtCallback, this);
NODELET_INFO_STREAM(" * Subscribed to topic " << mClickedPtTopic.c_str());
// <---- Subscribers
// ----> Services
initServices();
// <---- Services
// ----> Threads
if (!mDepthDisabled)
{
// Start Pointcloud thread
mPcThread = std::thread(&ZEDWrapperNodelet::pointcloud_thread_func, this);
}
// Start pool thread
mDevicePollThread = std::thread(&ZEDWrapperNodelet::device_poll_thread_func, this);
// Start Sensors thread
mSensThread = std::thread(&ZEDWrapperNodelet::sensors_thread_func, this);
// <---- Threads
NODELET_INFO("+++ ZED Node started +++");
}
void ZEDWrapperNodelet::initServices()
{
NODELET_INFO("*** SERVICES ***");
if (!mDepthDisabled)
{
mSrvSetInitPose = mNhNs.advertiseService("set_pose", &ZEDWrapperNodelet::on_set_pose, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvSetInitPose.getService().c_str());
mSrvResetOdometry = mNhNs.advertiseService("reset_odometry", &ZEDWrapperNodelet::on_reset_odometry, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvResetOdometry.getService().c_str());
mSrvResetTracking = mNhNs.advertiseService("reset_tracking", &ZEDWrapperNodelet::on_reset_tracking, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvResetTracking.getService().c_str());
mSrvSaveAreaMemory = mNhNs.advertiseService("save_area_memory", &ZEDWrapperNodelet::on_save_area_memory, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvSaveAreaMemory.getService().c_str());
mSrvStartMapping = mNhNs.advertiseService("start_3d_mapping", &ZEDWrapperNodelet::on_start_3d_mapping, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvStartMapping.getService().c_str());
mSrvStopMapping = mNhNs.advertiseService("stop_3d_mapping", &ZEDWrapperNodelet::on_stop_3d_mapping, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvStopMapping.getService().c_str());
mSrvSave3dMap = mNhNs.advertiseService("save_3d_map", &ZEDWrapperNodelet::on_save_3d_map, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvSave3dMap.getService().c_str());
mSrvEnableObjDet =
mNhNs.advertiseService("enable_object_detection", &ZEDWrapperNodelet::on_enable_object_detection, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvEnableObjDet.getService().c_str());
}
mSrvSvoStartRecording =
mNhNs.advertiseService("start_svo_recording", &ZEDWrapperNodelet::on_start_svo_recording, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvSvoStartRecording.getService().c_str());
mSrvSvoStopRecording = mNhNs.advertiseService("stop_svo_recording", &ZEDWrapperNodelet::on_stop_svo_recording, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvSvoStopRecording.getService().c_str());
mSrvSetLedStatus = mNhNs.advertiseService("set_led_status", &ZEDWrapperNodelet::on_set_led_status, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvSetLedStatus.getService().c_str());
mSrvToggleLed = mNhNs.advertiseService("toggle_led", &ZEDWrapperNodelet::on_toggle_led, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvToggleLed.getService().c_str());
mSrvSvoStartStream = mNhNs.advertiseService("start_remote_stream", &ZEDWrapperNodelet::on_start_remote_stream, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvSvoStartStream.getService().c_str());
mSrvSvoStopStream = mNhNs.advertiseService("stop_remote_stream", &ZEDWrapperNodelet::on_stop_remote_stream, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvSvoStopStream.getService().c_str());
mSrvSetRoi = mNhNs.advertiseService("set_roi", &ZEDWrapperNodelet::on_set_roi, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvSetRoi.getService().c_str());
mSrvResetRoi = mNhNs.advertiseService("reset_roi", &ZEDWrapperNodelet::on_reset_roi, this);
NODELET_INFO_STREAM(" * Advertised on service " << mSrvSetRoi.getService().c_str());
}
void ZEDWrapperNodelet::readGeneralParams()
{
NODELET_INFO_STREAM("*** GENERAL PARAMETERS ***");
std::string camera_model;
mNhNs.getParam("general/camera_model", camera_model);
if (camera_model == "zed")
{
mZedUserCamModel = sl::MODEL::ZED;
NODELET_INFO_STREAM(" * Camera Model by param\t-> " << camera_model);
}
else if (camera_model == "zedm")
{
mZedUserCamModel = sl::MODEL::ZED_M;
NODELET_INFO_STREAM(" * Camera Model by param\t-> " << camera_model);
}
else if (camera_model == "zed2")
{
mZedUserCamModel = sl::MODEL::ZED2;
NODELET_INFO_STREAM(" * Camera Model by param\t-> " << camera_model);
}
else if (camera_model == "zed2i")
{
mZedUserCamModel = sl::MODEL::ZED2i;
NODELET_INFO_STREAM(" * Camera Model by param\t-> " << camera_model);
}
else if (camera_model == "zedx")
{
mZedUserCamModel = sl::MODEL::ZED_X;
NODELET_INFO_STREAM(" * Camera Model by param\t-> " << camera_model);
}
else if (camera_model == "zedxm")
{
mZedUserCamModel = sl::MODEL::ZED_XM;
NODELET_INFO_STREAM(" * Camera Model by param\t-> " << camera_model);
}
else
{
NODELET_ERROR_STREAM("Camera model not valid: " << camera_model);
exit(EXIT_FAILURE);
}
mNhNs.getParam("general/camera_name", mCameraName);
NODELET_INFO_STREAM(" * Camera Name\t\t\t-> " << mCameraName.c_str());
std::string resol = "AUTO";
mNhNs.getParam("general/grab_resolution", resol);
if (resol == "AUTO")
{
mCamResol = sl::RESOLUTION::AUTO;
}
else if (sl_tools::isZEDX(mZedUserCamModel))
{
if (resol == "HD1200")
{
mCamResol = sl::RESOLUTION::HD1200;
}
else if (resol == "HD1080")
{
mCamResol = sl::RESOLUTION::HD1080;
}
else if (resol == "SVGA")
{
mCamResol = sl::RESOLUTION::SVGA;
}
else
{
NODELET_WARN("Not valid 'general.grab_resolution' value: '%s'. Using 'AUTO' setting.", resol.c_str());
mCamResol = sl::RESOLUTION::AUTO;
}
}
else
{
if (resol == "HD2K")
{
mCamResol = sl::RESOLUTION::HD2K;
}
else if (resol == "HD1080")
{
mCamResol = sl::RESOLUTION::HD1080;
}
else if (resol == "HD720")
{
mCamResol = sl::RESOLUTION::HD720;
}
else if (resol == "VGA")
{
mCamResol = sl::RESOLUTION::VGA;
}
else
{
NODELET_WARN("Not valid 'general.grab_resolution' value: '%s'. Using 'AUTO' setting.", resol.c_str());
mCamResol = sl::RESOLUTION::AUTO;
}
}
NODELET_INFO_STREAM(" * Camera resolution\t\t-> " << sl::toString(mCamResol).c_str());
mNhNs.getParam("general/grab_frame_rate", mCamFrameRate);
checkResolFps();
NODELET_INFO_STREAM(" * Camera Grab Framerate\t-> " << mCamFrameRate);
mNhNs.getParam("general/pub_frame_rate", mPubFrameRate);
if (mPubFrameRate > mCamFrameRate)
{
mPubFrameRate = mCamFrameRate;
NODELET_WARN_STREAM(
"'general/pub_frame_rate' cannot be bigger than 'general/grab_frame_rate'. Forced to the correct value: "
<< mPubFrameRate);
}
NODELET_INFO_STREAM(" * Grab compute capping FPS\t-> " << mPubFrameRate << " Hz");
std::string out_resol = "CUSTOM";
mNhNs.getParam("general/pub_resolution", out_resol);
if (out_resol == "NATIVE")
{
mPubResolution = PubRes::NATIVE;
}
else if (out_resol == "CUSTOM")
{
mPubResolution = PubRes::CUSTOM;
}
else
{
NODELET_WARN("Not valid 'general/pub_resolution' value: '%s'. Using default setting instead.", out_resol.c_str());
out_resol = "CUSTOM";
mPubResolution = PubRes::CUSTOM;
}
NODELET_INFO_STREAM(" * Publishing resolution\t-> " << out_resol.c_str());
if (mPubResolution == PubRes::CUSTOM)
{
mNhNs.getParam("general/pub_downscale_factor", mCustomDownscaleFactor);
NODELET_INFO_STREAM(" * Publishing downscale factor\t-> " << mCustomDownscaleFactor);
}
else
{
mCustomDownscaleFactor = 1.0;
}
mNhNs.getParam("general/gpu_id", mGpuId);
NODELET_INFO_STREAM(" * Gpu ID\t\t\t-> " << mGpuId);
mNhNs.getParam("general/zed_id", mZedId);
NODELET_INFO_STREAM(" * Camera ID\t\t\t-> " << mZedId);
mNhNs.getParam("general/sdk_verbose", mSdkVerbose);
NODELET_INFO_STREAM(" * SDK Verbose level\t\t-> " << mSdkVerbose);
std::string flip_str;
mNhNs.getParam("general/camera_flip", flip_str);
if (flip_str == "ON")
{
mCameraFlip = sl::FLIP_MODE::ON;
}
else if (flip_str == "OFF")
{
mCameraFlip = sl::FLIP_MODE::OFF;
}
else
{
mCameraFlip = sl::FLIP_MODE::AUTO;
}
NODELET_INFO_STREAM(" * Camera Flip\t\t\t-> " << sl::toString(mCameraFlip).c_str());
mNhNs.getParam("general/self_calib", mCameraSelfCalib);
NODELET_INFO_STREAM(" * Self calibration\t\t-> " << (mCameraSelfCalib ? "ENABLED" : "DISABLED"));
int tmp_sn = 0;
mNhNs.getParam("general/serial_number", tmp_sn);
if (tmp_sn > 0)
{
mZedSerialNumber = static_cast<int>(tmp_sn);
NODELET_INFO_STREAM(" * Serial number\t\t-> " << mZedSerialNumber);
}
std::string parsed_str = getRoiParam("general/region_of_interest", mRoiParam);
NODELET_INFO_STREAM(" * Region of interest\t\t-> " << parsed_str.c_str());
}
void ZEDWrapperNodelet::readDepthParams()
{
NODELET_INFO_STREAM("*** DEPTH PARAMETERS ***");
std::string depth_mode_str = sl::toString(mDepthMode).c_str();
mNhNs.getParam("depth/depth_mode", depth_mode_str);
bool matched = false;
for (int mode = static_cast<int>(sl::DEPTH_MODE::NONE); mode < static_cast<int>(sl::DEPTH_MODE::LAST); ++mode)
{
std::string test_str = sl::toString(static_cast<sl::DEPTH_MODE>(mode)).c_str();
std::replace(test_str.begin(), test_str.end(), ' ',
'_'); // Replace spaces with underscores to match the YAML setting
if (test_str == depth_mode_str)
{
matched = true;
mDepthMode = static_cast<sl::DEPTH_MODE>(mode);
break;
}
}
if (!matched)
{
NODELET_WARN_STREAM(
"The parameter 'depth.depth_mode' contains a not valid string. Please check it in 'common.yaml'.");
NODELET_WARN("Using default DEPTH_MODE.");
mDepthMode = sl::DEPTH_MODE::ULTRA;
}
if (mDepthMode == sl::DEPTH_MODE::NONE)
{
mDepthDisabled = true;
mDepthStabilization = 0;
NODELET_INFO_STREAM(" * Depth mode\t\t\t-> " << sl::toString(mDepthMode).c_str() << " - DEPTH DISABLED");
}
else
{
mDepthDisabled = false;
NODELET_INFO_STREAM(" * Depth mode\t\t\t-> " << sl::toString(mDepthMode).c_str() << " ["
<< static_cast<int>(mDepthMode) << "]");
}
if (!mDepthDisabled)
{
mNhNs.getParam("depth/openni_depth_mode", mOpenniDepthMode);
NODELET_INFO_STREAM(" * OpenNI mode\t\t\t-> " << (mOpenniDepthMode ? "ENABLED" : "DISABLED"));
mNhNs.getParam("depth/depth_stabilization", mDepthStabilization);
NODELET_INFO_STREAM(" * Depth Stabilization\t\t-> " << mDepthStabilization);
mNhNs.getParam("depth/min_depth", mCamMinDepth);
NODELET_INFO_STREAM(" * Minimum depth\t\t-> " << mCamMinDepth << " m");
mNhNs.getParam("depth/max_depth", mCamMaxDepth);
NODELET_INFO_STREAM(" * Maximum depth\t\t-> " << mCamMaxDepth << " m");
}
}
void ZEDWrapperNodelet::readPosTrkParams()
{
if (!mDepthDisabled)
{
NODELET_INFO_STREAM("*** POSITIONAL TRACKING PARAMETERS ***");
mNhNs.getParam("pos_tracking/pos_tracking_enabled", mPosTrackingEnabled);
NODELET_INFO_STREAM(" * Positional tracking\t\t-> " << (mPosTrackingEnabled ? "ENABLED" : "DISABLED"));
std::string pos_trk_mode;
mNhNs.getParam("pos_tracking/pos_tracking_mode", pos_trk_mode);
if (pos_trk_mode == "GEN_1")
{
mPosTrkMode = sl::POSITIONAL_TRACKING_MODE::GEN_1;
}
else if (pos_trk_mode == "GEN_2")
{
mPosTrkMode = sl::POSITIONAL_TRACKING_MODE::GEN_2;
}
else
{
NODELET_WARN_STREAM("'pos_tracking/pos_tracking_mode' not valid ('" << pos_trk_mode
<< "'). Using default value.");
mPosTrkMode = sl::POSITIONAL_TRACKING_MODE::GEN_2;
}
NODELET_INFO_STREAM(" * Positional tracking mode\t-> " << sl::toString(mPosTrkMode).c_str());
mNhNs.getParam("pos_tracking/set_gravity_as_origin", mSetGravityAsOrigin);
NODELET_INFO_STREAM(" * Set gravity as origin\t-> " << (mSetGravityAsOrigin ? "ENABLED" : "DISABLED"));
mNhNs.getParam("pos_tracking/path_pub_rate", mPathPubRate);
NODELET_INFO_STREAM(" * Path rate\t\t\t-> " << mPathPubRate << " Hz");
mNhNs.getParam("pos_tracking/path_max_count", mPathMaxCount);
NODELET_INFO_STREAM(" * Path history size\t\t-> " << ((mPathMaxCount == -1) ? std::string("INFINITE") :
std::to_string(mPathMaxCount)));
if (mPathMaxCount < 2 && mPathMaxCount != -1)
{
mPathMaxCount = 2;
}
mNhNs.getParam("pos_tracking/initial_base_pose", mInitialBasePose);
mNhNs.getParam("pos_tracking/area_memory_db_path", mAreaMemDbPath);
mAreaMemDbPath = sl_tools::resolveFilePath(mAreaMemDbPath);
NODELET_INFO_STREAM(" * Odometry DB path\t\t-> " << mAreaMemDbPath.c_str());
mNhNs.getParam("pos_tracking/save_area_memory_db_on_exit", mSaveAreaMapOnClosing);
NODELET_INFO_STREAM(" * Save Area Memory on closing\t-> " << (mSaveAreaMapOnClosing ? "ENABLED" : "DISABLED"));
mNhNs.getParam("pos_tracking/area_memory", mAreaMemory);
NODELET_INFO_STREAM(" * Area Memory\t\t\t-> " << (mAreaMemory ? "ENABLED" : "DISABLED"));
mNhNs.getParam("pos_tracking/imu_fusion", mImuFusion);