ソースを参照

md文档添加

wangyingjie 1 日 前
コミット
8bf259c00f

BIN
ros2_humble_安装/3_file.lnk


BIN
ros2_humble_安装/images/logo.png


+ 207 - 0
ros2_humble_安装/ros2_humble_安装.md

@@ -0,0 +1,207 @@
+<!--
+ * @Author: wangyingjie 2778809626@qq.com
+ * @Date: 2025-03-28 07:25:01
+ * @LastEditors: wangyingjie 2778809626@qq.com
+ * @LastEditTime: 2025-04-14 09:35:43
+ * @FilePath: \undefinedd:\7_work\1_nnzn\1_file\ros2 humble 安装\Docker基础知识.md
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+-->
+
+<div align='right' ><a href = "http://www.nzznusv.com" target="_blank">青岛能征智能装备有限公司</a></div>
+
+---
+
+<br><br>
+
+
+![Logo](images/logo.png){ width=300 style="display: block; margin: 0 auto" }
+
+
+<br><br><br><br><br><br>
+
+<div align='center'> <font size = "8" face="Microsoft YaHei">青岛能征智能基础资料</font></div>
+
+<br><br><br><br>
+
+<div align='center'> <font size = "6" face="Microsoft YaHei">ros2 humble 安装</font></div>
+
+<br><br>
+<br><br>
+
+<div align='center'> <font size = "8" face="Microsoft YaHei">青岛能征智能装备有限公司</font></div>
+
+
+<br><br>
+<div align='right' ><a href = "http://www.nzznusv.com" target="_blank">青岛能征智能装备有限公司</a></div>
+
+---
+
+<div align='center'> <font size = "5">修订记录</font></div>
+
+|    日期    | 版本  | 描述 |  作者  |
+| :--------: | :---: | :--: | :----: |
+| 2025-03-28 | 1.0.0 | 初版 | 王英杰 |
+|            |       |      |        |
+|            |       |      |        |
+|            |       |      |        |
+
+
+
+<div STYLE="page-break-after: always;"></div>
+<br><br>
+
+<div align='right' ><a href = "http://www.nzznusv.com" target="_blank">青岛能征智能装备有限公司</a></div>
+
+---
+
+<div align='center'> <font size = "5">目录</font></div>
+[TOC]
+
+<div align='right' ><a href = "http://www.nzznusv.com" target="_blank">青岛能征智能装备有限公司</a></div>
+
+---
+
+# ros2 humble 安装
+
+-----
+
+## 1.设置utf8语言环境
+
+
+```shell
+locale  
+
+sudo apt update && sudo apt install locales
+sudo locale-gen en_US en_US.UTF-8
+sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
+export LANG=en_US.UTF-8
+
+locale  ## verify settings
+```
+
+
+## 2.设置源
+
+```shell
+sudo apt install software-properties-common
+sudo add-apt-repository universe
+```
+
+使用 apt 添加 ROS 2 GPG 密钥
+
+```shell
+sudo apt update && sudo apt install curl -y
+
+sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key \ 
+-o /usr/share/keyrings/ros-archive-keyring.gpg
+
+#############
+
+上面是指令是将 https://raw.githubusercontent.com/ros/rosdistro/master/ros.key 文件
+下载下来放到 /usr/share/keyrings/目录下改名为ros-archive-keyring.gpg
+这个网站如果访问不到的话可以直接去 https://gitee.com/master-turtle/ros2_demo 
+这个地址下载 ros.key文件然后复制到 
+/usr/share/keyrings/目录下改名为ros-archive-keyring.gpg
+```
+
+接下来将软件源添加到您的源列表中
+
+```shell
+echo "deb [arch=$(dpkg --print-architecture) \
+signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] \
+http://packages.ros.org/ros2/ubuntu \
+$(. /etc/os-release && echo $UBUNTU_CODENAME) main" | \
+sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
+```
+
+## 3.安装ros2
+
+```shell
+sudo apt-get update
+sudo apt-get upgrade
+```
+
+桌面安装(推荐):ROS、RViz、演示、教程。
+
+```shell
+sudo apt install ros-humble-desktop
+```
+
+添加环境变量
+
+```shell
+echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
+source ~/.bashrc
+```
+也就是在~/.bashrc文件后面添加`source /opt/ros/humble/setup.bash`
+
+## 4.安装 colcon
+
+```shell
+sudo apt install python3-colcon-common-extensions
+```
+
+## 5.ros2 安装验证
+
+```shell
+wub@wub:~$ ros2 run demo_nodes_cpp talker
+[INFO] [1714036035.679785136] [talker]: Publishing: 'Hello World: 1'
+[INFO] [1714036036.679330436] [talker]: Publishing: 'Hello World: 2'
+[INFO] [1714036037.679588162] [talker]: Publishing: 'Hello World: 3'
+[INFO] [1714036038.679293145] [talker]: Publishing: 'Hello World: 4'
+
+## 另外建一个终端
+wub@wub:~$ ros2 run demo_nodes_py listener
+[INFO] [1714036273.699201424] [listener]: I heard: [Hello World: 239]
+[INFO] [1714036274.671316847] [listener]: I heard: [Hello World: 240]
+[INFO] [1714036275.670648235] [listener]: I heard: [Hello World: 241]
+
+```
+
+
+## 6.rqt 安装
+
+
+```bash
+sudo apt install ros-humble-rqt
+```
+
+## 7.tf2 安装
+
+```bash
+sudo apt install ros-humble-tf2-tools
+```
+
+## 8.gazebo 安装
+
+gazebo 是一个模型仿真的软件,按需要装,如果不是仿真可以不装
+
+
+```bash
+sudo apt install ros-humble-gazebo-*
+ros2 launch gazebo_ros gazebo.launch.py
+```
+
+
+
+## 9.卸载
+
+
+如果您需要卸载ROS 2或在已从二进制文件安装后切换到基于源代码的安装,请运行以下命令:
+
+```bash
+sudo apt remove ~nros-humble-* && sudo apt autoremove
+```
+
+您还可以删除存储库:
+
+```bash
+sudo rm /etc/apt/sources.list.d/ros2.list
+sudo apt update
+sudo apt autoremove
+
+sudo apt upgrade
+```
+
+
+

