Hi Chris,
If you are using ROS, this can be similar to User Data tutorial here:
http://wiki.ros.org/rtabmap_ros/Tutorials/WifiSignalStrengthMappingUserDataUsageIn RTAB-Map library,
Rtabmap::setUserData(int id, cont cv::Mat & data). If id is <=0, the data will be set to latest node in the graph. If you are going to set only a boolean, use cv:Mat(2,1,CV_8UC1) format (with dummy second row) to avoid rtabmap thinking that data is already compressed (one row CV_8UC1).
RTAB-Map doesn't save in the database exactly when a new node is created. The node stays in RAM until it is transferred to long-term memory or the application finishes (see this
issue). You should then use
Memory interface instead to access all nodes (those in RAM and those in database).
Memory::getAllSignatureIds() return all Ids in the map (RAM and database), then with Memory::getSignatureDataConst(locationId, false, false, true, false), you can get back the userData.
Example with
CoreWrapper.cpp
std::set<int> ids = rtabmap_.getMemory()->getAllSignatureIds();
for(std::set<int>::iterator iter=ids.begin(); iter!=ids.end(); ++iter)
{
int id = *iter;
SensorData data = rtabmap_.getMemory()->getSignatureDataConst(id, false, false, true, false);
cv::Mat userData;
data.uncompressDataConst(0, 0, 0, &userData)
if(!userData.empty() && userData.at<unsigned char>(0,0) != 0)
printf("Boolean is true for node %d!\n", id);
}
cheers,
Mathieu