提交 0088bc41 编写于 作者: Q Qi Luo 提交者: Dong Li

Common & Canbus : Update drive state proto and publish from canbus (#2301)

* Common : Update drive state proto

* Canbus : publish drive state from canbus
上级 ede001df
......@@ -18,6 +18,7 @@ proto_library(
deps = [
"//modules/common/proto:common_proto_lib",
"//modules/common/proto:header_proto_lib",
"//modules/common/proto:drive_state_proto_lib",
"//modules/common/proto:vehicle_signal_proto_lib",
"//modules/drivers/canbus/proto:canbus_proto_lib",
],
......
......@@ -4,8 +4,9 @@ package apollo.canbus;
import "modules/common/proto/header.proto";
import "modules/common/proto/vehicle_signal.proto";
import "modules/common/proto/drive_state.proto";
// next id :28
// next id :30
message Chassis {
enum DrivingMode {
COMPLETE_MANUAL = 0; // human drive
......@@ -91,6 +92,8 @@ message Chassis {
// Only available for Lincoln now
optional ChassisGPS chassis_gps = 28;
optional apollo.common.EngageAdvice engage_advice = 29;
}
message ChassisGPS {
......
......@@ -298,13 +298,26 @@ Chassis LincolnController::chassis() {
chassis_.mutable_chassis_gps()->set_gps_valid(false);
}
// last vin number will be written into KVDB once.
// vin number will be written into KVDB once.
if (chassis_detail.license().has_vin() && !received_vin_) {
apollo::common::KVDB::Put("apollo:canbus:vin",
chassis_detail.license().vin());
received_vin_ = true;
}
// give engage_advice based on error_code and canbus feedback
if (!chassis_error_mask_ && !chassis_.parking_brake() &&
(chassis_.steering_percentage() != 0.0) &&
(chassis_.throttle_percentage() != 0.0) &&
(chassis_.brake_percentage() != 0.0)) {
chassis_.mutable_engage_advice()->set_advice(
apollo::common::EngageAdvice::READY_TO_ENGAGE);
} else {
chassis_.mutable_engage_advice()->set_advice(
apollo::common::EngageAdvice::DISALLOW_ENGAGE);
chassis_.mutable_engage_advice()->set_reason(
"CANBUS not ready, firmware error or emergency button pressed!");
}
return chassis_;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册