55 lines
1.5 KiB
Python
Raw Normal View History

2025-09-20 16:50:45 +08:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def boot():
"""VDA5050小车处理脚本启动函数"""
# 注册华睿小车处理器(消息透传模式)
VWED.device.register_and_run(
device_id="SIM-1",
device_type="vehicle",
listen_topics=["uagv/v2/SEER/SIM-1/state"],
forward_topics=["oagv/v2/SEER/SIM-1/states"],
handler=vda5050_vehicle_handler1,
device_brand="huarui",
description="华睿小车处理器"
)
# 注册华睿小车处理器(消息透传模式)
VWED.device.register_and_run(
device_id="SIM-2",
device_type="vehicle",
listen_topics=["uagv/v2/SEER/SIM-2/state"],
forward_topics=["oagv/v2/SEER/SIM-2/states"],
handler=vda5050_vehicle_handler2,
device_brand="huarui",
description="华睿小车处理器"
)
def vda5050_vehicle_handler1(message):
"""VDA5050小车消息处理器"""
print("SIM-1:", message)
# 默认转发消息
return {
"forward": True,
"payload": {
# "device_id": device_id,
"original_data": message,
# "processed_at": VWED.util.now()
}
}
def vda5050_vehicle_handler2(message):
"""VDA5050小车消息处理器"""
print("SIM-2:", message)
# 默认转发消息
return {
"forward": True,
"payload": {
# "device_id": device_id,
"original_data": message,
# "processed_at": VWED.util.now()
}
}