Skip to content

Commit a665c81

Browse files
committed
2 parents 5366f20 + 37d0c02 commit a665c81

File tree

5 files changed

+50
-78
lines changed

5 files changed

+50
-78
lines changed

CHANGELOG.rst

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,44 @@
11
CHANGELOG
22
=========
33

4-
2023-09-15
4+
05-04-2024
55
----------
6+
- Fix compatibility with ZED SDK v4.1
7+
- Add support to Positional Tracking Gen 2
8+
- The parameter `pos_tracking_mode` can accept the new values `GEN_1` and `GEN_2`, instead of `STANDARD` and `QUALITY`
9+
- Add support to `NEURAL+` depth mode. Value `NEURAL_PLUS` for the parameter `depth_mode`
10+
- The annoying warning `Elaboration takes longer...` is now emitted only in DEBUG mode
11+
12+
v4.0.8
13+
------
14+
615
- Remove start_object_detection and stop_object_detection services
716
- Add enable_object_detection service that takes a bool as parameter to enable/disable the OD module (same behavior as in ROS 2 Wrapper)
817
- Add parameter 'object_detection/allow_reduced_precision_inference'
918
- Add parameter 'object_detection/prediction_timeout'
1019
- The parameter 'object_detection/model' is no more an integer, but a string with the full name of the supported OD model
11-
12-
2023-09-15
13-
----------
1420
- Add pose and odometry status publishers
1521
- Improve odometry and pose publishing and TF broadcasting
16-
17-
2023-09-13
18-
----------
1922
- Add ROS '.clang-format'
2023
- Code refactoring
2124
- Add 'set_roi' and 'reset_roi' services
2225
- Add parameter 'pos_tracking/depth_min_range'
2326
- Add parameter 'pos_tracking/set_as_static'
24-
25-
2023-09-12
26-
----------
2727
- Change the parameter 'general/resolution' to 'general/grab_resolution' and replace numeric values with strings
2828
- Add 'general.svo_realtime' parameter
2929
- Change 'general/verbose' to 'general/sdk_verbose'
3030
- Add 'general/region_of_interest' parameter
31-
32-
2023-09-10
33-
----------
3431
- Change the parameter 'depth/quality' to 'depth/depth_mode' and replace numeric values with strings
3532
- Improve the behavior of the "NO DEPTH" mode
3633
- Remove the parameters 'depth_downsample_factor' and 'img_downsample_factor'
3734
- Add the parameter 'pub_resolution' and 'pub_downscale_factor'
38-
39-
2023-09-08
40-
----------
4135
- Add 'pos_tracking/set_gravity_as_origin' parameter. If 'true' align the positional tracking world to imu gravity measurement. Keep the yaw from the user initial pose.
4236
- Add 'pos_tracking/pos_tracking_mode' parameter. Matches the ZED SDK setting: 'QUALITY', 'STANDARD'
4337
- Fix the warning 'Elaboration takes longer [...]'
44-
45-
2023-09-07
46-
----------
4738
- 'pub_frame_rate' now controls the 'InitParameters::grab_compute_capping_fps' parameter of the ZED SDK instead of controlling the frequency of a parallel thread. It's not a Dynamic parameter anymore.
4839
- Change 'general/camera_flip' parameter to string: 'AUTO', 'ON', 'OFF'
4940
- Change 'general/verbose' from bool to integer
5041

51-
52-
5342
v4.0.5
5443
------
5544
- Support for ZED SDK v4.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This package lets you use the ZED stereo camera with ROS. It outputs the camera
1717
### Prerequisites
1818

1919
- Ubuntu 20.04
20-
- [ZED SDK **≥ 4.0.6**](https://www.stereolabs.com/developers/) and its dependency [CUDA](https://developer.nvidia.com/cuda-downloads)
20+
- [ZED SDK **v4.1**](https://www.stereolabs.com/developers/) and its dependency [CUDA](https://developer.nvidia.com/cuda-downloads)
2121
- [ROS Noetic](http://wiki.ros.org/noetic/Installation/Ubuntu)
2222

2323
### Build the repository

zed_nodelets/src/zed_nodelet/include/zed_wrapper_nodelet.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ class ZEDWrapperNodelet : public nodelet::Nodelet
636636

637637
// Positional tracking
638638
bool mPosTrackingEnabled = false;
639-
sl::POSITIONAL_TRACKING_MODE mPosTrkMode = sl::POSITIONAL_TRACKING_MODE::QUALITY;
639+
sl::POSITIONAL_TRACKING_MODE mPosTrkMode = sl::POSITIONAL_TRACKING_MODE::GEN_2;
640640
bool mPosTrackingReady = false;
641641
bool mPosTrackingStarted = false;
642642
bool mPosTrackingRequired = false;

zed_nodelets/src/zed_nodelet/src/zed_wrapper_nodelet.cpp

Lines changed: 35 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -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

42964280
void 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

Comments
 (0)