Friday, October 24, 2014

Linking Error: undefined reference to symbol 'vtkCellArray::New()' when using pclVisualizer

While compiling the Correspondence_grouping code from pcl (http://www.pointclouds.org/documentation/tutorials/correspondence_grouping.php ) in my ROS Hydro workspace, I got following linking error:

Linking error:
 Linking CXX executable /home/swagatika/catkin_ws/devel/lib/my_pcl_tutorial/correspondence_grouping
/usr/bin/ld: CMakeFiles/correspondence_grouping.dir/src/correspondence_grouping.cpp.o: undefined reference to symbol 'vtkCellArray::New()'
/usr/bin/ld: note: 'vtkCellArray::New()' is defined in DSO /usr/lib/libvtkFiltering.so.5.8 so try adding it to the linker command line
/usr/lib/libvtkFiltering.so.5.8: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [/home/swagatika/catkin_ws/devel/lib/my_pcl_tutorial/correspondence_grouping] Error 1
make[1]: *** [my_pcl_tutorial/CMakeFiles/correspondence_grouping.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed

Solution:

In  ~/catkin_was/src/my_pcl_tutorial/CMakeLists.txt :

add_executable(correspondence_grouping src/correspondence_grouping.cpp)
target_link_libraries(correspondence_grouping ${catkin_LIBRARIES} ${PCL_LIBRARIES} libvtkCommon.so libvtkFiltering.so )


Ref:

http://www.pointclouds.org/documentation/tutorials/correspondence_grouping.php
http://answers.ros.org/question/37096/error-when-using-pclvisualizer/

Wednesday, October 22, 2014

Openni2 error: No matching device found.... waiting for devices.

I use openni2 with ROS with the ASUS Xtion Pro live (new model with rectangular less instead of the oval one) for capturing data.

However, suddenly openni2_launch stopped working.

$roslaunch openni2_launch openni2.launch

kept giving the following error:

Warning: USB events thread - failed to set priority. This might cause loss of data...
[ INFO] [1414001657.842030853]: No matching device found.... waiting for devices. Reason: openni2_wrapper::OpenNI2Device::OpenNI2Device(const string&) @ /tmp/buildd/ros-hydro-openni2-camera-0.1.3-0precise-20140921-1219/src/openni2_device.cpp @ 74 : Initialize failed
    Could not open "1d27/0601@3/3": USB transfer timeout!

I found solutions for openni for the same problem, but not for openni2.

Although I could not figure out the exact reason for this sudden change in behaviour, trying to re-install the ros-hydro-openni drivers helped to resolve this issue (Thanks to Andreas :) ).

So if you get the same problem, try doing this:

$ sudo apt-get remove ros-hydro-openni2-*

$sudo apt-get install ros-hydro-openni2-camera

$sudo apt-get install ros-hydro-openni2-launch

Monday, October 20, 2014

RGBDSLAM quick sources

Assembler messages: Error: no such instruction: `vfmadd312ss (%r15),%xmm0,%xmm1'

I got the following errors while building RGBDSLAMv2 in ROS in my ubuntu 12.04 system. 

[ 62%] Building CXX object rgbdslam_v2-hydro/CMakeFiles/rgbdslam.dir/src/qt_gui.o
[ 64%] Building CXX object rgbdslam_v2-hydro/CMakeFiles/rgbdslam.dir/src/node.o
[ 66%] Building CXX object rgbdslam_v2-hydro/CMakeFiles/rgbdslam.dir/src/glviewer.o
/tmp/ccgvJzxG.s: Assembler messages:
/tmp/ccgvJzxG.s:11194: Error: no such instruction: `vfmadd312ss (%r15),%xmm0,%xmm1'
/tmp/ccgvJzxG.s:12560: Error: no such instruction: `vfmadd312ss (%r15),%xmm0,%xmm1'
make[2]: *** [rgbdslam_v2-hydro/CMakeFiles/rgbdslam.dir/src/moc_graph_manager.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/tmp/cct3JxmG.s: Assembler messages:
/tmp/cct3JxmG.s:10798: Error: no such instruction: `vfmadd312ss (%r15),%xmm0,%xmm1'
/tmp/cct3JxmG.s:12164: Error: no such instruction: `vfmadd312ss (%r15),%xmm0,%xmm1'
make[2]: *** [rgbdslam_v2-hydro/CMakeFiles/rgbdslam.dir/src/moc_openni_listener.o] Error 1
Linking CXX executable /home/swagatika/catkin_ws/devel/lib/my_pcl_tutorial/example
[ 66%] Built target example
/tmp/ccELf8iw.s: Assembler messages:
/tmp/ccELf8iw.s:16630: Error: no such instruction: `vfmadd312ss 88(%rsp),%xmm1,%xmm2'
/tmp/ccELf8iw.s:16640: Error: no such instruction: `vfmadd312ss 96(%rsp),%xmm3,%xmm1'
/tmp/ccELf8iw.s:16641: Error: no such instruction: `vfmadd312ss 100(%rsp),%xmm3,%xmm0'
make[2]: *** [rgbdslam_v2-hydro/CMakeFiles/rgbdslam.dir/src/glviewer.o] Error 1
/tmp/ccslUlsc.s: Assembler messages:
/tmp/ccslUlsc.s:15733: Error: no such instruction: `vfmadd312ss (%r15),%xmm0,%xmm1'
/tmp/ccslUlsc.s:17099: Error: no such instruction: `vfmadd312ss (%r15),%xmm0,%xmm1'
make[2]: *** [rgbdslam_v2-hydro/CMakeFiles/rgbdslam.dir/src/main.o] Error 1
/tmp/ccAmx5la.s: Assembler messages:
/tmp/ccAmx5la.s:439309: Error: no such instruction: `vfmadd312ss (%r15),%xmm0,%xmm1'
/tmp/ccAmx5la.s:440675: Error: no such instruction: `vfmadd312ss (%r15),%xmm0,%xmm1'
make[2]: *** [rgbdslam_v2-hydro/CMakeFiles/rgbdslam.dir/src/openni_listener.o] Error 1
make[1]: *** [rgbdslam_v2-hydro/CMakeFiles/rgbdslam.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed



$ gcc -march=native -Q --help=target | grep march
  -march=                             corei7-avx

Solution:

In /home/swagatika/catkin_ws/src/rgbdslam_v2-hydro/CMakeLists.txt,

You can add -march=native -mno-avx This worked for me.
In my CMakeLists.txt, I added the above to the CMAKE_CXX_FLAGS :
SET(CMAKE_CXX_FLAGS "-ggdb -O3 -fPIC -std=c++0x -march=native -mno-avx")
 
Ref:

http://stackoverflow.com/questions/17126593/compile-errors-with-assembler-messages

http://stackoverflow.com/questions/10327939/erroring-on-no-such-instruction-while-assembling-project-on-mac-os-x-lion

Tuesday, October 7, 2014

Grab Pointclouds and save as pcd files using ROS and Openni

1) Install ROS Hydro Openni2 packages:

$sudo apt-get install ros-hydro-openni2-camera ros-hydro-openni2-launch

2) Run ROS

