29 #ifndef _scanmatcher_h__ 30 #define _scanmatcher_h__ 32 #include <Eigen/Geometry> 33 #include "../scan/DataPointContainer.h" 34 #include "../util/UtilFunctions.h" 36 #include "../util/DrawInterface.h" 37 #include "../util/HectorDebugInfoInterface.h" 41 template<
typename ConcreteOccGr
idMapUtil>
54 Eigen::Vector3f
matchData(
const Eigen::Vector3f& beginEstimateWorld, ConcreteOccGridMapUtil& gridMapUtil,
const DataContainer& dataContainer, Eigen::Matrix3f& covMatrix,
int maxIterations)
61 Eigen::Vector3f beginEstimateMap(gridMapUtil.getMapCoordsPose(beginEstimateWorld));
63 drawScan(beginEstimateMap, gridMapUtil, dataContainer);
68 if (dataContainer.
getSize() != 0) {
70 Eigen::Vector3f beginEstimateMap(gridMapUtil.getMapCoordsPose(beginEstimateWorld));
72 Eigen::Vector3f estimate(beginEstimateMap);
91 int numIter = maxIterations;
94 for (
int i = 0; i < numIter; ++i) {
101 float invNumIterf = 1.0f/
static_cast<float> (numIter);
114 drawScan(estimate, gridMapUtil, dataContainer);
172 covMatrix = Eigen::Matrix3f::Zero();
186 return gridMapUtil.getWorldCoordsPose(estimate);
189 return beginEstimateWorld;
196 gridMapUtil.getCompleteHessianDerivs(estimate, dataPoints,
H,
dTr);
201 if ((
H(0, 0) != 0.0
f) && (
H(1, 1) != 0.0
f)) {
205 Eigen::Vector3f searchDir (
H.inverse() *
dTr);
209 if (searchDir[2] > 0.2
f) {
211 std::cout <<
"SearchDir angle change too large\n";
212 }
else if (searchDir[2] < -0.2
f) {
213 searchDir[2] = -0.2f;
214 std::cout <<
"SearchDir angle change too large\n";
228 void drawScan(
const Eigen::Vector3f& pose,
const ConcreteOccGridMapUtil& gridMapUtil,
const DataContainer& dataContainer)
232 Eigen::Affine2f transform(gridMapUtil.getTransformForState(pose));
234 int size = dataContainer.
getSize();
235 for (
int i = 0; i < size; ++i) {
236 const Eigen::Vector2f& currPoint (dataContainer.
getVecEntry(i));
void drawScan(const Eigen::Vector3f &pose, const ConcreteOccGridMapUtil &gridMapUtil, const DataContainer &dataContainer)
void updateEstimatedPose(Eigen::Vector3f &estimate, const Eigen::Vector3f &change)
virtual void setColor(double r, double g, double b, double a=1.0)=0
ScanMatcher(DrawInterface *drawInterfaceIn=0, HectorDebugInfoInterface *debugInterfaceIn=0)
virtual void drawPoint(const Eigen::Vector2f &pointWorldFrame)=0
virtual void setScale(double scale)=0
const DataPointType & getVecEntry(int index) const
static float normalize_angle(float angle)
virtual void drawArrow(const Eigen::Vector3f &poseWorld)=0
bool estimateTransformationLogLh(Eigen::Vector3f &estimate, ConcreteOccGridMapUtil &gridMapUtil, const DataContainer &dataPoints)
virtual void addHessianMatrix(const Eigen::Matrix3f &hessian)=0
Eigen::Vector3f matchData(const Eigen::Vector3f &beginEstimateWorld, ConcreteOccGridMapUtil &gridMapUtil, const DataContainer &dataContainer, Eigen::Matrix3f &covMatrix, int maxIterations)
HectorDebugInfoInterface * debugInterface
DrawInterface * drawInterface