voidcheckForShutdown() { if (g_shutdown_requested) // 除非ros::requestShutdown() { // Since this gets run from within a mutex inside PollManager, we need to prevent ourselves from deadlocking with another thread that's already in the middle of shutdown() boost::recursive_mutex::scoped_try_lock lock(g_shutting_down_mutex, boost::defer_lock); while (!lock.try_lock() && !g_shutting_down) { ros::WallDuration(0.001).sleep(); }
if (!g_shutting_down) // ros::start()中赋值为false,之后未变 { shutdown(); // 关闭节点 }
./configure --build=arm-linux make sudo make install
在CMakeList里写好调用后,编译,结果报错:
1 2 3 4
//usr/local/lib/liblog4cpp.so: undefined reference to `pthread_key_create' //usr/local/lib/liblog4cpp.so: undefined reference to `pthread_getspecific' //usr/local/lib/liblog4cpp.so: undefined reference to `pthread_key_delete' //usr/local/lib/liblog4cpp.so: undefined reference to `pthread_setspecific'
using Point = bg::model::point<double, 2, bg::cs::cartesian>; using Box = bg::model::box<Point>; using Line = bg::model::linestring<Point>; // 线段 using Segment = bg::model::segment<Point>;
intmain(int argc, char** argv) { ros::init(argc, argv, "test_boost"); ros::NodeHandle nh; Point pt0(100, 100); Point pt1(200, 200); // 点的间距 cout << "distance from pt0 to pt1: "<< bg::distance(pt0, pt1) << endl;
等待时间可以通过-d选项来指定,比如等待10秒再播放bag: rosbag play -d 10 realsense.bag
以暂停的方式启动,防止跑掉数据:
1
rosbag play --pause record.bag
要一帧一帧播放的效果,先用暂停方式启动,然后按S键,这个用的还比较少
设置以0.5倍速回放,也就是以录制频率的一半回放。可以加倍播放,但会增大CPU占用。
1
rosbag play -r 0.5 record.bag
循环播放:
1
rosbag play -l record.bag
use_sim_time的问题
播放bag时,运行算法程序,结果报警:
1 2 3
Warning: TF_OLD_DATA ignoring data from the past for frame base_footprint at time 1.59524e+09 according to authority unknown_publisher Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained at line 277 in /tmp/binarydeb/ros-kinetic-tf2-0.5.20/src/buffer_core.cpp