Skip to content

Commit

Permalink
Prediction: add interfaces of current frame obstacle ids
Browse files Browse the repository at this point in the history
  • Loading branch information
kechxu committed Jan 15, 2019
1 parent 208fea6 commit a1a95fb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
18 changes: 18 additions & 0 deletions modules/prediction/container/obstacles/obstacles_container.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ void ObstaclesContainer::Insert(const ::google::protobuf::Message& message) {
for (const PerceptionObstacle& perception_obstacle :
perception_obstacles.perception_obstacle()) {
if (IsPredictable(perception_obstacle)) {
curr_frame_non_predictable_obstacle_ids_.push_back(
perception_obstacle.id());
continue;
}
Obstacle* obstacle_ptr = GetObstacle(perception_obstacle.id());
Expand Down Expand Up @@ -137,6 +139,22 @@ void ObstaclesContainer::Clear() {
timestamp_ = -1.0;
}

std::vector<int> ObstaclesContainer::curr_frame_predictable_obstacle_ids() {
return curr_frame_predictable_obstacle_ids_;
}

std::vector<int> ObstaclesContainer::curr_frame_non_predictable_obstacle_ids() {
return curr_frame_non_predictable_obstacle_ids_;
}

std::vector<int> ObstaclesContainer::curr_frame_obstacle_ids() {
std::vector<int> curr_frame_obs_ids = curr_frame_predictable_obstacle_ids_;
curr_frame_obs_ids.insert(curr_frame_obs_ids.end(),
curr_frame_non_predictable_obstacle_ids_.begin(),
curr_frame_non_predictable_obstacle_ids_.end());
return curr_frame_obs_ids;
}


void ObstaclesContainer::InsertPerceptionObstacle(
const PerceptionObstacle& perception_obstacle, const double timestamp) {
Expand Down
7 changes: 7 additions & 0 deletions modules/prediction/container/obstacles/obstacles_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ class ObstaclesContainer : public Container {

size_t NumOfObstacles() { return ptr_obstacles_.size(); }

std::vector<int> curr_frame_predictable_obstacle_ids();

std::vector<int> curr_frame_non_predictable_obstacle_ids();

std::vector<int> curr_frame_obstacle_ids();

private:
Obstacle* GetObstacleWithLRUUpdate(const int obstacle_id);
/**
Expand All @@ -126,6 +132,7 @@ class ObstaclesContainer : public Container {
// an id_mapping from perception_id to prediction_id
common::util::LRUCache<int, int> id_mapping_;
std::vector<int> curr_frame_predictable_obstacle_ids_;
std::vector<int> curr_frame_non_predictable_obstacle_ids_;
std::unordered_map<int, int> curr_frame_id_mapping_;
};

Expand Down

0 comments on commit a1a95fb

Please sign in to comment.