Commit c32195f6 authored by Lorenz Halt's avatar Lorenz Halt 🔀
Browse files

fix id matching

parent 7c44cf08
......@@ -45,7 +45,9 @@ public:
std::stringstream ss(line);
string token;
std::getline(ss, token, ','); // skip first item (tick_ms)
while (std::getline(ss, token, ',')) {
while (std::getline(ss, token, ','))
{
string subToken = token.erase(0, token.find_first_of("/")+1); // remove component prefix
ff_coordinates_.push_back(token);
}
// end header
......@@ -97,16 +99,13 @@ protected:
auto closest_ff = feedforward_.upper_bound(tick_ms); // uses upper bound to avoid negative ticks and not reusing the 'last' values if there is nothing in file
if (closest_ff != feedforward_.end()) { // fitting tick found
pi_info("[Coordinate]: [{}]", coordinate);
string coordinate_str = coordinate;
coordinate_str.erase(0, coordinate_str.find_first_of("/")+1); // delete id from string
coordinate_str.erase(0, coordinate_str.find_first_of("/")+1); // delete id prefix
auto it = closest_ff->second.find(coordinate_str);
if (it == closest_ff->second.end())
{
pi_error("Although closest tick was found, the respective coordinate was not found. This probably points to a corrupted input file.");
pi_error("Coordinate: {}", coordinate_str);
// pi_error("Candidates: {}" closest_ff->second);
} else {
auto res_ff = res + it->second;
pi_debug("Tick: {} Coordinate: {}\nres: {}, ff: {}, res+ff: {}", tick_ms,
......@@ -165,6 +164,6 @@ protected:
string filename_ff_;
Tick start_;
std::map<int, std::map<string, double>> feedforward_; // maps tick in ms -> object that maps coordinate -> feedforward value
std::map<int, std::map<string, double>> feedforward_; // first: tick in ms, second: object -> first: coordinate, second: feedforward value
std::vector<string> ff_coordinates_;
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment