scenario_simulator_v2 C++ API
test_raycaster.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 SIMPLE_SENSOR_SIMULATOR__TEST__TEST_RAYCASTER_HPP_
16 #define SIMPLE_SENSOR_SIMULATOR__TEST__TEST_RAYCASTER_HPP_
17 
18 #include <gtest/gtest.h>
19 
20 #include <geometry_msgs/msg/pose.hpp>
21 #include <sensor_msgs/msg/point_cloud2.hpp>
24 #include <vector>
25 
26 #include "../../utils/helper_functions.hpp"
27 
28 using namespace simple_sensor_simulator;
29 using namespace geometry_msgs::msg;
30 
31 constexpr static double degToRad(double deg) { return deg * M_PI / 180.0; }
32 
33 class RaycasterTest : public ::testing::Test
34 {
35 protected:
37  : raycaster_(std::make_unique<Raycaster>()),
38  config_(utils::constructLidarConfiguration("ego", "awf/universe", 0.0, 0.1)),
39  origin_(utils::makePose(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0)),
40  box_pose_(utils::makePose(5.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0))
41  {
42  raycaster_->setDirection(config_);
43  }
44 
45  std::unique_ptr<Raycaster> raycaster_;
46  simulation_api_schema::LidarConfiguration config_;
47 
48  const float box_depth_{1.0f};
49  const float box_width_{1.0f};
50  const float box_height_{1.0f};
51  const std::string box_name_{"box"};
52 
53  const rclcpp::Time stamp_{0};
54  const std::string frame_id_{"frame_id"};
55 
56  geometry_msgs::msg::Pose origin_;
57  geometry_msgs::msg::Pose box_pose_;
58 };
59 
60 #endif // SIMPLE_SENSOR_SIMULATOR__TEST__TEST_RAYCASTER_HPP_
Definition: test_raycaster.hpp:34
RaycasterTest()
Definition: test_raycaster.hpp:36
geometry_msgs::msg::Pose origin_
Definition: test_raycaster.hpp:56
geometry_msgs::msg::Pose box_pose_
Definition: test_raycaster.hpp:57
std::unique_ptr< Raycaster > raycaster_
Definition: test_raycaster.hpp:45
simulation_api_schema::LidarConfiguration config_
Definition: test_raycaster.hpp:46
Definition: raycaster.hpp:38
Definition: constants.hpp:19
Definition: cache.hpp:27
Definition: helper_functions.hpp:35
auto constructLidarConfiguration(const std::string &entity, const std::string &architecture_type, const double lidar_sensor_delay, const double horizontal_resolution) -> const simulation_api_schema::LidarConfiguration
Definition: helper_functions.hpp:60
std::string string
Definition: junit5.hpp:26
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