$roscore

3) Launch openni

$roslaunch openni2_launch openni2.launch

4) Launch RViz

$rosrun rviz rviz

5) Do settings in RViz to receive data from Kinect

6) Back in terminal, use the following command to save the point clouds


$rosrun pcl_ros pointcloud_to_pcd input:=<your target topic name>
 
For ex:
$ rosrun pcl_ros pointcloud_to_pcd input:=/camera/depth_registered/points
The output is :

[ INFO] [1412698428.630599815]: Listening for incoming data on topic /camera/depth_registered/points
[ INFO] [1412698428.870419685]: Received 307200 data points in frame /camera_rgb_optical_frame with the following fields: x y z rgb
[ INFO] [1412698428.870483694]: Data saved to 1412698428747359.pcd
[ INFO] [1412698429.421970793]: Received 307200 data points in frame /camera_rgb_optical_frame with the following fields: x y z rgb
[ INFO] [1412698429.422065179]: Data saved to 1412698429281241.pcd
[ INFO] [1412698429.979569838]: Received 307200 data points in frame /camera_rgb_optical_frame with the following fields: x y z rgb
[ INFO] [1412698429.979637397]: Data saved to 1412698429848510.pcd
[ INFO] [1412698430.495591052]: Received 307200 data points in frame /camera_rgb_optical_frame with the following fields: x y z rgb
[ INFO] [1412698430.495632948]: Data saved to 1412698430415787.pcd
[ INFO] [1412698430.974854796]: Received 307200 data points in frame /camera_rgb_optical_frame with the following fields: x y z rgb
[ INFO] [1412698430.974940083]: Data saved to 1412698430882933.pcd
 
