跳转到内容

2. 软件系统概述

机器人工控机由MDU与HDU组成,均安装 Ubuntu 24.04 系统,MDU为机器人小脑,HDU为机器人大脑,均使用 systemd 作为系统服务管理器,开机时会拉起 PM(进程启动管理)、SM(进程状态管理)模块,再由 PM 和 SM 配合拉起其余各个模块进程,SM 会对不同系统模式下的进程列表进行开启和关闭的状态管理。 PM 和 SM 的配置文件路径分别为 /agibot/software/v0/entry/launch/A3_T2D5_ZY3_L.yaml(HDU & MDU,yaml名称根据机型变化) 和 agibot/software/v0/config/sm/sm_config.yaml(MDU),前者列有默认启动的进程列表,后者列有各个系统模式分别启用哪些功能组的进程 。

模块性质所属工控机模块名称模块说明
公共服务 基础服务MDUmosquitto( MQTT网关)MQTT 网关节点,对接AimMaster和机上软件接口
MDU & HDUiox_roudi(iceoryx共享内存中心节点)负责 iceoryx 通信的中心调度,提供数据的储存位置
aimrte-tool-record_playback(录包)用来持续记录bag包

setting(设置模块)提供基本机器人工控机设置,如 wifi、蓝牙等
管理模块MDUSM(系统状态管理模块)
负责切换系统状态,管控进程列表
HDU & MDUEM(进程管理模块)负责拉起进程,查询进程状态
功能模块MDUhds、health_monitor(健康诊断模块)接收各个模块上报的故障信息
motion_control(运动控制模块)负责整个机器人的运动控制,下发运控动作指令
skillpilot(技能模块)灯带、动作、表情、任务管理接口
motion_player(动作播放模块)提供动作播放能力
hal_ethercat(硬件抽象层模块)负责与MCU进行ethercat通信,传递硬件的状态信息和控制指令
gateway(网关通信)将外部的请求转发到内部各个模块
HDUhal_audio(音频播放模块)提供原子性的音频播放能力,供 agent 调用
resource_manager(资源管理模块)统一管理机上动作、表情、播报等资源文件
agent(交互模块)统一管理机器人交互能力
hdu_camera(摄像头模块)负责管理机器人相机功能

各个系统模式下激活和启动的模块有所不同,如下(摘录自 sm_config.yaml)

