ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi Rajat, I had the same problem running vslam_system on monocular cameras. I've been searching in the code, and I think that the error is in the function calcNodeErr from the file planarSFM.cpp:

inline double calcNodeErr(sba::Proj& prj, const sba::Node &nd, const sba::Point &pt)
{
  Eigen::Vector3d p1 = nd.w2i * pt;
  prj.err = p1.head(2)/p1(2);
  if (p1(2) <= 0.0)
  {
    prj.err = Vector3d(0.0,0.0,0.0);
    return 0.0;
  }
  //    printf("Projection: %f %f, gt: %f %f, ", prj.err(0), prj.err(1), prj.kp(0), prj.kp(1));
  prj.err -= prj.kp;
  //  printf("dist: %f\n", prj.err.squaredNorm());
  return prj.err.squaredNorm();
}

The second assignment:

prj.err = p1.head(2)/p1(2);

was causing problems. Modify the code with something like this and it will work:

inline double calcNodeErr(sba::Proj& prj, const sba::Node &nd, const sba::Point &pt)
{
  Eigen::Vector3d p1 = nd.w2i * pt;
  //prj.err = p1.head(2)/p1(2); //<--That's the problem
  if (p1(2) <= 0.0)
  {
    prj.err = Vector3d(0.0,0.0,0.0);
    return 0.0;
  }
  //SOLUTION:
  else
     prj.err = Vector3d(p1(0)/p1(2),p1(1)/p1(2),0.0); //this seems to work

  //    printf("Projection: %f %f, gt: %f %f, ", prj.err(0), prj.err(1), prj.kp(0), prj.kp(1));
  prj.err -= prj.kp;
  //  printf("dist: %f\n", prj.err.squaredNorm());
  return prj.err.squaredNorm();
}

I have solved this problem, but the entire code isn't still working. I'm having other problems like:

-The SFM is very slow, it expends a lot of time calulcating the SFM. I think that the problem is the RANSAC algorithm, that needs 10000 iterations to be processed. Somebody have the same problem?

-In every image matching, the result is a bad image match, I think this is caused why the vo finds 0 inliers. I don't know how to solve this. Somebody have any idea?

Thanks