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

estimate covariance of a matrix

asked 2015-12-03 00:02:13 -0500

dmngu9 gravatar image

Hi, im implementing regularized particle filter. My particle has coordinate x,y,z. All particles would make up a matrix n by 3 matrix . i wonder is there any existing code to find covariance matrix of a matrix in c++ somewhere in ros . This is easily done by matlab but c++ is too complicated

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-12-03 09:26:03 -0500

I'm unaware of a "ROS" way of doing this, but if you are using C++, I'd recommend using Eigen. It is easily installed and used extensively by many ROS packages. If you're using a ROS Indigo or Jade, you'll need to depend on the cmake_modules package to get catkin to build your code (see these instructions).

If you're using Eigen, there are easy ways to calculate covariance using built-in Eigen matrix functions. For a few examples, see this Stack Overflow post.

edit flag offensive delete link more


thanks so much, the library is good but it is still so slow as the matrix is big, is there anyway to speed it up

dmngu9 gravatar image dmngu9  ( 2015-12-03 18:46:23 -0500 )edit

@dmngu9 so you want to say that it is much slower in Eigen than in Matlab? sounds suspicious

Mehdi. gravatar image Mehdi.  ( 2015-12-04 06:11:51 -0500 )edit

Question Tools

1 follower


Asked: 2015-12-03 00:02:13 -0500

Seen: 624 times

Last updated: Dec 03 '15