Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/unit tests/simple sensor simulator #27

Open
wants to merge 178 commits into
base: feature/simple_sensor_simulator_unit_tests_part3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 92 commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
07c48a5
Update FaultInjection to prepare Node and Publisher in the parse phase
yamacir-kit May 29, 2023
3dfb240
Lipsticks
yamacir-kit May 29, 2023
1e65bed
Add `ConfiguringPerceptionTopics` page to documentation
yamacir-kit May 29, 2023
082fb2e
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Jun 20, 2023
a592444
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Jun 20, 2023
88e1cb3
fix(action): fix fault injection - history_depth in qos
dmoszynski Jun 22, 2023
e36b3b8
ref(action): apply clang_format
dmoszynski Jun 22, 2023
81fdd09
Merge pull request #1021 from tier4/fix/interpreter/fault_injection_a…
yamacir-kit Jun 27, 2023
c6df109
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Jul 10, 2023
5f65939
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Jul 27, 2023
4e8b108
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Jul 31, 2023
94b67db
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Aug 7, 2023
8606f02
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Aug 31, 2023
a46115e
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Sep 5, 2023
dfc0c7d
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Oct 2, 2023
70a5ef3
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Oct 12, 2023
cf29228
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Oct 16, 2023
7bd0f17
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Nov 9, 2023
15080b8
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Dec 18, 2023
84f5a5f
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Jan 15, 2024
7bd926f
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit Mar 19, 2024
82a0881
floating_point comparison
robomic Apr 10, 2024
6a355d3
simple_sensr_simulation unit tests
robomic Apr 10, 2024
b651642
traffic_simulator unit tests
robomic Apr 10, 2024
c132545
simulation_interface unit tests
robomic Apr 10, 2024
2aae69e
conversions cleanup
robomic Apr 10, 2024
3b2a3aa
traffic_light status shape color tests
robomic Apr 10, 2024
ad29c42
traffic light bulb tests
robomic Apr 11, 2024
e9af35f
vertex, toPoints
robomic Apr 11, 2024
bec64f2
behavior getRequestString
robomic Apr 11, 2024
76d988d
job and job_list unit tests
robomic Apr 11, 2024
48febb2
make linter happy
robomic Apr 11, 2024
56af13b
job accessor tests
robomic Apr 12, 2024
56e31fe
entity_base dummy class with a couple of tests
robomic Apr 12, 2024
2a230da
EntityBase onUpdate. onPostUpdate tests
robomic Apr 12, 2024
fd21bcc
entity_base tests; code cleanup
robomic Apr 15, 2024
5cdd159
entity_base tests
robomic Apr 15, 2024
95a604f
simulation clock tests
robomic Apr 16, 2024
f601722
getRouteLanelets_empty
robomic Apr 18, 2024
07e587c
getDistanceToLeftLaneBound
robomic Apr 18, 2024
670cbbf
Merge branch 'master' into fix/interpreter/fault-injection-action
yamacir-kit Apr 19, 2024
e9c650d
style
robomic May 27, 2024
dc3fbe7
remove tests that exist in other branches and refactor wht is left
robomic May 27, 2024
5837933
Merge remote-tracking branch 'origin/master' into fix/interpreter/fau…
yamacir-kit May 30, 2024
f17189f
Prototype ParameterManager
TauTheLepton Jun 5, 2024
5869e8a
Move ParameterManager
TauTheLepton Jun 5, 2024
bb3b21b
Add ParameterManager to API
TauTheLepton Jun 5, 2024
5575b4e
Add getParameter forwarding in API
TauTheLepton Jun 5, 2024
1f9dc1a
Use const for getParameter
TauTheLepton Jun 5, 2024
6f22fc0
Apply API getParameter function where possible
TauTheLepton Jun 5, 2024
0e8a1a2
Use ParameterManager in EgoEntity
TauTheLepton Jun 5, 2024
8c9e194
Remove getParameter from EgoEntity
TauTheLepton Jun 5, 2024
ebc5ded
Remove getParameter from EntityManager
TauTheLepton Jun 5, 2024
ed4b521
remove arithmetic tests
robomic Jun 6, 2024
07b8e6b
remove simple sensor simulator tets
robomic Jun 6, 2024
067b01c
remove conversions tests
robomic Jun 6, 2024
7951725
final cleanup
robomic Jun 6, 2024
902878a
Merge branch 'master' of github.com:tier4/scenario_simulator_v2 into …
robomic Jun 6, 2024
a02b847
prepare notes for descriptions
robomic Jun 6, 2024
df258bd
Make ParameterManager explicit
TauTheLepton Jun 6, 2024
fe789e7
add tes descriptions
robomic Jun 6, 2024
bd99b7d
newlines
robomic Jun 6, 2024
b1572a6
remove unnecesary checks
robomic Jun 6, 2024
a3c6447
remove variables that are used only once
robomic Jun 6, 2024
4753237
use test fixture
robomic Jun 6, 2024
63f9e50
rename literal
robomic Jun 6, 2024
ff8e0d4
use test fixtures
robomic Jun 6, 2024
33ff172
ref(ParameterManager): rename to NodeParameterHandler, improve
dmoszynski Jun 6, 2024
b964336
Merge branch 'master' into fix/interpreter/fault-injection-action
yamacir-kit Jun 7, 2024
e52e0c2
remove test list file
robomic Jun 7, 2024
13adce4
Merge branch 'master' into fix/interpreter/fault-injection-action
yamacir-kit Jun 10, 2024
c04ba5f
resolve merge
robomic Jun 10, 2024
39ceca8
resolve merge confilct
robomic Jun 11, 2024
8a2f333
remove misc tests
robomic Jun 11, 2024
466d364
Remove quaternion_operation
TakanoTaiga Jun 11, 2024
3abd2e9
fix package xml
TakanoTaiga Jun 11, 2024
77cdef1
collect tests, will not compile
robomic Jun 11, 2024
f37be0d
make it work; some tests have been deleted
robomic Jun 11, 2024
f21000f
remove variables used only once
robomic Jun 11, 2024
7f8c4fe
use builder
robomic Jun 11, 2024
1d7d8dc
rename file definition
robomic Jun 11, 2024
2809b7f
add newline
robomic Jun 11, 2024
15481f4
clean up
robomic Jun 11, 2024
8b6d6d0
fix
TakanoTaiga Jun 12, 2024
c6a10ea
merge tests into a singular file
robomic Jun 12, 2024
d3395ba
use better naming
robomic Jun 12, 2024
63b3c34
change format
TakanoTaiga Jun 12, 2024
9f9d4af
Only publsih tf onece.
TakanoTaiga Jun 12, 2024
9ffa38f
fix format
TakanoTaiga Jun 12, 2024
8f047ee
test: [RJD-937] to Implement Unit tests on simple_sensor_simulator
SzymonParapura Jun 12, 2024
7c52e27
Merge branch 'feature/simple_sensor_simulator_ut' of github.com:Robot…
robomic Jun 12, 2024
40035b1
test: [RJD-937] to Implement Unit tests on simple_sensor_simulator
SzymonParapura Jun 12, 2024
aac0d50
merge conflict
robomic Jun 12, 2024
c835629
Merge branch 'master' into fix/interpreter/fault-injection-action
yamacir-kit Jun 13, 2024
2e25a7b
Merge branch 'master' into fix/remove_quaternion_operation
hakuturu583 Jun 13, 2024
529060e
empty
TakanoTaiga Jun 13, 2024
bf2da12
fix
TakanoTaiga Jun 13, 2024
4e5bcbf
Merge pull request #1012 from tier4/fix/interpreter/fault-injection-a…
HansRobo Jun 13, 2024
0e9e6d2
Update common/math/geometry/include/geometry/quaternion/get_rotation.hpp
hakuturu583 Jun 13, 2024
9512375
Merge branch 'master' into fix/remove_quaternion_operation
hakuturu583 Jun 13, 2024
e2b12fa
Bump version of scenario_simulator_v2 from version 2.1.1 to version 2…
actions-user Jun 13, 2024
35e1fa4
Merge branch 'master' into fix/remove_quaternion_operation
hakuturu583 Jun 13, 2024
1ee243d
Merge branch 'master' into fix/issue1276
hakuturu583 Jun 13, 2024
aaeba29
Declare parameters before getting values
TauTheLepton Jun 13, 2024
755df34
Merge branch 'master' into feature/improve-ros-parameter-handling
TauTheLepton Jun 13, 2024
e82c451
setting up zmq server
robomic Jun 13, 2024
39723a7
Revert changes adding parameter checking
TauTheLepton Jun 13, 2024
e777c45
add a bunch of working tests, first bug found
robomic Jun 13, 2024
9ece262
Merge pull request #1284 from tier4/fix/issue1276
hakuturu583 Jun 14, 2024
4ba52d4
Bump version of scenario_simulator_v2 from version 2.1.2 to version 2…
actions-user Jun 14, 2024
824d4f6
Merge pull request #1281 from tier4/fix/remove_quaternion_operation
hakuturu583 Jun 14, 2024
0893594
Bump version of scenario_simulator_v2 from version 2.1.3 to version 2…
actions-user Jun 14, 2024
51fb643
more tests
robomic Jun 14, 2024
3eae6c0
internal review corrections
robomic Jun 17, 2024
27772ef
add copy of helper_functions, apply review requests
robomic Jun 17, 2024
66a3762
add newlines
robomic Jun 17, 2024
03b72c9
remove unecessary assignment
robomic Jun 17, 2024
a4dd832
fix typo
robomic Jun 17, 2024
03cea51
Merge branch 'master' of github.com:tier4/scenario_simulator_v2 into …
robomic Jun 17, 2024
38fb9bb
resolve conflict
robomic Jun 17, 2024
1a3b3b9
Merge branch 'master' of github.com:tier4/scenario_simulator_v2 into …
robomic Jun 17, 2024
ce42ebf
resolve conflict
robomic Jun 17, 2024
ec4c74f
Bump urllib3 from 2.2.1 to 2.2.2
dependabot[bot] Jun 17, 2024
5a4d8c7
Merge branch 'master' into feature/improve-ros-parameter-handling
hakuturu583 Jun 18, 2024
e2be967
Merge pull request #1288 from tier4/dependabot/pip/urllib3-2.2.2
hakuturu583 Jun 18, 2024
f35ed44
Bump version of scenario_simulator_v2 from version 2.1.4 to version 2…
actions-user Jun 18, 2024
b095a3c
Revert "Optimize `EntityManager::broadcastEntityTransform` to Execute…
hakuturu583 Jun 18, 2024
c0602d2
Merge pull request #1289 from tier4/revert-1284-fix/issue1276
hakuturu583 Jun 18, 2024
bd366bc
Bump version of scenario_simulator_v2 from version 2.1.5 to version 2…
actions-user Jun 18, 2024
66138a1
getParameter -> getROS2Parameter
TauTheLepton Jun 18, 2024
5a462a1
file structure
robomic Jun 18, 2024
55b686f
add API::clearRoute()
TakanoTaiga Jun 18, 2024
f060cd2
Merge branch 'master' into feature/clear_route_api
TakanoTaiga Jun 18, 2024
f4db270
test: [RJD-937] to Implement Unit tests on simple_sensor_simulator
SzymonParapura Jun 18, 2024
708b6c1
merge conflict
robomic Jun 18, 2024
bdfb127
test: [RJD-937] to Implement Unit tests on simple_sensor_simulator
SzymonParapura Jun 18, 2024
86ac456
merge conflicts
robomic Jun 18, 2024
2847e33
Merge branch 'feature/simple_sensor_simulator_unit_test' of github.co…
robomic Jun 18, 2024
57a58e3
Merge branch 'master' into feature/simple_sensor_simulator_unit_test
SzymonParapura Jun 18, 2024
2278a52
port old tests
robomic Jun 18, 2024
2a0cb5a
Convert parameterHandler class to free function getParameter used wit…
TauTheLepton Jun 18, 2024
afeffb5
test: [RJD-937] to Implement Unit tests on simple_sensor_simulator
SzymonParapura Jun 18, 2024
ea8fab4
Merge pull request #1275 from tier4/feature/improve-ros-parameter-han…
hakuturu583 Jun 19, 2024
bf6a962
Bump version of scenario_simulator_v2 from version 2.1.6 to version 2…
actions-user Jun 19, 2024
14963d2
Merge branch 'master' into feature/simple_sensor_simulator_unit_test
HansRobo Jun 19, 2024
2c3aa14
add tests
robomic Jun 19, 2024
1ee4828
Optimize entity frame computation.
TakanoTaiga Jun 20, 2024
2aae71b
Moved ament_cmake_gtest to package.xml
SzymonParapura Jun 20, 2024
1eb6144
use test fixture
robomic Jun 20, 2024
cf246e4
Merge branch 'feature/simple_sensor_simulator_unit_test' of github.co…
robomic Jun 20, 2024
3d8101d
update comments, newlines
robomic Jun 20, 2024
8468052
Merge pull request #1291 from tier4/feature/simple_sensor_simulator_u…
HansRobo Jun 20, 2024
0dbbc28
Bump version of scenario_simulator_v2 from version 2.1.7 to version 2…
actions-user Jun 20, 2024
5bf9bef
Merge branch 'master' into feature/clear_route_api
hakuturu583 Jun 21, 2024
6e919da
remove arm build test
hakuturu583 Jun 24, 2024
8b6b47b
update Docker.yaml
hakuturu583 Jun 24, 2024
ab97cc3
update lockfile
hakuturu583 Jun 24, 2024
d0be23c
Merge pull request #1299 from tier4/fix/remove_arm_build_test
HansRobo Jun 24, 2024
4cfe5f7
Merge remote-tracking branch 'origin/master' into feature/clear_route…
hakuturu583 Jun 24, 2024
9602a5b
Bump version of scenario_simulator_v2 from version 2.1.8 to version 2…
actions-user Jun 24, 2024
2bc8f14
Merge remote-tracking branch 'origin/feature/clear_route_api' into fe…
hakuturu583 Jun 24, 2024
8af9196
Merge branch 'master' into feature/clear_route_api
hakuturu583 Jun 24, 2024
be7358d
Merge pull request #1286 from tier4/feature/unit_tests/misc_object_en…
hakuturu583 Jun 24, 2024
689049c
Bump version of scenario_simulator_v2 from version 2.1.9 to version 2…
actions-user Jun 24, 2024
b209600
Merge pull request #1287 from tier4/feature/unit_tests/miscellaneous
hakuturu583 Jun 24, 2024
8890816
Bump version of scenario_simulator_v2 from version 2.1.10 to version …
actions-user Jun 24, 2024
5a04ba7
Merge pull request #1292 from tier4/feature/clear_route_api
hakuturu583 Jun 24, 2024
c50d79f
Bump version of scenario_simulator_v2 from version 2.1.11 to version …
actions-user Jun 24, 2024
a61ae1f
Merge remote-tracking branch 'origin/master' into fix/issue1276-re
hakuturu583 Jun 24, 2024
dd70528
Merge pull request #1293 from tier4/fix/issue1276-re
hakuturu583 Jun 27, 2024
92803a2
Bump version of scenario_simulator_v2 from version 2.2.0 to version 2…
actions-user Jun 27, 2024
8b2b42a
Delete merged branch using github-script instead of delete-merged-bra…
f0reachARR Jun 28, 2024
f3fd10c
Merge pull request #1304 from tier4/fix/merged-branch-deletion
hakuturu583 Jun 28, 2024
e8fe111
Bump version of scenario_simulator_v2 from version 2.2.1 to version 2…
actions-user Jun 28, 2024
3822738
Merge branch 'master' of github.com:tier4/scenario_simulator_v2 into …
robomic Jun 28, 2024
9386835
review changes
robomic Jun 28, 2024
f0b5f62
merge conflicts
robomic Jun 28, 2024
61f421a
simplify file and package dependencies
robomic Jun 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions common/math/arithmetic/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,43 @@ Changelog for package arithmetic
* Merge branch 'master' into refactor/drop_workflow
* Contributors: Kotaro Yoshimoto

