koide3 / pointcloud_to_2dmap

54 stars 15 forks source link

how to build this repository? #2

Open darshb34 opened 3 years ago

darshb34 commented 3 years ago

I tried the following steps:

cd pointcloud_to_2d_map mkdir build cd build cmake .. make

the last step "make" gives me the error as below

pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp: In member function ‘cv::Mat MapGenerater::generate(const pcl::PointCloud&) const’: pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp:28:21: error: ISO C++ forbids declaration of ‘point’ with no type [-fpermissive] for(const auto& point: cloud) { ^ pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp:28:28: warning: range-based ‘for’ loops only available with -std=c++11 or -std=gnu++11 for(const auto& point: cloud) { ^ pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp:29:16: error: request for member ‘z’ in ‘point’, which is of non-class type ‘const int’ if(point.z < min_height || point.z > max_height) { ^ pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp:29:40: error: request for member ‘z’ in ‘point’, which is of non-class type ‘const int’ if(point.z < min_height || point.z > max_height) { ^ pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp:33:21: error: request for member ‘x’ in ‘point’, which is of non-class type ‘const int’ int x = point.x m2pix + map_width / 2; ^ pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp:34:22: error: request for member ‘y’ in ‘point’, which is of non-class type ‘const int’ int y = -point.y m2pix + map_width / 2; ^ pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp: In function ‘int main(int, char)’: pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp:97:8: error: ‘cloud’ does not name a type auto cloud = boost::make_shared<pcl::PointCloud>(); ^ pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp:98:63: error: ‘cloud’ was not declared in this scope if(pcl::io::loadPCDFile(vm["input_pcd"].as(), cloud)) { ^ pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp:104:37: error: ‘cloud’ was not declared in this scope cv::Mat map = generater.generate(cloud); ^ pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp:113:46: error: no matching function for call to ‘std::basic_ofstream::basic_ofstream(std::cxx11::basic_string)’ std::ofstream ofs(destination + "/map.yaml"); ^ In file included from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/videostab/global_motion.hpp:47:0, from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/videostab/stabilizer.hpp:50, from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/videostab.hpp:78, from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/opencv.hpp:98, from pointcloud_to_2dmap/src/pointcloud_to_2dmap.cpp:5: /usr/include/c++/5/fstream:697:7: note: candidate: std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const char, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits; std::ios_base::openmode = std::_Ios_Openmode] basic_ofstream(const char s, ^ /usr/include/c++/5/fstream:697:7: note: no known conversion for argument 1 from ‘std::__cxx11::basic_string’ to ‘const char’ /usr/include/c++/5/fstream:682:7: note: candidate: std::basic_ofstream<_CharT, _Traits>::basic_ofstream() [with _CharT = char; _Traits = std::char_traits] basic_ofstream(): ostream_type(), _M_filebuf() ^ /usr/include/c++/5/fstream:682:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/5/fstream:656:11: note: candidate: std::basic_ofstream::basic_ofstream(const std::basic_ofstream&) class basic_ofstream : public basic_ostream<_CharT,_Traits> ^ /usr/include/c++/5/fstream:656:11: note: no known conversion for argument 1 from ‘std::cxx11::basic_string’ to ‘const std::basic_ofstream&’ CMakeFiles/pointcloud_to_2dmap.dir/build.make:62: recipe for target 'CMakeFiles/pointcloud_to_2dmap.dir/src/pointcloud_to_2dmap.cpp.o' failed make[2]: [CMakeFiles/pointcloud_to_2dmap.dir/src/pointcloud_to_2dmap.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pointcloud_to_2dmap.dir/all' failed make[1]: [CMakeFiles/pointcloud_to_2dmap.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: [all] Error 2

Thank you

amjack0 commented 2 years ago

Clone the repo and cd pointcloud_to_2dmap configure your build using CMake with, cmake . After that, you can run, make

houcemsaidani commented 2 years ago

hello! sorry but i did what you said but i don't know where to locate my point cloud map from the lego loam algo and therefore see the results of the 2d map. after i launch the lego loam and i see the 3d map in Rviz, then what?