From d7b7a741c8af65efbd98bafdbe530d3e3fe39eb2 Mon Sep 17 00:00:00 2001 From: Guramumei <1421887449@qq.com> Date: Fri, 27 Oct 2023 22:24:46 +0800 Subject: [PATCH] Add path publisher. --- .../include/rm_chassis_controllers/chassis_base.h | 2 +- rm_chassis_controllers/src/chassis_base.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rm_chassis_controllers/include/rm_chassis_controllers/chassis_base.h b/rm_chassis_controllers/include/rm_chassis_controllers/chassis_base.h index 370087c8..2a322ea5 100644 --- a/rm_chassis_controllers/include/rm_chassis_controllers/chassis_base.h +++ b/rm_chassis_controllers/include/rm_chassis_controllers/chassis_base.h @@ -179,7 +179,7 @@ class ChassisBase : public controller_interface::MultiInterfaceController Command cmd_struct_; realtime_tools::RealtimeBuffer cmd_rt_buffer_; realtime_tools::RealtimeBuffer odom_buffer_; - ros::Publisher path_pub_ ; + ros::Publisher path_pub_; nav_msgs::Path path_; }; diff --git a/rm_chassis_controllers/src/chassis_base.cpp b/rm_chassis_controllers/src/chassis_base.cpp index fefd2eb5..703eb800 100644 --- a/rm_chassis_controllers/src/chassis_base.cpp +++ b/rm_chassis_controllers/src/chassis_base.cpp @@ -353,7 +353,7 @@ void ChassisBase::updateOdom(const ros::Time& time, const ros::Duration& p topic_update_ = false; } - if(enable_path_) + if (enable_path_) { path_.header.stamp = time; path_.header.frame_id = "odom"; @@ -372,7 +372,7 @@ void ChassisBase::updateOdom(const ros::Time& time, const ros::Duration& p if (path_publish_rate > 0.0 && last_path_publish_time_ + ros::Duration(1.0 / path_publish_rate) < time) { path_.poses.push_back(this_pose_stamped); - path_pub_.publish(path_);//path + path_pub_.publish(path_); // path last_path_publish_time_ = time; } }