# 系统状态
system_modes:
"Startup":
next_mode_list: [ "Ready", "OTA", "Poweroff" ]
active_FG_list: [ "System", "HAL", "EStop", "MoCap", "Gateway", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
"Poweroff":
next_mode_list: []
active_FG_list: []
action_list:
- [ open Poweroff ]
"Reboot":
next_mode_list: []
active_FG_list: []
action_list:
- [ open Reboot ]
# 系统的就绪状态,会启动业务管理模块以及HAL
"Ready":
next_mode_list: [ "Manual", "EStop", "Poweroff" ]
active_FG_list: [ "System", "HAL", "EStop", "MoCap", "Gateway", "Motion", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
- [ activate agent ]
- [ activate motion_player ]
# post_process:
# - level: 34
# action_list: [ [ forbid Manual ] ]
# OTA状态,会启动OTA功能组,完成OTA相关功能
"OTA":
next_mode_list: [ "Reboot", "Ready", "Poweroff" ]
active_FG_list: [ "System", "HAL", "MoCap", "Gateway", "Motion", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
- [ deactivate agent ]
- [ activate mc ]
- [ deactivate motion_player ]
# 手动状态,会启动遥控以及MC功能组
"Manual":
next_mode_list: [ "OTA", "Auto", "Reset", "EStop", "Poweroff", "MotionStream", "DataCollection", "FreeExploration", "Mapping", "Manipulator", "Lock" ]
active_FG_list: [ "System", "HAL", "EStop", "MoCap", "Gateway", "Motion", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
- [ activate agent ]
- [ activate mc ]
- [ activate motion_player ]
child_modes:
- mode_name: "Safety" # 通过tools下使能脚本调用进入的状态
extra_next_modes: [ "OTA", "Reset" ]
action_list:
- [ close Motion ]
- [ close EStop ]
post_process:
- level: 47
action_list: [ [ fallback mc ] ]
# 锁机状态
"Lock":
next_mode_list: [ "Manual" ]
active_FG_list: [ "System", "HAL", "EStop", "MoCap", "Gateway", "Motion", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
- [ deactivate agent ]
- [ activate mc ]
- [ deactivate motion_player ]
post_process:
- level: 47
action_list: [ [ fallback mc ] ]
# 重置状态,用于恢复出厂设置
"Reset":
next_mode_list: [ "Reboot", "Poweroff" ]
active_FG_list: [ "System", "OTA", "Gateway" ]
action_list:
- [ DIFF ]
# 紧急停止状态,用于紧急停止
"EStop":
next_mode_list: [ "Ready", "OTA", "Poweroff" ]
active_FG_list: [ "System", "HAL", "EStop", "MoCap", "Gateway", "Motion", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
- [ activate agent ]
- [ deactivate mc ]
- [ activate motion_player ]
# 实时遥操作状态,用于实时遥操作
"MotionStream":
next_mode_list: [ "Manual", "EStop", "Poweroff", "DataCollection" ]
active_FG_list: [ "System", "HAL", "EStop", "MoStream", "Gateway", "Motion", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
- [ activate agent ]
- [ activate mc ]
decision: # 系统决策层
Auto_transToReady: true # 如果为false需要在一定时机下调用一键激活脚本
Auto_transToManual: true
type: 1

如需二开替换某些功能模块,需要在系统中配置禁用该模块。

模块依照受 A3_T2D5_ZY3_L.yaml 和 sm_config.yaml 管理分为两种,前者管理的模块会在启动时默认启动,后续也不受 sm 管理,保持常驻;后者管理的模块会在各个系统模式间切换。

  1. 如果需要禁用 A3_T2D5_ZY3_L.yaml 中管理的模块(即其中 default_apps 中的部分),只需要从 default_apps 中移除即可。

  2. 如果需要禁用 sm 管理的模块,则需在相应的系统模式中加入一行 deactivate,指定去使能对应模块。

  3. 操作前请先备份相应目录下的A3_T2D5_ZY3_L.yaml 和sm_config.yaml

以禁用 motion_player 模块为例,可按照如下步骤进行操作: 首先备份A3_T2D5_ZY3_L.yaml(MDU)和 sm_config.yaml.

Terminal window
cp /agibot/software/v0/entry/launch/A3_T2D5_ZY3_L.yaml \
/agibot/software/v0/entry/launch/A3_T2D5_ZY3_L_backup.yaml
cp /agibot/software/v0/config/sm/sm_config.yaml \
agibot/software/v0/config/sm/sm_config_backup.yaml

在 A3_T2D5_ZY3_L.yaml(MDU) 将 default_apps 列表里 motion_player 模块移除:

@@ -22,7 +22,6 @@ process_manager:
"health_monitor0",
"recordbag0",
- "motion_player",
"hds",
"setting0",
"mc",
# "pnc",
# "uwb_fusion",
"hal_ethercat",
"hal_elink",
"skillpilot",
"ota_master",
"gateway",
"ota_service0",

然后在 sm_config.yaml (MDU) 中 移除 SystemManagerModule 中 group 里的 motion_player, 将 MoCap 配置修改为空,并移除各状态下对 motion_player 的 activate / deactivate 操作:

@@ -14,7 +14,7 @@ SystemManagerModule:
- group: [motion_player, mc, hal_ethercat, poweroff0, reboot0, setting0, recordbag0, health_monitor0, hds, gateway, ota_master, ota_service0]
+ group: [mc, hal_ethercat, poweroff0, reboot0, setting0, recordbag0, health_monitor0, hds, gateway, ota_master, ota_service0]
@@ -36,7 +36,7 @@ SystemManagerModule:
"RC":
[ "rc" ]
"MoCap":
- [ "motion_player" ]
+ []
"MoStream":
[ "motion_streamer" ]
@@ -78,7 +78,6 @@ SystemManagerModule:
"Ready":
next_mode_list: [ "Manual", "EStop", "Poweroff" ]
active_FG_list: [ "System", "HAL", "EStop", "MoCap", "Gateway", "Motion", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
- - [ activate motion_player ]
@@ -93,7 +93,6 @@ SystemManagerModule:
"OTA":
next_mode_list: [ "Reboot", "Ready", "Poweroff" ]
active_FG_list: [ "System", "HAL", "MoCap", "Gateway", "Motion", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
- [ deactivate agent ]
- [ activate mc ]
- - [ deactivate motion_player]
@@ -105,7 +105,6 @@ SystemManagerModule:
"Manual":
next_mode_list: [ "OTA", "Auto", "Reset", "EStop", "Poweroff", "MotionStream", "DataCollection", "FreeExploration", "Mapping", "Manipulator", "Lock" ]
active_FG_list: [ "System", "HAL", "EStop", "MoCap", "Gateway", "Motion", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
- [ activate agent ]
- [ activate mc ]
- - [ activate motion_player ]
@@ -126,7 +126,6 @@ SystemManagerModule:
"Lock":
next_mode_list: [ "Manual" ]
active_FG_list: [ "System", "HAL", "EStop", "MoCap", "Gateway", "Motion", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
- [ deactivate agent ]
- [ activate mc ]
- - [ deactivate motion_player ]
@@ -148,7 +148,6 @@ SystemManagerModule:
"EStop":
next_mode_list: [ "Ready", "OTA", "Poweroff" ]
active_FG_list: [ "System", "HAL", "EStop", "MoCap", "Gateway", "Motion", "OTA" ]
action_list:
- [ DIFF ]
- [ activate recordbag0 ]
- [ activate recordbag1 ]
- [ activate agent ]
- [ deactivate mc ]
- - [ activate motion_player ]