Tuesday, December 30, 2014

Updating CMake

http://cameo54321.blogspot.sg/2014/02/installing-cmake-288-or-higher-on.html

Wednesday, December 10, 2014

UBUNTU SOFTWARE CENTER NOT RESPONDING...


source : http://glamanate.com/2013/02/12/ubuntu-software-center-not-responding

Open up terminal and paste:
rm ~/.cache/software-center -R
Then...
unity --reset &



Sunday, November 23, 2014

Square of an Integer N

The square of an integer N = the square of (N-1) integer + N'th Odd Number.

For Example :
4 = 1 + 3
9 = 4 + 5
16 = 9 + 7
25 = 16 + 9
36 = 25 + 11
49 = 36 + 13
64 = 49 + 15

Look at the third column, they are all odd numbers, while the second column is the square of the previous integer. :) 

https://plus.google.com/107229543234337812645/posts/VbY5aQHeRLs

Thursday, November 6, 2014

How to build and install Boost Libraries










One can use

  •  ./bootstrap.sh --prefix=/usr/include

for the installation path.


Cheers

Monday, September 15, 2014

Call any subscriber to a topic only ONCE in ROS

In short:


sensor_msgs::PointCloud2ConstPtr msg = ros::topic::waitForMessage("/camera/depth/points");

cloud_cb(msg);





Tuesday, August 26, 2014

finding eigen values of a covariance matrix using Eigen library

Eigen::Vector4f xyz_centroid;
            
Eigen::Matrix3f covariance_matrix;
            
compute3DCentroid (voxel_cloud, pointIdxRadiusSearch, xyz_centroid);
            
pcl17::computeCovarianceMatrix (voxel_cloud, pointIdxRadiusSearch, xyz_centroid, covariance_matrix);
                
                
Eigen::SelfAdjointEigenSolver<Eigen::Matrix3f> eigen_solver(covariance_matrix);
                
//std::cout << "From Eigen Solver :  \n " << eigen_solver.eigenvalues() <<  std::endl;
                
Eigen::Vector3f temp1;

                
temp1 = eigen_solver.eigenvalues();

QT is by far the best IDE for C/C++

QT (pronounced as 'cute') is amazingly cute IDE for C/C++ :)

Wednesday, August 13, 2014

astyle is amazing

If you want your program to be indented automatically in a systematic/coherent way

Then here you go :

check this out
http://astyle.sourceforge.net/

Convert Point Cloud to Range Image to OpenCV Mat


source :
http://www.pcl-users.org/Convert-point-cloud-to-range-image-td4035137.html

Good tutorial

http://pointclouds.org/documentation/tutorials/project_inliers.php

Question:

HI,everyone, I'm trying to convert a 3d point cloud to a opencv mat. So here is my plan: 

1.convert the point cloud to a range image 

2.convert the range image to mat image 
Yet, I'm facing some problems, when I generate the range image by the example code with a terrain point cloud, it only gives me a very small window and nothing show up (other pcd file works). Is it because the pcd file too large? 

And is there any other way to convert the point cloud to opencv mat. Now I'm only caring about x,y data. So it's like a projection of point cloud and convert to a mat image. 


Thanks so much for your help~




Solution


If that is what you need it is exactly what you can do with the project 
inliers filter. 
http://docs.pointclouds.org/trunk/classpcl_1_1_project_inliers.html

just project the point cloud on the xy-Plane there is a tutorial for that: 
http://pointclouds.org/documentation/tutorials/project_inliers.php

after that you can the bounds of the plane by using pcl::getMinMax3D. 
Now you can define a top left and a bottom right corner (defining a rect) and 
compute a scale factor to match your image size. Say you want a 1000x1000px 
Image use 1000 / rect.width for x scale factor and 1000 / rect.height as y 
scale factor after that you can iterate over all points and set the 
corresponding pixels in the mat. cv::Mat::at(pt.x*scaleX, pt.y * scaleY) = 
pt.z After that you might have to to some interpolation to fill in the missing 
pixels and you have your opencv image. 

Saturday, July 26, 2014

When to Use 'A,' 'An,' or 'The'

When to Use 'A,' 'An,' or 'The'

There are several exceptions, or more complicated situations than the above chart covers. Below we have laid out some of the general and specific rules about using A, AN, and THE.
Remember, in order to use A, AN, and THE properly, you must know whether or not a noun is a Count or Non-Count Noun. (A count noun is the name of something that can be counted: one book, two books, three books. A non-count noun is the name of something that cannot be counted: milk, flour, freedom, justice).

Use "a" or "an"Use "the"Don't Use "a," "an," or "the"
General RulesUse "a" or "an" with a singular count noun when you mean "one of many," "any," "in general."
  • Bob is a student (one of many students).
  • I like a good movie (one of many movies).