2.1.7 (2024-06-19)
------------------
* Merge branch 'master' into feature/improve-ros-parameter-handling
* Merge branch 'master' into feature/improve-ros-parameter-handling
* Contributors: Masaya Kataoka, Mateusz Palczuk

2.1.6 (2024-06-18)
------------------

2.1.5 (2024-06-18)
------------------

2.1.4 (2024-06-14)
------------------
* Merge branch 'master' into fix/remove_quaternion_operation
* Merge branch 'master' into fix/remove_quaternion_operation
* Contributors: Masaya Kataoka

2.1.3 (2024-06-14)
------------------
* Merge branch 'master' into fix/issue1276
* Contributors: Masaya Kataoka

2.1.2 (2024-06-13)
------------------
* Merge branch 'master' into fix/interpreter/fault-injection-action
* Merge branch 'master' into fix/interpreter/fault-injection-action
* Merge branch 'master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge branch 'master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Contributors: Tatsuya Yamasaki, yamacir-kit

2.1.1 (2024-06-11)
------------------
* Merge branch 'master' into fix/reorder
Expand Down
2 changes: 1 addition & 1 deletion common/math/arithmetic/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>arithmetic</name>
<version>2.1.1</version>
<version>2.1.7</version>
<description>arithmetic library for scenario_simulator_v2</description>
<maintainer email="[email protected]">Tatsuya Yamasaki</maintainer>
<license>Apache License 2.0</license>
Expand Down
45 changes: 45 additions & 0 deletions common/math/geometry/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,51 @@ Changelog for package geometry
* Merge branch 'master' into refactor/drop_workflow
* Contributors: Kotaro Yoshimoto

