-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlocalization_layer.cpp
More file actions
31 lines (24 loc) · 847 Bytes
/
localization_layer.cpp
File metadata and controls
31 lines (24 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// Created by aoool on 28.10.18.
//
#include "localization_layer.hpp"
LocalizationLayer::LocalizationLayer(const PathPlannerConfig& config):
path_planner_config_{config}, sensor_fusion_{0}, time_{0.0}, cars_{sensor_fusion_.size()}, cars_updated_{false}, update_cnt_{0}
{
}
LocalizationLayer::~LocalizationLayer() = default;
void LocalizationLayer::Update(const std::vector< std::vector<double> >& sensor_fusion, double time) {
sensor_fusion_ = sensor_fusion;
time_ = time;
cars_updated_ = false;
}
std::vector<Car> LocalizationLayer::GetCars() {
if (not cars_updated_) {
cars_.resize(sensor_fusion_.size());
for (int i = 0; i < sensor_fusion_.size(); ++i) {
cars_[i] =
Car::FromVectorAssumingConstantVelocityAndLaneKeeping(sensor_fusion_[i], time_, path_planner_config_);
}
}
return cars_;
}