BIN
vcpkg安装与配置/images/logo.png


+ 222 - 0
vcpkg安装与配置/vcpkg安装与配置.md

@@ -0,0 +1,222 @@
+<!--
+ * @Author: wangyingjie 2778809626@qq.com
+ * @Date: 2025-03-28 07:25:01
+ * @LastEditors: wangyingjie 2778809626@qq.com
+ * @LastEditTime: 2025-04-13 16:12:18
+ * @FilePath: \undefinedd:\7_work\1_nnzn\1_file\能征智能vcpkg安装与配置\Docker基础知识.md
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+-->
+
+
+<div align='right' ><a href = "http://www.nzznusv.com" target="_blank">青岛能征智能装备有限公司</a></div>
+
+---
+
+<br><br>
+
+
+![Logo](images/logo.png){ width=300 style="display: block; margin: 0 auto" }
+
+
+<br><br><br><br><br><br>
+
+<div align='center'> <font size = "8" face="Microsoft YaHei">青岛能征智能基础资料</font></div>
+
+<br><br><br><br>
+
+<div align='center'> <font size = "6" face="Microsoft YaHei">vcpkg安装与配置</font></div>
+
+<br><br>
+<br><br>
+
+<div align='center'> <font size = "8" face="Microsoft YaHei">青岛能征智能装备有限公司</font></div>
+
+
+<br><br>
+<div align='right' ><a href = "http://www.nzznusv.com" target="_blank">青岛能征智能装备有限公司</a></div>
+
+---
+
+<div align='center'> <font size = "5">修订记录</font></div>
+
+|    日期    | 版本  | 描述 |  作者  |
+| :--------: | :---: | :--: | :----: |
+| 2025-04-12 | 1.0.0 | 初版 | 王英杰 |
+|            |       |      |        |
+|            |       |      |        |
+|            |       |      |        |
+
+
+
+<div STYLE="page-break-after: always;"></div>
+<br><br>
+
+<div align='right' ><a href = "http://www.nzznusv.com" target="_blank">青岛能征智能装备有限公司</a></div>
+
+---
+
+<div align='center'> <font size = "5">目录</font></div>
+[TOC]
+
+<div align='right' ><a href = "http://www.nzznusv.com" target="_blank">青岛能征智能装备有限公司</a></div>
+
+---
+
+
+# Windows
+
+## 1.构建vcpkg
+
+- 平台 visual studio 2019
+- c++库管理工具
+- vcpkg + vcpkg 使用方法
+
+```bash
+# 拉取
+git clone https://github.com/Microsoft/vcpkg.git
+也可以直接使用 下载好的固定版本的vcpkg 暂定使用 vcpkg-2025.02.14.zip
+
+## 构建
+\vcpkg\bootstrap-vcpkg.bat
+
+## 集成vcpkg 到visual studio
+vcpkg integrate install
+
+```
+
+## 2.添加环境变量方便vcpkg使用
+
+```bash
+# vcpkg 主目录
+VCPKG_HOME = git 下载的目录:D:\3_env\2_vcpkg\vcpkg 该目录下就是vcpkg可执行程序的目录
+
+# vcpkg 安装编译的默认版本
+VCPKG_DEFAULT_TRIPLET = x64-windows 
+
+# vcpkg 国内镜像地址, 不设置此项可能需要翻墙才能下载源代码才能编译
+X_VCPKG_ASSET_SOURCES = x-azurl,http://106.15.181.5/
+
+```
+
+## 3.visual studio 2019设置
+
+```bash
+工具 -> 选项 -> NuGet包管理器 -> 程序包源   添加-> 名称: vcpkg   源: 
+{VCPKG_HOME}\scripts\buildsystems   点击更新
+```
+至此,可以通过vcpkg自动编译所需要的库,并且vcpkg会帮助visual studio 2019自动找编译过程中需要依赖的lib, 
+visual studio 2019 默认会从{VCPKG_HOME}\installed\windows*\include 中寻找头文件,不再需要显式的添加头文
+件所在目录.
+visual studio 2019 先安装英文语言包,以避免有些库并没有适配中文的项目可以构建导致的库编译失败.
+
+## 4.安装依赖库
+
+通过 vcpkg 安装项目需要的依赖库:
+
+```bash
+vcpkg install jsoncpp
+vcpkg install zlib
+vcpkg install libiconv
+vcpkg install spdlog
+vcpkg install polyclipping
+vcpkg install boost
+```
+
+
+# Linux
+
+
+## 1.安装依赖
+
+首先,确保你的系统已经安装了以下工具:
+- **Git**
+- **CMake**
+- **G++ (C++ 编译器)**
+
+你可以通过以下命令安装这些工具(适用于 Ubuntu):
+
+```bash
+sudo apt update
+sudo apt install -y git cmake g++
+```
+
+## 2.克隆 vcpkg 源码
+
+使用 Git 克隆 vcpkg 仓库:
+
+```bash
+git clone https://github.com/microsoft/vcpkg.git
+也可以直接使用 下载好的固定版本的vcpkg 暂定使用 vcpkg-2025.02.14.zip
+```
+
+## 3.构建 vcpkg
+
+进入 `vcpkg` 目录并运行 bootstrap 脚本来构建 vcpkg:
+
+```bash
+cd vcpkg
+bootstrap-vcpkg.sh
+```
+
+
+该命令会自动配置系统,使得 CMake 可以使用 vcpkg 管理的库。
+
+## 4.配置环境变量
+
+为方便在系统中使用 vcpkg,可以将 vcpkg 的路径添加到环境变量中。在 `~/.bashrc` 文件(如果使用的是 bash shell)中添加以下内容:
+
+```bash
+export VCPKG_ROOT=/path/to/vcpkg
+export PATH=$VCPKG_ROOT:$PATH
+```
+
+然后执行以下命令使更改生效:
+
+```bash
+source ~/.bashrc
+```
+
+## 5.安装依赖库
+
+现在,你可以使用 vcpkg 安装所需的库。比如,要安装 `rapidjson`、`libcurl`、`libiconv`、`cryptopp` 等库,可以使用以下命令:
+
+```bash
+vcpkg install rapidjson
+vcpkg install libcurl
+vcpkg install libiconv
+vcpkg install cryptopp
+vcpkg install sqlite3
+vcpkg install log4cxx
+```
+
+如果你希望为不同的架构安装库(如 64 位或 32 位),可以使用 `x64-linux` 或 `x86-linux` 作为 triplet。例如,安装 64 位的 `libcurl`:
+
+```bash
+vcpkg install libcurl:x64-linux
+```
+
+## 7.使用 vcpkg 管理的库
+
+在使用 CMake 构建项目时,确保 vcpkg 已经集成,并且在 CMake 配置中能够找到这些库。你可以通过设置 `CMAKE_TOOLCHAIN_FILE` 来告诉 CMake 使用 vcpkg:
+
+```bash
+cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake ..
+```
+
+## 8.其他可选配置
+
+**指定国内镜像**(如果遇到下载速度慢的问题),可以设置 vcpkg 使用国内镜像下载源:
+  
+编辑 `~/.bashrc` 文件,加入如下配置:
+
+```bash
+export X_VCPKG_ASSET_SOURCES="x-azurl,http://106.15.181.5/"
+```
+
+然后执行:
+
+```bash
+source ~/.bashrc
+```
+
+