Cartographer_ros
Entry file: node_main.cc
The entry function is main, as shown below:
Initialize node: cartographer_node;
The Run function loads the configuration file loadoptions () and processes the subscribed topic according to the configuration file. such as Imu
note whether the cartographer accepts IMU data, depending on the conditions of the If judgment, which are configured in "Backpack_2d.lua". It is then handed to the Handleimumessage function (defined in sensor_bridge.cc) for processing, as shown in the following figure:
The function will make a simple check on the frame_id, and then give the function Trajectory_builder_->addimudata processing (directly implemented in Trajectory_builder.h), as shown below:
and Addsensordata is a pure virtual function, it is in inheriting the subclass of the parent class to implement, as shown in the following diagram:
know this inheritance relationship by searching: class Collatedtrajectorybuilder:public Trajectorybuilder
realized in this.
In Sensor_collator_->addsensordata, Sensor::collator sensor_collator_ is defined in Map_builder.h. Then find the implementation in collator.cc, as shown below:
This will add the IMU data to the queue. Std::unique_ptr is a smart pointer to the standard library,
notice a function in Collator.h:
The implementation is as follows:
It is called in the Collatedtrajectorybuilder constructor, the incoming callback function is named Handlecollatedsensordata, processing the collated sensor data, and here we begin to enter the key point.
This function prints the rate of sensor data, and distinguishes the data type. Keep track of IMU data. Wrapped_trajectory_builder_->addimudata, the type is:
In the header file Cartographer/mapping_2d/local_trajectory_ Builder.h, it is known that the Globaltrajectorybuilder class inherits the Globaltrajectorybuilderinterface class, as shown in figure:
Naturally you can find the concrete implementation of Globaltrajectorybuilder::addimudata, as shown below:
This function means that the map building goes from global optimization to local partial optimization.
The first step:
Above this function Kalman filter based on time prediction pose, constantly update IMU data, set the maximum tilt angle threshold of 20 degrees, more than 2D SLAM will fail.
Step Two: Figure optimization
The Optimizationproblem class is a closed-loop method for implementing SPA (statistical process tuning).
These are the key functions, which are then analyzed in detail.
Links to related articles online:
http://mp.weixin.qq.com/s/LdbFp-Zvkr02-_25ILb16g
http://blog.csdn.net/u010566411/article/category/6467677
http://www.cnblogs.com/wenhust/tag/SLAM/(highly recommended)
http://blog.csdn.net/zyh821351004/article/details/52421005
http://blog.csdn.net/jsgaobiao/article/details/53116042
http://blog.csdn.net/roadseek_zw/article/details/53316177
Thesis:
Improved techniques for Grid Mapping With rao-blackwellized particle filters
Blog:
http://blog.csdn.net/heyijia0327/article/details/ 40899819  PF principle explanation
http://blog.csdn.net/u010545732/article/details/17462941  PF code implementation
http://www.cnblogs.com/yhlx125/p/5634128.html gmapping analysis
http://wenku.baidu.com/view/ 3a67461550e2524de4187e4d.html?from=search gmapping Analysis
Other:
http://ishare.iask.sina.com.cn /f/24615049.html