Skip to content

Remove deprecated parameter from pose_broadcaster #1685

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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,10 +63,6 @@ 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
56 changes: 10 additions & 46 deletions pose_broadcaster/src/pose_broadcaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,6 @@ controller_interface::CallbackReturn PoseBroadcaster::on_configure(

pose_sensor_ = std::make_unique<semantic_components::PoseSensor>(params_.pose_name);

// 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
{
pose_publisher_ = get_node()->create_publisher<geometry_msgs::msg::PoseStamped>(
Expand Down Expand Up @@ -181,42 +166,21 @@ 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;
// rlcpp::Time comparisons throw if clock types are not the same
if (tf_last_publish_time_.get_clock_type() != time.get_clock_type())
{
do_publish = true;
}
else if (!tf_publish_period_ || (tf_last_publish_time_ + *tf_publish_period_ <= time))
{
do_publish = true;
}

if (do_publish)
{
auto & tf_transform = realtime_tf_publisher_->msg_.transforms[0];
tf_transform.header.stamp = time;

tf_transform.transform.translation.x = pose.position.x;
tf_transform.transform.translation.y = pose.position.y;
tf_transform.transform.translation.z = pose.position.z;
auto & tf_transform = realtime_tf_publisher_->msg_.transforms[0];
tf_transform.header.stamp = time;

tf_transform.transform.rotation.x = pose.orientation.x;
tf_transform.transform.rotation.y = pose.orientation.y;
tf_transform.transform.rotation.z = pose.orientation.z;
tf_transform.transform.rotation.w = pose.orientation.w;
tf_transform.transform.translation.x = pose.position.x;
tf_transform.transform.translation.y = pose.position.y;
tf_transform.transform.translation.z = pose.position.z;

realtime_tf_publisher_->unlockAndPublish();
tf_transform.transform.rotation.x = pose.orientation.x;
tf_transform.transform.rotation.y = pose.orientation.y;
tf_transform.transform.rotation.z = pose.orientation.z;
tf_transform.transform.rotation.w = pose.orientation.w;

tf_last_publish_time_ = time;
}
else
{
realtime_tf_publisher_->unlock();
}
realtime_tf_publisher_->unlockAndPublish();
}

return controller_interface::return_type::OK;
Expand Down
8 changes: 0 additions & 8 deletions pose_broadcaster/src/pose_broadcaster_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,3 @@ 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. This parameter is deprecated and limiting should not be performed."
validation:
gt_eq<>: 0.0
Loading