Apollo  6.0
Open source self driving car software
racobit_radar_canbus_component.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 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 
21 #pragma once
22 
23 #include <memory>
24 #include <string>
25 #include <utility>
26 #include <vector>
27 
28 #include "cyber/cyber.h"
29 
30 #include "cyber/time/time.h"
39 #include "modules/drivers/canbus/proto/can_card_parameter.pb.h"
40 #include "modules/drivers/canbus/proto/sensor_canbus_conf.pb.h"
42 #include "modules/drivers/proto/racobit_radar.pb.h"
45 
50 namespace apollo {
51 namespace drivers {
52 namespace racobit_radar {
53 
61 using apollo::common::ErrorCode;
63 using apollo::common::monitor::MonitorMessageItem;
69 using apollo::drivers::canbus::SensorCanbusConf;
70 
72  public:
73  // TODO(lizh): check whether we need a new msg item, say
74  // MonitorMessageItem::SENSORCANBUS
77 
82  bool Init() override;
83 
84  private:
85  void RegisterCanClients();
86  apollo::common::ErrorCode ConfigureRadar();
87  Status OnError(const std::string &error_msg);
88  std::shared_ptr<CanClient> can_client_;
89  CanReceiver<RacobitRadar> can_receiver_;
90  std::unique_ptr<RacobitRadarMessageManager> sensor_message_manager_;
91 
92  int64_t last_timestamp_ = 0;
93  apollo::common::monitor::MonitorLogBuffer monitor_logger_buffer_;
94  bool start_success_ = false;
95  // cyber
96  RacobitRadarConf racobit_radar_conf_;
97  std::shared_ptr<cyber::Writer<RacobitRadar>> racobit_radar_writer_;
98 };
99 
101 
102 } // namespace racobit_radar
103 } // namespace drivers
104 } // namespace apollo
::apollo::cyber::Time Time
Definition: racobit_radar_message_manager.h:41
Definition: racobit_radar_canbus_component.h:71
CanClientFactory inherites apollo::common::util::Factory.
Definition: can_client_factory.h:44
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Defines the CanFrame struct and CanClient interface.
The class which defines the CAN client to send and receive message.
Definition: can_client.h:92
The class of MessageManager.
Defines SenderMessage class and CanSender class.
Defines CanReceiver class.
The class of MonitorLogBuffer.
This class defines the message to send.
Definition: can_sender.h:55
The class of RacobitRadarMessageManager.
A general class to denote the return status of an API call. It can either be an OK status for success...
Definition: status.h:43
#define CYBER_REGISTER_COMPONENT(name)
Definition: component.h:551
Defines the CanClientFactory class.
This class help collect MonitorMessage pb to monitor topic. The messages can be published automatical...
Definition: monitor_log_buffer.h:60
bool Init() override
module initialization function
CAN receiver.
Definition: can_receiver.h:55
Some util functions.
The Component can process up to four channels of messages. The message type is specified when the com...
Definition: component.h:58