You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Software_Architecture/facelightcontrol/README_faceLight.md

112 lines
2.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# FaceLight 命令行控制工具
## 编译方法
```bash
# 使用新的CMakeLists.txt编译
mkdir build2
cd build2
cmake -f ../CMakeLists2.txt ..
make
# 编译完成后,可执行文件位于 bin/faceLightClient2
```
## 使用方法
### 基本语法
```bash
./bin/faceLightClient2 [选项]
```
### 可用选项
| 选项 | 长选项 | 参数 | 说明 |
|------|--------|------|------|
| -m | --mode | MODE | 控制模式all\|single\|cycle\|custom\|pattern |
| -c | --color | COLOR | 颜色red\|green\|blue\|yellow\|white\|black |
| -i | --index | INDEX | LED索引0-11用于single模式 |
| -d | --delay | DELAY | 延时毫秒默认2000 |
| -p | --pattern | PATTERN | 自定义图案:"0:red,1:green,2:blue" |
| -t | --times | TIMES | 循环次数,默认无限 |
| -h | --help | | 显示帮助信息 |
### 控制模式说明
#### 1. all - 全部LED同色
所有LED使用相同颜色
```bash
./bin/faceLightClient2 -m all -c red # 全部LED红色
./bin/faceLightClient2 -m all -c blue # 全部LED蓝色
```
#### 2. single - 单个LED控制
控制指定索引的单个LED
```bash
./bin/faceLightClient2 -m single -i 0 -c red # LED 0 红色
./bin/faceLightClient2 -m single -i 5 -c green # LED 5 绿色
```
#### 3. cycle - 颜色循环
自动循环显示不同颜色
```bash
./bin/faceLightClient2 -m cycle # 无限循环
./bin/faceLightClient2 -m cycle -t 3 # 循环3次
./bin/faceLightClient2 -m cycle -d 1000 -t 5 # 每秒切换循环5次
```
#### 4. custom - RGB交替模式
原始示例程序的RGB交替模式
```bash
./bin/faceLightClient2 -m custom
```
#### 5. pattern - 自定义图案
根据指定的图案设置不同LED
```bash
./bin/faceLightClient2 -m pattern -p "0:red,1:green,2:blue"
./bin/faceLightClient2 -m pattern -p "0:red,5:green,10:blue"
```
### 使用示例
```bash
# 1. 查看帮助
./bin/faceLightClient2 -h
# 2. 设置所有LED为红色
./bin/faceLightClient2 -m all -c red
# 3. 设置第0个LED为蓝色其他关闭
./bin/faceLightClient2 -m single -i 0 -c blue
# 4. 颜色循环每1秒切换一次循环10次
./bin/faceLightClient2 -m cycle -d 1000 -t 10
# 5. 自定义图案0号红色3号绿色6号蓝色
./bin/faceLightClient2 -m pattern -p "0:red,3:green,6:blue"
# 6. RGB交替模式
./bin/faceLightClient2 -m custom
```
## LED索引说明
机器狗面部LED索引范围0-11
- 具体的LED位置映射请参考硬件文档
## 可用颜色
- red红色
- green绿色
- blue蓝色
- yellow黄色
- white白色
- black黑色/关闭)
## 注意事项
1. 使用前确保已正确连接到机器狗系统
2. 确保libfaceLight_SDK_arm64.so库文件在lib目录中
3. 程序需要在机器狗系统上运行ARM64架构
4. 设置颜色后需要调用sendCmd()函数才能生效(程序已自动处理)