-
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 #1481 from tier4/feature/multi-level-lanelet-support
Feature/multi level lanelet support
- Loading branch information
Showing
18 changed files
with
369 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,8 @@ | |
"Tschirnhaus", | ||
"walltime", | ||
"xerces", | ||
"xercesc" | ||
"xercesc", | ||
"Szymon", | ||
"Parapura" | ||
] | ||
} |
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,45 @@ | ||
// 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 GEOMETRY__PLANE_HPP_ | ||
#define GEOMETRY__PLANE_HPP_ | ||
|
||
#include <geometry_msgs/msg/point.hpp> | ||
#include <geometry_msgs/msg/vector3.hpp> | ||
#include <optional> | ||
|
||
namespace math | ||
{ | ||
namespace geometry | ||
{ | ||
|
||
/// @class Plane | ||
/// @brief Represents a plane in 3D space, defined by a normal vector and a point on the plane. | ||
/// | ||
/// The plane is described using the equation: | ||
/// Ax + By + Cz + D = 0 | ||
/// where: | ||
/// - A, B, C are the components of the normal vector (normal_ attribute). | ||
/// - D is the offset from the origin, calculated using the point and normal vector (d_ attribute). | ||
struct Plane | ||
{ | ||
Plane(const geometry_msgs::msg::Point & point, const geometry_msgs::msg::Vector3 & normal); | ||
auto offset(const geometry_msgs::msg::Point & point) const -> double; | ||
|
||
const geometry_msgs::msg::Vector3 normal_; | ||
const double d_; | ||
}; | ||
} // namespace geometry | ||
} // namespace math | ||
#endif // GEOMETRY__PLANE_HPP_ |
39 changes: 39 additions & 0 deletions
39
common/math/geometry/include/geometry/quaternion/get_angle_difference.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,39 @@ | ||
// 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 GEOMETRY__QUATERNION__GET_ANGLE_DIFFERENCE_HPP_ | ||
#define GEOMETRY__QUATERNION__GET_ANGLE_DIFFERENCE_HPP_ | ||
|
||
#include <Eigen/Geometry> | ||
#include <geometry/quaternion/is_like_quaternion.hpp> | ||
|
||
namespace math | ||
{ | ||
namespace geometry | ||
{ | ||
template < | ||
typename T, std::enable_if_t<std::conjunction_v<IsLikeQuaternion<T>>, std::nullptr_t> = nullptr> | ||
auto getAngleDifference(const T & quat1, const T & quat2) -> double | ||
{ | ||
const Eigen::Quaterniond q1(quat1.w, quat1.x, quat1.y, quat1.z); | ||
const Eigen::Quaterniond q2(quat2.w, quat2.x, quat2.y, quat2.z); | ||
|
||
const Eigen::AngleAxisd delta(q1.inverse() * q2); | ||
|
||
return std::abs(delta.angle()); // [rad] | ||
} | ||
} // namespace geometry | ||
} // namespace math | ||
|
||
#endif // GEOMETRY__QUATERNION__GET_ANGLE_DIFFERENCE_HPP_ |
41 changes: 41 additions & 0 deletions
41
common/math/geometry/include/geometry/quaternion/get_normal_vector.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,41 @@ | ||
// 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 GEOMETRY__VECTOR3__GET_NORMAL_VECTOR_HPP_ | ||
#define GEOMETRY__VECTOR3__GET_NORMAL_VECTOR_HPP_ | ||
|
||
#include <geometry/quaternion/get_rotation_matrix.hpp> | ||
#include <geometry/quaternion/is_like_quaternion.hpp> | ||
#include <geometry_msgs/msg/vector3.hpp> | ||
|
||
namespace math | ||
{ | ||
namespace geometry | ||
{ | ||
template < | ||
typename T, std::enable_if_t<std::conjunction_v<IsLikeQuaternion<T>>, std::nullptr_t> = nullptr> | ||
auto getNormalVector(const T & orientation) -> geometry_msgs::msg::Vector3 | ||
{ | ||
const Eigen::Matrix3d rotation_matrix = getRotationMatrix(orientation); | ||
|
||
return geometry_msgs::build<geometry_msgs::msg::Vector3>() | ||
.x(rotation_matrix(0, 2)) | ||
.y(rotation_matrix(1, 2)) | ||
.z(rotation_matrix(2, 2)); | ||
} | ||
|
||
} // namespace geometry | ||
} // namespace math | ||
|
||
#endif // GEOMETRY__VECTOR3__GET_NORMAL_VECTOR_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,39 @@ | ||
// 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. | ||
|
||
#include <cmath> | ||
#include <geometry/plane.hpp> | ||
#include <geometry/quaternion/operator.hpp> | ||
#include <scenario_simulator_exception/exception.hpp> | ||
|
||
namespace math | ||
{ | ||
namespace geometry | ||
{ | ||
Plane::Plane(const geometry_msgs::msg::Point & point, const geometry_msgs::msg::Vector3 & normal) | ||
: normal_(normal), d_(-(normal.x * point.x + normal.y * point.y + normal.z * point.z)) | ||
{ | ||
if (normal.x == 0.0 && normal.y == 0.0 && normal.z == 0.0) { | ||
THROW_SIMULATION_ERROR("Plane cannot be created using zero normal vector."); | ||
} else if (std::isnan(point.x) || std::isnan(point.y) || std::isnan(point.z)) { | ||
THROW_SIMULATION_ERROR("Plane cannot be created using point with NaN value."); | ||
} | ||
} | ||
|
||
auto Plane::offset(const geometry_msgs::msg::Point & point) const -> double | ||
{ | ||
return normal_.x * point.x + normal_.y * point.y + normal_.z * point.z + d_; | ||
} | ||
} // namespace geometry | ||
} // namespace math |
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
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.