New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load/Save Map #443
Comments
@sumitsarkar1 Please see Calibration_Tutorial.pdf in this project. It has introduced each parameter. And you can just Save/Load a map through some parameters. |
@dz306271098 are you able to save the map? I applied the flag |
When the stop button is pressed |
@sumitsarkar1 which dataset you test. I haven't met this situation when test in V101, MH01, MH05 EuRoC datasets. |
I am testing with Intel Realsense T265 If you check the |
@sumitsarkar1 I have checked. When you save map successfully, the cout gets printed. Like this |
@dz306271098 let me know if you have any success for the seg fault |
@sumitsarkar1 ok~ But unfortunately, I don't have a reliable way, and usually meet this error, like this
I will continue to try. |
I have tried save load map feature and it works for euroc dataset MH_01 series, you need to change the .yaml file and add these params System config#-------------------------------------------------------------------------------------------- When the variables are commented, the system doesn't load a previous session or not store the current oneIf the LoadFile doesn't exist, the system give a message and create a new Atlas from scratchSystem.LoadAtlasFromFile: "mapeuro" The store file is created from the current session, if a file with the same name exists it is deletedSystem.SaveAtlasToFile: "mapeuro" Above camera params |
@knazneen123 already done those but I face seg fault for T265 and because of the fault may be I cant save the map |
I also faced this seg fault issue when the program terminates or while I try to shut it down using ctrl+c, it mainly happens due to some pointer being corrupted or null, you can try to check the functions called in saveAtlas() like presave or dont add .osa extension in the params they have already added it in the code, do verify the file name as well once it using to save. Also, do check the shutdown function of previous version and this in System.cc they have made some changes for viewer try removing those comments as well if in case later seg fault happens after saving function |
@sumitsarkar1 I think I have found the solution. There are maybe two unsuitable operations.
I have done some rough work on both of them, and it seems successful. |
@dz306271098 thnx for the suggestions...It will be helpful if you have a forked version of the recent ORBSLAM3 with the rough changes so that I can build that...
This is with Realsense T265 . This seg fault is what I get |
@sumitsarkar1 I have updated the rough changes without using mutex in my forked version. And there are also some other problems. You can have a try. Maybe utilizing mutex is more reliable. I am fighting with my course examination recently (:з」∠) |
Hello, I have save and load the map successfully, but every time I loaded the map, the Tracker didn't use the saved map but create a new map, even though I turn the OnlyTracking-mode on, it's still tracking in the new map, am I use it in a wrong way? How could I use the loaded map to track?
and when the first frame came, StereoIntialization will set the first frame as the initial Frame and set it's pose to a identity matrix,how could relocalize in and turn the the Coordinate system to the loaded map |
@Sherlock-hh on what are you able to save and load map successfully? Benchmark data sets or Sensors (Realsense) |
realsense, stereo, sometimes it's failed to save map with different reasons, but most are accessing a null pointer, maybe it's because while presaving the map, loopclosing thread or localmapping thread are delete mappoint or keyFrame. |
delete |
yes, most of time it's caused by null pointer , you can add judge if it null when you prepare to save, or add mutex. |
OK, thank you for your remind. I will try to find it. Maybe before saving the map, add some mutex to the map or map points will work. |
Applying the changes from this fork seems to solve my problem. void Map::PreSave(std::set<GeometricCamera*> &spCams)
{
int nMPWithoutObs = 0;
std::set<MapPoint*> tmp_mspMapPoints1;
tmp_mspMapPoints1.insert(mspMapPoints.begin(), mspMapPoints.end());
for(MapPoint* pMPi : tmp_mspMapPoints1)
{
if(!pMPi || pMPi->isBad())
continue;
if(pMPi->GetObservations().size() == 0)
{
nMPWithoutObs++;
}
map<KeyFrame*, std::tuple<int,int>> mpObs = pMPi->GetObservations();
for(map<KeyFrame*, std::tuple<int,int>>::iterator it= mpObs.begin(), end=mpObs.end(); it!=end; ++it)
{
if(it->first->GetMap() != this || it->first->isBad())
{
pMPi->EraseObservation(it->first);
}
}
}
// Saves the id of KF origins
mvBackupKeyFrameOriginsId.clear();
mvBackupKeyFrameOriginsId.reserve(mvpKeyFrameOrigins.size());
for(int i = 0, numEl = mvpKeyFrameOrigins.size(); i < numEl; ++i)
{
mvBackupKeyFrameOriginsId.push_back(mvpKeyFrameOrigins[i]->mnId);
}
// Backup of MapPoints
mvpBackupMapPoints.clear();
std::set<MapPoint*> tmp_mspMapPoints2;
tmp_mspMapPoints2.insert(mspMapPoints.begin(), mspMapPoints.end());
for(MapPoint* pMPi : tmp_mspMapPoints2)
{
if(!pMPi || pMPi->isBad())
continue;
mvpBackupMapPoints.push_back(pMPi);
pMPi->PreSave(mspKeyFrames,mspMapPoints);
}
// Backup of KeyFrames
mvpBackupKeyFrames.clear();
for(KeyFrame* pKFi : mspKeyFrames)
{
if(!pKFi || pKFi->isBad())
continue;
mvpBackupKeyFrames.push_back(pKFi);
pKFi->PreSave(mspKeyFrames,mspMapPoints, spCams);
}
mnBackupKFinitialID = -1;
if(mpKFinitial)
{
mnBackupKFinitialID = mpKFinitial->mnId;
}
mnBackupKFlowerID = -1;
if(mpKFlowerID)
{
mnBackupKFlowerID = mpKFlowerID->mnId;
}
} and void MapPoint::PreSave(set<KeyFrame*>& spKF,set<MapPoint*>& spMP)
{
mBackupReplacedId = -1;
if(mpReplaced && spMP.find(mpReplaced) != spMP.end())
mBackupReplacedId = mpReplaced->mnId;
mBackupObservationsId1.clear();
mBackupObservationsId2.clear();
// Save the id and position in each KF who view it
std::map<KeyFrame*,std::tuple<int,int> > tmp_mObservations;
tmp_mObservations.insert(mObservations.begin(), mObservations.end());
for(std::map<KeyFrame*,std::tuple<int,int> >::const_iterator it = tmp_mObservations.begin(), end = tmp_mObservations.end(); it != end; ++it)
{
KeyFrame* pKFi = it->first;
if(spKF.find(pKFi) != spKF.end())
{
mBackupObservationsId1[it->first->mnId] = get<0>(it->second);
mBackupObservationsId2[it->first->mnId] = get<1>(it->second);
}
else
{
EraseObservation(pKFi);
}
}
// Save the id of the reference KF
if(spKF.find(mpRefKF) != spKF.end())
{
mBackupRefKFId = mpRefKF->mnId;
}
} |
When I Load the bin File, it shows the problem of std::bad_alloc. How can I solve it? I find that the problem is boost::archive::binary_iarchive ia(ifs); |
maybe the bin file is genarated before? Before u reloaded it,u changed some class Member variables, it's may causing the error. Or u didn't load the map file in the same order of saving, like u save it in order of atlas, map, and keyframedatebase, so when u load it like atlas, map, and keyframedatebase. |
@tungtungyan I can save the map, but there is a segmentation error when loading the map |
I met similar problem and tried all the method above, but it stil not work. Then I try to call System::Shutdown() manually, it works though i don't konw why ...
` |
Hello, saving the map works well (after very slight changes), however loading the map freezes the program, (pangolin freezes on startup and nothing works) no error is printed out. what do you recommend or suggest ? |
A lot of people are having problems with saving and loading the map, I was too getting segmentation faults while saving/loading map. I believe that the issue with I ended up replacing this line with string These changes reduced the number of seg faults I was getting but, it didn't remove completely. I also observed that when I was using Pangolin to see the GUI, while exiting I am seeing seg faults while the GUI is closing. Running orbslam3 without GUI also reduced the number of seg faults. doing all this hasn't removed all the seg faults i am facing but reduced it by a lot. |
Thank you guys for the updated version ! On the GUI I could not figure out how to Save/Load a map. Do we have a separate flag for that or we need to use the GUI
The text was updated successfully, but these errors were encountered: