scenario_simulator_v2 C++ API
test_utils.hpp
Go to the documentation of this file.
1 // Copyright 2015 TIER IV, Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GEOMETRY__TEST__TEST_UTILS_HPP_
16 #define GEOMETRY__TEST__TEST_UTILS_HPP_
17 
18 #include <geometry_msgs/msg/point.hpp>
19 #include <geometry_msgs/msg/pose.hpp>
20 #include <geometry_msgs/msg/vector3.hpp>
21 #include <traffic_simulator_msgs/msg/bounding_box.hpp>
22 
32 inline geometry_msgs::msg::Point makePoint(double x, double y, double z = 0.0)
33 {
34  geometry_msgs::msg::Point p;
35  p.x = x;
36  p.y = y;
37  p.z = z;
38  return p;
39 }
40 
50 inline geometry_msgs::msg::Vector3 makeVector(double x, double y, double z = 0.0)
51 {
52  geometry_msgs::msg::Vector3 v;
53  v.x = x;
54  v.y = y;
55  v.z = z;
56  return v;
57 }
58 
69 inline geometry_msgs::msg::Pose makePose(
70  double x, double y, double z = 0.0,
71  geometry_msgs::msg::Quaternion q = geometry_msgs::msg::Quaternion())
72 {
73  geometry_msgs::msg::Pose p;
74  p.position.x = x;
75  p.position.y = y;
76  p.position.z = z;
77  p.orientation = q;
78  return p;
79 }
80 
93 inline traffic_simulator_msgs::msg::BoundingBox makeBbox(
94  double dim_x, double dim_y, double dim_z = 0.0, double center_x = 0.0, double center_y = 0.0,
95  double center_z = 0.0)
96 {
97  traffic_simulator_msgs::msg::BoundingBox bbox;
98  bbox.dimensions.x = dim_x;
99  bbox.dimensions.y = dim_y;
100  bbox.dimensions.z = dim_z;
101  bbox.center.x = center_x;
102  bbox.center.y = center_y;
103  bbox.center.z = center_z;
104  return bbox;
105 }
106 
107 #endif // GEOMETRY__TEST__TEST_UTILS_HPP_
geometry_msgs::msg::Point makePoint(double x, double y, double z=0.0)
Definition: test_utils.hpp:32
geometry_msgs::msg::Vector3 makeVector(double x, double y, double z=0.0)
Definition: test_utils.hpp:50
traffic_simulator_msgs::msg::BoundingBox makeBbox(double dim_x, double dim_y, double dim_z=0.0, double center_x=0.0, double center_y=0.0, double center_z=0.0)
Definition: test_utils.hpp:93
geometry_msgs::msg::Pose makePose(double x, double y, double z=0.0, geometry_msgs::msg::Quaternion q=geometry_msgs::msg::Quaternion())
Definition: test_utils.hpp:69