Skip to content

Deprecate tf.publish_rate parameter for pose_broadcaster #1614

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

Merged
merged 5 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ class PoseBroadcaster : public controller_interface::ControllerInterface
std::unique_ptr<realtime_tools::RealtimePublisher<geometry_msgs::msg::PoseStamped>>
realtime_publisher_;

// TODO(amronos): Remove these two member variables
std::optional<rclcpp::Duration> tf_publish_period_;
rclcpp::Time tf_last_publish_time_{0, 0, RCL_CLOCK_UNINITIALIZED};

rclcpp::Publisher<tf2_msgs::msg::TFMessage>::SharedPtr tf_publisher_;
std::unique_ptr<realtime_tools::RealtimePublisher<tf2_msgs::msg::TFMessage>>
realtime_tf_publisher_;
Expand Down
20 changes: 16 additions & 4 deletions pose_broadcaster/src/pose_broadcaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,21 @@ controller_interface::CallbackReturn PoseBroadcaster::on_configure(
params_ = param_listener_->get_params();

pose_sensor_ = std::make_unique<semantic_components::PoseSensor>(params_.pose_name);
tf_publish_period_ =
params_.tf.publish_rate == 0.0
? std::nullopt
: std::optional{rclcpp::Duration::from_seconds(1.0 / params_.tf.publish_rate)};

// TODO(amronos): Remove this check and its contents
if (params_.tf.publish_rate == 0.0)
{
tf_publish_period_ = std::nullopt;
}
else
{
tf_publish_period_ =
std::optional{rclcpp::Duration::from_seconds(1.0 / params_.tf.publish_rate)};
RCLCPP_WARN(
get_node()->get_logger(),
"[deprecated] tf.publish_rate parameter is deprecated, please set the value to 0.0. "
"The publish rate of TF messages should not be limited.");
}

try
{
Expand Down Expand Up @@ -170,6 +181,7 @@ controller_interface::return_type PoseBroadcaster::update(
pose.position.z, pose.orientation.x, pose.orientation.y, pose.orientation.z,
pose.orientation.w);
}
// TODO(amronos): Remove publish rate functionality
else if (realtime_tf_publisher_ && realtime_tf_publisher_->trylock())
{
bool do_publish = false;
Expand Down
3 changes: 2 additions & 1 deletion pose_broadcaster/src/pose_broadcaster_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ pose_broadcaster:
default_value: ""
description: "Child frame id of published tf transforms. Defaults to ``pose_name`` if left
empty."
# TODO(amronos): Remove this parameter as it is deprecated
publish_rate:
type: double
default_value: 0.0
description: "Rate to limit publishing of tf transforms to (Hz). If set to 0, no limiting is
performed."
performed. This parameter is deprecated and limiting should not be performed."
validation:
gt_eq<>: 0.0
Loading