Apollo 10.0
自动驾驶开放平台
smartereye_component.h
浏览该文件的文档.
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
17#pragma once
18
19#include <atomic>
20#include <future>
21#include <memory>
22#include <vector>
23
24#include "cyber/cyber.h"
25#include "modules/common_msgs/sensor_msgs/sensor_image.pb.h"
26#include "modules/common_msgs/sensor_msgs/smartereye.pb.h"
27#include "modules/drivers/smartereye/proto/config.pb.h"
29#include "third_party/camera_library/smartereye/include/frameext.h"
30#include "third_party/camera_library/smartereye/include/obstacleData.h"
31#include "third_party/camera_library/smartereye/include/obstaclepainter.h"
32#include "third_party/camera_library/smartereye/include/roadwaypainter.h"
33#include "third_party/camera_library/smartereye/include/yuv2rgb.h"
34
35namespace apollo {
36namespace drivers {
37namespace smartereye {
38
44
46 public:
47 bool Init() override;
49
50 protected:
51 void run();
52 bool SetCallback();
53 bool Callback(RawImageFrame *rawFrame);
54 void processFrame(int frameId, char *image, char *extended, int64_t time,
55 int width, int height);
56 void processFrame(int frameId, char *image, uint32_t dataSize, int width,
57 int height, int frameFormat);
58
59 private:
60 std::shared_ptr<Writer<Image>> writer_ = nullptr;
61 std::shared_ptr<Writer<SmartereyeObstacles>> SmartereyeObstacles_writer_ =
62 nullptr;
63 std::shared_ptr<Writer<SmartereyeLanemark>> SmartereyeLanemark_writer_ =
64 nullptr;
65 std::unique_ptr<SmartereyeDevice> camera_device_ = nullptr;
66 std::shared_ptr<Config> camera_config_ = nullptr;
67 uint32_t spin_rate_ = 200;
68 uint32_t device_wait_ = 2000;
69 std::future<void> async_result_;
70 std::atomic<bool> running_ = {false};
71 bool b_ispolling_ = false;
72};
73
75} // namespace smartereye
76} // namespace drivers
77} // namespace apollo
Reader subscribes a channel, it has two main functions:
Definition reader.h:69
void processFrame(int frameId, char *image, char *extended, int64_t time, int width, int height)
#define CYBER_REGISTER_COMPONENT(name)
Definition component.h:656
class register implement
Definition arena_queue.h:37