Apollo  6.0
Open source self driving car software
robosense_driver_component.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2020 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 #pragma once
17 #include <list>
18 #include <memory>
19 #include <string>
20 #include <thread>
21 
22 #include "cyber/cyber.h"
24 
25 namespace apollo {
26 namespace drivers {
27 namespace robosense {
28 
30 
31 class RobosenseComponent : public Component<> {
32  public:
34  bool Init() override {
35  if (!GetProtoConfig(&conf_)) {
36  AERROR << "load config error, file:" << config_file_path_;
37  return false;
38  }
39  driver_.reset(new RobosenseDriver(node_, conf_));
40  if (!driver_->Init()) {
41  AERROR << "driver init error";
42  return false;
43  }
44  return true;
45  }
46 
47  private:
48  std::shared_ptr<RobosenseDriver> driver_;
49  Config conf_;
50 };
51 
53 
54 } // namespace robosense
55 } // namespace drivers
56 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
bool Init() override
Definition: robosense_driver_component.h:34
std::string config_file_path_
Definition: component_base.h:114
std::shared_ptr< Node > node_
Definition: component_base.h:113
Definition: robosense_driver_component.h:31
#define CYBER_REGISTER_COMPONENT(name)
Definition: component.h:551
~RobosenseComponent()
Definition: robosense_driver_component.h:33
#define AERROR
Definition: log.h:44
bool GetProtoConfig(T *config) const
Definition: component_base.h:63
The Component can process up to four channels of messages. The message type is specified when the com...
Definition: component.h:58