Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
localization_controller_config.hpp
Go to the documentation of this file.
1#pragma once
2
3/*
4 * Copyright (C) 2021-2022 LEIDOS.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
7 * use this file except in compliance with the License. You may obtain a copy of
8 * the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 * License for the specific language governing permissions and limitations under
16 * the License.
17 */
18
19#include <iostream>
20#include <vector>
21#include <unordered_map>
22#include <type_traits>
23#include <boost/functional/hash/extensions.hpp>
24#include <rapidjson/document.h>
25
27{
29 FAILED=0,
30 OPERATIONAL=1
31 };
32
33 enum class SensorAlertStatus {
34 FATAL=0,
35 OPERATIONAL=1,
36 CAUTION=2,
37 WARNING=3
38 };
39
40 struct VectorHash : boost::hash<std::vector<SensorBooleanStatus>> {};
41
46 {
48 std::vector<std::string> sensor_nodes;
49
50 // TODO comments
51 std::unordered_map<std::vector<SensorBooleanStatus>, SensorAlertStatus, VectorHash> sensor_fault_map;
52
53
54 // Stream operator for this config
55 friend std::ostream &operator<<(std::ostream &output, const LocalizationControllerConfig &c)
56 {
57
58 output << "LocalizationControllerConfig { " << std::endl
59 << "sensor_nodes: [ ";
60
61 for (auto node : c.sensor_nodes)
62 output << node << ", ";
63
64 output << "] " << std::endl;
65
66 output << "sensor_fault_map: [ ";
67
68 for (auto const& pair: c.sensor_fault_map) {
69 output << "{ ";
70
71 for (auto const& status : pair.first) {
72 output << static_cast<std::underlying_type<SensorBooleanStatus>::type>(status) << ", ";
73 }
74
75 output << ": " << static_cast<std::underlying_type<SensorAlertStatus>::type>(pair.second) << " }" << std::endl;
76 }
77
78 output << "] " << std::endl
79 << "}" << std::endl;
80 return output;
81 }
82 };
83
84} // namespace subsystem_controllers
Stuct containing the algorithm configuration values for the BaseSubsystemController.
std::unordered_map< std::vector< SensorBooleanStatus >, SensorAlertStatus, VectorHash > sensor_fault_map
friend std::ostream & operator<<(std::ostream &output, const LocalizationControllerConfig &c)