解决方法,参考:https://blog.csdn.net/sunlin972913894/article/details/103674042
…
是因为CmakeLists.txt文件没有添加rosbag的依赖,在CMakeLists.txt 和rosbag 项即可。
find_package(catkin REQUIRED COMPONENTS
roscpp
rosbag
std_msgs
)
原文说在 package.xml 中添加
<build_depend>roscpp</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>rosbag</build_depend>
我这边没有package.xml ,使用的是manifest.xml(从ORB3中考过来的) ,在里边添加的是:
<depend package="nav_msgs"/>
<depend package="std_msgs"/>
<depend package="rosbag"/>
我也不知道这俩个.xml文件有沙区别
或者用下列命令重建项目:
~/cat_ws/src$catkin_create_pkg bagdemo roscpp rospy rosbag std_msgs geometry_msgs
另外电脑时区设置一定要对,否则运行时可能会报错:Tried to insert a message with time less than ros::TIME_MIN Aborted (core dumped)