Skip to content

Commit

Permalink
Use controller interface update time
Browse files Browse the repository at this point in the history
  • Loading branch information
munseng-flexiv committed Apr 30, 2024
1 parent 8c5e1b9 commit 6f2b565
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions flexiv_controllers/src/tcp_pose_state_broadcaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ CallbackReturn TcpPoseStateBroadcaster::on_configure(
}

try {
// register ft sensor data publisher
// register TCP pose data publisher
sensor_state_publisher_ = get_node()->create_publisher<geometry_msgs::msg::PoseStamped>(
"~/" + topic_name_, rclcpp::SystemDefaultsQoS());
realtime_publisher_ = std::make_unique<StatePublisher>(sensor_state_publisher_);
Expand All @@ -99,10 +99,10 @@ CallbackReturn TcpPoseStateBroadcaster::on_configure(
}

controller_interface::return_type TcpPoseStateBroadcaster::update(
const rclcpp::Time& /*time*/, const rclcpp::Duration& /*period*/)
const rclcpp::Time& time, const rclcpp::Duration& /*period*/)
{
if (realtime_publisher_ && realtime_publisher_->trylock()) {
realtime_publisher_->msg_.header.stamp = get_node()->now();
realtime_publisher_->msg_.header.stamp = time;
cartesian_pose_sensor_->get_values_as_message(realtime_publisher_->msg_.pose);
realtime_publisher_->unlockAndPublish();
}
Expand All @@ -129,4 +129,4 @@ CallbackReturn TcpPoseStateBroadcaster::on_deactivate(
#include "pluginlib/class_list_macros.hpp"

PLUGINLIB_EXPORT_CLASS(
flexiv_controllers::TcpPoseStateBroadcaster, controller_interface::ControllerInterface)
flexiv_controllers::TcpPoseStateBroadcaster, controller_interface::ControllerInterface)

0 comments on commit 6f2b565

Please sign in to comment.