Skip to content

Commit bc16c46

Browse files
author
Long Vuong
committed
feat [ROS]: pub output as pose with cov msg type
1 parent 3f08908 commit bc16c46

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

ros/src/OdometryServer.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ OdometryServer::OdometryServer(const rclcpp::NodeOptions &options)
9090
// Initialize publishers
9191
rclcpp::QoS qos((rclcpp::SystemDefaultsQoS().keep_last(1).durability_volatile()));
9292
odom_publisher_ = create_publisher<nav_msgs::msg::Odometry>("kiss/odometry", qos);
93+
pose_publisher_ =
94+
create_publisher<geometry_msgs::msg::PoseWithCovarianceStamped>("kiss/pose", qos);
9395
if (publish_debug_clouds_) {
9496
frame_publisher_ = create_publisher<sensor_msgs::msg::PointCloud2>("kiss/frame", qos);
9597
kpoints_publisher_ = create_publisher<sensor_msgs::msg::PointCloud2>("kiss/keypoints", qos);
@@ -221,6 +223,11 @@ void OdometryServer::PublishOdometry(const Sophus::SE3d &kiss_pose,
221223
odom_msg.pose.covariance[28] = orientation_covariance_;
222224
odom_msg.pose.covariance[35] = orientation_covariance_;
223225
odom_publisher_->publish(std::move(odom_msg));
226+
227+
geometry_msgs::msg::PoseWithCovarianceStamped pose_msg;
228+
pose_msg.header = odom_msg.header;
229+
pose_msg.pose = odom_msg.pose;
230+
pose_publisher_->publish(pose_msg);
224231
}
225232

226233
void OdometryServer::PublishClouds(const std::vector<Eigen::Vector3d> &frame,

ros/src/OdometryServer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "kiss_icp/pipeline/KissICP.hpp"
2727

2828
// ROS 2
29+
#include <geometry_msgs/msg/pose_with_covariance_stamped.hpp>
2930
#include <nav_msgs/msg/odometry.hpp>
3031
#include <rclcpp/rclcpp.hpp>
3132
#include <sensor_msgs/msg/point_cloud2.hpp>
@@ -76,6 +77,7 @@ class OdometryServer : public rclcpp::Node {
7677

7778
/// Data publishers.
7879
rclcpp::Publisher<nav_msgs::msg::Odometry>::SharedPtr odom_publisher_;
80+
rclcpp::Publisher<geometry_msgs::msg::PoseWithCovarianceStamped>::SharedPtr pose_publisher_;
7981
rclcpp::Publisher<sensor_msgs::msg::PointCloud2>::SharedPtr frame_publisher_;
8082
rclcpp::Publisher<sensor_msgs::msg::PointCloud2>::SharedPtr kpoints_publisher_;
8183
rclcpp::Publisher<sensor_msgs::msg::PointCloud2>::SharedPtr map_publisher_;

0 commit comments

Comments
 (0)