44 const std::string& config_path,
47 return OnError(
"Unable to load canbus conf file: " + config_path);
50 AINFO <<
"The canbus conf file is loaded: " << config_path;
51 ADEBUG <<
"Canbus_conf:" << ultrasonic_radar_conf_.ShortDebugString();
54 auto can_factory = CanClientFactory::Instance();
55 can_factory->RegisterCanClients();
56 can_client_ = can_factory->CreateCANClient(
59 return OnError(
"Failed to create can client.");
61 AINFO <<
"Can client is successfully created.";
63 sensor_message_manager_ = std::unique_ptr<UltrasonicRadarMessageManager>(
66 if (sensor_message_manager_ ==
nullptr) {
67 return OnError(
"Failed to create message manager.");
69 sensor_message_manager_->set_can_client(can_client_);
70 AINFO <<
"Sensor message manager is successfully created.";
72 bool enable_receiver_log =
74 if (can_receiver_.Init(can_client_.get(), sensor_message_manager_.get(),
75 enable_receiver_log) != ErrorCode::OK) {
76 return OnError(
"Failed to init can receiver.");
78 AINFO <<
"The can receiver is successfully initialized.";
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...