From 2710351fbf95ddc2ed03c8f5b73926fa9892287b Mon Sep 17 00:00:00 2001 From: zhanli <719901725@qq.com> Date: Sat, 3 Feb 2024 20:45:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0OpenCV=E7=9A=84=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E6=95=99=E7=A8=8B=E5=92=8C=E8=A1=A5=E5=85=85Pibot=5Fr?= =?UTF-8?q?os=E4=BD=BF=E7=94=A8=E6=95=99=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Docs/2.PIbot-ROS安装.md | 14 +++++- ...算法环境搭建—OpenCV编译安装.md | 46 +++++++++++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 Docs/3. 割草机器人算法环境搭建—OpenCV编译安装.md diff --git a/Docs/2.PIbot-ROS安装.md b/Docs/2.PIbot-ROS安装.md index 9be3a35..ddf203d 100644 --- a/Docs/2.PIbot-ROS安装.md +++ b/Docs/2.PIbot-ROS安装.md @@ -118,13 +118,23 @@ sed -i '/.*wiki.t-firefly.com.*/s/^#//' /etc/apt/sources.list #### 2.5 功能测试 +​ 功能测试前可能有一些依赖没有完全安装完成,可能会造成一些问题,根据下面的步骤补充一下依赖的安装。 + +```shell +# 先安装控制所需要的依赖 +sudo apt-get install ros-noetic-teleop-twist-keyboard +# 安装python,一般在前面的步骤就已经安装了 +sudo apt install -y python3 +# 创建python的软链接,因为后续的代码执行用到了python xxxx.py +sudo ln -s /usr/bin/python3 /usr/bin/python +``` + ​ 完成2.3中的步骤后,就可以通过`pibot`提供的脚本控制小车的运动。 ```shell # 1.先启动pibot_bringup, 它负责pibot底盘的基本通信(必要),或者运行roslaunch pibot_bringup bringup.launch pibot_bringup -# 2.启动pibot的配置界面,但是由于RK35**平台安装的PyQ5存在问题,参照 -# https://blog.csdn.net/fhqlongteng/article/details/130113779解决,这个不是启动小车控制的必要条件 +# 2.启动pibot的配置界面 # 或者采用命令 rosrun rqt_reconfigure rqt_reconfigure pibot_configure # 3. 启动小车控制, 或者使用命令 roslaunch pibot keyboard_teleop.launch diff --git a/Docs/3. 割草机器人算法环境搭建—OpenCV编译安装.md b/Docs/3. 割草机器人算法环境搭建—OpenCV编译安装.md new file mode 100644 index 0000000..eb6f792 --- /dev/null +++ b/Docs/3. 割草机器人算法环境搭建—OpenCV编译安装.md @@ -0,0 +1,46 @@ +# 割草机器人算法环境搭建——OpenCV编译安装 + +### 一、说明 + +​ 割草机器人项目的算法采用`opencv 3.4.3`的版本,在RK3588上编译大约需要花费1到2个小时左右。步骤比较简单,按照下面的步骤一步步输入命令即可。 + +> `OpenCV`安装3.4.3版本 +> +> 下载地址:1) 官方下载地址 https://github.com/opencv/opencv/archive/3.4.3.zip 2)http://logzhan.ticp.io:30000/Mirrors/opencv-3.4.3 + +### 二、OpenCV的代码下载和编译 + +```shell +# 方法1 wget https://github.com/opencv/opencv/archive/3.4.3.zip +# 方法2 git clone http://logzhan.ticp.io:30000/Mirrors/opencv-3.4.3.git +unzip opencv-3.4.3.zip +cd opencv-3.4.3 +mkdir build +cd build +cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. +make +sudo make install +``` + +### 三、OpenCV的环境配置 + +​ `OpenCV`安装好后,需要配置一下环境才能正常使用,配置的步骤如下。 + +```shell +# 1.添加库路径 +sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf' +# 2.更新系统库 +sudo ldconfig +# 3.配置bash +sudo gedit /etc/bash.bashrc +# 4.在末尾粘贴这两行代码 +PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig +export PKG_CONFIG_PATH +# 5.保存后,执行如下命令使得配置生效 +source /etc/bash.bashrc +# 6.安装mlocate +sudo apt-get install mlocate +sudo updatedb +# 7.检测opencv版本 +pkg-config --modversion opencv +``` \ No newline at end of file