From d40ff1935000e4f64c6f55168f71eecba1f27929 Mon Sep 17 00:00:00 2001 From: Michel Hidalgo Date: Wed, 18 Mar 2020 17:38:52 -0300 Subject: [PATCH] Use RViz node clock in tools. Signed-off-by: Michel Hidalgo --- .../src/rviz_default_plugins/tools/goal_pose/goal_tool.cpp | 3 ++- .../src/rviz_default_plugins/tools/point/point_tool.cpp | 3 ++- .../tools/pose_estimate/initial_pose_tool.cpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rviz_default_plugins/src/rviz_default_plugins/tools/goal_pose/goal_tool.cpp b/rviz_default_plugins/src/rviz_default_plugins/tools/goal_pose/goal_tool.cpp index 15654afe6..bc9ec227c 100644 --- a/rviz_default_plugins/src/rviz_default_plugins/tools/goal_pose/goal_tool.cpp +++ b/rviz_default_plugins/src/rviz_default_plugins/tools/goal_pose/goal_tool.cpp @@ -81,7 +81,8 @@ void GoalTool::onPoseSet(double x, double y, double theta) std::string fixed_frame = context_->getFixedFrame().toStdString(); geometry_msgs::msg::PoseStamped goal; - goal.header.stamp = rclcpp::Clock().now(); + goal.header.stamp = + context_->getRosNodeAbstraction().lock()->get_raw_node()->get_clock()->now(); goal.header.frame_id = fixed_frame; goal.pose.position.x = x; diff --git a/rviz_default_plugins/src/rviz_default_plugins/tools/point/point_tool.cpp b/rviz_default_plugins/src/rviz_default_plugins/tools/point/point_tool.cpp index 21cc1efbc..b9afa8b29 100644 --- a/rviz_default_plugins/src/rviz_default_plugins/tools/point/point_tool.cpp +++ b/rviz_default_plugins/src/rviz_default_plugins/tools/point/point_tool.cpp @@ -134,7 +134,8 @@ void PointTool::publishPosition(const Ogre::Vector3 & position) const geometry_msgs::msg::PointStamped point_stamped; point_stamped.point = point; point_stamped.header.frame_id = context_->getFixedFrame().toStdString(); - point_stamped.header.stamp = rclcpp::Clock().now(); + point_stamped.header.stamp = + context_->getRosNodeAbstraction().lock()->get_raw_node()->get_clock()->now(); publisher_->publish(point_stamped); } diff --git a/rviz_default_plugins/src/rviz_default_plugins/tools/pose_estimate/initial_pose_tool.cpp b/rviz_default_plugins/src/rviz_default_plugins/tools/pose_estimate/initial_pose_tool.cpp index f82cb19b2..5a850ed7d 100644 --- a/rviz_default_plugins/src/rviz_default_plugins/tools/pose_estimate/initial_pose_tool.cpp +++ b/rviz_default_plugins/src/rviz_default_plugins/tools/pose_estimate/initial_pose_tool.cpp @@ -83,7 +83,8 @@ void InitialPoseTool::onPoseSet(double x, double y, double theta) geometry_msgs::msg::PoseWithCovarianceStamped pose; pose.header.frame_id = fixed_frame; - pose.header.stamp = rclcpp::Clock().now(); + pose.header.stamp = + context_->getRosNodeAbstraction().lock()->get_raw_node()->get_clock()->now(); pose.pose.pose.position.x = x; pose.pose.pose.position.y = y;