Monday, December 23, 2013
Friday, December 20, 2013
How to add GICP source code into CMakeLists.txt and use it in ROS
The source code for GICP can be found at
http://www.robots.ox.ac.uk/~avsegal/generalized_icp.html
Part of CMakeLists.txt
The gicp folder downloaded from the website is at /home/sai/workspace/
Add these lines in CMakeLists.txt
include_directories(/home/sai/workspace/gicp/ann_1.1.1/include/ANN/)
include_directories(/home/sai/workspace/gicp/)
link_directories(/home/sai/workspace/gicp/)
include_directories(/home/sai/workspace/gicp/ann_1.1.1/lib/)
link_directories(/home/sai/workspace/gicp/ann_1.1.1/lib/)
rosbuild_add_executable(gicp_testing src/gicp_testing.cpp)
target_link_libraries(gicp_testing ${PCL_LIBRARIES} libgicp.a libANN.a -lgsl -lgslcblas)
Add this line in your test file which in my case is gicp_testing.cpp
The original source code is at
http://www.pcl-users.org/file/n4019799/Main.cpp
gicp_testing.cpp file is as follows.
#include "pcl17/io/pcd_io.h"
#include "pcl17/filters/voxel_grid.h"
#include "pcl17/registration/gicp.h"
#include "pcl17/visualization/cloud_viewer.h"
#include "/home/sai/workspace/gicp/gicp.h"
pcl17::PointCloud::Ptr modelCloud(new pcl17::PointCloud);
pcl17::PointCloud::Ptr modelCloudDownsampled(new pcl17::PointCloud);
pcl17::PointCloud::Ptr dataCloud(new pcl17::PointCloud);
pcl17::PointCloud::Ptr dataCloudDownsampled(new pcl17::PointCloud);
pcl17::PointCloud::Ptr transformed(new pcl17::PointCloud);
void viewerOneOff(pcl17::visualization::PCLVisualizer& viewer)
{
viewer.addPointCloud(modelCloudDownsampled, "model");
//viewer.setPointCloudRenderingProperties(pcl17::visualization::PCL_VISUALIZER_COLOR, 255, 0, 0, "model");
viewer.addPointCloud(transformed, "transformed");
//viewer.setPointCloudRenderingProperties(pcl17::visualization::PCL_VISUALIZER_COLOR, 0, 0, 255, "transformed");
}
int main(int argv, char **args)
{
// load files and convert to point type pcl17::PointXYZ
sensor_msgs::PointCloud2 cloudBlob;
pcl17::io::loadPCDFile("temp1.pcd", cloudBlob);
pcl17::fromROSMsg(cloudBlob, *modelCloud);
pcl17::io::loadPCDFile("temp2.pcd", cloudBlob);
pcl17::fromROSMsg(cloudBlob, *dataCloud);
// make dense
std::vector indices;
pcl17::removeNaNFromPointCloud(*modelCloud, *modelCloud, indices);
pcl17::removeNaNFromPointCloud(*dataCloud, *dataCloud, indices);
// downsample clouds
pcl17::VoxelGrid vg;
vg.setInputCloud(modelCloud);
vg.setLeafSize (0.01f, 0.01f, 0.01f);
vg.filter(*modelCloudDownsampled);
vg.setInputCloud(dataCloud);
vg.setLeafSize (0.01f, 0.01f, 0.01f);
vg.filter(*dataCloudDownsampled);
/* Segal-GICP */
dgc::gicp::GICPPointSet ps_in, ps_out;
for(int i=0; ipoints.size(); ++i)
{
dgc::gicp::GICPPoint p;
p.x = dataCloudDownsampled->points[i].x;
p.y = dataCloudDownsampled->points[i].y;
p.z = dataCloudDownsampled->points[i].z;
ps_in.AppendPoint(p);
}
for(int i=0; ipoints.size(); ++i)
{
dgc::gicp::GICPPoint p;
p.x = modelCloudDownsampled->points[i].x;
p.y = modelCloudDownsampled->points[i].y;
p.z = modelCloudDownsampled->points[i].z;
ps_out.AppendPoint(p);
}
dgc_transform_t T_guess, T_delta, T_est;
dgc_transform_identity(T_delta);
dgc_transform_identity(T_guess);
ps_in.BuildKDTree();
ps_out.BuildKDTree();
ps_in.ComputeMatrices();
ps_out.ComputeMatrices();
ps_out.SetDebug(0);
//ps_out.SetMaxIterationInner(8);
ps_out.AlignScan(&ps_in, T_guess, T_delta, 5);
dgc_transform_copy(T_est, T_guess);
dgc_transform_left_multiply(T_est, T_delta);
Eigen::Matrix4f em;
for(int i=0; i<4 i="" p=""> for(int j=0; j<4 j="" p=""> em(i,j) = (float) T_est[i][j];
std::cout << em << std::endl << std::endl;
return 0;
}4>4>
http://www.robots.ox.ac.uk/~avsegal/generalized_icp.html
Part of CMakeLists.txt
The gicp folder downloaded from the website is at /home/sai/workspace/
Add these lines in CMakeLists.txt
include_directories(/home/sai/workspace/gicp/ann_1.1.1/include/ANN/)
include_directories(/home/sai/workspace/gicp/)
link_directories(/home/sai/workspace/gicp/)
include_directories(/home/sai/workspace/gicp/ann_1.1.1/lib/)
link_directories(/home/sai/workspace/gicp/ann_1.1.1/lib/)
rosbuild_add_executable(gicp_testing src/gicp_testing.cpp)
target_link_libraries(gicp_testing ${PCL_LIBRARIES} libgicp.a libANN.a -lgsl -lgslcblas)
Add this line in your test file which in my case is gicp_testing.cpp
The original source code is at
http://www.pcl-users.org/file/n4019799/Main.cpp
gicp_testing.cpp file is as follows.
#include "pcl17/io/pcd_io.h"
#include "pcl17/filters/voxel_grid.h"
#include "pcl17/registration/gicp.h"
#include "pcl17/visualization/cloud_viewer.h"
#include "/home/sai/workspace/gicp/gicp.h"
pcl17::PointCloud
pcl17::PointCloud
pcl17::PointCloud
pcl17::PointCloud
pcl17::PointCloud
void viewerOneOff(pcl17::visualization::PCLVisualizer& viewer)
{
viewer.addPointCloud(modelCloudDownsampled, "model");
//viewer.setPointCloudRenderingProperties(pcl17::visualization::PCL_VISUALIZER_COLOR, 255, 0, 0, "model");
viewer.addPointCloud(transformed, "transformed");
//viewer.setPointCloudRenderingProperties(pcl17::visualization::PCL_VISUALIZER_COLOR, 0, 0, 255, "transformed");
}
int main(int argv, char **args)
{
// load files and convert to point type pcl17::PointXYZ
sensor_msgs::PointCloud2 cloudBlob;
pcl17::io::loadPCDFile("temp1.pcd", cloudBlob);
pcl17::fromROSMsg(cloudBlob, *modelCloud);
pcl17::io::loadPCDFile("temp2.pcd", cloudBlob);
pcl17::fromROSMsg(cloudBlob, *dataCloud);
// make dense
std::vector
pcl17::removeNaNFromPointCloud(*modelCloud, *modelCloud, indices);
pcl17::removeNaNFromPointCloud(*dataCloud, *dataCloud, indices);
// downsample clouds
pcl17::VoxelGrid
vg.setInputCloud(modelCloud);
vg.setLeafSize (0.01f, 0.01f, 0.01f);
vg.filter(*modelCloudDownsampled);
vg.setInputCloud(dataCloud);
vg.setLeafSize (0.01f, 0.01f, 0.01f);
vg.filter(*dataCloudDownsampled);
/* Segal-GICP */
dgc::gicp::GICPPointSet ps_in, ps_out;
for(int i=0; i
{
dgc::gicp::GICPPoint p;
p.x = dataCloudDownsampled->points[i].x;
p.y = dataCloudDownsampled->points[i].y;
p.z = dataCloudDownsampled->points[i].z;
ps_in.AppendPoint(p);
}
for(int i=0; i
{
dgc::gicp::GICPPoint p;
p.x = modelCloudDownsampled->points[i].x;
p.y = modelCloudDownsampled->points[i].y;
p.z = modelCloudDownsampled->points[i].z;
ps_out.AppendPoint(p);
}
dgc_transform_t T_guess, T_delta, T_est;
dgc_transform_identity(T_delta);
dgc_transform_identity(T_guess);
ps_in.BuildKDTree();
ps_out.BuildKDTree();
ps_in.ComputeMatrices();
ps_out.ComputeMatrices();
ps_out.SetDebug(0);
//ps_out.SetMaxIterationInner(8);
ps_out.AlignScan(&ps_in, T_guess, T_delta, 5);
dgc_transform_copy(T_est, T_guess);
dgc_transform_left_multiply(T_est, T_delta);
Eigen::Matrix4f em;
for(int i=0; i<4 i="" p=""> for(int j=0; j<4 j="" p=""> em(i,j) = (float) T_est[i][j];
std::cout << em << std::endl << std::endl;
return 0;
}4>4>
Monday, December 16, 2013
Sunday, December 15, 2013
Friday, December 13, 2013
Boost linking error and its solution in ROS
Error
/usr/bin/ld: note: 'boost::signals::connection::~connection()' is defined in DSO /usr/lib/libboost_signals.so.1.46.1 so try adding it to the linker command line
/usr/lib/libboost_signals.so.1.46.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
Solution
# Put this line before the executable or library in your CMakeLists.txt
rosbuild_add_boost_directories()
# assuming that my_target is your executable
rosbuild_add_executable(my_target my_srcs/my_target.cpp)
# Put this line after the executable or library:
rosbuild_link_boost(my_target signals)
If the above steps does not solve the issue then add
target_link_libraries(my_target libboost_system.so)
source : http://wiki.ros.org/fuerte/Migration
Thursday, December 12, 2013
OMP Error: /usr/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:93: undefined reference to `omp_get_num_threads' ---> Solution to this error
Error:
/usr/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:93: undefined reference to `omp_get_num_threads'
CMakeFiles/ndt_feature_eval.dir/src/ndt_feature_eval.o: In function `void Eigen::internal::parallelize_gemm
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:105: undefined reference to `omp_get_num_threads'
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:145: undefined reference to `GOMP_parallel_start'
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:145: undefined reference to `GOMP_parallel_end'
CMakeFiles/ndt_feature_eval.dir/src/ndt_feature_eval.o: In function `nbThreads':
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:47: undefined reference to `omp_get_max_threads'
collect2: ld returned 1 exit status
make[3]: *** [../bin/ndt_feature_eval] Error 1
make[3]: Leaving directory `/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_feature_reg/build'
make[2]: *** [CMakeFiles/ndt_feature_eval.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
Linking CXX executable ../bin/ndt_feature_reg_node
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `lslgeneric::NDTMatcherD2D
/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_registration/include/impl/ndt_matcher_d2d.hpp:1476: undefined reference to `omp_get_num_threads'
/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_registration/include/impl/ndt_matcher_d2d.hpp:1476: undefined reference to `omp_get_thread_num'
/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_registration/include/impl/ndt_matcher_d2d.hpp:1476: undefined reference to `GOMP_barrier'
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `void Eigen::internal::parallelize_gemm
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:131: undefined reference to `omp_get_num_threads'
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:131: undefined reference to `omp_get_thread_num'
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `lslgeneric::NDTMatcherD2D
/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_registration/include/impl/ndt_matcher_d2d.hpp:1550: undefined reference to `GOMP_parallel_start'
/home/sai/fuerte_workspace/oru-ros-pkg-read-only/perception_oru/ndt_registration/include/impl/ndt_matcher_d2d.hpp:1550: undefined reference to `GOMP_parallel_end'
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `Eigen::internal::general_matrix_matrix_product
/usr/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:92: undefined reference to `omp_get_thread_num'
/usr/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:93: undefined reference to `omp_get_num_threads'
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `void Eigen::internal::parallelize_gemm
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:105: undefined reference to `omp_get_num_threads'
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:145: undefined reference to `GOMP_parallel_start'
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:145: undefined reference to `GOMP_parallel_end'
CMakeFiles/ndt_feature_reg_node.dir/src/ndt_feature_reg_node.o: In function `nbThreads':
/usr/include/eigen3/Eigen/src/Core/products/Parallelizer.h:47: undefined reference to `omp_get_max_threads'
collect2: ld returned 1 exit status
Solution:
Add these lines in your CMakeLists.txt
#check for OpenMP
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
if(MSVC90 OR MSVC10)
if(MSVC90)
set(OPENMP_DLL VCOMP90)
elseif(MSVC10)
set(OPENMP_DLL VCOMP100)
endif(MSVC90)
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DELAYLOAD:${OPENMP_DLL}D.dll")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DELAYLOAD:${OPENMP_DLL}.dll")
endif(MSVC)
else(OPENMP_FOUND)
message (STATUS "OpenMP not found")
endif()
if (MSVC)
Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /O2 ${SSE_FLAGS}")
else (MSVC)
set(CMAKE_CXX_FLAGS "-O3 ${CMAKE_CXX_FLAGS} ${SSE_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g ${SSE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE " ${CMAKE_CXX_FLAGS} -O3 ${SSE_FLAGS}")
endif (MSVC)
Wednesday, December 11, 2013
Thursday, December 5, 2013
pcl17 in ROS . Error " undefined referenced to "
Error
Built target ROSBUILD_gensrv_lisp
Built target ROSBUILD_gensrv_cpp
make[3]: Entering directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
[ 88%] Built target rospack_gensrv
make[3]: Entering directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Entering directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
[ 88%] [ 88%] Built target rosbuild_precompile
Built target rospack_gensrv_all
make[3]: Entering directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Entering directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
Linking CXX executable ../bin/depth_odometry_node
/usr/bin/ld: skipping incompatible /usr/lib/Lib/libOpenNI.so when searching for -lOpenNI
/usr/bin/ld: skipping incompatible /usr/lib/Lib/libOpenNI.so when searching for -lOpenNI
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PCDWriter::resetLockingPermissions(std::basic_string, std::allocator > const&, boost::interprocess::file_lock&)'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN >::nearestKSearch(pcl17::PointXYZ const&, int, std::vector >&, std::vector >&) const'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PassThrough::applyFilterIndices(std::vector >&)'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN >::radiusSearch(pcl17::PointXYZ const&, double, std::vector >&, std::vector >&, unsigned int) const'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN >::setInputCloud(boost::shared_ptr const> const&, boost::shared_ptr > const> const&)'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN >::KdTreeFLANN(bool)'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::search::KdTree::KdTree(bool)'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PCDWriter::writeASCII(std::basic_string, std::allocator > const&, sensor_msgs::PointCloud2_ > const&, Eigen::Matrix const&, Eigen::Quaternion const&, int)'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PCDWriter::writeBinary(std::basic_string, std::allocator > const&, sensor_msgs::PointCloud2_ > const&, Eigen::Matrix const&, Eigen::Quaternion const&)'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::search::KdTree::setPointRepresentation(boost::shared_ptr const> const&)'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::VoxelGrid::applyFilter(pcl17::PointCloud&)'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PassThrough::applyFilter(pcl17::PointCloud&)'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PCDWriter::setLockingPermissions(std::basic_string, std::allocator > const&, boost::interprocess::file_lock&)'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN >::cleanup()'
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN >::setEpsilon(float)'
collect2: ld returned 1 exit status
make[3]: *** [../bin/depth_odometry_node] Error 1
make[3]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[2]: *** [CMakeFiles/depth_odometry_node.dir/all] Error 2
make[2]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
-------------------------------------------------------------------------------}
[ rosmake ] Output from build of package depth_odometry written to:
[ rosmake ] /home/sai/.ros/rosmake/rosmake_output-20131205-164150/depth_odometry/build_output.log
[rosmake-2] Finished <<< depth_odometry [FAIL] [ 3.10 seconds ]
[ rosmake ] Halting due to failure in package depth_odometry.
[ rosmake ] Waiting for other threads to complete.
[ rosmake ] Results:
[ rosmake ] Built 36 packages with 1 failures.
[ rosmake ] Summary output to directory
[ rosmake ] /home/sai/.ros/rosmake/rosmake_output-20131205-164150
sai@sai-HP-EliteBook-8460w:~/fuerte_workspace$ rosmake depth_odometry
Built target ROSBUILD_gensrv_lisp
Built target ROSBUILD_gensrv_cpp
make[3]: Entering directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
[ 88%] Built target rospack_gensrv
make[3]: Entering directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Entering directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
[ 88%] [ 88%] Built target rosbuild_precompile
Built target rospack_gensrv_all
make[3]: Entering directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[3]: Entering directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
Linking CXX executable ../bin/depth_odometry_node
/usr/bin/ld: skipping incompatible /usr/lib/Lib/libOpenNI.so when searching for -lOpenNI
/usr/bin/ld: skipping incompatible /usr/lib/Lib/libOpenNI.so when searching for -lOpenNI
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PCDWriter::resetLockingPermissions(std::basic_string
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PassThrough
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::search::KdTree
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PCDWriter::writeASCII(std::basic_string
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PCDWriter::writeBinary(std::basic_string
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::search::KdTree
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::VoxelGrid
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PassThrough
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::PCDWriter::setLockingPermissions(std::basic_string
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN
/home/sai/fuerte_workspace/depth_odometry_tools/lib_depthtools/lib/librgbdtools.so: undefined reference to `pcl17::KdTreeFLANN
collect2: ld returned 1 exit status
make[3]: *** [../bin/depth_odometry_node] Error 1
make[3]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[2]: *** [CMakeFiles/depth_odometry_node.dir/all] Error 2
make[2]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sai/fuerte_workspace/depth_odometry_tools/depth_odometry/build'
-------------------------------------------------------------------------------}
[ rosmake ] Output from build of package depth_odometry written to:
[ rosmake ] /home/sai/.ros/rosmake/rosmake_output-20131205-164150/depth_odometry/build_output.log
[rosmake-2] Finished <<< depth_odometry [FAIL] [ 3.10 seconds ]
[ rosmake ] Halting due to failure in package depth_odometry.
[ rosmake ] Waiting for other threads to complete.
[ rosmake ] Results:
[ rosmake ] Built 36 packages with 1 failures.
[ rosmake ] Summary output to directory
[ rosmake ] /home/sai/.ros/rosmake/rosmake_output-20131205-164150
sai@sai-HP-EliteBook-8460w:~/fuerte_workspace$ rosmake depth_odometry
Solution
Add the lines given below in the CMakeLists.txt
include_directories(/home/sai/fuerte_workspace/pcl17/include/pcl-1.7/)
include_directories(/home/sai/fuerte_workspace/pcl17/lib/)
link_libraries(pcl17_2d ; pcl17_surface ; pcl_io_ply ; pcl_people ; pcl_stereo ;pcl17_common ; pcl17_tracking.so ; pcl_io ; pcl_people ; pcl_stereo; pcl17_features;pcl17_visualization.so ;pcl_io;pcl_recognition ; pcl_stereo ;pcl17_filters ; pcl_2d ; pcl_io ; pcl_recognition; pcl_surface;pcl17_io_ply ; pcl_2d ; pcl_kdtree; pcl_recognition ; pcl_surface ;pcl17_io ; pcl_2d ; pcl_kdtree ; pcl_registration ; pcl_surface ;pcl17_kdtree ; pcl_common ; pcl_kdtree ; pcl_registration ; pcl_tracking ;pcl17_keypoints ; pcl_common ; pcl_keypoints ; pcl_registration ; pcl_tracking;pcl17_ml ; pcl_common; pcl_keypoints ; pcl_sample_consensus ; pcl_tracking; pcl17_octree ; pcl_features ; pcl_keypoints ; pcl_sample_consensus ; pcl_visualization; pcl17_people ; pcl_features; pcl_ml ; pcl_sample_consensus ; pcl_visualization ;pcl17_recognition ; pcl_features ; pcl_ml ; pcl_search ; pcl_visualization ;pcl17_registration ; pcl_filters ; pcl_ml; pcl_search ; pcl17_sample_consensus; pcl_filters; pcl_octree ; pcl_search; pcl17_search ; pcl_filters ; pcl_octree ; pcl_segmentation ;pcl17_segmentation; pcl_io_ply ; pcl_octree ; pcl_segmentation; pcl17_stereo; pcl_io_ply; pcl_people ; pcl_segmentation )
Tuesday, December 3, 2013
How to use PCL 1.7 in ROS
copied from an answer at
source : http://answers.ros.org/question/44821/updating-to-pcl-17-in-ros-fuerte/
source : http://answers.ros.org/question/44821/updating-to-pcl-17-in-ros-fuerte/
Ok, I believe I figured out the update for using pcl17.
change directories to your ROS_PACAKGE_PATH
Download the packages from the link below
Download the packages from the link below
https://github.com/ros-perception/perception_pcl/tree/fuerte-unstable-devel
check if you can roscd to pcl17 and pcl17_ros
check if you can roscd to pcl17 and pcl17_ros
once you have these checked out change folders,
do
rosdep install
and
rosmake
on each pcl17 and pcl17_ros. Side note, it took a while to run rosmake on pcl17 so make sure you give it enough time.
do
rosdep install
and
rosmake
on each pcl17 and pcl17_ros. Side note, it took a while to run rosmake on pcl17 so make sure you give it enough time.
If you are planning to use these in your package for say a pcl tutorial you have to change your 'manifest.xml'
depend package = pcl17
and
depend package = pcl17_ros
depend package = pcl17
and
depend package = pcl17_ros
Once you've done this make sure to update all your references from pcl:: to pcl17:: in your code
Saturday, November 30, 2013
Friday, November 29, 2013
Wednesday, November 27, 2013
Tuesday, November 19, 2013
Profit on Education
How can a country have better future if government and or private educational institutions make money out of education ?
Good Morning Ppl,
I was trying the Normal Estimation tutorial. The code and errors are given below. I am using the input cloud captured from kinect.
Code
pcl::PointCloud::Ptr cloud1(new pcl::PointCloud);
if (pcl::io::loadPCDFile ("test1.pcd", *cloud1) == -1) //* load the file
{
PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
return (-1);
}
std::cout << "Loaded "
<< cloud1->width * cloud1->height
<< " data points from test_pcd.pcd with the following fields: "
<< std::endl;
pcl::PointCloud::Ptr normals (new pcl::PointCloud);
pcl::IntegralImageNormalEstimation ne;
ne.setNormalEstimationMethod (ne.AVERAGE_3D_GRADIENT);
ne.setMaxDepthChangeFactor(0.02f);
ne.setNormalSmoothingSize(10.0f);
ne.setInputCloud(cloud1);
ne.compute(*normals);
Error:
[100%] Building CXX object CMakeFiles/iss_on_cloud.dir/src/iss_on_cloud.o
In file included from /usr/include/c++/4.6/backward/strstream:52:0,
from /usr/include/vtk-5.8/vtkIOStream.h:112,
from /usr/include/vtk-5.8/vtkSystemIncludes.h:40,
from /usr/include/vtk-5.8/vtkIndent.h:24,
from /usr/include/vtk-5.8/vtkObjectBase.h:43,
from /usr/include/vtk-5.8/vtkCommand.h:205,
from /home/sai/fuerte_workspace/perception_pcl/pcl/include/pcl-1.4/pcl/visualization/common/common.h:39,
from /home/sai/fuerte_workspace/perception_pcl/pcl/include/pcl-1.4/pcl/visualization/pcl_visualizer.h:49,
from /home/sai/fuerte_workspace/perception_pcl/pcl/include/pcl-1.4/pcl/visualization/cloud_viewer.h:39,
from /home/sai/fuerte_workspace/sure_on_cloud/src/iss_on_cloud.cpp:10:
/usr/include/c++/4.6/backward/backward_warning.h:33:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
Linking CXX executable ../bin/iss_on_cloud
CMakeFiles/iss_on_cloud.dir/src/iss_on_cloud.o: In function `pcl::search::OrganizedNeighbor::setInputCloud(boost::shared_ptr const> const&)':
iss_on_cloud.cpp:(.text._ZN3pcl6search17OrganizedNeighborINS_8PointXYZEE13setInputCloudERKN5boost10shared_ptrIKNS_10PointCloudIS2_EEEE[pcl::search::OrganizedNeighbor::setInputCloud(boost::shared_ptr const> const&)]+0x88): undefined reference to `pcl::search::OrganizedNeighbor::estimateFocalLengthFromInputCloud(pcl::PointCloud const&)'
iss_on_cloud.cpp:(.text._ZN3pcl6search17OrganizedNeighborINS_8PointXYZEE13setInputCloudERKN5boost10shared_ptrIKNS_10PointCloudIS2_EEEE[pcl::search::OrganizedNeighbor::setInputCloud(boost::shared_ptr const> const&)]+0xa2): undefined reference to `pcl::search::OrganizedNeighbor::generateRadiusLookupTable(unsigned int, unsigned int)'
CMakeFiles/iss_on_cloud.dir/src/iss_on_cloud.o: In function `pcl::search::OrganizedNeighbor::setInputCloud(boost::shared_ptr const> const&, boost::shared_ptr > const> const&)':
iss_on_cloud.cpp:(.text._ZN3pcl6search17OrganizedNeighborINS_8PointXYZEE13setInputCloudERKN5boost10shared_ptrIKNS_10PointCloudIS2_EEEERKNS5_IKSt6vectorIiSaIiEEEE[pcl::search::OrganizedNeighbor::setInputCloud(boost::shared_ptr const> const&, boost::shared_ptr > const> const&)]+0xd8): undefined reference to `pcl::search::OrganizedNeighbor::estimateFocalLengthFromInputCloud(pcl::PointCloud const&)'
iss_on_cloud.cpp:(.text._ZN3pcl6search17OrganizedNeighborINS_8PointXYZEE13setInputCloudERKN5boost10shared_ptrIKNS_10PointCloudIS2_EEEERKNS5_IKSt6vectorIiSaIiEEEE[pcl::search::OrganizedNeighbor::setInputCloud(boost::shared_ptr const> const&, boost::shared_ptr > const> const&)]+0xf2): undefined reference to `pcl::search::OrganizedNeighbor::generateRadiusLookupTable(unsigned int, unsigned int)'
CMakeFiles/iss_on_cloud.dir/src/iss_on_cloud.o:(.rodata._ZTVN3pcl6search17OrganizedNeighborINS_8PointXYZEEE[vtable for pcl::search::OrganizedNeighbor]+0x24): undefined reference to `pcl::search::OrganizedNeighbor::nearestKSearch(pcl::PointCloud const&, int, int, std::vector >&, std::vector >&)'
CMakeFiles/iss_on_cloud.dir/src/iss_on_cloud.o:(.rodata._ZTVN3pcl6search17OrganizedNeighborINS_8PointXYZEEE[vtable for pcl::search::OrganizedNeighbor]+0x28): undefined reference to `pcl::search::OrganizedNeighbor::nearestKSearch(int, int, std::vector >&, std::vector >&)'
CMakeFiles/iss_on_cloud.dir/src/iss_on_cloud.o:(.rodata._ZTVN3pcl6search17OrganizedNeighborINS_8PointXYZEEE[vtable for pcl::search::OrganizedNeighbor]+0x30): undefined reference to `pcl::search::OrganizedNeighbor::radiusSearch(pcl::PointXYZ const&, double, std::vector >&, std::vector >&, int) const'
CMakeFiles/iss_on_cloud.dir/src/iss_on_cloud.o:(.rodata._ZTVN3pcl6search17OrganizedNeighborINS_8PointXYZEEE[vtable for pcl::search::OrganizedNeighbor]+0x38): undefined reference to `pcl::search::OrganizedNeighbor::radiusSearch(int, double, std::vector >&, std::vector >&, int) const'
collect2: ld returned 1 exit status
make[3]: *** [../bin/iss_on_cloud] Error 1
make[3]: Leaving directory `/home/sai/fuerte_workspace/sure_on_cloud/build'
make[2]: *** [CMakeFiles/iss_on_cloud.dir/all] Error 2
make[2]: Leaving directory `/home/sai/fuerte_workspace/sure_on_cloud/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sai/fuerte_workspace/sure_on_cloud/build'
-------------------------------------------------------------------------------}
Solution
If any one gets a solution please let me know
saimanoj18@gmail.com
How to save files in a loop ?
source: http://stackoverflow.com/questions/4232842/how-to-dynamically-change-filename-while-writing-in-a-loop
How to save pcdfiles in a loop ?
In the code segment below, count increments as the new point cloud comes in...
char file_name[64];
sprintf (file_name, "file%d.pcd", count);
pcl::io::savePCDFile(file_name, *cloud);
How to save pcdfiles in a loop ?
In the code segment below, count increments as the new point cloud comes in...
char file_name[64];
sprintf (file_name, "file%d.pcd", count);
pcl::io::savePCDFile(file_name, *cloud);
How to upgrade GCC/G++ to a newer version
Steps to update gcc/g++
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
source:
http://askubuntu.com/questions/271388/how-to-install-gcc-4-8-in-ubuntu-12-04-from-the-terminal
Solution to cc1plus: error: unrecognized command line option ‘-std=c++11’
If you get an error like this
cc1plus: error: unrecognized command line option ‘-std=c++11’
Then
Step 1 : Update your gcc/g++ compiler to the latest version
Step 2 :
cc1plus: error: unrecognized command line option ‘-std=c++11’
Then
Step 1 : Update your gcc/g++ compiler to the latest version
Step 2 :
Change the line
SET( CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-deprecated -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-variable -Wno-narrowing -DUNIX_ENVIRONMENT -DHAVE_NAMESPACES -DHAVE_STD " )
to the line below by splitting the parameters. (http://stackoverflow.com/questions/10984442/how-to-detect-c11-support-of-a-compiler-with-cmake.)
SET( CMAKE_CXX_FLAGS "-std=c++11 -Wall " )
SET( CMAKE_CXX_FLAGS "-Wno-deprecated -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-variable -Wno-narrowing -DUNIX_ENVIRONMENT -DHAVE_NAMESPACES -DHAVE_STD " )
Hope this solve the issue.
If it doesnt,
then
Step 3 : GOOGLE :)
Thursday, October 24, 2013
Nitin Gupta's answer to: Currencies: What is the economics behind printing of currency?
Copied from Quora
Awesome answer by Nitin Gupta
Original Link
Nitin Gupta, Human | Thinker | Knowledge Aficionado Suggest Bio
Votes by Prabhath Kamarapu, Karthik Suroju, Sai Manoj Prakhya, Shivraj Patil, and1984 more.
Take any currency note and have a look at it. You will find wordings similar to this.
“I promise to pay the bearer a sum of….”So what does this mean? It means that the reserve bank of the country (in other words the Government) promises that the person who possesses the currency note (i.e the bearer) will be eligible to be paid goods worth the amount mentioned on that currency note.
But what will the bank get in return for assuring and making that payment? To answer this we have to go back a bit in history, to the origin of the currency notes as we see them today.
Of course in US dollars, it would be “This note is a legal tender for all debts…”.The ” Will pay to bearer on demand ” which was present in US dollars earlier vanished from it in 1934 and was replaced by “This note is a legal tender for all debts…” !!!A 1918 US dollar note.
In other words, the dollar note is just a legal tender, meaning all US banks will accept it, but other than that, nothing is promised by the US Federal Reserves about its value. In fact Federal Reserve is NOT Federal i.e it is NOT owned by the US federal government , nor does it have any independent reserves. It is just a group of private banks working with the US treasury department.
It all started…
In ancient times precious metals like Gold and Silver acted as the currency. Which is why we see that the ancient coins were made of precious metals. And there was no need for anybody to make a promise about the value of a Gold coin because the coin in itself contained precious Gold, unlike today’s paper currency.
I promise to pay…
And then came the promissory notes, which were the ancestors of today’s currency notes. Here, people used to deposit the precious metals they had with a trustee who in turn used to issue them a promissory note mentioning in it the worth of the Gold it represented. Then anybody who gave this note to the trustee would get back Gold worth the value mentioned in that promissory note. The trustee in turn would charge a small amount to the people for safeguarding their Gold assets.
Slowly instead of using actual Gold to purchase goods people started using these promissory notes instead. Different denominations of these notes came into existence. These were the initial days of currency notes, which is why even today you see on our notes a promise by the reserve bank (today’s trustee) about the value of that currency note. But then today these notes are NOT supported by Gold or any other precious metal. How is that possible? Read on…
The promissory notes became popular because it meant carrying a simple piece of paper instead of heavy metals. It not only reduced the carrying burden, but also protected people from thieves who could otherwise easily detect that you were carrying Gold/Silver.
Over a period of time the trustees observed that most of the people who had deposited the Gold with them were not coming back to take back the Gold, and instead simply kept circulating the promissory notes, much like today’s currency notes. So the trustees thought why not issue more promissory notes than the amount of the Gold reserves they had? And thus was born the concept of modern currencies and the banking system.
Deposited money exits through back-doors
Banks in those days simply issued more promissory notes than the amount of Gold they had, based on a simple faith that all their depositors wont come and demand their Gold back all at the same time! Imagine a bank which had 100 kg Gold in deposits and which had issued promissory notes for 200 kg of Gold. If all its customers came at the same time demanding their Gold back, then the bank would go bankrupt! But that doesn’t happen unless and until the bank loses the faith of its customers. So based on the faith that the overall amount of Gold withdrawn would always be little compared to the overall amount of Gold deposited, Banks started overstating their Gold deposits.
What the banks did with those extra promissory notes was to lend loans and earn interest. This is how the banking systems as we know today came into existence. And this is what is practiced by banks today in the name of fractional reserve banking . In other words, the banks today keep only a fraction of the customer deposits in reserves, and lend out all remaining money as loans to earn interest. The interest on the loans would be more than the interest paid by the banks for your deposits and thats how banks make profit. Your deposits are nothing but loan offered by you to bank for which bank pays a small interest, and in turn lends that money to others for a higher interst rate.
So if the borrowers don’t pay back the loan amount, then your money is gone! And that is what is exactly happening in US today in the name of Sub-prime crisis. Borrowers have defaulted, banks have gone bankrupt and so have the investors! Lehman brothers was just an example, and AIG was bailed out by the US Government because it was too big to be allowed to go bankrupt! The current US sub-prime crisis threatening the global economy is nothing but Banks being unable to recover the billions of dollars of depositors’ money which it had given out in the form of Bad loans.
And how does the US Government bail out big bankruptcies? Simply by printing more dollars !In fact Billions of it!
The question is why can’t other countries simply print more of their currencies and be rich? Because there will be no takers for mere paper. Currency being a piece of paper has to be supported by something which is really valuable, like the earlier Gold system. So what is supporting the US dollar then? Read on…
Post World War II – US Strategy
After the second world war most of the world economy was devastated. Most of the world’s Gold reserves had ended up in US as all countries required US help to rebuild themselves, the same way they needed US weapons prior to that. It should be noted that US mainland was not at all affected by the second world war and there have been conspiracy theories about Pearl Harbor, the same way there have been conspiracy theories about 9/11 . UK had been the world leader till then, but now was desperate for help after the devastating world war. It had enough of its own business to mind and hence declared independence to countries like India which were becoming unmanageable and which had already been looted to its core by the British. The empire on which the Sun never set had started shrinking to see its Sun setting. Britain’s prominent industries had been destroyed by the war and it badly needed aid. It wasn’t able to import more than half of its food and all raw materials, probably except Coal.
At the same time US had the ambition to replace UK as the world economic power. At the end of second world war there was already great inflation in US and there were strikes in all major US industries like automobiles, steel etc. So US desparately wanted unhindered access to markets across the world to get cheap stuff to fuel its own economy. US agreed to give a loan worth 3.8$ dollar to UK provided it entered into a new trade agreement with US. And thus was born theBretton Woods agreement which paved way for the creation of IMF, World Bank and laid foundation for the world domination of the US dollar. Prior to this agreement US and UK combined controlled over half of the world’s trade, and this agreement ensured that US entered UK markets. It should be noted that if not for the devastating effects of world war II on british economy, the british pound would have been today’s dominant currency. It was infact a dominant currency in the world prior to world war II.
Bretton Woods Agreement
US entered into this Bretton Woods agreement with UK and rest of the world nations after the world war in 1945. According to this agreement all member countries had to trade their currencies against US dollar instead of against Gold or other currencies, and US dollar itself was promised to have a fixed value in terms of Gold. In other words, by this agreement US dollars became the new promissory notes of the world economy! So a country need not worry if it didn’t have enough Gold to support its currency, all it had to do was to buy US dollars, because US promised its dollars to be supported by Gold!
Now, what would a country do when it had a currency deficit? Well, it can take loans from the newly formed IMF and World bank(then known as IBRD), which would obviously be in terms of US dollars. In return for this loan IMF (on behalf of US) would set up rules and regulations on that country’s economy, so as to favor the US (in the disguise of helping that country overcome its crisis) and would put that country’s economy under IMF surveillance. The US owned one-third of all IMF quotas, more than enough to impose its rules and to veto any change it disliked in the IMF.
To pay back the IMF loans (in US dollars) a country had to export its goods and services to US so as to earn US dollars. Even otherwise, countries wanted to earn US dollars since it was the default global currency for international trade in the non-communist (non-soviet) block. So all countries started selling their products to US for cheap prices, since they had competition amongst themselves. This ensured that US got best of the world products for lowest prices. And in the process US economy and consumerism boomed because they got cheap goods of great quality from all across the world! Pegging of world currencies to US dollar ensured that the value of US currency remained stable and hence there was no inflation in US and things became available for throw away prices. That’s how US consumerism was fuelled and continues to be fuelled even today.
While in the third world countries people think a thousand times before throwing out something, in US it is the world’s largest amount of garbage produced everyday, simply because in US its cheaper to buy than to reuse. Things are(were) cheap in US at the cost of the rest of the world because rest of the world compete(d)s to sell their goods to US, just to earn US dollars, since it was supported by Gold. In other words US dollars had the greatest purchasing power, thanks to the Bretton Woods system. In return for making this agreement happen, US gifted its european friends with its Marshall Plan , where in the european countries received aid in terms of grants instead of loans to rebuild their economies. US offered a similar Marshall plan to the communist states led by USSR but was rejected by the Soviets who were well aware of US ambitions to dominate the world economy.
Nixon Shock
All this went fine till one day the flaw in the system came out. US had created a Pax Americana system in the world, where every developing economy had this goal of exporting its goods and services to US to earn more dollars. US continued to print dollars left and right and kept distributing it to all countries to fuel its hungry consumers. But then according to the agreement the dollar was being supported by a promised denomination of Gold. But printing more dollars is not same as mining more Gold! And hence insufficient supply of Gold broke the system.
While US dollar had a fixed value against Gold which was artificially set just to enable US to print more dollars, the price of the Gold in the open market was much higher than the Gold supported by an US dollar! In other words, if Gold of amount x was available for a dollar, the same Gold x cost 3 dollars in the open market!
This meant countries could now use their piled up US dollars to get back cheap Gold from US government (since US had promised fixed amount of Gold to its dollar according to the Bretton Woods agreement), and then sell it in the open markets for higher prices! Just imagine all the countries that had kept piling up US dollars, now opting to give it back all, in return for the promised Gold. Well, this happened on March 17 1968 (along with violent protests in London the same day against US involvement in the Vietman war) and US looked blank! Where is so much Gold? US had Gold reserves to support only 22% of the dollars it had printed so far! What about the rest, and obviously US cant give away all its Gold and go bankrupt on its own either.
Thus came the Nixon Shock in 1971 on 15th of August when the then US President Nixon simply refused to pay Gold for US dollars anymore! He didnt even consult IMF before announcing his decision. In other words, entire world economies collapsed since their millions of dollar reserves were worth nothing more than a bundle of paper! If any other country had done this to US, then US would have nuked it out of existence, but since it was the great military power of the world that had defaulted, all other countries had to keep quiet.
Once the US refused to pay Gold for its dollars, the world entered a floating exchange rate system, where the markets decided the exchange rates based on demand and supply principle for currencies. While the US dollar was supported by Gold, other currencies were held weak in respect to US dollars so as to facilitate cheap imports to US. Now that the US refused to pay Gold for its dollars, its economy came down as other countries stopped buying its dollars since it was no more than a piece of paper now. So to boost US economy, US had to now export goods instead of importing them. Gone were the days when US could buy anything and everything just by printing more dollars. So, Nixon heavily devalued US dollar to allow US exports to other countries, so that US economy could get a boost. He even imposed 10% import duties so as to discourage cheaper imports which would harm local industries.
Enter Petrodollar
But how long could US be without a strong dollar? Absence of a strong dollar meant US would have to compete with other countries on an equal floor and dollar would no longer be a dominating world currency. This would remove economic US advantage in the world since there would be no demand for US dollars across the world, and if there is no demand to US dollars then why will countries prefer exporting their products to US only? And if that doesnt happen then how to fuel US consumerism?
It should be noted that it is the consumerism that fuels more buying which in turn fuels innovation, provides funds for further research and hence leads to growth of science and technology.
So between 1972 and 1974 the then US president Nixon held a series of meetings with Saudi Arabia, the world’s largest oil exporter, and struck a deal where in US would provide technological and miltary assistance to Saudi, and in return Saudi had to trade its oil exports only in terms of US dollars. Now this resulted in two major advantages for US. One, all countries which import oil have to pile up dollars, since only dollars are accepted by oil exporting countries. This was because once Saudis agreed to trade oil in terms of dollars, even OPEC (the organization of petroleum exporting countries) agreed to trade oil only in terms of dollars. So oil importing countries again started to trade with US and started selling their goods and services at throw away prices just so that they could earn dollars to enable them to buy Oil. So all oil importing countries started to build up dollar reserves, and this boosted US consumerism, bringing back the world currency status to US dollar, this time supported by Petroleum instead of Gold, and hence the term Petrodollar.
The second advantage to US from the petro-dollar was it could simply print more dollars to buy the oil it needed, and hence petroleum became available in US at throw away prices, and this is what made owning private cars almost one per head, cheaper in US. Without petroleum being not just affordable, but cheaper, there was no way that a giant automobile and airlines industry could have come up in US. Now that the US dollar is losing its value again, the effects of increased petroleum costs on US roads is becoming evident.
As described in earlier articles Iraq was invaded simply because Saddam Hussein had started accepting Euros instead of dollars to sell Iraqi Petroleum. This was a master blow to US economy and hence Iraq was invaded. The WMD which Saddam had was none other than Oil. After US invaded Iraq and dethroned Saddam the first thing it did was to revert back oil exporting currency of Iraq to dollars. Similary Iran is being threatened by US not because it has started Uranium enrichment programme but because it has started accepting Euros instead of dollars. Similarly Russia has started accepting its own Roubles instead of dollars to boost its own economy. Venezuela is also switching to Euros to export its Oil.
Iran, Venezuela and Russia account for about 25% of world oil exports, and if they do away with dollars, then there is a serious threat to dollar stability, and would lead to serious inflation and recession in US. UAE central bank has said that it will convert 10% of its dollar reserves to Euros. Even Kuwait and Qatar have hinted at the same. Sweden has brought down its dollar reserves from 37% to 20%. If there are no buyers for dollars, why will countries export their goods to US, what will they do with the dollars paid to them?
Biggest threat to US economy today is China which is sitting on world’s largest dollar reserves. If it releases those billions of dollars it holds in its reserves, then US economy will simply collapse. At the same time, the dollar reserves are a threat to China itself, for if dollar value comes down due to some other reasons, then Chinese collection of dollars would be mere paper notes. Slowly the ground below the international dollar is shaking, and shaking violently . It simply means US will have to go for a major war to bring back the world economy into its hold again. The target can be Iran, North Korea, Pakistan, anything and it has no ideological basis. It is the military might which fuels the economic might and vice versa. When one is under threat, use the other to recover. Its as simple as that.
What Promise?
By the way, today’s paper currencies have no inherent value in them. Even though the Reserve Bank promises to pay the value mentioned in the notes, consider inflation. What you get for 100 Rupees today, if you have the same 100 Rupees three years from now its value will be less worth than what it was when you earned that 100 Rupees. So where is the promise? What is the promise all about?
Note that your money is not supported by any Gold or Oil. Its just a piece of paper. The moment you earn money convert it into something which has real value. For instance, buy Gold or invest in real estate. Because these things have real value in them. If you just end up saving your 10000 Rupees in a bank account, 5 years from now its value would have reduced due to inflation and would be worth probably only 7000! Understand the economics of money and play safe. Dont save money as cash, other than for the minimum amount required to face any eventual emergencies.
EDIT:
Watch this.
Also watch movie "Zeitgeist", to get more insight.
Rush Movie Review
Yesterday night, I have been to this movie "RUSH" directed by Ron Howard. The fact the Ron Howard directed "The Beautiful mind" and the imdb rating of this movie were impressive.
The movie is a true story which happened during 1976 when Formula 1 racing was gaining popularity and fame. It shows the rivalry between two F1 racing world champions James Hunt and Niki Lauda.
Niki Lauda comes from a well to do business family in Austria and want to race for his living. He does not get ant support from his family. SO he takes a huge bank loan from his life insurance policy and gets into the racing industry.
James Hunt hailing from Britain is a Casanova and a play boy who is ready to risk life in every race he is in. James Hunt and Niki Lauda were F3 racers in the beginning and get into F1. Niki Lauda signs for Ferrari and James hunt with another company.
James and Niki strive to become No 1 in every race and Niki wins most of the times. Niki s well disciplined, does not hang out in bars after the race and his policy is early to bed and early to rise. On the other side James partys all the time and goes out with girls.
Niki is known for the accident which happened in 1976 on German track. It was raining when the race is about to start and Niki calls for an emergency meeting with all F1 drivers. He proposes to cancel the race as its too dangerous to race in the rain. But James complains that Niki will have an advantage over the players in gaining points as others would also get no points for this race. Thus the race kick off and unfortunately Niki gets into an accident and will be struck in the burning car at 800 degree centigrade for about a minute. He inhales hot fumes from the flames and thus have to get his lungs cleaned up which is the most painful part of the whole treatment. His face got permanently disfigured, yet he gets back on to the track within six weeks.
Niki wins the first race immediately after his accident and gains back the rank on the score board. The final race of the season which decides who will be world champion be in 1976 is going to be help in Japan. Unfortunately it rains on that day too and after one lap, Niki gets away from the race thinking that his life will be at risk. If James can get atleast third position in the race, then James will become the World Champion and James was ready to lose his life to win this race. He drives hard through the rain and finishes third.
From Niki's point of view, James proved to the world that he can be a world champion and James retired from F1 racing. James died at 45 due to heart attack and Niki says that he was not surprised but a bit sad to know about the death of the person whom he respected personally, though people thought they both were rivals.
Niki continues to race and becomes world champion again after seven years in 1984. This movies potrays two characters, James and Niki. James, ready to risk his life, and feels more lively when life is at stake and a playboy character who takes pleasures out of the life. Niki who is more disciplined and comes back on track was patient and consistent to become world champion after seven years.
The movie is a true story which happened during 1976 when Formula 1 racing was gaining popularity and fame. It shows the rivalry between two F1 racing world champions James Hunt and Niki Lauda.
Niki Lauda comes from a well to do business family in Austria and want to race for his living. He does not get ant support from his family. SO he takes a huge bank loan from his life insurance policy and gets into the racing industry.
James Hunt hailing from Britain is a Casanova and a play boy who is ready to risk life in every race he is in. James Hunt and Niki Lauda were F3 racers in the beginning and get into F1. Niki Lauda signs for Ferrari and James hunt with another company.
James and Niki strive to become No 1 in every race and Niki wins most of the times. Niki s well disciplined, does not hang out in bars after the race and his policy is early to bed and early to rise. On the other side James partys all the time and goes out with girls.
Niki is known for the accident which happened in 1976 on German track. It was raining when the race is about to start and Niki calls for an emergency meeting with all F1 drivers. He proposes to cancel the race as its too dangerous to race in the rain. But James complains that Niki will have an advantage over the players in gaining points as others would also get no points for this race. Thus the race kick off and unfortunately Niki gets into an accident and will be struck in the burning car at 800 degree centigrade for about a minute. He inhales hot fumes from the flames and thus have to get his lungs cleaned up which is the most painful part of the whole treatment. His face got permanently disfigured, yet he gets back on to the track within six weeks.
Niki wins the first race immediately after his accident and gains back the rank on the score board. The final race of the season which decides who will be world champion be in 1976 is going to be help in Japan. Unfortunately it rains on that day too and after one lap, Niki gets away from the race thinking that his life will be at risk. If James can get atleast third position in the race, then James will become the World Champion and James was ready to lose his life to win this race. He drives hard through the rain and finishes third.
From Niki's point of view, James proved to the world that he can be a world champion and James retired from F1 racing. James died at 45 due to heart attack and Niki says that he was not surprised but a bit sad to know about the death of the person whom he respected personally, though people thought they both were rivals.
Niki continues to race and becomes world champion again after seven years in 1984. This movies potrays two characters, James and Niki. James, ready to risk his life, and feels more lively when life is at stake and a playboy character who takes pleasures out of the life. Niki who is more disciplined and comes back on track was patient and consistent to become world champion after seven years.
Subscribe to:
Posts (Atom)