Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 475

segfault when reading rosbag

$
0
0
Hi all, I'm trying to parse a rosbag file. According to the guide here, I wrote something like this: rosbag::Bag bag; std::vector topics; std::cout << "Opening " << filename_ << std::endl; bag.open(filename_.c_str(), rosbag::bagmode::Read); std::cout << "Mode: " << bag.getMode() << std::endl; topics.push_back(std::string("/Imu")); topics.push_back(std::string("/joint_states")); rosbag::View view(bag, rosbag::TopicQuery(topics)); foreach(rosbag::MessageInstance const m, view) { std::cout << "Found message of type " << m.getDataType() << std::endl; if(m.getDataType().compare("sensor_msgs/Imu") == 0) { sensor_msgs::ImuConstPtr s = m.instantiate(); cout << "S = " << s << std::endl; double ax = s->linear_acceleration.x; } The address printed by S is not NULL, but when I reach the last line to get the data, I get a SEGFAULT.

Viewing all articles
Browse latest Browse all 475

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>