提交 e632d3ab 编写于 作者: Z Zhang Liangliang 提交者: Yifei Jiang

added perception_proxy.

上级 7228508d
......@@ -3,13 +3,32 @@ package(default_visibility = ["//visibility:public"])
load("//tools:cpplint.bzl", "cpplint")
cc_library(
name = "proxy",
name = "perception_proxy",
srcs = [
"perception_proxy.cc",
],
hdrs = [
"perception_proxy.h",
],
deps = [
"//external:gflags",
"//modules/common/math",
"//modules/common/status",
"//modules/common/util",
"//modules/map/proto:map_proto",
"//modules/perception/proto:perception_proto",
"//modules/planning/common:planning_gflags",
],
)
cc_library(
name = "routing_proxy",
srcs = [
"routing_proxy.cc",
],
hdrs = glob([
"*.h",
]),
hdrs = [
"routing_proxy.h",
],
data = ["//modules/map:map_data"],
deps = [
"//external:gflags",
......
/******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
/**
* @file perception_proxy.cc
**/
#include "modules/planning/proxy/perception_proxy.h"
#include "modules/planning/common/planning_gflags.h"
namespace apollo {
namespace planning {
void PerceptionProxy::add_perception_obstacles(
const apollo::perception::PerceptionObstacles& perception_obstacles) {
if (_perception_frame.size() >
static_cast<std::size_t>(FLAGS_max_frame_size)) {
_perception_frame.pop_front();
}
_perception_frame.emplace_back(std::move(perception_obstacles));
return;
}
apollo::perception::PerceptionObstacles*
PerceptionProxy::get_latest_perception_frame() {
if (_perception_frame.size() == 0) {
return nullptr;
}
return &(*(_perception_frame.rbegin()));
}
const std::list<apollo::perception::PerceptionObstacles>&
PerceptionProxy::perception_frame() const {
return _perception_frame;
}
} // namespace planning
} // namespace apollo
/******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
/**
* @file perception_proxy.h
**/
#ifndef MODULES_PLANNING_PROXY_PERCEPTION_PROXY_H_
#define MODULES_PLANNING_PROXY_PERCEPTION_PROXY_H_
#include <list>
#include "modules/common/proto/error_code.pb.h"
#include "modules/perception/proto/perception_obstacle.pb.h"
namespace apollo {
namespace planning {
class PerceptionProxy {
public:
PerceptionProxy() = default;
void add_perception_obstacles(
const apollo::perception::PerceptionObstacles& perception_obstacles);
apollo::perception::PerceptionObstacles* get_latest_perception_frame();
const std::list<apollo::perception::PerceptionObstacles>& perception_frame()
const;
private:
std::list<apollo::perception::PerceptionObstacles> _perception_frame;
};
} // namespace planning
} // namespace apollo
#endif // MODULES_PLANNING_PROXY_PERCEPTION_PROXY_H_
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册