Test environment: python3.6 Ubunut18.04
1. Because the jetsonnano nx board belongs to the ubuntu system under the ARM architecture and the pcl method installed in the ordinary virtual machine or ubuntu system is different, so in order to avoid some unknown problems when following the tutorial, this pitfall , Writing it down is also convenient for me to remember and can help everyone.
2. I like to create a virtual environment before configuring the environment to facilitate debugging and avoid environment strings.
Installation of archiconda
- Why choose archiconda? Because Nvidia’s boards, including Miaosuan, have an arm architecture similar to a mobile phone architecture, and you can’t install Linux anconda and win10 ancoda like a computer
- Download archiconda
-
Here I directly give my Baidu cloud link, because it takes at least 30 minutes to download from the official website, first use the computer to download to another U disk and then insert the Nvidia board.
-
https://pan.baidu.com/s/1W9LjQsmdM6RwSUH3x4wmJA Extraction code: 1111
-
Put the file into the jetsonnano nx board and copy and paste it to the main directory, click the right mouse button where the file is located to open the terminal terminal input cd
-
1.sudo ./Archiconda3-0.2.3-Linux-aarch64.sh install 2.sudo vim ~/.bashrc 3. Add export PATH=~/archiconda3/bin:$PATH in the last line 4. Refresh source ~/.bashrc after exiting
conda create -p XXXXX python=3.6 conda activate XXXXX activates the virtual environment, and if you want to enter the virtual environment in the future, run this line of code Leave the virtual environment command conda env list conda remove -p XXXXX --all delete virtual environment The virtual environment can be seen in the env of the archiconda file Xxxx is the name of the virtual environment you want to create, why choose 3.6? Because jetson nano nx has built-in python2.7 and python3.6, it can be created directly with the only python it has.
- Configure cuda
1.gedit ~/.bashrc terminal run 2. Bottom line input export PATH=/usr/local/cuda-10.2/bin${PATH: + :${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH: + :${LD_LIBRARY_PATH}} export CUDA_ROOT=/usr/local/cuda 3. Save and exit 4.source ~/.bashrc to refresh the environment nvcc -V checks the cuda environment and if cuda10.2 appears, the configuration is successful
First install the C++ version of the PCL library
-
sudo apt update #If you don't update, you may not find the latest version sudo apt install libpcl-dev #Install pcl dependent library
Install python-pcl
-
Direct pip installation will report an error, because pip will directly install pcl1.8 version, which is not compatible with python3.6, and must be compiled and installed by itself. First download the source code, then unzip it, don’t rush to install it, open setup.py, and modify the statements inside.
https://github.com/strawlab/python-pcl
In line 726 VTK=7.0 changed to 6.3
In 752, ‘vtkXXXX-‘ + vtk_version is deleted, where XXXX stands for
-
vtkexpat vtkfreetype vtkgl2ps vtkhdf5 vtkhdf5_hl vtkjpeg vtkjsoncpp vtklibxml2 vtkNetCDF vtkNetCDF_cxx vtkoggtheora vtkpng vtkproj4 vtksqlite vtktiff vtkzlib
Compile and install
-
python setup.py build_ext -i python setup.py install
After success, there is no feedback, and the terminal enters python
In order to save time, you can also put it into the compiled file. It is recommended to compile it yourself, and the comparison time is not very long.
Link: https://pan.baidu.com/s/1SZAbfU0e_gGTlzLr85TcTw Extraction code: 1111 --Sharing from Baidu Netdisk super member V3
Test pcl
1. Create a test_pcl folder, and then create a source file test_pcl.cpp, the code is as follows:
#include <iostream> #include <pcl/common/common_headers.h> #include <pcl/io/pcd_io.h> #include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/cloud_viewer.h> #include <pcl/console/parse.h> using namespace std; int main(int argc, char **argv) {//Cylinder point cloud test cout << "Test PCL !" << endl; pcl::PointCloud<pcl::PointXYZRGB>::Ptr point_cloud_ptr (new pcl::PointCloud<pcl::PointXYZRGB>); uint8_t r(255), g(15), b(15); for (float z(-1.0); z <= 1.0; z + = 0.05) {//Make columnar point cloud for (float angle(0.0); angle <= 360.0; angle + = 5.0) { pcl::PointXYZRGB point; point.x = cos(pcl::deg2rad(angle)); point.y = sin(pcl::deg2rad(angle)); point.z = z; uint32_t rgb = (static_cast<uint32_t>(r) << 16 | static_cast<uint32_t>(g) << 8 | static_cast<uint32_t>(b)); point.rgb = *reinterpret_cast<float*>( & amp;rgb); point_cloud_ptr->points.push_back(point); } if (z < 0.0) {//color gradient r -= 12; g + = 12; } else { g -= 12; b + = 12; } } point_cloud_ptr->width = (int) point_cloud_ptr->points.size (); point_cloud_ptr->height = 1; pcl::visualization::CloudViewer viewer ("pcl-test test"); viewer.showCloud(point_cloud_ptr); while (!viewer. wasStopped()){ }; return 0; } #include <iostream> #include <pcl/common/common_headers.h> #include <pcl/io/pcd_io.h> #include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/cloud_viewer.h> #include <pcl/console/parse.h> using namespace std; int main(int argc, char **argv) {//Cylinder point cloud test cout << "Test PCL !" << endl; pcl::PointCloud<pcl::PointXYZRGB>::Ptr point_cloud_ptr (new pcl::PointCloud<pcl::PointXYZRGB>); uint8_t r(255), g(15), b(15); for (float z(-1.0); z <= 1.0; z + = 0.05) {//Make columnar point cloud for (float angle(0.0); angle <= 360.0; angle + = 5.0) { pcl::PointXYZRGB point; point.x = cos(pcl::deg2rad(angle)); point.y = sin(pcl::deg2rad(angle)); point.z = z; uint32_t rgb = (static_cast<uint32_t>(r) << 16 | static_cast<uint32_t>(g) << 8 | static_cast<uint32_t>(b)); point.rgb = *reinterpret_cast<float*>( & amp;rgb); point_cloud_ptr->points.push_back(point); } if (z < 0.0) {//color gradient r -= 12; g + = 12; } else { g -= 12; b + = 12; } } point_cloud_ptr->width = (int) point_cloud_ptr->points.size (); point_cloud_ptr->height = 1; pcl::visualization::CloudViewer viewer ("pcl-test test"); viewer.showCloud(point_cloud_ptr); while (!viewer. wasStopped()){ }; return 0; }
Create another configuration file CMakeLists.txt under the test_pcl folder, the code is as follows:
cmake_minimum_required(VERSION 2.6) project(test_pcl) find_package(PCL 1.2 REQUIRED) include_directories (${PCL_INCLUDE_DIRS}) link_directories (${PCL_LIBRARY_DIRS}) add_definitions (${PCL_DEFINITIONS}) add_executable(test_pcl test_pcl.cpp) target_link_libraries (test_pcl ${PCL_LIBRARIES}) install(TARGETS test_pcl RUNTIME DESTINATION bin)
Compile source code
Create another build folder under the test_pcl folder, and enter the build folder in the terminal.
Enter cmake ..
to analyze the project, and then enter make
to compile.
Run source code
After the compilation is successful, enter ./test_pcl
to run the executable file, and the operation is successful! A point cloud image with free stretching and rotation appears
So far, congratulations! PCL installed successfully and running successfully! ! !
reference link
https://blog.csdn.net/qq_42257666/article/details/124574029?ops_request_misc=%7B%22request%5Fid%22%3A%22166799730916782388092430%22%2C%22scm%22%3A%222 0140713.130102334..% 22%7D &request_id=166799730916782388092430 &biz_id=0 &utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-124574029-null-null.142^v63 ^ control,201^v3^control_2,213^v2^t3_control2 &utm_term=ubuntu pcl test&spm=1018.2226.3001.4449 https://blog.csdn.net/qq_54609718/article/details/124997287?ops_request_misc= &request_id=&biz_id=102 &utm_term=jetson nx pcl &utm_medium=distribute.pc_search_result.none- task-blog-2~all~sobaiduweb~default-0-124997287.142^v63^control,201^v3^control_2,213^v2^t3_control2 & amp;spm=1018.2226.3001.4187