Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/site/notes/List.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
{"dg-publish":true,"dg-path":"计算机/Python/List.md","permalink":"/计算机/Python/List/","dgPassFrontmatter":true,"noteIcon":"","created":"2024-05-21T15:20:27.860+08:00","updated":"2025-11-17T10:04:53.543+08:00"}
{"dg-publish":true,"dg-path":"计算机/Python/List.md","permalink":"/计算机/Python/List/","dgPassFrontmatter":true,"noteIcon":"","created":"2024-05-21T15:20:27.860+08:00","updated":"2026-01-02T23:30:20.594+08:00"}
---


Expand Down Expand Up @@ -78,9 +78,9 @@ l1.extend(l2)
```

#### Remove
`pop() ` method removes and returns value :移除指定索引的元素,并返回该元素的值, 未指定参数时,默认弹出最后一个元素
`del` removes it without returning anything:移除特定索引的元素(不会返回值)
`remove()` remove a specific value : 移除特定值的元素
`pop() ` method removes and returns value :**移除指定索引**的元素,并返回该元素的值, 未指定参数时,默认弹出最后一个元素
`del` removes it without returning anything:**移除特定索引**的元素(不会返回值)
`remove()` remove a specific value : **移除特定值**的元素
`clear()`  remove all items : 清除所有的元素
使用 [[set\|Set]] 移除重复的元素

Expand Down
7 changes: 6 additions & 1 deletion src/site/notes/Nonlinear.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
{"dg-publish":true,"dg-home":true,"dg-pinned":true,"dg-path":"Nonlinear.md","dg-hide-in-graph":true,"permalink":"/Nonlinear/","hideInGraph":true,"pinned":true,"tags":["gardenEntry"],"dgPassFrontmatter":true,"noteIcon":"","created":"2025-08-03T22:30:48.520+08:00","updated":"2025-11-15T09:50:33.591+08:00"}
{"dg-publish":true,"dg-home":true,"dg-pinned":true,"dg-path":"Nonlinear.md","dg-hide-in-graph":true,"permalink":"/Nonlinear/","hideInGraph":true,"pinned":true,"tags":["gardenEntry"],"dgPassFrontmatter":true,"noteIcon":"","created":"2025-08-03T22:30:48.520+08:00","updated":"2026-01-09T22:17:19.533+08:00"}
---


Expand Down Expand Up @@ -107,4 +107,9 @@ root((本网站))

I'm grateful to **Obsidian** and the open-source plugin **Digital Garden**, which have enabled my knowledge network to be presented to the public.

***

近期的其他项目,欢迎体验、star、提意见 :
1. https://unlinearity.github.io/URDF-Visualizer/ 集成了 URDF 和 Xacro 解析的机器人文件可视化网站
2. https://unlinearity.github.io/Animated-Image-Creator/ 将静态图片序列转为 `.apng` 或 `webp` 的动态图片的实用网站

40 changes: 24 additions & 16 deletions src/site/notes/Python Data Types.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
{"dg-publish":true,"dg-path":"计算机/Python/Python Data Types.md","permalink":"/计算机/Python/Python Data Types/","dgPassFrontmatter":true,"noteIcon":"","created":"2024-04-16T13:01:27.460+08:00","updated":"2025-11-17T10:04:53.544+08:00"}
{"dg-publish":true,"dg-path":"计算机/Python/Python Data Types.md","permalink":"/计算机/Python/Python Data Types/","dgPassFrontmatter":true,"noteIcon":"","created":"2024-04-16T13:01:27.460+08:00","updated":"2026-01-03T11:20:10.571+08:00"}
---


Expand All @@ -11,29 +11,37 @@
`type()`
- Basic Data Types : store a single value
- Advanced Data Yypes : can store many items
[[Python Basic Data Types\|Python Basic Data Types]]
[[Python Comprehensions\|Python Comprehensions]]


| | 类型 | 可变性 | 可迭代 | 类型构造函数 |
| -------- | ----------------- | --------- | -------- | ----------- |
| Basic | Integer | immutable | | `int()` |
| Basic | Float | immutable | | `float()` |
| Basic | Boolean | immutable | | `bool()` |
| Basic | Complex numbers | immutable | | `complex()` |
| Basic | [[String\|String]] | immutable | Iterable | `str()` |
| Advanced | [[Range\|Range]] | immutable | Iterable | `range()` |
| Advanced | [[Tuple\|Tuple]] 元组 | immutable | Iterable | `tuple()` |
| Advanced | [[List\|List]] 列表 | mutable | Iterable | `list()` |
| Advanced | [[set\|Set]] 集合 | mutable | Iterable | `set()` |
| Advanced | [[Dictionary\|Dictionary]] 字典 | mutable | Iterable | `dict()` |
| 类别 | 类型 | 补充说明 | 类型构造函数 | 可变性 | 可迭代 |
| ---------------------------------- | ----------------- | ----------- | --------------- | --- | --- |
| [[Python Basic Data Types\|Basic]] | Integer | 整型数据 | `int()` | ❌ | ❌ |
| | Float | 浮点数 | `float()` | ❌ | ❌ |
| | Boolean | 布尔值 | `bool()` | ❌ | ❌ |
| | Complex numbers | 复数 | `complex()` | ❌ | ❌ |
| | [[String\|String]] | 字符串 | `str()` | ❌ | ✅ |
| Advanced | [[Range\|Range]] | 数值范围 | `range()` | ❌ | ✅ |
| | [[Tuple\|Tuple]] 元组 | 有序不可变序列 | `tuple()` | ❌ | ✅ |
| [[Python Comprehensions\|推导式]] | [[List\|List]] 列表 | 有序可变序列 | `list()` | ✅ | ✅ |
| | [[set\|Set]] 集合 | 无序不重复元素集 | `set()` | ✅ | ✅ |
| | [[Dictionary\|Dictionary]] 字典 | 键值对映射 | `dict()` | ✅ | ✅ |
| [[collections\|collections]] | defaultdict | 带默认值的字典 | `defaultdict()` | ✅ | ✅ |
| | Counter | 计数器,统计频率 | `Countere()` | ✅ | ✅ |
| | deque | 双端队列,高效两端操作 | `deque()` | ✅ | ✅ |
| | OrderedDict | 有序字典 | `OrderedDict()` | ✅ | ✅ |
| | namedtuple | 命名元组,字段名访问 | `namedtuple()` | ❌ | ✅ |
| | ChainMap | 多个字典的链式视图 | `ChainMap()` | ✅ | ✅ |
| | UserDict | 字典的用户友好包装器 | `UserDict()` | ✅ | ✅ |
| | UserList | 列表的用户友好包装器 | `UserList()` | ✅ | ✅ |
| | UserString | 字符串的用户友好包装器 | `UserString()` | ❌ | ✅ |


- mutable **可变**:  可以在原地修改其内容,不需要创建新对象
- immutable **不可变** : 一旦创建,内容 (值或内部元素) 不能被修改,如果尝试“修改”,实际上会创建一个新对象。
**变量名只是一个标签**,**不可变对象的值本身永远不会变**,当重新赋值时,不是改变了对象,而是指向了新的对象。

对于不变对象来说,调用对象自身的任意方法,也不会改变该对象自身的内容。相反,这些方法会创建新的对象并返回,这样,就保证了不可变对象本身永远是不可变的。


### Iterator
**Iterable** **可迭代对象** An object that implements another special method, called `__iter__`. This function returns an iterator.
是数据的容器,可以通过 `for` 循环遍历(但不能自己遍历,需要迭代器)。
Expand Down
7 changes: 3 additions & 4 deletions src/site/notes/Python.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
{"tags":["Programming"],"dg-publish":true,"dg-path":"计算机/Python/Python.md","dg-pinned":true,"permalink":"/计算机/Python/Python/","pinned":true,"dgPassFrontmatter":true,"noteIcon":"","created":"2024-05-21T15:20:27.000+08:00","updated":"2025-11-19T18:15:26.840+08:00"}
{"tags":["Programming"],"dg-publish":true,"dg-path":"计算机/Python/Python.md","dg-pinned":true,"permalink":"/计算机/Python/Python/","pinned":true,"dgPassFrontmatter":true,"noteIcon":"","created":"2024-05-21T15:20:27.000+08:00","updated":"2026-01-03T11:23:14.828+08:00"}
---


Expand All @@ -10,10 +10,10 @@
[[Python 函数\|Python 函数]]
[[Python 类与对象\|Python 类与对象]]

[[String\|Python 字符串操作]]

[[Python 输入输出\|Python 输入输出]]
[[Python 常用操作\|Python 常用操作]]

[[Python 常用操作\|Python 常用操作]]
[[Python 位运算\|Python 位运算]]
[[python日期处理\|python日期处理]]

Expand All @@ -23,7 +23,6 @@
### 二、常用库
[[Python Modules and Packages\|Python Modules and Packages]] [[pip\|pip]]


| 库名/工具 | 功能 |
| ---------------- | -------------- |
| [[Jupyter\|Jupyter]] | 核心平台 |
Expand Down
4 changes: 2 additions & 2 deletions src/site/notes/RMW.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
{"dg-path":"机器人/RMW.md","dg-publish":true,"permalink":"/机器人/RMW/","dgPassFrontmatter":true,"noteIcon":"","created":"2025-05-01T17:46:37.000+08:00","updated":"2025-10-27T18:46:10.000+08:00"}
{"dg-path":"机器人/RMW.md","dg-publish":true,"permalink":"/机器人/RMW/","dgPassFrontmatter":true,"noteIcon":"","created":"2025-05-01T17:46:37.000+08:00","updated":"2026-01-02T00:21:33.443+08:00"}
---

(terminology::**ROS Middleware Interface**)

> 是 ROS 2 架构中一个关键的中间层接口,全称为 **ROS 中间件接口**


它位于 [[ ROS 2\| ROS 2]] 软件架构中 [[RCL\|RCL]](ROS Client Library)与具体通信中间件(如 [[DDS\|DDS]])实现之间,扮演了中间抽象层的角色。
它位于 [[ROS2\|ROS2]] 软件架构中 [[RCL\|RCL]](ROS Client Library)与具体通信中间件(如 [[DDS\|DDS]])实现之间,扮演了中间抽象层的角色。

RMW 的主要作用是为上层提供一个标准化、与中间件无关的 API,使得 ROS 2 能够支持多种不同的底层通信中间件而无需修改上层逻辑,从而实现“中间件无关性”(middleware agnosticism)。

Expand Down
105 changes: 38 additions & 67 deletions src/site/notes/ROS 2.md → src/site/notes/ROS2.md
Original file line number Diff line number Diff line change
@@ -1,122 +1,93 @@
---
{"tags":["OpenSource","Framework"],"dg-publish":true,"dg-path":"机器人/ROS 2.md","permalink":"/机器人/ROS 2/","dgPassFrontmatter":true,"noteIcon":"","created":"2025-08-28T21:52:03.720+08:00","updated":"2025-11-07T21:49:00.000+08:00"}
{"tags":["OpenSource","Framework","Robotics"],"dg-publish":true,"dg-path":"机器人/ROS2.md","permalink":"/机器人/ROS2/","dgPassFrontmatter":true,"noteIcon":"","created":"2025-08-28T21:52:03.720+08:00","updated":"2026-01-03T16:44:57.245+08:00"}
---

(website::https://docs.ros.org/)
(terminology::**Robot Operating System 2**) 第二代机器人操作系统
是一个用于[[机器人\|机器人]]软件开发的开源框架。它提供了一套工具和库,使得开发者能够更容易地创建复杂的机器人应用程序。ROS的核心目标是实现代码的复用、模块化以及跨平台的机器人软件开发。
模块化、分布式

实际上是**软件库和工具集**,用于简化在各种机器人平台上创建复杂而强大的机器人行为的任务,即不重复造轮子。
ROS2 是在 ROS 的基础上设计开发的第二代机器人操作系统,可以帮助我们简化机器人开发任务,本质上是加速机器人落地的**软件库和工具集**。
(terminology::**Robot Operating System 2**) 第二代机器人操作系统[^1]
> 并不是一个传统意义上的操作系统(如 Windows 或 Linux),而是一个用于构建[[机器人\|机器人]]应用的开源**软件框架和中间件**。
> 它提供了一系列库、工具和约定,核心目标是实现代码的复用、模块化以及跨平台的机器人软件开发,使得软件的复用性更高,简化机器人开发任务,是加速机器人落地的**软件库和工具集**。

一个面向机器人的中间件、库和工具的集合。它为机器人应用开发提供了一种灵活的框架,用于编写机器人软件。它能够帮助开发者更容易地构建复杂的机器人系统,使得软件的复用性更高,
### 设计目标:面向真实世界应用
ROS 2 是对其前身 ROS 1 的彻底重新设计,旨在解决 ROS 1 在真实世界商业和研究应用中遇到的局限。其核心设计目标包括:

- **支持多机器人系统**: 提供开箱即用的、可靠的多机器人通信能力。
- **支持实时控制**: 改善对实时系统(Real-time Systems)的支持,满足高性能机器人(如机械臂)的控制需求。
- **支持嵌入式平台**: 能够轻松部署到资源受限的微控制器上。
- **支持生产环境**: 提升稳定性和安全性,使其适用于商业产品而非仅仅是学术研究。
### 相关章节
[[ROS2 相关基础\|ROS2 相关基础]]
[[ROS2 的安装\|ROS2 的安装]]
[[ROS2 Architecture\|ROS2 Architecture]]
[[ROS2 Package\|ROS2 Package]]
[[ROS2 Message\|ROS2 Message]]
[[ROS2 Communication\|ROS2 Communication]]
[[Ros2 bag\|Ros2 bag]]
[[ROS and mqtt 代码使用\|ROS and mqtt 代码使用]]

![Pasted image 20250501214912.png](../img/user/Functional%20files/Photo%20Resources/Pasted%20image%2020250501214912.png)


### 概念 Concepts
#### Basic Concepts
#### 概念 Concepts
Basic Concepts
[[ROS2 Nodes\|ROS2 Nodes]]
[[ROS2 Topics\|ROS2 Topics]]
[[ROS2 Services\|ROS2 Services]]
[[RCL\|RCL]]

### 实际实践
[[ROS2 Package\|ROS2 Package]]
[[ROS2 Message\|ROS2 Message]]
[[ROS2 Communication\|ROS2 Communication]]
#### 实际实践
创建工作区
编写节点 rclcpp 或 rclpy
编译构建 colcon build
运行节点 ros2 run
测试通信 ros2 topic echo / ros2 topic pub

### 相关工具





| 相关工具 | 简要介绍 |
| ---------- | ------------ |
| [[Rviz2\|Rviz2]] | Data |
| [[RQT\|RQT]] | GUI Framwork |
| [[Gazebo\|Gazebo]] | |
| [[Colcon\|Colcon]] | |




(terminology::**Robot Operating System 2**)
> ROS 2 (Robot Operating System 2) 并不是一个传统意义上的操作系统(如 Windows 或 Linux),而是一个用于构建[[机器人\|机器人]]应用的开源**软件框架和中间件**。它提供了一系列库、工具和约定,旨在简化创建复杂、鲁棒的机器人行为的难度。

### 设计目标:面向真实世界应用

ROS 2 是对其前身 ROS 1 的彻底重新设计,旨在解决 ROS 1 在真实世界商业和研究应用中遇到的局限。其核心设计目标包括:

- **支持多机器人系统**: 提供开箱即用的、可靠的多机器人通信能力。
- **支持实时控制**: 改善对实时系统(Real-time Systems)的支持,满足高性能机器人(如机械臂)的控制需求。
- **支持嵌入式平台**: 能够轻松部署到资源受限的微控制器上。
- **支持生产环境**: 提升稳定性和安全性,使其适用于商业产品而非仅仅是学术研究。
[[ROS and mqtt 代码使用\|ROS and mqtt 代码使用]]

### 核心概念:计算图模型 (Computation Graph)

一个 ROS 2 系统由一系列松散耦合的、可独立运行的**节点 (Nodes)** 组成,这些节点通过一个通用的通信层进行交互,形成一个“计算图”。
![Pasted image 20260101204203.png](../img/user/Functional%20files/Photo%20Resources/Pasted%20image%2020260101204203.png)

#### 1. 节点 (Nodes)

节点是 ROS 2 中的基本可执行单元。一个机器人系统通常由许多各司其职的节点组成。例如,一个节点负责从摄像头读取图像,另一个节点负责处理图像以检测障碍物,还有一个节点负责根据障碍物信息控制电机。

#### 2. 通信机制

节点之间通过三种核心机制进行通信:

- **话题 (Topics)**
- **模式**: **发布/订阅 (Publish/Subscribe)** 模式,是**多对多**的异步通信。
- **工作方式**: 一个节点(发布者)将消息发布到一个特定的话题上(如 `/camera/image`),其他任意数量的节点(订阅者)都可以订阅该话题以接收这些消息。
- **适用场景**: 持续的数据流传输,如传感器数据、机器人状态等。这是最常用的通信方式。

- **服务 (Services)**
- **模式**: **请求/响应 (Request/Response)** 模式,是**一对一**的同步通信。
- **工作方式**: 一个节点(客户端)向另一个节点(服务器)发送一个请求,并**等待**服务器处理并返回一个响应。
- **适用场景**: 需要远程过程调用(RPC)的场景,例如请求机器人执行一个特定的、耗时较短的计算或动作。

- **动作 (Actions)**
- **模式**: **带反馈的请求/响应**模式,是**一对一**的异步通信。
- **工作方式**: 客户端向服务器发送一个**目标 (Goal)**,服务器在执行任务的过程中会**周期性地发布反馈 (Feedback)**,并在任务完成后返回一个最终**结果 (Result)**。客户端可以随时取消任务。
- **适用场景**: 需要执行耗时较长、且需要过程监控的任务,如“导航到某个位置”、“旋转机械臂 30 度”等。

#### 3. 其他概念

- **参数 (Parameters)**: 每个节点都可以拥有可动态配置的参数,方便在不重新编译代码的情况下调整节点行为。
- **启动文件 (Launch Files)**: 使用 Python 编写的脚本,用于一次性地启动和配置一个包含多个节点的复杂系统。

### 与 ROS 1 的主要区别
| 类别 | ROS 1 | ROS 2 |
| ------ | ------------------ | --------------------- |
| 网络传输 | 基于TCP/UDP的自定义协议 | 现有标准(DDS),抽象层支持添加其他协议 |
| 网络架构 | 中央名称服务器(roscore) | 对等节点发现 |
| 平台支持 | Linux | Linux、Windows 和 macOS |
| 客户端库 | 各种语言独立编写 | 共享一个共同的底层C库(rcl) |
| 节点与进程 | 每个进程单节点 | 每个进程多节点 |
| 线程模型 | 回调队列和处理程序 | 可交换的执行器 |
| 节点状态管理 | 无 | 生命周期节点 |
| 嵌入式系统 | 最小实验性支持(rosserial) | 商业支持的实现(micro-ROS) |
| 参数访问 | 基于XMLRPC的辅助协议 | 使用服务调用实现 |
| 参数类型 | 赋值时推断类型 | 类型声明并强制执行 |

| 特性 | ROS 1 | ROS 2 |
|------------------|----------------------------------------|--------------------------------------------------------------------|
| **底层通信** | TCPROS/UDPROS (自定义) | **DDS (Data Distribution Service)**,一个工业级、标准化的实时中间件。 |
| **多机器人通信** | 需要复杂的手动网络配置 | **原生支持**,可自动发现和通信。 |
| **实时性** | 支持不佳 | **设计核心**,提供实时安全的 C++客户端库。 |
| **官方支持语言** | C++, Python | **C++, Python** (均为一等公民) |
| **安全性** | 基本没有 | **内置安全机制**,支持加密、认证和访问控制。 |

### 核心生态系统

- **Rviz2**: 强大的 3D 可视化工具,用于显示传感器数据、机器人模型和各种调试信息。
- **Gazebo**: 功能齐全的 3D 物理仿真环境,用于在部署到真实机器人之前进行算法测试。
- **MoveIt2**: 应用最广泛的开源运动规划框架,用于机械臂的路径规划、运动学求解和碰撞检测。
- **Nav2**: 完整的机器人自主导航框架。

---

> [[机器人\|机器人]]
| 相关工具 | 简要介绍 |
| ---------- | ------------ |
| [[Rviz2\|Rviz2]] | Data |
| [[RQT\|RQT]] | GUI Framwork |
| [[Gazebo\|Gazebo]] | |
| [[Colcon\|Colcon]] | |


[^1]: (website::https://docs.ros.org/)
Loading