// Inter constraints, different trajectories 线段的两个端点 constraint_marker->points.push_back( ToGeometryMsgPoint(submap_pose.translation())); constraint_marker->points.push_back( ToGeometryMsgPoint(constraint_pose.translation())); // Inter residuals, different trajectories 线段的两个端点 residual_marker->points.push_back( ToGeometryMsgPoint(constraint_pose.translation())); residual_marker->points.push_back( ToGeometryMsgPoint(trajectory_node_pose.translation()));
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake
sed -i "s/2.8.3/3.19/g" `grep 2.8.3 -rl . --include="*.txt" `
这个命令不要滥用,否则可能更改过多
涉及PCL的一个警告
1 2 3 4 5
CMake Warning (dev) at /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message): The package name passed to `find_package_handle_standard_args` (PCL_KDTREE) does not match the name of the calling package (PCL). This can lead to problems in calling code that expects `find_package` result variables (e.g., `_FOUND`) to follow a certain pattern.
在find_package(PCL REQUIRED)之前加上
1 2 3
if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS) set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings") endif()
No rule to make target
有时明明写好了,但编译会出现报错,看上去是CMakeLists中没有编译规则
1 2 3 4 5 6
make[2]: *** No rule to make target 'package/CMakeFiles/test_bin.dir/build'。 停止。 CMakeFiles/Makefile2:3192: recipe for target 'package/CMakeFiles/test_bin.dir/all' failed make[1]: *** [package/CMakeFiles/test_bin.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j4 -l4" failed
此时再重新编译仍然报错,只要把CMakeLists改一下,再编译就通过了
CMakeCache 报错
执行编译时报错:
1
CMake Error: The current CMakeCache.txt directory /home/user/common/build/CMakeCache.txt is different than the directory /home/user/space/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
// 第一个子图或冻结,不优化子图位姿。 也就是不优化初值 if (first_submap || frozen) { first_submap = false; // Fix the pose of the first submap or all submaps of a frozen // trajectory. problem.SetParameterBlockConstant(C_submaps.at(submap_id_data.id).data()); } }
const std::string& landmark_id = landmark_node.first; // 轨迹中第一个 node_data constauto& begin_of_trajectory = node_data.BeginOfTrajectory(observation.trajectory_id); // 如果 landmark observation was made before the trajectory was created if (observation.time < begin_of_trajectory->data.time) { continue; } /* 以下语句Find the trajectory nodes before and after the landmark observation */
// 找到在landmark观测时间后的第一个节点 auto next = node_data.lower_bound(observation.trajectory_id, observation.time); /* The landmark observation was made, but the next trajectory node has not been added yet. 即next已经是轨迹最后一个节点 */ if (next == node_data.EndOfTrajectory(observation.trajectory_id) ) { continue; } // 如果是刚开始的node data if (next == begin_of_trajectory) { next = std::next(next); } // 这里的pre配合next是为了获取两个位置,找到landmark观测时间的前一个节点 auto prev = std::prev(next);
// 根据两个索引,获取两个节点位姿 // Add parameter blocks for the landmark ID if they were not added before std::array<double, 3>* prev_node_pose = &C_nodes->at(prev->id); std::array<double, 3>* next_node_pose = &C_nodes->at(next->id);
// Set landmark constant if it is frozen. 不参与优化 // 这里容易记不清,frozen 定义在 struct LandmarkNode if (landmark_node.second.frozen) { problem->SetParameterBlockConstant( C_landmarks->at(landmark_id).translation());
if (sensor_id.type == SensorId::SensorType::LANDMARK && !collate_landmarks_) { continue; }
如果提供landmark的观测不低于10 Hz,那么可以设置TRAJECTORY_BUILDER.collate_landmarks = on. Cartographer将deterministically运行(对于给定的bag, 使用offline node每次获得的结果是一样的). 如果collate_landmarks = off, landmark observations将跳过sensor queue (so they do not block it if they are sparse) and are injected directly into the pose graph, which is not deterministic.
要求是:标定板在激光正前方120°范围内,并且激光前方2m范围内只存在一个连续的直线线段,所以请在空旷的地方采集数据,不然激光数据会提取错误。需要充分旋转 roll 和 pitch。更直白一点,假设在长方形的标定板中心画了个十字线,那请绕着十字线的两个轴充分旋转,比如绕着竖轴旋转,然后还要绕着横轴旋转。在运行offline程序时,程序会将认为正确的直线会显示为红色。
Load apriltag pose size: 582 terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 57) [lasercamcal_ros-1] process has died
有时连录几次bag,都出现这种情况,估计是某个地方在for循环里push_back导致
结果不可观
计算初值阶段
1 2 3 4 5 6 7 8 9
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Notice Notice Notice: system unobservable !!!!!!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~