introlab / rtabmap_ros

RTAB-Map's ROS package.
http://wiki.ros.org/rtabmap_ros
BSD 3-Clause "New" or "Revised" License
974 stars 557 forks source link

GPS posePrior and Wi-Fi generated Range-Only constraints with g2o #434

Open MathieuNass opened 4 years ago

MathieuNass commented 4 years ago

Hi Mathieu Labbe,

Great work on RTAB-map, because of you I have a very interesting subject for my MSc. thesis, namely "Adding GPS and range only Wi-Fi based constraints to a graph-based visual 2D SLAM algorithm". So, thank you very much! The plan for my thesis is to have an active Wi-Fi sniffer generate 1d constraints (e.g. distance from current pose) for RTAB-MAP in order to determine the perceived locations of the routers. These locations could in turn be used for localisation using Wi-Fi only. Furthermore, it could speed up loop-closure detection because MAC-addresses disambiguate similar locations, comparable to the implications of GPS or april tags. As specified in the title everything will be done in 2D space as, for me, this is complicated enough already.

I'll ask my questions first and list my approach after:

The approach: I built g2o and rtabmap from source and implemented my range-only constraint in g2o, the levenberg solvers are able to handle these very well. Now I need to integrate this in rtabmap so it can be used in the optimisation process as well as in the loop closure process.

The additions/changes I've planned:

Thanks again for the continued amazing work, I hope that I will be able to contribute something to SLAM research this way.

Best regards, Mathieu Nass

matlabbe commented 4 years ago

It is a great idea to add Wifi constraint in the graph. I think you could use landmark links directly. Which kind of g2o edge are you using for range-only constraints? You could make use of the covariance to detect which kind of landmark is used. I do this already to differentiate between landmarks XY and landmarks XY+Yaw. If the Yaw covariance is >=9999, then I add a XY constraint. In your case, if you set covariance of Y to >= 9999 too, assuming only X value is valid, then you know you should use range-only constraint. Note that in OptimizerG2O, the type of link is not used, the covariance is used to switch between appropriate links.

Adding correct pose for the landmark: https://github.com/introlab/rtabmap/blob/3505611fb57c80da870f11545416293e08ecf7be/corelib/src/optimizer/OptimizerG2O.cpp#L387-L412 Adding corresponding link type: https://github.com/introlab/rtabmap/blob/3505611fb57c80da870f11545416293e08ecf7be/corelib/src/optimizer/OptimizerG2O.cpp#L575-L616

To use landmark links, the id of the mac address would need to be negative.

For your previous questions:

For the GPS you've already provided me with a lot of information on the forums and the wiki but it does not work as I expected it to work. When using g2o, I inspected the data that is given to optimize or optimizeBA functions in optimizerG2O.cpp and never did I observe a link of type kPosePrior. How is or can GPS be incorporated in the graph optimisation?

GPS is used as prior here: https://github.com/introlab/rtabmap/blob/3505611fb57c80da870f11545416293e08ecf7be/corelib/src/Memory.cpp#L5202 then normally the prior links will show up in optimize(). Optimizer/PriorsIgnored should be false to be actually used in optimization.

Is adding another typeName to the enumerator of link enough for the loop-closure process to consider these links as traversible when selecting keyframes?

Not sure what you mean by "traversible when selecting keyframes?" You can experiment with Apriltags to see what happens with landmark links.

In the end, I would like RTAB-map to be able to add range-only constraints to the mapGraph for optimisation and keyframe selection (e.g. traversible by the function that uses RGBD/ProximityMaxGraphDepth). Can I please have your opinion on the planned approach (below)? Do you think that if I implement these changes as described I will be able to achieve the aforementioned goal?

RGBD/ProximityMaxGraphDepth is used in proximity detection. The landmark links should be used (to be verified) to select nodes to compare too. For loop closure detection, if you want to limit the radius like with the GPS, is it done here before computing the likelihood. There could be a filtering of the signatures to keep only those inside a radius around a wifi hotspot detected in the current signature.

cheers, Mathieu