Apollo 10.0
自动驾驶开放平台
smartereye_device.cc
浏览该文件的文档.
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
18
19#include <time.h>
20
21#include <cmath>
22#include <string>
23
24#define CLEAR(x) memset(&(x), 0, sizeof(x))
25
26namespace apollo {
27namespace drivers {
28namespace smartereye {
29
31
33
34bool SmartereyeDevice::init(const std::shared_ptr<Config>& camera_config) {
35 pcamera_ = StereoCamera::connect("192.168.1.251");
36 pcameraHandler_ = new SmartereyeHandler("camera A");
37 pcamera_->enableTasks(TaskId::ObstacleTask | TaskId::DisplayTask);
38 inited_ = true;
39
40 return true;
41}
42
44 pcameraHandler_->SetCallback(ptr);
45
46 return true;
47}
48
50 pcamera_->requestFrame(pcameraHandler_, FrameId::Compound);
51 is_capturing_ = true;
52
53 return 1;
54}
55
57 if (!inited_) {
58 return 1;
59 }
60
61 pcamera_->disconnectFromServer();
62 is_capturing_ = false;
63 inited_ = false;
64
65 return 1;
66}
67
68bool SmartereyeDevice::is_capturing() { return is_capturing_; }
69
71 if (is_capturing_) {
72 ADEBUG << "is capturing";
73 return true;
74 }
75
76 return true;
77}
78
79} // namespace smartereye
80} // namespace drivers
81} // namespace apollo
virtual bool init(const std::shared_ptr< Config > &camera_config)
#define ADEBUG
Definition log.h:41
std::function< bool(RawImageFrame *rawFrame)> CallbackFunc
class register implement
Definition arena_queue.h:37