-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: /tf and /static_tf topics' inconsistencies #2676
Changes from 5 commits
ec8023a
b092f35
f032edb
1e38de7
ce50027
f36c390
31f3cac
dce6b74
7ebd9ce
82eb970
3e87a6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -984,12 +984,17 @@ void BaseRealSenseNode::publishStaticTransforms(std::vector<rs2::stream_profile> | |
|
||
void BaseRealSenseNode::startDynamicTf() | ||
{ | ||
if (!_publish_tf) | ||
{ | ||
ROS_WARN("Since the param 'publish_tf' is set to 'false'," | ||
"the value set on the param 'tf_publish_rate' won't have any effect"); | ||
return; | ||
} | ||
if (_tf_publish_rate > 0) | ||
{ | ||
ROS_WARN("Publishing dynamic camera transforms (/tf) at %g Hz", _tf_publish_rate); | ||
if (!_tf_t) | ||
{ | ||
_dynamic_tf_broadcaster = std::make_shared<tf2_ros::TransformBroadcaster>(_node); | ||
_tf_t = std::make_shared<std::thread>([this]() | ||
{ | ||
publishDynamicTransforms(); | ||
|
@@ -1003,12 +1008,22 @@ void BaseRealSenseNode::startDynamicTf() | |
_tf_t->join(); | ||
_tf_t.reset(); | ||
_dynamic_tf_broadcaster.reset(); | ||
ROS_WARN("Stopped publishing dynamic camera transforms (/tf)"); | ||
} | ||
else | ||
{ | ||
ROS_WARN("Currently not publishing dynamic camera transforms (/tf)"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a question, can you remind me when we will get to here ? In which scenario ? |
||
} | ||
} | ||
} | ||
|
||
void BaseRealSenseNode::publishDynamicTransforms() | ||
{ | ||
if (!_dynamic_tf_broadcaster) | ||
{ | ||
_dynamic_tf_broadcaster = std::make_shared<tf2_ros::TransformBroadcaster>(_node); | ||
} | ||
|
||
// Publish transforms for the cameras | ||
std::unique_lock<std::mutex> lock(_publish_dynamic_tf_mutex); | ||
while (rclcpp::ok() && _is_running && _tf_publish_rate > 0) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,6 @@ void BaseRealSenseNode::getParameters() | |
startDynamicTf(); | ||
}); | ||
_parameters_names.push_back(param_name); | ||
startDynamicTf(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this change the behavior from default start publishing to not? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
param_name = std::string("diagnostics_period"); | ||
_diagnostics_period = _parameters->setParam<double>(param_name, DIAGNOSTICS_PERIOD); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to explain more in the description field, specially for these two parameters since they can confuse users.
publish_tf
: [bool] enable/disable publishing static or dynamic TFtf_publish_rate
: [double] rate in HZ for publishing dynamic TFAlso, I would prefer to explanation and elaborate more in the README.md file, where we explain about
publish_rate
andtf_publish_rate
1- to explain that
publish_tf:=false
will not publish any static/dynamic TFs, even iftf_publish_rate
is bigger than 0.02- to explain that
publish_tf:=true
, will automatically publish static TFs. If dynamic TFs are needed, user should set thetf_publish_rate
for it, and it should be > 0.03- to mention that the default value is
publish_tf:=true
with tf_publish_rate:=0.0
which means publishing static TFs as default behavior.