1 #ifndef SLAM_CTOR_ROS_BAG_TOPIC_WITH_TRANSFORM_H 2 #define SLAM_CTOR_ROS_BAG_TOPIC_WITH_TRANSFORM_H 8 #include <unordered_map> 13 #include <tf/tfMessage.h> 14 #include <geometry_msgs/TransformStamped.h> 16 #include <boost/shared_ptr.hpp> 18 template <
typename MsgType>
21 using vstr = std::vector<std::string>;
22 using Transforms = std::unordered_map<std::string, std::vector<std::string>>;
25 const std::string &topic_name,
26 const std::string &tf_topic_name,
27 const std::string &target_frame)
51 auto msg_topic = ros_msg.getTopic();
53 _msg_cache.push(ros_msg.instantiate<MsgType>());
54 }
else if (msg_topic == _tf_topic_name) {
55 auto tf_msg = ros_msg.instantiate<tf::tfMessage>();
56 for(
auto t : tf_msg->transforms) {
80 auto from = t.header.frame_id, to = t.child_frame_id;
85 return std::find(skip_tos.begin(), skip_tos.end(), to) != skip_tos.end();
100 auto reason = std::string{e.what()};
101 if (reason.find(
"extrapolation into the future") != std::string::npos) {
106 std::cout <<
"[WARN][BagTopic] ";
107 if (reason.find(
"past") != std::string::npos) {
109 std::cout <<
"Scan dropped. ";
111 std::cout << reason << std::endl;;
static void transformStampedMsgToTF(const geometry_msgs::TransformStamped &msg, StampedTransform &bt)