Programming with Karto
ID #1074
We've noticed that when we save the .kxd files, the corrected pose fields for the laser scans are full of zeros. Is there a way that we can fill these fields with the corrected poses from Karto's mapper before writing the file to disk?
You have two options:
- You can save the file as a state file (which is basically a txt copy of the mapper state, which you can reload at anytime time). The tutorial5.cpp shows you the way to use the function:
WriteState(); The state file is also an XML format.
- You can write your own format, by iterating over the mapper graph (this is more advanced), the function to use is GetAllProcessedScans().
kt::LocalizedRangeScanVector lrfVector = pMapper->GetAllProcessedScan
forEach(kt::LocalizedRangeScanVector, &lrfVector) {kt::LocalizedRangeScan* pScan = *iter;
std::cout << pScan->Time().GetTicks()<< "," <<kt::Pose2(pScan->CorrectedPose()).X() << "," << kt::Pose2(pScan->CorrectedPose()).Y() << "," << kt::Pose2(pScan->CorrectedPose()).Heading() << std::endl;
}
Tags: -
Related entries: -
Last update: 2010-02-03 14:00
Author: Regis Vincent
Revision: 1.9
You cannot comment on this entry