2.1.7 (2024-06-19)
------------------
* Merge branch 'master' into feature/improve-ros-parameter-handling
* Merge branch 'master' into feature/improve-ros-parameter-handling
* Contributors: Masaya Kataoka, Mateusz Palczuk

2.1.6 (2024-06-18)
------------------

2.1.5 (2024-06-18)
------------------

2.1.4 (2024-06-14)
------------------
* Merge pull request `#1281 <https://github.com/tier4/scenario_simulator_v2/issues/1281>`_ from tier4/fix/remove_quaternion_operation
Remove quaternion_operation
* Merge branch 'master' into fix/remove_quaternion_operation
* Update common/math/geometry/include/geometry/quaternion/get_rotation.hpp
* fix
* Merge branch 'master' into fix/remove_quaternion_operation
* Remove quaternion_operation
* Contributors: Masaya Kataoka, Taiga Takano

2.1.3 (2024-06-14)
------------------
* Merge branch 'master' into fix/issue1276
* Contributors: Masaya Kataoka

2.1.2 (2024-06-13)
------------------
* Merge branch 'master' into fix/interpreter/fault-injection-action
* Merge branch 'master' into fix/interpreter/fault-injection-action
* Merge branch 'master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge branch 'master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Merge remote-tracking branch 'origin/master' into fix/interpreter/fault-injection-action
* Contributors: Tatsuya Yamasaki, yamacir-kit

