提交 5bf33868 编写于 作者: V vlin17 提交者: Xiangquan Xiao

Dreamview: sync HMI status after executing commands

上级 14d8b905
......@@ -68,9 +68,7 @@ void HMI::RegisterMessageHandlers() {
// Send current status and vehicle param to newly joined client.
websocket_->RegisterConnectionReadyHandler(
[this](WebSocketHandler::Connection* conn) {
const auto status_json =
JsonUtil::ProtoToTypedJson("HMIStatus", hmi_worker_->GetStatus());
websocket_->SendData(conn, status_json.dump());
SendStatus(conn);
SendVehicleParam(conn);
});
......@@ -142,6 +140,12 @@ void HMI::RegisterMessageHandlers() {
monitor_log_buffer_.WARN("Failed to submit a drive event.");
}
});
websocket_->RegisterMessageHandler(
"HMIStatus",
[this](const Json &json, WebSocketHandler::Connection* conn) {
SendStatus(conn);
});
}
void HMI::SendVehicleParam(WebSocketHandler::Connection* conn) {
......@@ -160,5 +164,11 @@ void HMI::SendVehicleParam(WebSocketHandler::Connection* conn) {
}
}
void HMI::SendStatus(WebSocketHandler::Connection* conn) {
const auto status_json =
JsonUtil::ProtoToTypedJson("HMIStatus", hmi_worker_->GetStatus());
websocket_->SendData(conn, status_json.dump());
}
} // namespace dreamview
} // namespace apollo
......@@ -41,6 +41,7 @@ class HMI {
private:
// Send VehicleParam to the given conn, or broadcast if conn is null.
void SendVehicleParam(WebSocketHandler::Connection *conn = nullptr);
void SendStatus(WebSocketHandler::Connection *conn = nullptr);
void RegisterMessageHandlers();
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -5159,7 +5159,7 @@
"default": 500
}
},
"refSWeight": {
"sPotentialWeight": {
"type": "double",
"id": 4,
"options": {
......@@ -5173,27 +5173,41 @@
"default": 10
}
},
"endSWeight": {
"refSWeight": {
"type": "double",
"id": 6,
"options": {
"default": 10
}
},
"endVWeight": {
"endSWeight": {
"type": "double",
"id": 7,
"options": {
"default": 10
}
},
"endAWeight": {
"endVWeight": {
"type": "double",
"id": 8,
"options": {
"default": 10
}
},
"endAWeight": {
"type": "double",
"id": 9,
"options": {
"default": 10
}
},
"softSBoundWeight": {
"type": "double",
"id": 10,
"options": {
"default": 10
}
},
"useWarmStart": {
"type": "bool",
"id": 100,
......@@ -7131,6 +7145,13 @@
"options": {
"default": false
}
},
"isClearToChangeLane": {
"type": "bool",
"id": 8,
"options": {
"default": false
}
}
},
"nested": {
......@@ -7217,6 +7238,10 @@
"adcInitHeading": {
"type": "double",
"id": 2
},
"inCheckStage": {
"type": "bool",
"id": 3
}
}
},
......
......@@ -16,6 +16,8 @@ export default class RealtimeWebSocketEndpoint {
this.routingTime = undefined;
this.currentMode = null;
this.worker = new Worker();
this.requestHmiStatus = this.requestHmiStatus.bind(this);
}
initialize() {
......@@ -269,6 +271,8 @@ export default class RealtimeWebSocketEndpoint {
type: "HMIAction",
action: action,
}));
setTimeout(this.requestHmiStatus, 5000);
}
executeModuleCommand(moduleName, command) {
......@@ -282,6 +286,8 @@ export default class RealtimeWebSocketEndpoint {
action: command,
value: moduleName
}));
setTimeout(this.requestHmiStatus, 5000);
}
submitDriveEvent(eventTimeMs, eventMessage, eventTypes, isReportable) {
......@@ -307,6 +313,12 @@ export default class RealtimeWebSocketEndpoint {
}));
}
requestHmiStatus() {
this.websocket.send(JSON.stringify({
type: "HMIStatus"
}));
}
publishNavigationInfo(data) {
this.websocket.send(data);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册