-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1463 from tier4/refactor/interpreter
Refactor/interpreter
- Loading branch information
Showing
9 changed files
with
84 additions
and
83 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
44 changes: 44 additions & 0 deletions
44
openscenario/openscenario_interpreter/include/openscenario_interpreter/cmath/hypot.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,44 @@ | ||
// Copyright 2015 TIER IV, Inc. All rights reserved. | ||
// | ||
// 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 OPENSCENARIO_INTERPRETER__CMATH__HYPOT_HPP_ | ||
#define OPENSCENARIO_INTERPRETER__CMATH__HYPOT_HPP_ | ||
|
||
#include <cmath> | ||
#include <rclcpp/rclcpp.hpp> | ||
|
||
namespace openscenario_interpreter | ||
{ | ||
inline namespace cmath | ||
{ | ||
/* | ||
@todo: after checking all the scenario work well with | ||
consider_pose_by_road_slope = true, remove this function and use | ||
std::hypot(x, y, z) | ||
*/ | ||
template <typename T> | ||
auto hypot(T x, T y, T z) | ||
{ | ||
static const auto consider_pose_by_road_slope = []() { | ||
auto node = rclcpp::Node("get_parameter", "simulation"); | ||
node.declare_parameter("consider_pose_by_road_slope", false); | ||
return node.get_parameter("consider_pose_by_road_slope").as_bool(); | ||
}(); | ||
|
||
return consider_pose_by_road_slope ? std::hypot(x, y, z) : std::hypot(x, y); | ||
} | ||
} // namespace cmath | ||
} // namespace openscenario_interpreter | ||
|
||
#endif // OPENSCENARIO_INTERPRETER__CMATH__HYPOT_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
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
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