Use "the" with any noun when the meaning is specific; for example, when the noun names the only one (or one) of a kind. 
  • Adam was the first man (the only 'first man').
  • New York is the largest city in the United States (only one city can be 'the largest').
  • We live on the earth (the only Earth we know).
  • Have you heard the news (specific news)?
Don't Use "a," "an," or "the" with a non-count noun when you mean "any," "in general."
  • We believe in love (in general).
  • He gave me information (not specific).
Use "a" or "an" the first time you use a noun in a paragraph.
  • I saw a movie last night.
  • A man ran into the street.
Use "the" the second time you use that same noun in the same paragraph.
  • I saw a movie last night. The movie was entertaining.
  • A man ran into the street. A car hit the man.
Don't Use "a," "an," or "the" with a plural count noun when you mean "some of many things," "any," "in general."
  • Movies are entertaining (some movies; movies in general).
  • She likes men (in general).
For more detailed ....
visit source http://www.gallaudet.edu/tip/english_works/grammar_and_vocabulary/when_to_use_a_an_or_the.html


Wednesday, May 28, 2014

Finding the plane coefficients from three points

This is a discussion on Point Cloud Library...thanks for the answer, Victor lamoine and Anders Glent Buch and Matteo Munaro :)

source: http://www.pcl-users.org/Method-finding-plane-equation-crossing-3-points-tc4034211.html#a4034214


Does PCL provide function for finding plane crossing 3 given points in 3D? 

Method should find plane coefficients A B C D from equation Ax+By+Cz+D=0 and it should save the found coefficients to pcl::ModelCoefficients class. 

Does PCL have such functionality?


If you denote your 3D points p1, p2 and p3, take the cross product of the in-plane vectors (p2 - p1) x (p3 - p1) to get the normal vector, and normalize it. Now you have the A, B and C coefficients already by these three components. To get D, just take the negative dot product between this vector and p1.




void 
threePointsToPlane (const PointT &point_a, 
                            const PointT &point_b, 
                            const PointT &point_c, 
                            const pcl::ModelCoefficients::Ptr plane) 

  // Create Eigen plane through 3 points 
  Eigen::Hyperplane eigen_plane = 
    Eigen::Hyperplane::Through (point_a.getArray3fMap (), 
                                                          point_b.getArray3fMap (), 
                                                          point_c.getArray3fMap ()); 

  plane->values.resize (4); 

  for (int i = 0; i < plane->values.size (); i++) 
    plane->values[i] = eigen_plane.coeffs ()[i]; 
}



// Ground plane estimation:
  Eigen::VectorXf ground_coeffs;
  ground_coeffs.resize(4);
  std::vector<int> clicked_points_indices;
  for (unsigned int i = 0; i < clicked_points_3d->points.size(); i++)
    clicked_points_indices.push_back(i);
  pcl::SampleConsensusModelPlane<PointT> model_plane(clicked_points_3d);
  model_plane.computeModelCoefficients(clicked_points_indices,ground_coeffs);
  std::cout << "Ground plane: " << ground_coeffs(0) << " " << ground_coeffs(1) << " " << ground_coeffs(2) << " " << ground_coeffs(3) << std::endl;

Monday, May 26, 2014

Error and its solution : undefined symbol: _ZN5pcl177PCLBaseINS_8PointXYZEEC2Ev

Error :  undefined symbol: _ZN5pcl177PCLBaseINS_8PointXYZEEC2Ev


While working with ROS and PCL , I encountered this error.
 undefined symbol: _ZN5pcl177PCLBaseINS_8PointXYZEEC2Ev


Solution : 


From the CMakeLists.txt, just comment 


find_package(PCL 1.x REQUIRED)

This solved the issue for me....Of course the pcl pcl_ros pcl1x pcl1x_ros are in the manifest.xml


Have a Good daY!

Sunday, May 4, 2014

kindaaa... crazy

You can construct a Transform from an abstract transformation, like this:
Transform t(AngleAxis(angle,axis));

or like this:

Transform t;
t = AngleAxis(angle,axis);

But note that unfortunately, because of how C++ works, you can not do this:
Transform t = AngleAxis(angle,axis);



Explanation: In the C++ language, this would require Transform to have a non-explicit conversion constructor from AngleAxis, but we really don't want to allow implicit casting here.


source : http://eigen.tuxfamily.org/dox-devel/group__TutorialGeometry.html

Tuesday, April 29, 2014

Error



In file included from /usr/include/boost/graph/breadth_first_search.hpp:21:0,
                 from /usr/include/boost/graph/dijkstra_shortest_paths.hpp:21,
                 from /home/sai/workspace/pcl-pcl-1.7.0/registration/include/pcl/registration/boost.h:49,
                 from /home/sai/workspace/pcl-pcl-1.7.0/registration/include/pcl/registration/registration.h:50,
                 from /home/sai/workspace/pcl-pcl-1.7.0/registration/include/pcl/registration/icp.h:47,
                 from /home/sai/pcl_testing/narf_keypoint_extraction/sure_narf_fpfh_matching.cpp:34:
/usr/include/boost/graph/graph_concepts.hpp: In destructor ‘boost::concepts::AdjacencyMatrix::~AdjacencyMatrix()’:
/usr/include/boost/graph/graph_concepts.hpp:368:17: error: missing template arguments before ‘(’ token
/usr/include/boost/graph/graph_concepts.hpp: In member function ‘void boost::concepts::AdjacencyMatrix::const_constraints(const G&)’:
/usr/include/boost/graph/graph_concepts.hpp:372:17: error: missing template arguments before ‘(’ token
make[2]: *** [CMakeFiles/sure_narf_fpfh_matching.dir/sure_narf_fpfh_matching.cpp.o] Error 1
make[1]: *** [CMakeFiles/sure_narf_fpfh_matching.dir/all] Error 2

make: *** [all] Error 2


Solution

Just copy the header file 

#include "pcl/registration/icp.h"


to the beginning of all the header files.

This will solve the issue

Good day!

Friday, April 4, 2014

lse_xsens_mti

Error

process[lse_xsens_mti/xsens-1]: started with pid [9792]
[FATAL] [1396619501.045578081]: MTi -- Unable to connect to the MTi.
[FATAL] [1396619503.209193347]: MTi -- Unable to set the output mode and settings.

If the above error occurs when running the lse_xsens_mti package in ROS

Solution

Go to the launch file and change ttyS0 to ttyUSB0

Monday, March 31, 2014

Best way to update ROS_PACKAGE_PATH

#Assuming you have a package installed called ethzasl_ptam
# Update ROS_PACKAGE_PATH (if necessary)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:`pwd`/ethzasl_ptam

Friday, March 28, 2014

Configuring xsens_driver for XSENS IMU in ROS

Here I employ xsens MTI-G IMU which is orange in colour.

I am working in ROS FUERTE on ubuntu 12.04 using the xsens_driver package that ships in ethzasl_xsens_driver.

I tried to get all the relevant data from IMU namely
orientation
orientation covariance
angular velocity
angular velocity covariance
linear acceleration
linear acceleration covariance

Configuration steps
1. Attach IMU via USB
2. sudo chmod 777 /dev/ttyUSB0
3.  rosrun xsens_driver mtdevice.py --configure --output-mode=coapvs --output-settings=tqMAG

The above command should result in something like this

Configuring mode and settings  Ok

4. roslaunch xsens_driver xsens_driver.launch

5. rostopic echo /imu/data

Then it should display

header:
  seq: 166
  stamp:
    secs: 1396073832
    nsecs: 314651012
  frame_id: /imu
orientation:
  x: -0.00116935407277
  y: -0.0249380189925
  z: 0.306782633066
  w: 0.95145213604
orientation_covariance: [0.017453292519943295, 0.0, 0.0, 0.0, 0.017453292519943295, 0.0, 0.0, 0.0, 0.15707963267948966]
angular_velocity:
  x: 0.00783694628626
  y: -0.0136562986299
  z: 0.00587089639157
angular_velocity_covariance: [0.0004363323129985824, 0.0, 0.0, 0.0, 0.0004363323129985824, 0.0, 0.0, 0.0, 0.0004363323129985824]
linear_acceleration:
  x: 0.347801417112
  y: -0.202733114362
  z: 9.81818389893
linear_acceleration_covariance: [0.0004, 0.0, 0.0, 0.0, 0.0004, 0.0, 0.0, 0.0, 0.0004]
---


Good day!

Thursday, March 27, 2014

XSENS diver from ethzasl_xsens_driver error on ubuntu 12.04

Error


WARN] [WallTime: 1362075228.016104] Cannot find value for parameter: ~device, assigning default: auto

[WARN] [WallTime: 1362075228.017062] Cannot find value for parameter: ~baudrate, assigning default: 0

[ERROR] [WallTime: 1362075228.018932] Fatal: could not find proper MT device.


SOLUTION


One has to give proper permissions to access the port, which can be done by

sudo chmod a+rw /dev/ttyUSB0


Good day!

Wednesday, March 26, 2014

Authentication Required for adding printer in Ubuntu

Solution:

Just trigger the application using

gksudo system-config-printer

and the problem is solved

Sunday, March 23, 2014

Understanding 3D Rigid Body Transformation

A good tutorial on 3D rigid body transformation, Euler angles i.e. roll, pitch and yaw, the rotation matrix can be found in the link below.

Just traverse to before and next sections for better understanding :)

http://planning.cs.uiuc.edu/node102.html

http://www.cs.iastate.edu/~cs577/handouts/homogeneous-transform.pdf

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.