Thursday, March 20, 2014

Differentiation of norm


Suppose f:RmRn. Decompose into f=(f1,,fn). Each fi is a real-valued function, i.e.fi:RmR. Then
g(X)=f(X)2=i=1nfi(X)2.
Therefore,
g(X)=12(i=1nfi(X)2)12(i=1n2fi(X)fi(X))=ni=1fi(X)fi(X)f(X)2.
This matches your answer.

If you want to write in terms of the Jacobian matrix of f instead of components fi, you can:



g(X)=Jf(X)Tf(X)f(X)2.

Wednesday, March 5, 2014

An Alternative to the Mahalanobis distance for determining optimal correspondences in data association

It was a nice experience to go through the work of Jose-Luis Blanco et al. titled "An Alternative to the Mahalanobis distance for determining optimal correspondences in data association".

They propose a new distance metric that can replace the state-of-the-art Mahalanobis distance to determine optimal correspondences. They have specifically proposed this for the data association problem in SLAM (Simultaneous Localization and Mapping). They clearly show how this new metric called as Matching Likelihood (ML) is a more generalized metric and the Squared Mahalanobis Distance (SMD) turns out to be a part of it.

Theoretically and experimentally they validate that ML always gives better correspondences than SMD.

The paper can be downloaded from this link
http://ingmec.ual.es/~jlblanco/papers/blanco2012amd.pdf

Thursday, February 27, 2014

accessing points in Point clouds with iteration over locations

source: taken from PCL answers

It is very similar to what you would do for an image or a matrix, and it 
is explained all over the tutorials.

Say you have a cloud pcl::Cloud m_cloud; that has been 
populated.
then you can access your points through m_cloud[i] where i is the linera 
index m_cloud.width * row + col or m_cloud (row, col).

So basically pcl::PointXYZ p = cloud[0] works and p = cloud (0,0) works 
as well.

Please read the tutorials or the API documentation, we put many efforts 
on them.
--
Nizar

Wednesday, February 26, 2014

Kdtree headers in PCL

Error

  /usr/bin/ld: skipping incompatible /usr/lib/Lib/libOpenNI.so when searching for -lOpenNI
  CMakeFiles/plane_extraction.dir/src/plane_extraction.o:(.rodata._ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE[vtable for pcl::KdTreeFLANN >]+0x18): undefined reference to `pcl::KdTreeFLANN >::nearestKSearch(pcl::PointXYZ const&, int, std::vector >&, std::vector >&)'
  CMakeFiles/plane_extraction.dir/src/plane_extraction.o:(.rodata._ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE[vtable for pcl::KdTreeFLANN >]+0x24): undefined reference to `pcl::KdTreeFLANN >::radiusSearch(pcl::PointXYZ const&, double, std::vector >&, std::vector >&, int) const'
  collect2: ld returned 1 exit status


Solution

Make sure you added these header files

Tuesday, February 18, 2014

convert Matrix4f to Affine transformation in Eigen

source http://answers.ros.org/question/37609/counterpart-to-pcl_rostransformasmatrix/



Counterpart to pcl_ros::transformAsMatrix ?

asked Jul 2 '12
this post is marked as community wiki
This post is a wiki. Anyone with karma >75 is welcome to improve it.
jodafo gravatar image
Hi,
I understand pcl_ros::transformAsMatrix(const tf::Transform& bt, Eigen::Matrix4f &out_mat) can be used to convert a tf::transform to a 4x4 matrix describing the same transformation.
I am now looking for a method that does the same thing backwards, converting a 4x4 matrix to a tf::transform.
Is such a method already implemented somewhere?
Thanks
EDIT: Solution that works for me, thanks to Eric:
  Eigen::Matrix4f mf; //The matrix I want to convert
  Eigen::Matrix4d md(mf.cast());
  Eigen::Affine3d affine(md);
  tf::Transform transform;
  tf::TransformEigenToTF(affine, transform);
