-
Notifications
You must be signed in to change notification settings - Fork 676
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(control_evaluator, tier4_control_launch): add a trigger to choic…
…e whether to output metrics to log folder (#9478) * refactor and add output_metrics. a bug existing when psim. Signed-off-by: xtk8532704 <[email protected]> * refactored launch file. Signed-off-by: xtk8532704 <[email protected]> * output description Signed-off-by: xtk8532704 <[email protected]> * add parm to launch file. Signed-off-by: xtk8532704 <[email protected]> * move output_metrics from param config to launch file. Signed-off-by: xtk8532704 <[email protected]> * move output_metrics from config to launch.xml Signed-off-by: xtk8532704 <[email protected]> * fix unit test bug. Signed-off-by: xtk8532704 <[email protected]> * fix test bug again. Signed-off-by: xtk8532704 <[email protected]> * Update evaluator/autoware_control_evaluator/include/autoware/control_evaluator/control_evaluator_node.hpp --------- Signed-off-by: xtk8532704 <[email protected]> Co-authored-by: Kosuke Takeuchi <[email protected]>
- Loading branch information
1 parent
210ff63
commit b77f091
Showing
8 changed files
with
198 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
evaluator/autoware_control_evaluator/include/autoware/control_evaluator/metrics/metric.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright 2021 Tier IV, Inc. | ||
// | ||
// 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. | ||
|
||
#ifndef AUTOWARE__CONTROL_EVALUATOR__METRICS__METRIC_HPP_ | ||
#define AUTOWARE__CONTROL_EVALUATOR__METRICS__METRIC_HPP_ | ||
|
||
#include <iostream> | ||
#include <string> | ||
#include <unordered_map> | ||
#include <vector> | ||
|
||
namespace control_diagnostics | ||
{ | ||
/** | ||
* @brief Enumeration of trajectory metrics | ||
*/ | ||
enum class Metric { | ||
lateral_deviation, | ||
yaw_deviation, | ||
goal_longitudinal_deviation, | ||
goal_lateral_deviation, | ||
goal_yaw_deviation, | ||
SIZE, | ||
}; | ||
|
||
static const std::unordered_map<std::string, Metric> str_to_metric = { | ||
{"lateral_deviation", Metric::lateral_deviation}, | ||
{"yaw_deviation", Metric::yaw_deviation}, | ||
{"goal_longitudinal_deviation", Metric::goal_longitudinal_deviation}, | ||
{"goal_lateral_deviation", Metric::goal_lateral_deviation}, | ||
{"goal_yaw_deviation", Metric::goal_yaw_deviation}, | ||
}; | ||
|
||
static const std::unordered_map<Metric, std::string> metric_to_str = { | ||
{Metric::lateral_deviation, "lateral_deviation"}, | ||
{Metric::yaw_deviation, "yaw_deviation"}, | ||
{Metric::goal_longitudinal_deviation, "goal_longitudinal_deviation"}, | ||
{Metric::goal_lateral_deviation, "goal_lateral_deviation"}, | ||
{Metric::goal_yaw_deviation, "goal_yaw_deviation"}, | ||
}; | ||
|
||
// Metrics descriptions | ||
static const std::unordered_map<Metric, std::string> metric_descriptions = { | ||
{Metric::lateral_deviation, "Lateral deviation from the reference trajectory[m]"}, | ||
{Metric::yaw_deviation, "Yaw deviation from the reference trajectory[rad]"}, | ||
{Metric::goal_longitudinal_deviation, "Longitudinal deviation from the goal point[m]"}, | ||
{Metric::goal_lateral_deviation, "Lateral deviation from the goal point[m]"}, | ||
{Metric::goal_yaw_deviation, "Yaw deviation from the goal point[rad]"}}; | ||
|
||
namespace details | ||
{ | ||
static struct CheckCorrectMaps | ||
{ | ||
CheckCorrectMaps() | ||
{ | ||
if ( | ||
str_to_metric.size() != static_cast<size_t>(Metric::SIZE) || | ||
metric_to_str.size() != static_cast<size_t>(Metric::SIZE) || | ||
metric_descriptions.size() != static_cast<size_t>(Metric::SIZE)) { | ||
std::cerr << "[metrics/metrics.hpp] Maps are not defined for all metrics: "; | ||
std::cerr << str_to_metric.size() << " " << metric_to_str.size() << " " | ||
<< metric_descriptions.size() << std::endl; | ||
} | ||
} | ||
} check; | ||
|
||
} // namespace details | ||
} // namespace control_diagnostics | ||
|
||
#endif // AUTOWARE__CONTROL_EVALUATOR__METRICS__METRIC_HPP_ |
14 changes: 7 additions & 7 deletions
14
evaluator/autoware_control_evaluator/launch/control_evaluator.launch.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
<launch> | ||
<arg name="input/diagnostics" default="/diagnostics"/> | ||
<arg name="output_metrics" default="false"/> | ||
<arg name="input/odometry" default="/localization/kinematic_state"/> | ||
<arg name="input/acceleration" default="/localization/acceleration"/> | ||
<arg name="input/trajectory" default="/planning/scenario_planning/trajectory"/> | ||
<arg name="map_topic_name" default="/map/vector_map"/> | ||
<arg name="route_topic_name" default="/planning/mission_planning/route"/> | ||
<arg name="input/vector_map" default="/map/vector_map"/> | ||
<arg name="input/route" default="/planning/mission_planning/route"/> | ||
|
||
<!-- control evaluator --> | ||
<group> | ||
<node name="control_evaluator" exec="control_evaluator" pkg="autoware_control_evaluator"> | ||
<param from="$(find-pkg-share autoware_control_evaluator)/param/control_evaluator.defaults.yaml"/> | ||
<remap from="~/input/diagnostics" to="$(var input/diagnostics)"/> | ||
<param name="output_metrics" value="$(var output_metrics)"/> | ||
<remap from="~/input/odometry" to="$(var input/odometry)"/> | ||
<remap from="~/input/acceleration" to="$(var input/acceleration)"/> | ||
<remap from="~/input/trajectory" to="$(var input/trajectory)"/> | ||
<remap from="~/input/vector_map" to="$(var map_topic_name)"/> | ||
<remap from="~/input/route" to="$(var route_topic_name)"/> | ||
<remap from="~/input/vector_map" to="$(var input/vector_map)"/> | ||
<remap from="~/input/route" to="$(var input/route)"/> | ||
</node> | ||
</group> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.