2.1.1 (2024-06-11)
------------------
* Merge branch 'master' into fix/reorder
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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__EULER_TO_QUATERNION_HPP_
#define GEOMETRY__QUATERNION__EULER_TO_QUATERNION_HPP_

#include <tf2/LinearMath/Matrix3x3.h>

#include <cmath>
#include <geometry/vector3/is_like_vector3.hpp>
#include <geometry_msgs/msg/quaternion.hpp>

namespace math
{
namespace geometry
{
template <
typename T, std::enable_if_t<std::conjunction_v<IsLikeVector3<T>>, std::nullptr_t> = nullptr>
auto convertEulerAngleToQuaternion(const T & v)
{
const double & roll = v.x;
const double & pitch = v.y;
const double & yaw = v.z;
tf2::Quaternion tf_quat;
tf_quat.setRPY(roll, pitch, yaw);
return geometry_msgs::build<geometry_msgs::msg::Quaternion>()
.x(tf_quat.x())
.y(tf_quat.y())
.z(tf_quat.z())
.w(tf_quat.w());
}
} // namespace geometry
} // namespace math

#endif // GEOMETRY__QUATERNION__EULER_TO_QUATERNION_HPP_
43 changes: 43 additions & 0 deletions common/math/geometry/include/geometry/quaternion/get_rotation.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// 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_ROTATION_HPP_
#define GEOMETRY__QUATERNION__GET_ROTATION_HPP_