retag flag offensive close delete

Comments

1
A small info which might be helpful for others. For ROS hydro, tf::transformEigenToTF must be used.
balakumar-s (Dec 1 '13)

1 answer


2
answered Jul 2 '12
Eric Perko gravatar image
You should look at the tf_conversions package, specifically thetf::TransformEigenToTF function.
You would have to make an Eigen::Affine3d from your Eigen::Matrix4f. See the Eigen Geometry Module Tutorial (and linked docs for each class) for information on how to go about that. I expect it involves a conversion from Matrix4f to Matrix4d and then passing that to the Affine3d constructor, but I don't know the exact function calls and syntax required off the top of my head.
flag offensive delete link

Comments

Works, thank you.
jodafo (Jul 2 '12)

Thursday, February 13, 2014

Tuesday, February 11, 2014

Errors


the errors that I get while compiling GTSAM 2.3.1 on the ubuntu 12.04

/home/sai/workspace/gtsam-2.3.1/examples/SolverComparer.cpp: In function ‘void runPerturb()’:
/home/sai/workspace/gtsam-2.3.1/examples/SolverComparer.cpp:487:3: error: ‘mt19937’ is not a member of ‘boost::random’
/home/sai/workspace/gtsam-2.3.1/examples/SolverComparer.cpp:487:3: note: suggested alternative:
/usr/include/boost/random/mersenne_twister.hpp:361:47: note:   ‘boost::mt19937’
/home/sai/workspace/gtsam-2.3.1/examples/SolverComparer.cpp:487:26: error: expected ‘;’ before ‘rng’
/home/sai/workspace/gtsam-2.3.1/examples/SolverComparer.cpp:488:3: error: ‘normal_distribution’ is not a member of ‘boost::random’
/home/sai/workspace/gtsam-2.3.1/examples/SolverComparer.cpp:488:3: note: suggested alternative:
/usr/include/boost/random/normal_distribution.hpp:37:7: note:   ‘boost::normal_distribution’
/home/sai/workspace/gtsam-2.3.1/examples/SolverComparer.cpp:488:38: error: expected primary-expression before ‘double’
/home/sai/workspace/gtsam-2.3.1/examples/SolverComparer.cpp:488:38: error: expected ‘;’ before ‘double’
/home/sai/workspace/gtsam-2.3.1/examples/SolverComparer.cpp:497:26: error: ‘rng’ was not declared in this scope
/home/sai/workspace/gtsam-2.3.1/examples/SolverComparer.cpp:497:29: error: ‘normal’ was not declared in this scope
make[2]: *** [examples/CMakeFiles/SolverComparer.dir/SolverComparer.cpp.o] Error 1
make[1]: *** [examples/CMakeFiles/SolverComparer.dir/all] Error 2
make: *** [all] Error 2


Solution


The error is solved by changing the lines 487 and 488 from examples/SolverComparer.cpp

  boost::random::mt19937 rng;
  boost::random::normal_distribution normal(0.0, perturbationNoise);

to

  boost::mt19937 rng;
  boost::normal_distribution normal(0.0, perturbationNoise);

Thanks.

adding / Linking GTSAM with ROS

After downloading the gtsam from their website and successfully compiling it.

I downloaded gtsam-2.3.1 to /home/sai/workspace/

Then add these lines in the CMakeLists.txt

include_directories(/home/sai/workspace/gtsam-2.3.1)
include_directories(/home/sai/workspace/gtsam-2.3.1/build)
include_directories(/home/sai/workspace/gtsam-2.3.1/build/gtsam)
link_directories(/home/sai/workspace/gtsam-2.3.1/build)
link_directories(/home/sai/workspace/gtsam-2.3.1/build/gtsam)


rosbuild_add_executable(OdometryExample src/OdometryExample.cpp)
target_link_libraries(OdometryExample gtsam)


This shows an example that runs as ros node


Cya