旭日x3使用记录

ARM 8架构或者说aarch64,由于SD卡空间小,不能像以前那样随意装软件包。

安装

按着网上的说明一步步安装即可,包括SD卡的烧录。我开始犯了个低级错误,把SD卡插在读卡器上,把读卡器插到USB口上启动了,结果板子一直是绿灯。没有用开发板的习惯,在工控机上用惯了,换到卡槽上就好了。

网络

外接天线直接可以插到插孔上,并不复杂。但是发现wifi连接很不稳定,时不时掉线,于是还是决定用有线,同时取消开机连接wifi

温度

装好风扇后,上电发现风扇动了一下就停了,拆装了多少遍,结果仍然无效,后来看说明书才发现要运行程序。后来直接用电风扇吹,发现CPU很快降了十几度,目前只是单用开发板,所以干脆先不装风扇了。

watch -n1 hrut_somstatus 用于实时查询温度传感器读数及 CPU/BPU 频率实时信息

1
2
3
4
5
6
7
8
9
10
11
12
13
=====================1=====================
temperature-->
CPU : 72.8 (C)
cpu frequency-->
min cur max
cpu0: 240000 1200000 1200000
cpu1: 240000 1200000 1200000
cpu2: 240000 1200000 1200000
cpu3: 240000 1200000 1200000
bpu status information---->
min cur max ratio
bpu0: 400000000 1000000000 1000000000 100
bpu1: 400000000 1000000000 1000000000 100

扩大swap内存

free -m可查看swap内存

先确定swapfile存放的路径,之后执行

1
2
3
4
5
6
fallocate -l 6G swapfile
chmod 600 swapfile
# 如果不设置开机加载,重启后,只执行下面两个命令
mkswap swapfile
sudo swapon swapfile
swapfile -s

这样就成功了,但是开机启动时不会加载,还要修改/etc/fstab,但一般不需要

ROS环境部署

后来发现启动rviz会报错,之前只启动乌龟程序,看来以后装完ROS也得启动Rviz。内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
[ INFO] rviz version 1.14.19
[ INFO] compiled against Qt version 5.12.8
[ INFO] compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] Forcing OpenGl version 0.

libEGL warning: DRI2: failed to authenticate

libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
Segmentation fault

正常的输出是这样:
1
2
3
4
5
6
7
[ INFO] rviz version 1.13.21
[ INFO] compiled against Qt version 5.9.5
[ INFO] compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] Forcing OpenGl version 0.
[ INFO] Stereo is NOT SUPPORTED
[ INFO] OpenGL device: SVGA3D; build: RELEASE; LLVM;
[ INFO] OpenGl version: 3.3 (GLSL 3.3) limited to GLSL 1.4 on Mesa system.

安装glxinfo工具:sudo apt-get install -y mesa-utils,然后执行glxinfo,应当出现很多内容,而我的只有
1
2
name of display: :0.0
Error: couldn't find RGB GLX visual or fbconfig

而在x86上执行glxinfo | grep OpenGL 可以看到有一行结果: OpenGL ES profile version string: OpenGL ES 2.0 Mesa 20.0.8

查论坛发现x3派不支持openGL,所以看来 不能使用rviz了

编译 cartographer

编译cartographer出错, absl库出错
这是因为这个库我是从其他电脑拷贝过来的,不是ARM架构编译的,还是要重新编译。

继续编译时遇到了PCL的报错

PCLConfig.cmake的772行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
if(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
# Found a PCL installation
# pcl_message("Found a PCL installation")
set(PCL_INCLUDE_DIRS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}")
set(PCL_LIBRARY_DIRS "${PCL_ROOT}/lib/x86_64-linux-gnu")
if(EXISTS "${PCL_ROOT}/3rdParty")
set(PCL_ALL_IN_ONE_INSTALLER ON)
endif(EXISTS "${PCL_ROOT}/3rdParty")
elseif(EXISTS "${PCL_ROOT}/include/pcl/pcl_config.h")
# Found a non-standard (likely ANDROID) PCL installation
# pcl_message("Found a PCL installation")
set(PCL_INCLUDE_DIRS "${PCL_ROOT}/include")
set(PCL_LIBRARY_DIRS "${PCL_ROOT}/lib")
if(EXISTS "${PCL_ROOT}/3rdParty")
set(PCL_ALL_IN_ONE_INSTALLER ON)
endif(EXISTS "${PCL_ROOT}/3rdParty")
elseif(EXISTS "${PCL_DIR}/include/pcl/pcl_config.h")
# Found PCLConfig.cmake in a build tree of PCL
# pcl_message("PCL found into a build tree.")
set(PCL_INCLUDE_DIRS "${PCL_DIR}/include") # for pcl_config.h
set(PCL_LIBRARY_DIRS "${PCL_DIR}/lib/x86_64-linux-gnu")
set(PCL_SOURCES_TREE "/build/pcl-OilVEB/pcl-1.8.1+dfsg1")
else(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
pcl_report_not_found("PCL can not be found on this machine") # 这里报错
endif(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")

结果发现我没有pcl_config.h,在x86上发现在/usr/include/pcl-1.8/pcl/pcl_config.h

编译PCL

一开始发现其实已经安装好了PCL,但是缺cmake文件。比如x86的主机上有路径/usr/lib/x86_64-linux-gnu/cmake/pcl,包含PCLConfig.cmakePCLConfigVersion.cmake。旭日上并没有这个路径,显然需要的路径是/usr/lib/aarch64-linux-gnu/cmake/pcl

旭日默认存在的pcl相关文件在/usr/bin中的pcl_开头的文件,以及/usr/lib/aarch64-linux-gnu/中以libpcl_开头的so文件,对应x86的路径在 /usr/lib/x86_64-linux-gnu/

编译PCL要很久很久,尤其到后面编译Building CXX object surface/CMakeFiles/pcl_surface.dir/src/mls.cpp.o时,一直编译不过。编译PC主要是消耗内存很大,CPU其实占用很少。所以生成swap内存尽量大一些,至少6G

编译完成后,把上面提到的两个cmake文件复制到/usr/lib/aarch64-linux-gnu/cmake/pcl,在/usr/local/lib中有很多大文件,超过100M的有

1
2
3
4
5
6
7
/usr/local/lib/libpcl_sample_consensus.so.1.10.0
/usr/local/lib/libpcl_filters.so.1.10.0
/usr/local/lib/libpcl_features.so.1.10.0
/usr/local/lib/libpcl_segmentation.so.1.10.0
/usr/local/lib/libpcl_surface.so.1.10.0
/usr/local/lib/libpcl_registration.so.1.10.0
/usr/local/lib/libpcl_recognition.so.1.10.0

重新编译cartographer,就可以成功了。

参考:
旭日x3派上电记录
串口驱动安装
PCL交叉编译