跳转至

Effector ViewModel

controller.presentation.view_models.effector_view_model

末端执行器视图模型 - Presentation层

EffectorViewModel

EffectorViewModel(command_hub_service: CommandHubService, parent=None)

Bases: BaseViewModel

末端执行器视图模型。

负责处理末端执行器(如夹爪、吸盘)的控制命令。

属性:

名称 类型 描述
command_hub_service CommandHubService

命令中心服务。

初始化末端执行器视图模型。

参数:

名称 类型 描述 默认
command_hub_service CommandHubService

命令中心服务。

必需
parent QObject

父对象. Defaults to None.

None
源代码位于: src/controller/controller/presentation/view_models/effector_view_model.py
17
18
19
20
21
22
23
24
25
def __init__(self, command_hub_service: CommandHubService, parent=None):
    """初始化末端执行器视图模型。

    Args:
        command_hub_service (CommandHubService): 命令中心服务。
        parent (QObject, optional): 父对象. Defaults to None.
    """
    super().__init__(parent)
    self.command_hub_service = command_hub_service

send_effector_command

send_effector_command(config_dict: dict)

发送末端执行器命令。

参数:

名称 类型 描述 默认
config_dict dict

命令配置字典。

必需
源代码位于: src/controller/controller/presentation/view_models/effector_view_model.py
27
28
29
30
31
32
33
def send_effector_command(self, config_dict: dict):
    """发送末端执行器命令。

    Args:
        config_dict (dict): 命令配置字典。
    """
    self.command_hub_service.command_distribution(config_dict)