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
2 changes: 1 addition & 1 deletion docs/basic_coding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sidebar_position: 4

## 本章前提

各页的示例假定工程已按 [CMake 配置](./cmake.md) 链接 `xr`,并包含 `libxr.hpp`。外设驱动的头文件(如 `uart.hpp`、`gpio.hpp`)和部分工具头文件(如 `pid.hpp`、`cycle_value.hpp`、`serialized_service.hpp`)不在 `libxr.hpp` 中,使用时单独包含。开启 `LIBXR_NO_EIGEN` 时,`transform.hpp`、`kinematic.hpp` 和 `inertia.hpp` 的内容不参与编译。
各页的示例假定工程已按 [CMake 配置](./cmake.md) 链接 `xr`,并包含 `libxr.hpp`。外设驱动的头文件(如 `uart.hpp`、`gpio.hpp`)和部分工具头文件(如 `pid.hpp`、`cycle_value.hpp`、`serialized_service.hpp`)不在 `libxr.hpp` 中,使用时单独包含。

程序先调用一次 `LibXR::PlatformInit()`,再使用 LibXR 的其他功能,各后端的参数与调用顺序见[平台初始化](./system/README.md#平台初始化)。以下是 Linux 上的最小程序,运行后输出 `Hello, 42`:

Expand Down
1 change: 0 additions & 1 deletion docs/basic_coding/cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ CMake 内部会把配置名称转换为小写。交叉编译时须设置 `LIBXR_

| 选项 | 作用 |
| --- | --- |
| `LIBXR_NO_EIGEN` | 不编译依赖 Eigen 的几何与运动学部分 |
| `LIBXR_DEFAULT_SCALAR` | 默认数学标量类型,默认 `double` |
| `LIBXR_SINGLE_CORE` | 单核并发对齐策略 |
| `LIBXR_DEV_ASSERT_BUILD` | 启用维护者断言,默认关闭 |
Expand Down
2 changes: 1 addition & 1 deletion docs/basic_coding/utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar_position: 6

本节汇总 LibXR 的工具和数学类型。

`libxr.hpp` 导出 `Flag`、`Transform`、`Inertia` 和 `Kinematic`;`SerializedService`、`PID`、`CycleValue`、`FloatEncoder` 和 CRC 类按各页面示例分别包含 `serialized_service.hpp`、`pid.hpp`、`cycle_value.hpp`、`float_encoder.hpp` 和 `crc.hpp`。`Transform`、`Inertia`、`Kinematic` 基于 Eigen,定义 `LIBXR_NO_EIGEN` 时这三组类型不参与编译。
`libxr.hpp` 导出 `Flag`、`Transform`、`Inertia` 和 `Kinematic`;`SerializedService`、`PID`、`CycleValue`、`FloatEncoder` 和 CRC 类按各页面示例分别包含 `serialized_service.hpp`、`pid.hpp`、`cycle_value.hpp`、`float_encoder.hpp` 和 `crc.hpp`。`Transform`、`Inertia`、`Kinematic` 基于 Eigen。

## 目录

Expand Down
3 changes: 0 additions & 3 deletions docs/basic_coding/utils/inertia.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ sidebar_position: 3
- `LibXR::Inertia<Scalar>`:刚体惯性张量与质量;
- `LibXR::CenterOfMass<Scalar>`:质心位置与质量。

与 [Transform](./transform.md) 页面中的类型一样,这一组接口也受 `LIBXR_NO_EIGEN` 控制。

---

## 1. `Inertia<Scalar>`
Expand Down Expand Up @@ -101,4 +99,3 @@ LibXR::CenterOfMass<> cog(rotated, pose);

- 如果只需要“几何姿态”,使用 `Transform / Quaternion / RotationMatrix` 即可;只有在涉及质量分布、质心、惯性换算时才需要 `Inertia`。
- `Translate()` 和 `Rotate()` 会返回新的惯性对象,适合按坐标系变换链逐步构造结果。
- 当工程关闭 Eigen(`LIBXR_NO_EIGEN`)时,这些类型不可用,不应作为公共模块边界的一部分。
2 changes: 0 additions & 2 deletions docs/basic_coding/utils/kinematic.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ namespace LibXR::Kinematic

它主要面向串联关节结构的前向运动学、目标姿态传播、逆运动学求解、惯性分布与质心计算。

与 [Transform](./transform.md) 和 [Inertia](./inertia.md) 一样,这一组接口受 `LIBXR_NO_EIGEN` 控制。

---

## 1. 核心类型
Expand Down
6 changes: 0 additions & 6 deletions docs/basic_coding/utils/transform.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ sidebar_position: 2

`transform.hpp` 提供 LibXR 的几何基础类型,包括位置、方向、欧拉角、旋转矩阵、四元数与刚体变换。

这些类型受 `LIBXR_NO_EIGEN` 控制:

- 未定义 `LIBXR_NO_EIGEN` 时,相关类型可用;
- 定义 `LIBXR_NO_EIGEN` 时,整个头文件内容不会参与编译。

模板参数默认使用:

```cpp
Expand Down Expand Up @@ -138,4 +133,3 @@ auto t_body_tool = t_body_world + t_world_tool;

- 需要统一姿态表示时,优先在模块边界固定一种主表示,例如内部统一用四元数,对外按需转欧拉角。
- 如果项目对欧拉角顺序敏感,不要只写 `ToEulerAngle()` / `ToQuaternion()`,应显式写成 `...ZYX()`、`...XYZ()` 等具体接口。
- 若工程启用了 `LIBXR_NO_EIGEN`,则这些类型不应作为公共接口依赖。
3 changes: 1 addition & 2 deletions docs/env_setup/hpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ cmake --build --preset release-flash-xip

## CMake 集成

`cmake/LibXR.CMake` 用三个变量选择平台,然后把 LibXR 作为子工程加入:
`cmake/LibXR.CMake` 用两个变量选择平台,然后把 LibXR 作为子工程加入:

```cmake
set(LIBXR_SYSTEM None)
set(LIBXR_DRIVER hpm)
set(LIBXR_NO_EIGEN True)
```

`xr` 链接 `${HPM_SDK_LIB_ITF}`,LibXR 因此使用与 SDK 相同的编译选项和头文件路径;应用目标 `app` 和最终的 ELF 目标链接 `xr`。工具链的探测由 `find_package(hpm-sdk)` 完成。
Expand Down
3 changes: 1 addition & 2 deletions docs/env_setup/mspm0.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,11 @@ BSP 的目录结构如下:

## CMake 集成

`cmake/LibXR.CMake` 用三个变量把 LibXR 接入工程:
`cmake/LibXR.CMake` 用两个变量把 LibXR 接入工程:

```cmake
set(LIBXR_SYSTEM None)
set(LIBXR_DRIVER mspm0)
set(LIBXR_NO_EIGEN True)
```

`LIBXR_SYSTEM None` 表示裸机系统,`LIBXR_DRIVER mspm0` 启用 LibXR 的 `driver/mspm0` 驱动目录。链接选项与 SDK 例程的 gcc makefile 相同(`-nostartfiles`、`--specs=nano.specs`、`--specs=nosys.specs`),C++ 运行时因此缺少的 `__dso_handle`、`_getpid` 和 `_kill` 由 LibXR 的 `driver/mspm0/mspm0_syscalls.c` 以弱定义提供,工程需要时可以自行定义。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This chapter introduces LibXR's CMake configuration and basic APIs. The basic AP

## Prerequisites

The examples in this chapter assume a project that links `xr` as described in [CMake Configuration](./cmake.md) and includes `libxr.hpp`. Device driver headers (such as `uart.hpp` and `gpio.hpp`) and some utility headers (such as `pid.hpp`, `cycle_value.hpp` and `serialized_service.hpp`) are not part of `libxr.hpp` and are included separately. With `LIBXR_NO_EIGEN` enabled, the contents of `transform.hpp`, `kinematic.hpp` and `inertia.hpp` are not compiled.
The examples in this chapter assume a project that links `xr` as described in [CMake Configuration](./cmake.md) and includes `libxr.hpp`. Device driver headers (such as `uart.hpp` and `gpio.hpp`) and some utility headers (such as `pid.hpp`, `cycle_value.hpp` and `serialized_service.hpp`) are not part of `libxr.hpp` and are included separately.

A program calls `LibXR::PlatformInit()` once before using other LibXR features; the parameters and the call order on each backend are described in [Platform initialization](./system/README.md#platform-initialization). The minimal Linux program below prints `Hello, 42`:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ Names are normalized to lowercase internally. Cross-compiling requires `LIBXR_SY

| Option | Purpose |
| --- | --- |
| `LIBXR_NO_EIGEN` | Exclude Eigen-dependent geometry and kinematics |
| `LIBXR_DEFAULT_SCALAR` | Default math scalar, `double` by default |
| `LIBXR_SINGLE_CORE` | Single-core concurrency alignment policy |
| `LIBXR_DEV_ASSERT_BUILD` | Enable maintainer assertions; OFF by default |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar_position: 6

This section covers the LibXR utility and math types.

`libxr.hpp` exports `Flag`, `Transform`, `Inertia`, and `Kinematic`; `SerializedService`, `PID`, `CycleValue`, `FloatEncoder`, and the CRC classes are included separately through `serialized_service.hpp`, `pid.hpp`, `cycle_value.hpp`, `float_encoder.hpp`, and `crc.hpp`, as shown on each page. `Transform`, `Inertia`, and `Kinematic` are built on Eigen; defining `LIBXR_NO_EIGEN` removes these three from the build.
`libxr.hpp` exports `Flag`, `Transform`, `Inertia`, and `Kinematic`; `SerializedService`, `PID`, `CycleValue`, `FloatEncoder`, and the CRC classes are included separately through `serialized_service.hpp`, `pid.hpp`, `cycle_value.hpp`, `float_encoder.hpp`, and `crc.hpp`, as shown on each page. `Transform`, `Inertia`, and `Kinematic` are built on Eigen.

## Contents

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ sidebar_position: 3
- `LibXR::Inertia<Scalar>`: rigid-body inertia tensor plus mass
- `LibXR::CenterOfMass<Scalar>`: center-of-mass position plus mass

Like the types described on the [Transform](./transform.md) page, this group is also gated by `LIBXR_NO_EIGEN`.

---

## 1. `Inertia<Scalar>`
Expand Down Expand Up @@ -101,4 +99,3 @@ LibXR::CenterOfMass<> cog(rotated, pose);

- For geometry and pose only, `Transform / Quaternion / RotationMatrix` are enough; `Inertia` is needed when mass distribution, center of mass, or inertia conversion matters.
- `Translate()` and `Rotate()` return new inertia objects, which fits transformation-chain style calculations well.
- When the build disables Eigen through `LIBXR_NO_EIGEN`, these types are unavailable and should not be part of public module boundaries.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ namespace LibXR::Kinematic

It is mainly intended for serial joint structures and covers forward kinematics, target-state propagation, inverse-kinematics solving, inertia distribution, and center-of-mass calculation.

Like [Transform](./transform.md) and [Inertia](./inertia.md), this group is gated by `LIBXR_NO_EIGEN`.

---

## 1. Core types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ sidebar_position: 2

`transform.hpp` provides the geometry foundation types in LibXR, including position, direction, Euler angles, rotation matrices, quaternions, and rigid transforms.

These types are gated by `LIBXR_NO_EIGEN`:

- when `LIBXR_NO_EIGEN` is not defined, the types are available
- when `LIBXR_NO_EIGEN` is defined, the whole header body is excluded from compilation

Their default template parameter comes from:

```cpp
Expand Down Expand Up @@ -138,4 +133,3 @@ auto t_body_tool = t_body_world + t_world_tool;

- For one consistent attitude representation, fix a primary representation at module boundaries, for example quaternions internally and Euler angles only for UI / configuration.
- If Euler order matters, prefer explicit calls such as `ToEulerAngleZYX()` or `ToQuaternionXYZ()` instead of the default helpers.
- If the build uses `LIBXR_NO_EIGEN`, these types should not appear in public interfaces.
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ The artifacts land in `build/output/`, for example `demo.elf` and `demo.bin`.

## CMake Integration

`cmake/LibXR.CMake` selects the platform with three variables and adds LibXR as a subproject:
`cmake/LibXR.CMake` selects the platform with two variables and adds LibXR as a subproject:

```cmake
set(LIBXR_SYSTEM None)
set(LIBXR_DRIVER hpm)
set(LIBXR_NO_EIGEN True)
```

`xr` links `${HPM_SDK_LIB_ITF}`, so LibXR compiles with the same options and include paths as the SDK; the application target `app` and the final ELF target link `xr`. Toolchain detection is handled by `find_package(hpm-sdk)`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,11 @@ The BSP directory structure:

## CMake Integration

`cmake/LibXR.CMake` brings LibXR into the project with three variables:
`cmake/LibXR.CMake` brings LibXR into the project with two variables:

```cmake
set(LIBXR_SYSTEM None)
set(LIBXR_DRIVER mspm0)
set(LIBXR_NO_EIGEN True)
```

`LIBXR_SYSTEM None` is the bare-metal system and `LIBXR_DRIVER mspm0` enables the LibXR `driver/mspm0` driver directory. The link options are those of the SDK example gcc makefiles (`-nostartfiles`, `--specs=nano.specs`, `--specs=nosys.specs`), and `__dso_handle`, `_getpid` and `_kill`, which the C++ runtime then lacks, are provided as weak definitions by the LibXR `driver/mspm0/mspm0_syscalls.c`; a project can define its own.
Expand Down
Loading