Skip to content

Commit b3ae2e4

Browse files
authored
Merge pull request #6 from 78/main
otto新增动作和AI自定义编程动作MCP工具 (78#1365)
2 parents 7ff70a1 + e39a46c commit b3ae2e4

File tree

9 files changed

+927
-171
lines changed

9 files changed

+927
-171
lines changed

main/boards/electron-bot/electron_emoji_display.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void ElectronEmojiDisplay::SetupChatLabel() {
8989
chat_message_label_ = lv_label_create(container_);
9090
lv_label_set_text(chat_message_label_, "");
9191
lv_obj_set_width(chat_message_label_, width_ * 0.9); // 限制宽度为屏幕宽度的 90%
92-
lv_label_set_long_mode(chat_message_label_, LV_LABEL_LONG_WRAP); // 设置为自动换行模式
92+
lv_label_set_long_mode(chat_message_label_, LV_LABEL_LONG_SCROLL_CIRCULAR); // 设置为自动换行模式
9393
lv_obj_set_style_text_align(chat_message_label_, LV_TEXT_ALIGN_CENTER, 0); // 设置文本居中对齐
9494
lv_obj_set_style_text_color(chat_message_label_, lv_color_white(), 0);
9595
SetTheme(LvglThemeManager::GetInstance().GetTheme("dark"));

main/boards/otto-robot/README.md

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ otto 机器人是一个开源的人形机器人平台,具有多种动作能力
2121
>
2222
> **我的动作能力**
2323
> - **基础移动**: 行走(前后), 转向(左右), 跳跃
24-
> - **特殊动作**: 摇摆, 太空步, 弯曲身体, 摇腿, 上下运动
25-
> - **手部动作**: 举手, 放手, 挥手 (仅在配置手部舵机时可用)
24+
> - **特殊动作**: 摇摆, 太空步, 弯曲身体, 摇腿, 上下运动, 旋风腿, 坐下, 展示动作
25+
> - **手部动作**: 举手, 放手, 挥手, 大风车, 起飞, 健身, 打招呼, 害羞, 广播体操, 爱的魔力转圈圈 (仅在配置手部舵机时可用)
2626
>
2727
> **我的个性特点**
2828
> - 我有强迫症,每次说话都要根据我的心情随机做一个动作(先发送动作指令再说话)
@@ -58,37 +58,57 @@ otto 机器人具有丰富的动作能力,包括行走、转向、跳跃、摇
5858
| self.otto.moonwalk | 太空步 | **steps**: 太空步步数(1-100,默认3)<br>**speed**: 速度(500-1500,数值越小越快,默认1000)<br>**direction**: 方向(1=左, -1=右,默认1)<br>**amount**: 幅度(0-170度,默认25) |
5959
| self.otto.bend | 弯曲身体 | **steps**: 弯曲次数(1-100,默认1)<br>**speed**: 弯曲速度(500-1500,数值越小越快,默认1000)<br>**direction**: 弯曲方向(1=左, -1=右,默认1) |
6060
| self.otto.shake_leg | 摇腿 | **steps**: 摇腿次数(1-100,默认1)<br>**speed**: 摇腿速度(500-1500,数值越小越快,默认1000)<br>**direction**: 腿部选择(1=左腿, -1=右腿,默认1) |
61+
| self.otto.sit | 坐下 | 不需要参数 |
62+
| self.otto.showcase | 展示动作 | 不需要参数。串联执行多个动作:往前走3步、挥挥手、跳舞(广播体操)、太空步、摇摆、起飞、健身、往后走3步 |
6163
| self.otto.updown | 上下运动 | **steps**: 上下运动次数(1-100,默认3)<br>**speed**: 运动速度(500-1500,数值越小越快,默认1000)<br>**amount**: 运动幅度(0-170度,默认20) |
64+
| self.otto.whirlwind_leg | 旋风腿 | **steps**: 动作次数(3-100,默认3)<br>**speed**: 动作速度(100-1000,数值越小越快,建议300)<br>**amplitude**: 踢腿幅度(20-40度,默认30) |
6265
| self.otto.hands_up | 举手 * | **speed**: 举手速度(500-1500,数值越小越快,默认1000)<br>**direction**: 手部选择(1=左手, -1=右手, 0=双手,默认1) |
6366
| self.otto.hands_down | 放手 * | **speed**: 放手速度(500-1500,数值越小越快,默认1000)<br>**direction**: 手部选择(1=左手, -1=右手, 0=双手,默认1) |
64-
| self.otto.hand_wave | 挥手 * | **speed**: 挥手速度(500-1500,数值越小越快,默认1000)<br>**direction**: 手部选择(1=左手, -1=右手, 0=双手,默认1) |
67+
| self.otto.hand_wave | 挥手 * | **direction**: 手部选择(1=左手, -1=右手, 0=双手,默认1) |
68+
| self.otto.windmill | 大风车 * | **steps**: 动作次数(3-100,默认6)<br>**speed**: 动作周期(300-2000毫秒,数值越小越快,默认500)<br>**amplitude**: 振荡幅度(50-90度,默认70) |
69+
| self.otto.takeoff | 起飞 * | **steps**: 动作次数(5-100,默认5)<br>**speed**: 动作周期(200-600毫秒,数值越小越快,建议300)<br>**amplitude**: 振荡幅度(20-60度,默认40) |
70+
| self.otto.fitness | 健身 * | **steps**: 动作次数(3-100,默认5)<br>**speed**: 动作速度(500-2000毫秒,数值越小越快,默认1000)<br>**amplitude**: 振荡幅度(10-50度,默认25) |
71+
| self.otto.greeting | 打招呼 * | **direction**: 手部选择(1=左手, -1=右手,默认1)<br>**steps**: 动作次数(3-100,默认5) |
72+
| self.otto.shy | 害羞 * | **direction**: 方向(1=左, -1=右,默认1)<br>**steps**: 动作次数(3-100,默认5) |
73+
| self.otto.radio_calisthenics | 广播体操 * | 不需要参数 |
74+
| self.otto.magic_circle | 爱的魔力转圈圈 * | 不需要参数 |
6575

6676
****: 标记 * 的手部动作仅在配置了手部舵机时可用。
6777

6878
### 系统工具
6979

70-
| MCP工具名称 | 描述 | 返回值 |
80+
| MCP工具名称 | 描述 | 返回值/说明 |
7181
|-------------------|-----------------|---------------------------------------------------|
72-
| self.otto.stop | 立即停止 | 停止当前动作并回到初始位置 |
82+
| self.otto.home | 复位机器人到初始位置 | 不需要参数 |
83+
| self.otto.stop | 立即停止所有动作并复位 | 停止当前动作并回到初始位置 |
7384
| self.otto.get_status | 获取机器人状态 | 返回 "moving" 或 "idle" |
85+
| self.otto.set_trim | 校准单个舵机位置 | **servo_type**: 舵机类型(left_leg/right_leg/left_foot/right_foot/left_hand/right_hand)<br>**trim_value**: 微调值(-50到50度) |
86+
| self.otto.get_trims | 获取当前的舵机微调设置 | 返回所有舵机微调值的JSON格式 |
7487
| self.battery.get_level | 获取电池状态 | 返回电量百分比和充电状态的JSON格式 |
88+
| self.otto.servo_sequences | 舵机序列自编程 | 支持分段发送序列,支持普通移动和振荡器两种模式。详见代码注释中的详细说明 |
7589

7690
### 参数说明
7791

7892
1. **steps**: 动作执行的步数/次数,数值越大动作持续时间越长
79-
2. **speed**: 动作执行速度,数值范围500-1500,**数值越小越快**
93+
2. **speed**: 动作执行速度/周期,**数值越小越快**
94+
- 大多数动作: 500-1500毫秒
95+
- 特殊动作可能有所不同(如旋风腿: 100-1000,起飞: 200-600等)
96+
- 具体范围请参考各动作的说明
8097
3. **direction**: 方向参数
8198
- 移动动作: 1=左/前进, -1=右/后退
8299
- 手部动作: 1=左手, -1=右手, 0=双手
83-
4. **amount/arm_swing**: 动作幅度,范围0-170度
100+
4. **amount/amplitude/arm_swing**: 动作幅度,范围根据动作而定(通常0-170度
84101
- 0表示不摆动(适用于手臂摆动)
85102
- 数值越大幅度越大
103+
- 不同动作可能有不同的幅度范围限制
86104

87105
### 动作控制
88106
- 每个动作执行完成后,机器人会自动回到初始位置(home),以便于执行下一个动作
107+
- **例外**: `sit`(坐下)和 `showcase`(展示动作)执行后不会自动复位
89108
- 所有参数都有合理的默认值,可以省略不需要自定义的参数
90109
- 动作在后台任务中执行,不会阻塞主程序
91110
- 支持动作队列,可以连续执行多个动作
111+
- 手部动作需要配置手部舵机才能使用,如果没有配置手部舵机,相关动作将被跳过
92112

93113
### MCP工具调用示例
94114
```json
@@ -107,6 +127,18 @@ otto 机器人具有丰富的动作能力,包括行走、转向、跳跃、摇
107127
// 挥左手打招呼
108128
{"name": "self.otto.hand_wave", "arguments": {"direction": 1}}
109129

130+
// 展示动作(串联多个动作)
131+
{"name": "self.otto.showcase", "arguments": {}}
132+
133+
// 大风车动作
134+
{"name": "self.otto.windmill", "arguments": {"steps": 10, "amplitude": 80}}
135+
136+
// 起飞动作
137+
{"name": "self.otto.takeoff", "arguments": {"steps": 5, "speed": 300}}
138+
139+
// 广播体操
140+
{"name": "self.otto.radio_calisthenics", "arguments": {}}
141+
110142
// 立即停止
111143
{"name": "self.otto.stop", "arguments": {}}
112144
```
@@ -115,9 +147,20 @@ otto 机器人具有丰富的动作能力,包括行走、转向、跳跃、摇
115147
- "向前走" / "向前走5步" / "快速向前"
116148
- "左转" / "右转" / "转身"
117149
- "跳跃" / "跳一下"
118-
- "摇摆" / "跳舞"
150+
- "摇摆" / "摇摆舞" / "跳舞"
119151
- "太空步" / "月球漫步"
120-
- "挥手" / "举手" / "放手"
152+
- "旋风腿" / "旋风腿动作"
153+
- "坐下" / "坐下休息"
154+
- "展示动作" / "表演一下"
155+
- "挥手" / "挥手打招呼"
156+
- "举手" / "双手举起" / "放手"
157+
- "大风车" / "做大风车"
158+
- "起飞" / "准备起飞"
159+
- "健身" / "做健身动作"
160+
- "打招呼" / "打招呼动作"
161+
- "害羞" / "害羞动作"
162+
- "广播体操" / "做广播体操"
163+
- "爱的魔力转圈圈" / "转圈圈"
121164
- "停止" / "停下"
122165

123166
**说明**: 小智控制机器人动作是创建新的任务在后台控制,动作执行期间仍可接受新的语音指令。可以通过"停止"语音指令立即停下Otto。

main/boards/otto-robot/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@
4747

4848
#define BOOT_BUTTON_GPIO GPIO_NUM_0
4949

50-
#define OTTO_ROBOT_VERSION "2.0.4"
50+
#define OTTO_ROBOT_VERSION "2.0.5"
5151

5252
#endif // _BOARD_CONFIG_H_

main/boards/otto-robot/oscillator.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//--------------------------------------------------------------
2+
//-- Oscillator.pde
3+
//-- Generate sinusoidal oscillations in the servos
4+
//--------------------------------------------------------------
5+
//-- (c) Juan Gonzalez-Gomez (Obijuan), Dec 2011
6+
//-- (c) txp666 for esp32, 202503
7+
//-- GPL license
8+
//--------------------------------------------------------------
19
#include "oscillator.h"
210

311
#include <driver/ledc.h>

main/boards/otto-robot/oscillator.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//--------------------------------------------------------------
2+
//-- Oscillator.pde
3+
//-- Generate sinusoidal oscillations in the servos
4+
//--------------------------------------------------------------
5+
//-- (c) Juan Gonzalez-Gomez (Obijuan), Dec 2011
6+
//-- (c) txp666 for esp32, 202503
7+
//-- GPL license
8+
//--------------------------------------------------------------
19
#ifndef __OSCILLATOR_H__
210
#define __OSCILLATOR_H__
311

0 commit comments

Comments
 (0)