Skip to content

Commit

Permalink
Tracker now accepts an initial_guess
Browse files Browse the repository at this point in the history
  • Loading branch information
mtlazaro committed Aug 4, 2015
1 parent b847c50 commit a6999ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/tsm_core/tracker.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#include <cstdio>
#include <fstream>

#include "tracker.h"

namespace tsm {
using namespace std;

inline double tv2sec(struct timeval& tv) {
return (double) tv.tv_sec + 1e-6 * (double) tv.tv_usec;
}
Expand All @@ -27,7 +32,7 @@ namespace tsm {
_correspondence_finder = 0;
_inlier_distance = 0.1;
_min_correspondences_ratio = 0.5;
_local_map_clipping_range = 10;
_local_map_clipping_range = 5;
_clip_translation_threshold = 5;
}

Expand All @@ -42,7 +47,7 @@ namespace tsm {
}


void Tracker::update(Cloud2D* cloud_) {
void Tracker::update(Cloud2D* cloud_, const Eigen::Isometry2f& initial_guess) {
if (cloud_)
setCurrent(cloud_);
double init = getTime();
Expand All @@ -65,10 +70,9 @@ namespace tsm {
throw std::runtime_error("Cannot track without a projector and a solver");
}

Eigen::Isometry2f global_t_inverse = _global_t.inverse();
_solver->setReference(_reference);
_solver->setCurrent(_current);
_solver->setT(Eigen::Isometry2f::Identity());
_solver->setT(initial_guess);
_correspondence_finder.init();
_solver->setReferencePointsHint(_correspondence_finder.indicesReference());

Expand Down Expand Up @@ -104,6 +108,7 @@ namespace tsm {
++outliers;
}
}

float correspondences_ratio = (float)num_correspondences/(float)_current->size();
if (correspondences_ratio < _min_correspondences_ratio) {
if(_current && _current != _reference) {
Expand Down Expand Up @@ -132,7 +137,6 @@ namespace tsm {
//_reference->voxelize(*_reference, 2);
_reference->transformInPlace(_solver->T().inverse());


if (_current && _reference != _current) {
delete _current;
_current = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/tsm_core/tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace tsm {
public:
Tracker();
virtual ~Tracker();
void update(Cloud2D* cloud=0);
void update(Cloud2D* cloud=0, const Eigen::Isometry2f& initial_guess=Eigen::Isometry2f::Identity());
inline void reset();

// setter & getter
Expand Down

0 comments on commit a6999ba

Please sign in to comment.