提交 935b9b9d 编写于 作者: K kechxu 提交者: Kecheng Xu

Prediction: add relative_map_container

上级 b14a84bf
......@@ -13,6 +13,11 @@ config {
mode: RECEIVE_ONLY
message_history_limit: 1
}
config {
type: RELATIVE_MAP
mode: RECEIVE_ONLY
message_history_limit: 1
}
config {
type: PREDICTION
mode: PUBLISH_ONLY
......
......@@ -13,6 +13,7 @@ cc_library(
"//modules/prediction/container/obstacles:obstacles_container",
"//modules/prediction/container/pose:pose_container",
"//modules/prediction/container/adc_trajectory:adc_trajectory_container",
"//modules/prediction/container/relative_map:relative_map_container",
"@glog//:glog",
],
)
......
......@@ -20,6 +20,7 @@
#include "modules/prediction/container/obstacles/obstacles_container.h"
#include "modules/prediction/container/pose/pose_container.h"
#include "modules/prediction/container/adc_trajectory/adc_trajectory_container.h"
#include "modules/prediction/container/relative_map/relative_map_container.h"
namespace apollo {
namespace prediction {
......@@ -62,6 +63,8 @@ std::unique_ptr<Container> ContainerManager::CreateContainer(
container_ptr.reset(new PoseContainer());
} else if (type == AdapterConfig::PLANNING_TRAJECTORY) {
container_ptr.reset(new ADCTrajectoryContainer());
} else if (type == AdapterConfig::RELATIVE_MAP) {
container_ptr.reset(new RelativeMapContainer());
}
return container_ptr;
}
......
load("//tools:cpplint.bzl", "cpplint")
package(default_visibility = ["//visibility:public"])
cc_library(
name = "relative_map_container",
srcs = ["relative_map_container.cc"],
hdrs = ["relative_map_container.h"],
deps = [
"//modules/common:log",
"//modules/map/relative_map:relative_map_lib",
"//modules/prediction/container",
],
)
cpplint()
/******************************************************************************
* Copyright 2018 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.
*****************************************************************************/
#include "modules/prediction/container/relative_map/relative_map_container.h"
#include "modules/common/log.h"
namespace apollo {
namespace prediction {
using apollo::relative_map::MapMsg;
void RelativeMapContainer::Insert(const ::google::protobuf::Message& message) {
relative_map_.CopyFrom(dynamic_cast<const MapMsg&>(message));
ADEBUG << "Received a planning message ["
<< relative_map_.ShortDebugString() << "].";
}
} // namespace prediction
} // namespace apollo
/******************************************************************************
* Copyright 2018 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
*/
#ifndef MODULES_PREDICTION_CONTAINER_RELATIVE_MAP_CONTAINER_H_
#define MODULES_PREDICTION_CONTAINER_RELATIVE_MAP_CONTAINER_H_
#include "modules/prediction/container/container.h"
#include "modules/map/relative_map/proto/navigation.pb.h"
namespace apollo {
namespace prediction {
class RelativeMapContainer : public Container {
public:
/**
* @brief Constructor
*/
RelativeMapContainer() = default;
/**
* @brief Destructor
*/
virtual ~RelativeMapContainer() = default;
/**
* @brief Insert a data message into the container
* @param Data message to be inserted in protobuf
*/
void Insert(const ::google::protobuf::Message& message) override;
private:
apollo::relative_map::MapMsg relative_map_;
};
} // namespace prediction
} // namespace apollo
#endif // MODULES_PREDICTION_CONTAINER_RELATIVE_MAP_CONTAINER_H_
......@@ -85,12 +85,17 @@ Status Prediction::Init() {
CHECK(AdapterManager::GetRelativeMap());
}
if (FLAGS_use_navigation_mode) {
// Set relative map callback function
AdapterManager::AddRelativeMapCallback(&Prediction::OnRelativeMap, this);
} else {
// Set localization callback function
AdapterManager::AddLocalizationCallback(&Prediction::OnLocalization, this);
// Set planning callback function
AdapterManager::AddPlanningCallback(&Prediction::OnPlanning, this);
}
// Set perception obstacle callback function
AdapterManager::AddPerceptionObstaclesCallback(&Prediction::RunOnce, this);
// Set localization callback function
AdapterManager::AddLocalizationCallback(&Prediction::OnLocalization, this);
// Set planning callback function
AdapterManager::AddPlanningCallback(&Prediction::OnPlanning, this);
if (!FLAGS_use_navigation_mode && !PredictionMap::Ready()) {
return OnError("Map cannot be loaded.");
......@@ -135,6 +140,10 @@ void Prediction::OnPlanning(const planning::ADCTrajectory& adc_trajectory) {
<< "].";
}
void Prediction::OnRelativeMap(const relative_map::MapMsg& relative_map) {
// TODO(kechxu): implement
}
void Prediction::RunOnce(const PerceptionObstacles& perception_obstacles) {
if (FLAGS_prediction_offline_mode) {
PredictOnNavigation(perception_obstacles);
......
......@@ -28,6 +28,7 @@
#include "modules/localization/proto/localization.pb.h"
#include "modules/perception/proto/perception_obstacle.pb.h"
#include "modules/planning/proto/planning.pb.h"
#include "modules/map/relative_map/proto/navigation.pb.h"
#include "modules/prediction/prediction_interface.h"
#include "modules/prediction/proto/prediction_conf.pb.h"
......@@ -88,6 +89,8 @@ class Prediction : public PredictionInterface {
void OnPlanning(const planning::ADCTrajectory &adc_trajectory);
void OnRelativeMap(const relative_map::MapMsg& relative_map);
bool IsValidTrajectoryPoint(
const ::apollo::common::TrajectoryPoint &trajectory_point);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册