(Ref: http://answers.ros.org/question/47345/kinect-point-cloud-to-pcd-files/ )
This will keep dumping the pointcloud files until you stop the process (ctrl + c).


Quick PCL commands to capture data using Kinect

$ pcl_openni_viewer
 press 'r' to visualize the point cloud. Pointcloud appears inverted manner. have to use mouse to see in correct orientation.

you can see 2 windows (PCL OpenNI cloud, PCL OpenNI Image)

$ pcl_openni_save_image  (saves depth and RGB image in .tiff format... You have to stop it if you want to save only 1 frame.)


View the depth image in octave:

$octave
octave:1> imshow('1_1_depth.tiff' , [])

$ pcl_openni_grabber_example
Warning: USB events thread - failed to set priority. This might cause loss of data...
<Esc>, 'q', 'Q': quit the program
' ': pause
's': save


$ pcl_viewer pcd_file.pcd
(press r to view, 5 to see color)

Friday, September 26, 2014

PCL: pointcloud transformation




// transform the model by the transformation value
  Eigen::Matrix4f txform;
 

 //get the txformation matrix (discussed below)

 pcl::transformPointCloud (*cloud_3dmodel, *txformed_model, txform );


ICP can be used to estimate the transform :

Eigen::Matrix4f txform;

 pcl::IterativeClosestPoint<pcl::PointXYZRGB, pcl::PointXYZRGB> icp;
 icp.setInputCloud(cloud_3dmodel);
 icp.setInputTarget(cloud_cluster);
 pcl::PointCloud<pcl::PointXYZRGB> Final;
 icp.align(Final);
 std::cout << "ICP has converged:" << icp.hasConverged() << " score: " <<    icp.getFitnessScore() << std::endl;

txform = icp.getFinalTransformation();

Refer:
http://stc0.wordpress.com/2013/03/22/equivalent-ways-to-register-two-point-clouds-with-pcl/
http://pointclouds.org/documentation/tutorials/iterative_closest_point.php 
http://robotica.unileon.es/mediawiki/index.php/PCL/OpenNI_tutorial_3:_Cloud_processing_%28advanced%29

Eigen: block access to matrices

  
 Eigen library: matrix block operation: 

 http://eigen.tuxfamily.org/dox-devel/group__TutorialBlockOperations.html


 //Code snippet to define a 4x4 transformation matrix:


  Eigen::Matrix4f txform;

  .........

  // Get Rotation Matrix and translation vector: T = [R | t]
  Eigen::Matrix3f rotation = txform.block<3,3>(0, 0);
  Eigen::Vector3f translation = txform.block<3,1>(0, 3);
 

  //Print he individual values
    printf ("\n");
    printf ("            | %6.3f %6.3f %6.3f | \n", rotation (0,0), rotation (0,1), rotation (0,2));
    printf ("        R = | %6.3f %6.3f %6.3f | \n", rotation (1,0), rotation (1,1), rotation (1,2));
    printf ("            | %6.3f %6.3f %6.3f | \n", rotation (2,0), rotation (2,1), rotation (2,2));
    printf ("\n");
    printf ("        t = < %0.3f, %0.3f, %0.3f >\n", translation (0), translation (1), translation (2));


   


Saturday, September 20, 2014

A quick python tutorial

Here is the link to a quick python tutorial for beginners:

http://www.ccs.neu.edu/home/rplatt/cs5100_2014/pa0/hw_asst0.html

Hope it helps for people who want to begin with their work in python!

Sunday, May 4, 2014

How to write Unicode text using LaTeX

Here is a ppt I made with my lab-mate Praveen Krishnan, where I have compiled how to write in LaTeX documents using different languages. I have compiled it from various sources ... I hope it is useful to you all...

http://researchweb.iiit.ac.in/~swagatika.panda/Documents/UnicodeText_Latex_Tutorial.pdf
 
References:



  • Devanagari for TEXVersion 1.2, User Manual

Split a PDF to many PDFs

Here is the link to Linux Commando's blogpost on using pdftk  to split a pdf.

http://linuxcommando.blogspot.in/2013/02/splitting-up-is-easy-for-pdf-file.html

Monday, March 3, 2014

Take screencast and ogv to Avi conversion in Ubuntu

For recording your screen, where we can demonstrate some videos or some functions, RecordMydesktop is a nice option in Ubuntu. It can be downloaded using Ubuntu Software Center. It is pretty easy to use too.

Here is the link for RecordMyDesktop:

https://apps.ubuntu.com/cat/applications/gtk-recordmydesktop/

However, this tool generates the video in ".ogv" format. If we wish to convert it into a commonly used format such as ".avi", we can use following commad:

$ mencoder input.ogv -ovc lavc -oac mp3lame -o output.avi

Courtesy:

http://www.cyberciti.biz/faq/linux-unix-bsd-appleosx-convert-ogv-to-avi-video-audio/

Saturday, March 1, 2014

Show that A^2 = 0 is possible but A’A = 0 is not possible (unless A= zero matrix).

Found a solution in Stackexchage and quoting it here:

http://math.stackexchange.com/questions/435880/if-aat-is-the-zero-matrix-then-a-is-the-zero-matrix

if we put A=(aij)1i,jn , then At=(bij) , with bij=aji , so by definition:
AAt=(k=1naikbkj)=(k=1naikajk)

If you now look at the main diagonal's general entry of the above, you get
k=1naikaik=k=1na2ik

So if AAt=0 then the above diagonal's entries are zero, but a sum of squared real numbers is zero iff each number is zero, so...