#include <tf2/LinearMath/Matrix3x3.h>

#include <cmath>
#include <geometry/quaternion/is_like_quaternion.hpp>
#include <geometry/quaternion/operator.hpp>

namespace math
{
namespace geometry
{
template <
typename T, typename U,
std::enable_if_t<std::conjunction_v<IsLikeQuaternion<T>, IsLikeQuaternion<U>>, std::nullptr_t> =
nullptr>
auto getRotation(T from, U to)
{
// This function gets the conjugate of the quaternion.
from.x *= -1;
from.y *= -1;
from.z *= -1;
return from * to;
}
} // namespace geometry
} // namespace math

#endif // GEOMETRY__QUATERNION__GET_ROTATION_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// 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_ROTATION_MATRIX_HPP_
#define GEOMETRY__QUATERNION__GET_ROTATION_MATRIX_HPP_

#include <tf2/LinearMath/Matrix3x3.h>

#include <cmath>
#include <geometry/quaternion/is_like_quaternion.hpp>

#define EIGEN_MPL2_ONLY
#include <Eigen/Core>
#include <Eigen/Geometry>

namespace math
{
namespace geometry
{
template <
typename T, std::enable_if_t<std::conjunction_v<IsLikeQuaternion<T>>, std::nullptr_t> = nullptr>
auto getRotationMatrix(T quat)
{
auto x = quat.x;
auto y = quat.y;
auto z = quat.z;
auto w = quat.w;
Eigen::Matrix3d ret(3, 3);
// clang-format off
ret << x * x - y * y - z * z + w * w, 2 * (x * y - z * w), 2 * (z * x + w * y),
2 * (x * y + z * w), -x * x + y * y - z * z + w * w, 2 * (y * z - x * w),
2 * (z * x - w * y), 2 * (y * z + w * x), -x * x - y * y + z * z + w * w;
// clang-format on
return ret;
}
} // namespace geometry
} // namespace math

