载荷控制

载荷设备(自动门等)的控制功能。

自动门控制

door_control(door_id, cmd, door_timeout=10, retry_times=1, block=True, timeout=300)

Control the payload automatic door.

Parameters:
  • door_id (int) – Target door identifier.

  • cmd (int) – Command. 0=Close, 1=Open, 2=Query.

  • door_timeout (int) – Door action timeout in seconds (default: 10).

  • retry_times (int) – Retry times on failure (default: 1).

  • block (bool) – Whether to block until completion (default: true).

  • timeout (int) – Timeout in seconds, only effective when block=false (default: 300).

Return type:

DoorControlResult

Returns:

DoorControlResult with .result (bool, true=success).

Examples:

result = door_control(door_id=1, cmd=1)  # open door 1
print(f"DoorControl result: {result.result}")

底层 ROS2 接口

  • 类型: Action rms_msgs/action/DoorControl

  • 名称: /door/cmd

  • 说明: 通过 ROS2 Action 调用,feedback(uint8 status)通过 /sdk/payload/door_control_feedback topic 发布

  • 参数映射:

封装参数

原生字段(Goal)

door_id

door_id

cmd

``cmd``(0=关,1=开,2=查询)

door_timeout

``timeout``(门动作超时,秒)

retry_times

retry_times

block

客户端是否阻塞等待(不下发)

timeout

客户端等待时长,不下发

报警灯控制

alarm_led_control(type, mode, block=True, timeout=30)

Control the payload alarm LED (strobe light).

Parameters:
  • type (int) – LED type. 1 = led_strobe (strobe alarm light).

  • mode (int) – Mode. 0 = off; 1 = always on; 2~16 = other flashing modes.

  • block (bool) – Whether to block until completion (default: true).

  • timeout (int) – Timeout in seconds, only effective when block=false (default: 30).

Return type:

AlarmLedControl_Response

Returns:

AlarmLedControl_Response with .success (bool) and .message (str).

Examples:

response = alarm_led_control(type=1, mode=1)  # strobe light, always on
print(f"AlarmLedControl: {response.success}")

底层 ROS2 接口

  • 类型: Service rms_msgs/srv/LedControl

  • 名称: /led_ctrl/control

  • 说明: ``type``=1 表示爆闪灯;``mode``=0 关闭,1 常亮,2~16 其他闪烁模式

  • 参数映射:

封装参数

原生字段(Request)

type

``type``(1=爆闪灯)

mode

``mode``(0=关闭,1=常亮,2~16=闪烁)

block

客户端是否阻塞等待(不下发)

timeout

客户端等待时长,不下发