The /scan observation buffer has not been updated for22.06 seconds, and it should be updated every 5.00 seconds.
来源在
1 2 3 4 5 6 7 8 9 10 11 12 13 14
boolObservationBuffer::isCurrent()const { if (expected_update_rate_ == ros::Duration(0.0)) returntrue; // last_updated_ 没有赋值 bool current = (ros::Time::now() - last_updated_).toSec() <= expected_update_rate_.toSec(); if (!current) { ROS_WARN( "The %s observation buffer has not been updated for %.2f seconds, and it should be updated every %.2f seconds.", topic_name_.c_str(), (ros::Time::now() - last_updated_).toSec(), expected_update_rate_.toSec()); } return current; }
此时发导航命令,又有报警
1
[/move_base]:Sensor data is out of date, we're not going to allow commanding of the base for safety
if(!controller_costmap_ros_->isCurrent()) { ROS_WARN("[%s]:Sensor data is out of date, we're not going to allow commanding of the base for safety",ros::this_node::getName().c_str()); publishZeroVelocity(); returnfalse; }
保证代码是 exception-safe: When your code can be interrupted by exceptions, you must ensure that resources you hold will be deallocated when stack variables go out of scope. In particular, mutexes must be released, and heap-allocated memory must be freed. Accomplish this safety by using the following mutex guards and smart pointers
This prevents enums from polluting the namespace they’re inside. Individual items within the enum are referenced by: Choices::Choice1, but the typedef still allows declaration of the Choice enum without the namespace.
If you are using C++11 and above, you can use scoped enumeration
1 2 3 4 5 6 7
enumclassChoice { Choice1, Choice2, Choice3 }; Choice c = Choice::Choice1;
Depending on compilation settings, the assertion may not be executed.
It is typical to develop software with assertion-checking enabled, in order to catch violations. When nearing software completion and when assertions are found to always be true in the face of extensive testing, you build with a flag that removes assertions from compilation, so they take up no space or time.
The following option to catkin_make will define the NDEBUG macro for all your ROS packages, and thereby remove assertion checks. catkin_make -DCMAKE_CXX_FLAGS:STRING="-DNDEBUG"
Note: cmake will rebuild all your software when you run it with this command, and will remember the setting through subsequent catkin_make runs until you delete your build and devel directories and rebuild.
#include<iostream> intmain() { #if defined __linux__ std::cout<<"linux system"<<std::endl; #elif defined _WIN32 std::cout<<"windows system"<<std::endl; #endif #if defined __aarch64__ std::cout<<"this is arm cpu"<<std::endl; #elif defined __x86_64__ std::cout<<"this id x86 cpu"<<std::endl; #endif return0; }
cmake 中判断CPU 架构,操作系统类型
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
cmake_minimum_required(VERSION 3.10.0) message(${CMAKE_HOST_SYSTEM_NAME}) message(${CMAKE_HOST_SYSTEM_PROCESSOR}) if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") message("this is Linux") elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") message("this is Windows") endif() if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64") message("this is aarch64 cpu") elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64") message("this is x86_64 cpu") endif()