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)