#endif // GEOMETRY__QUATERNION__GET_ROTATION_MATRIX_HPP_
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__QUATERNION__QUATERNION_TO_EULER_HPP_
#define GEOMETRY__QUATERNION__QUATERNION_TO_EULER_HPP_

#include <tf2/LinearMath/Matrix3x3.h>

#include <cmath>
#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 convertQuaternionToEulerAngle(const T & q)
{
tf2::Quaternion tf_quat(q.x, q.y, q.z, q.w);
tf2::Matrix3x3 mat(tf_quat);
double roll, pitch, yaw;
mat.getRPY(roll, pitch, yaw);
return geometry_msgs::build<geometry_msgs::msg::Vector3>().x(roll).y(pitch).z(yaw);
}
} // namespace geometry
} // namespace math

#endif // GEOMETRY__QUATERNION__QUATERNION_TO_EULER_HPP_
58 changes: 58 additions & 0 deletions common/math/geometry/include/geometry/quaternion/slerp.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// 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__SLERP_HPP_
#define GEOMETRY__QUATERNION__SLERP_HPP_

#include <cmath>
#include <geometry/quaternion/is_like_quaternion.hpp>
#include <geometry_msgs/msg/quaternion.hpp>
namespace math
{
namespace geometry
{
template <
typename T, typename U, typename V,
std::enable_if_t<
std::conjunction_v<IsLikeQuaternion<T>, IsLikeQuaternion<U>, std::is_scalar<V>>,
std::nullptr_t> = nullptr>
auto slerp(T quat1, U quat2, V t)
{
double qr = quat1.w * quat2.w + quat1.x * quat2.x + quat1.y * quat2.y + quat1.z * quat2.z;
double ss = 1.0 - qr * qr;
constexpr double e = std::numeric_limits<double>::epsilon();
if (std::fabs(ss) <= e) {
return geometry_msgs::build<geometry_msgs::msg::Quaternion>()
.x(quat1.x)
.y(quat1.y)
.z(quat1.z)
.w(quat1.w);
} else {
double sp = std::sqrt(ss);
double ph = std::acos(qr);
double pt = ph * t;
double t1 = std::sin(pt) / sp;
double t0 = std::sin(ph - pt) / sp;

return geometry_msgs::build<geometry_msgs::msg::Quaternion>()
.x(quat1.x * t0 + quat2.x * t1)
.y(quat1.y * t0 + quat2.y * t1)
.z(quat1.z * t0 + quat2.z * t1)
.w(quat1.w * t0 + quat2.w * t1);
}
}
} // namespace geometry
} // namespace math

#endif // GEOMETRY__QUATERNION__SLERP_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#define GEOMETRY__SPLINE__HERMITE_CURVE_HPP_

#include <gtest/gtest.h>
#include <quaternion_operation/quaternion_operation.h>

#include <geometry/solver/polynomial_solver.hpp>
#include <geometry_msgs/msg/point.hpp>
Expand Down
4 changes: 2 additions & 2 deletions common/math/geometry/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>geometry</name>
<version>2.1.1</version>
<version>2.1.7</version>
<description>geometry math library for scenario_simulator_v2 application</description>
<maintainer email="[email protected]">Masaya Kataoka</maintainer>
<license>Apache License 2.0</license>
Expand All @@ -12,10 +12,10 @@

<depend>boost</depend>
<depend>geometry_msgs</depend>
<depend>quaternion_operation</depend>
<depend>rclcpp</depend>
<depend>scenario_simulator_exception</depend>
<depend>tf2_geometry_msgs</depend>
<depend>tf2_ros</depend>
<depend>traffic_simulator_msgs</depend>

<test_depend>ament_cmake_clang_format</test_depend>
Expand Down
2 changes: 0 additions & 2 deletions common/math/geometry/src/bounding_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <quaternion_operation/quaternion_operation.h>

#include <geometry/bounding_box.hpp>
#include <geometry/polygon/polygon.hpp>

Expand Down
2 changes: 0 additions & 2 deletions common/math/geometry/src/intersection/collision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <quaternion_operation/quaternion_operation.h>

#include <boost/assert.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/geometry.hpp>
Expand Down
Loading