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().
Here is some sample code (that might work since it's taken from our new Karto 1.2 release and not the 1.1 you are using)
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

Digg it! Print this record Send to a friend Show this as PDF file
Propose a translation for Propose a translation for
Please rate this entry:

Average rating: 0 out of 5 (0 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry