@@ -962,19 +962,19 @@ void ZEDWrapperNodelet::readPosTrkParams()
962962
963963 std::string pos_trk_mode;
964964 mNhNs .getParam (" pos_tracking/pos_tracking_mode" , pos_trk_mode);
965- if (pos_trk_mode == " QUALITY " )
965+ if (pos_trk_mode == " GEN_1 " )
966966 {
967- mPosTrkMode = sl::POSITIONAL_TRACKING_MODE::QUALITY ;
967+ mPosTrkMode = sl::POSITIONAL_TRACKING_MODE::GEN_1 ;
968968 }
969- else if (pos_trk_mode == " STANDARD " )
969+ else if (pos_trk_mode == " GEN_2 " )
970970 {
971- mPosTrkMode = sl::POSITIONAL_TRACKING_MODE::STANDARD ;
971+ mPosTrkMode = sl::POSITIONAL_TRACKING_MODE::GEN_2 ;
972972 }
973973 else
974974 {
975975 NODELET_WARN_STREAM (" 'pos_tracking/pos_tracking_mode' not valid ('" << pos_trk_mode
976976 << " '). Using default value." );
977- mPosTrkMode = sl::POSITIONAL_TRACKING_MODE::QUALITY ;
977+ mPosTrkMode = sl::POSITIONAL_TRACKING_MODE::GEN_2 ;
978978 }
979979 NODELET_INFO_STREAM (" * Positional tracking mode\t -> " << sl::toString (mPosTrkMode ).c_str ());
980980
@@ -984,8 +984,8 @@ void ZEDWrapperNodelet::readPosTrkParams()
984984 mNhNs .getParam (" pos_tracking/path_pub_rate" , mPathPubRate );
985985 NODELET_INFO_STREAM (" * Path rate\t\t\t -> " << mPathPubRate << " Hz" );
986986 mNhNs .getParam (" pos_tracking/path_max_count" , mPathMaxCount );
987- NODELET_INFO_STREAM (" * Path history size\t\t -> " << (mPathMaxCount == -1 ) ? std::string (" INFINITE" ) :
988- std::to_string (mPathMaxCount ));
987+ NODELET_INFO_STREAM (" * Path history size\t\t -> " << (( mPathMaxCount == -1 ) ? std::string (" INFINITE" ) :
988+ std::to_string (mPathMaxCount ))) ;
989989
990990 if (mPathMaxCount < 2 && mPathMaxCount != -1 )
991991 {
@@ -1028,9 +1028,6 @@ void ZEDWrapperNodelet::readPosTrkParams()
10281028 NODELET_INFO_STREAM (" * Camera is static\t\t -> " << (mIsStatic ? " ENABLED" : " DISABLED" ));
10291029 mNhNs .getParam (" pos_tracking/depth_min_range" , mPosTrkMinDepth );
10301030 NODELET_INFO_STREAM (" * Depth minimum range\t\t -> " << mPosTrkMinDepth );
1031-
1032- bool mIsStatic = false ;
1033- double mPosTrkMinDepth = 0.0 ;
10341031 }
10351032}
10361033
@@ -1495,7 +1492,7 @@ void ZEDWrapperNodelet::checkResolFps()
14951492 NODELET_WARN_STREAM (" Wrong FrameRate (" << mCamFrameRate << " ) for the resolution HD1080. Forced to 15 FPS." );
14961493 mCamFrameRate = 15 ;
14971494 }
1498- else if ( mCamFrameRate >= 23 )
1495+ else
14991496 {
15001497 NODELET_WARN_STREAM (" Wrong FrameRate (" << mCamFrameRate << " ) for the resolution HD1080. Forced to 30 FPS." );
15011498 mCamFrameRate = 30 ;
@@ -1573,7 +1570,7 @@ void ZEDWrapperNodelet::checkResolFps()
15731570 NODELET_WARN_STREAM (" Wrong FrameRate (" << mCamFrameRate << " ) for the resolution HD1200. Forced to 30 FPS." );
15741571 mCamFrameRate = 30 ;
15751572 }
1576- else if ( mCamFrameRate >= 45 )
1573+ else
15771574 {
15781575 NODELET_WARN_STREAM (" Wrong FrameRate (" << mCamFrameRate << " ) for the resolution HD1200. Forced to 60 FPS." );
15791576 mCamFrameRate = 60 ;
@@ -1639,8 +1636,7 @@ bool ZEDWrapperNodelet::getCamera2BaseTransform()
16391636{
16401637 NODELET_DEBUG (" Getting static TF from '%s' to '%s'" , mCameraFrameId .c_str (), mBaseFrameId .c_str ());
16411638
1642- mCamera2BaseTransfValid = false ;
1643- static bool first_error = true ;
1639+ mCamera2BaseTransfValid = false ;
16441640
16451641 // ----> Static transforms
16461642 // Sensor to Base link
@@ -1663,6 +1659,7 @@ bool ZEDWrapperNodelet::getCamera2BaseTransform()
16631659 }
16641660 catch (tf2::TransformException& ex)
16651661 {
1662+ static bool first_error = true ;
16661663 if (!first_error)
16671664 {
16681665 NODELET_DEBUG_THROTTLE (1.0 , " Transform error: %s" , ex.what ());
@@ -1690,9 +1687,7 @@ bool ZEDWrapperNodelet::getSens2CameraTransform()
16901687{
16911688 NODELET_DEBUG (" Getting static TF from '%s' to '%s'" , mDepthFrameId .c_str (), mCameraFrameId .c_str ());
16921689
1693- mSensor2CameraTransfValid = false ;
1694-
1695- static bool first_error = true ;
1690+ mSensor2CameraTransfValid = false ;
16961691
16971692 // ----> Static transforms
16981693 // Sensor to Camera Center
@@ -1714,6 +1709,7 @@ bool ZEDWrapperNodelet::getSens2CameraTransform()
17141709 }
17151710 catch (tf2::TransformException& ex)
17161711 {
1712+ static bool first_error = true ;
17171713 if (!first_error)
17181714 {
17191715 NODELET_DEBUG_THROTTLE (1.0 , " Transform error: %s" , ex.what ());
@@ -1742,8 +1738,7 @@ bool ZEDWrapperNodelet::getSens2BaseTransform()
17421738{
17431739 NODELET_DEBUG (" Getting static TF from '%s' to '%s'" , mDepthFrameId .c_str (), mBaseFrameId .c_str ());
17441740
1745- mSensor2BaseTransfValid = false ;
1746- static bool first_error = true ;
1741+ mSensor2BaseTransfValid = false ;
17471742
17481743 // ----> Static transforms
17491744 // Sensor to Base link
@@ -1765,6 +1760,7 @@ bool ZEDWrapperNodelet::getSens2BaseTransform()
17651760 }
17661761 catch (tf2::TransformException& ex)
17671762 {
1763+ static bool first_error = true ;
17681764 if (!first_error)
17691765 {
17701766 NODELET_DEBUG_THROTTLE (1.0 , " Transform error: %s" , ex.what ());
@@ -2016,7 +2012,6 @@ bool ZEDWrapperNodelet::start_obj_detect()
20162012 sl::ObjectDetectionParameters od_p;
20172013 od_p.enable_segmentation = false ;
20182014 od_p.enable_tracking = mObjDetTracking ;
2019- od_p.image_sync = true ;
20202015 od_p.detection_model = mObjDetModel ;
20212016 od_p.filtering_mode = mObjFilterMode ;
20222017 od_p.prediction_timeout_s = mObjDetPredTimeout ;
@@ -2337,11 +2332,6 @@ void ZEDWrapperNodelet::publishPose()
23372332 size_t poseSub = mPubPose .getNumSubscribers ();
23382333 size_t poseCovSub = mPubPoseCov .getNumSubscribers ();
23392334
2340- tf2::Transform base_pose;
2341- base_pose.setIdentity ();
2342-
2343- base_pose = mMap2BaseTransf ;
2344-
23452335 std_msgs::Header header;
23462336 header.stamp = mFrameTimestamp ;
23472337 header.frame_id = mMapFrameId ; // frame
@@ -2633,11 +2623,10 @@ void ZEDWrapperNodelet::callback_pubFusedPointCloud(const ros::TimerEvent& e)
26332623 resized = true ;
26342624 }
26352625
2636- std::chrono::steady_clock::time_point start_time = std::chrono::steady_clock::now ();
2626+ // std::chrono::steady_clock::time_point start_time = std::chrono::steady_clock::now();
26372627
26382628 // NODELET_INFO_STREAM("Chunks: " << mFusedPC.chunks.size());
26392629
2640- int index = 0 ;
26412630 float * ptCloudPtr = (float *)(&pointcloudFusedMsg->data [0 ]);
26422631 int updated = 0 ;
26432632
@@ -2660,13 +2649,9 @@ void ZEDWrapperNodelet::callback_pubFusedPointCloud(const ros::TimerEvent& e)
26602649 pointcloudFusedMsg->header .stamp = sl_tools::slTime2Ros (mFusedPC .chunks [c].timestamp );
26612650 }
26622651 }
2663- else
2664- {
2665- index += mFusedPC .chunks [c].vertices .size ();
2666- }
26672652 }
26682653
2669- std::chrono::steady_clock::time_point end_time = std::chrono::steady_clock::now ();
2654+ // std::chrono::steady_clock::time_point end_time = std::chrono::steady_clock::now();
26702655
26712656 // NODELET_INFO_STREAM("Updated: " << updated);
26722657
@@ -2775,7 +2760,6 @@ void ZEDWrapperNodelet::fillCamDepthInfo(sl::Camera& zed, sensor_msgs::CameraInf
27752760
27762761 zedParam = zed.getCameraInformation (mMatResol ).camera_configuration .calibration_parameters ;
27772762
2778- float baseline = zedParam.getCameraBaseline ();
27792763 depth_info_msg->distortion_model = sensor_msgs::distortion_models::PLUMB_BOB;
27802764 depth_info_msg->D .resize (5 );
27812765 depth_info_msg->D [0 ] = zedParam.left_cam .disto [0 ]; // k1
@@ -2927,7 +2911,7 @@ void ZEDWrapperNodelet::callback_dynamicReconf(zed_nodelets::ZedConfig& config,
29272911 if (config.auto_exposure_gain != mCamAutoExposure )
29282912 {
29292913 mCamAutoExposure = config.auto_exposure_gain ;
2930- NODELET_INFO_STREAM (" Reconfigure auto exposure/gain: " << mCamAutoExposure ? " ENABLED" : " DISABLED" );
2914+ NODELET_INFO_STREAM (" Reconfigure auto exposure/gain: " << ( mCamAutoExposure ? " ENABLED" : " DISABLED" ) );
29312915 }
29322916 mDynParMutex .unlock ();
29332917 // NODELET_DEBUG_STREAM( "dynamicReconfCallback MUTEX UNLOCK");
@@ -2965,7 +2949,7 @@ void ZEDWrapperNodelet::callback_dynamicReconf(zed_nodelets::ZedConfig& config,
29652949 if (config.auto_whitebalance != mCamAutoWB )
29662950 {
29672951 mCamAutoWB = config.auto_whitebalance ;
2968- NODELET_INFO_STREAM (" Reconfigure auto white balance: " << mCamAutoWB ? " ENABLED" : " DISABLED" );
2952+ NODELET_INFO_STREAM (" Reconfigure auto white balance: " << ( mCamAutoWB ? " ENABLED" : " DISABLED" ) );
29692953 mTriggerAutoWB = true ;
29702954 }
29712955 else
@@ -3038,8 +3022,8 @@ void ZEDWrapperNodelet::pubVideoDepth()
30383022 sl::Mat mat_right_gray, mat_right_raw_gray;
30393023 sl::Mat mat_depth, mat_disp, mat_conf;
30403024
3041- sl::Timestamp ts_rgb = 0 ; // used to check RGB/Depth sync
3042- sl::Timestamp ts_depth = 0 ; // used to check RGB/Depth sync
3025+ sl::Timestamp ts_rgb = 0 ; // used to check RGB/Depth sync
3026+ sl::Timestamp ts_depth; // used to check RGB/Depth sync
30433027 sl::Timestamp grab_ts = 0 ;
30443028
30453029 // ----> Retrieve all required image data
@@ -4059,7 +4043,7 @@ void ZEDWrapperNodelet::device_poll_thread_func()
40594043 {
40604044 mStopNode = true ;
40614045
4062- std::lock_guard<std::mutex> lock (mCloseZedMutex );
4046+ std::lock_guard<std::mutex> stop_lock (mCloseZedMutex );
40634047 NODELET_INFO_STREAM (" Closing ZED " << mZedSerialNumber << " ..." );
40644048 if (mRecording )
40654049 {
@@ -4210,20 +4194,20 @@ void ZEDWrapperNodelet::device_poll_thread_func()
42104194
42114195 double elab_usec = std::chrono::duration_cast<std::chrono::microseconds>(end_elab - start_elab).count ();
42124196
4213- double mean_elab_sec = mElabPeriodMean_sec ->addValue (elab_usec / 1000000 .);
4214-
4215- static int count_warn = 0 ;
4197+ double mean_elab_sec = mElabPeriodMean_sec ->addValue (elab_usec / 1000000 .);
42164198
42174199 if (!loop_rate.sleep ())
42184200 {
4201+ static int count_warn = 0 ;
42194202 if (mean_elab_sec > (1 . / mPubFrameRate ))
42204203 {
4204+
42214205 if (++count_warn > 10 )
42224206 {
42234207 NODELET_DEBUG_THROTTLE (1.0 , " Working thread is not synchronized with the Camera grab rate" );
42244208 NODELET_DEBUG_STREAM_THROTTLE (1.0 , " Expected cycle time: " << loop_rate.expectedCycleTime ()
42254209 << " - Real cycle time: " << mean_elab_sec);
4226- NODELET_WARN_STREAM_THROTTLE (10.0 , " Elaboration takes longer ("
4210+ NODELET_DEBUG_STREAM_THROTTLE (10.0 , " Elaboration takes longer ("
42274211 << mean_elab_sec << " sec) than requested by the FPS rate ("
42284212 << loop_rate.expectedCycleTime ()
42294213 << " sec). Please consider to "
@@ -4295,7 +4279,7 @@ void ZEDWrapperNodelet::processPointcloud(ros::Time ts)
42954279
42964280void ZEDWrapperNodelet::processCameraSettings ()
42974281{
4298- int value;
4282+
42994283 sl::VIDEO_SETTINGS setting;
43004284 sl::ERROR_CODE err;
43014285
@@ -4304,6 +4288,7 @@ void ZEDWrapperNodelet::processCameraSettings()
43044288 // NODELET_DEBUG_STREAM( "[" << mFrameCount << "] device_poll_thread_func MUTEX LOCK");
43054289 mDynParMutex .lock ();
43064290
4291+ int value;
43074292 setting = sl::VIDEO_SETTINGS::BRIGHTNESS;
43084293 err = mZed .getCameraSettings (setting, value);
43094294 if (err == sl::ERROR_CODE::SUCCESS && value != mCamBrightness )
@@ -4545,8 +4530,8 @@ void ZEDWrapperNodelet::callback_updateDiagnostic(diagnostic_updater::Diagnostic
45454530
45464531 if (mPcPublishing )
45474532 {
4548- double freq = 1000000 . / mPcPeriodMean_usec ->getMean ();
4549- double freq_perc = 100 . * freq / mPointCloudFreq ;
4533+ freq = 1000000 . / mPcPeriodMean_usec ->getMean ();
4534+ freq_perc = 100 . * freq / mPointCloudFreq ;
45504535 stat.addf (" Point Cloud" , " Mean Frequency: %.1f Hz (%.1f%%)" , freq, freq_perc);
45514536 }
45524537 else
@@ -4578,8 +4563,8 @@ void ZEDWrapperNodelet::callback_updateDiagnostic(diagnostic_updater::Diagnostic
45784563
45794564 if (mObjDetRunning )
45804565 {
4581- double freq = 1000 . / mObjDetPeriodMean_msec ->getMean ();
4582- double freq_perc = 100 . * freq / mPubFrameRate ;
4566+ freq = 1000 . / mObjDetPeriodMean_msec ->getMean ();
4567+ freq_perc = 100 . * freq / mPubFrameRate ;
45834568 stat.addf (" Object detection" , " Mean Frequency: %.3f Hz (%.1f%%)" , freq, freq_perc);
45844569 }
45854570 else
@@ -4913,7 +4898,8 @@ bool ZEDWrapperNodelet::on_set_roi(zed_interfaces::set_roi::Request& req, zed_in
49134898 // Create mask
49144899 NODELET_INFO (" * Setting ROI" );
49154900 std::vector<sl::float2> sl_poly;
4916- std::string log_msg = parseRoiPoly (parsed_poly, sl_poly);
4901+ // std::string log_msg =
4902+ parseRoiPoly (parsed_poly, sl_poly);
49174903 // NODELET_INFO_STREAM(" * Parsed ROI: " << log_msg.c_str());
49184904 sl::Resolution resol (mCamWidth , mCamHeight );
49194905 sl::Mat roi_mask (resol, sl::MAT_TYPE::U8_C1, sl::MEM::CPU);
@@ -5271,7 +5257,7 @@ void ZEDWrapperNodelet::clickedPtCallback(geometry_msgs::PointStampedConstPtr ms
52715257 float c_x = zedParam.left_cam .cx ;
52725258 float c_y = zedParam.left_cam .cy ;
52735259
5274- float out_scale_factor = mMatResol .width / mCamWidth ;
5260+ float out_scale_factor = static_cast < float >( mMatResol .width ) / mCamWidth ;
52755261
52765262 float u = ((camX / camZ) * f_x + c_x) / out_scale_factor;
52775263 float v = ((camY / camZ) * f_y + c_y) / out_scale_factor;
@@ -5649,7 +5635,6 @@ void ZEDWrapperNodelet::processPose()
56495635 tr_2d.setZ (mFixedZValue );
56505636 mMap2BaseTransf .setOrigin (tr_2d);
56515637
5652- double roll, pitch, yaw;
56535638 tf2::Matrix3x3 (mMap2BaseTransf .getRotation ()).getRPY (roll, pitch, yaw);
56545639
56555640 tf2::Quaternion quat_2d;
@@ -5665,8 +5650,6 @@ void ZEDWrapperNodelet::processPose()
56655650 mBaseFrameId .c_str (), mMap2BaseTransf .getOrigin ().x (), mMap2BaseTransf .getOrigin ().y (),
56665651 mMap2BaseTransf .getOrigin ().z (), roll * RAD2DEG, pitch * RAD2DEG, yaw * RAD2DEG);
56675652
5668- bool initOdom = false ;
5669-
56705653 // Transformation from map to odometry frame
56715654 mOdomMutex .lock (); //
56725655 mMap2OdomTransf = mMap2BaseTransf * mOdom2BaseTransf .inverse ();
0 commit comments