forked from autowarefoundation/autoware.universe
-
Notifications
You must be signed in to change notification settings - Fork 34
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 #765 from tier4/sync-upstream
chore: sync upstream
- Loading branch information
Showing
84 changed files
with
1,832 additions
and
992 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
project(glog_component) | ||
|
||
find_package(autoware_cmake REQUIRED) | ||
autoware_package() | ||
|
||
|
||
ament_auto_add_library(glog_component SHARED | ||
src/glog_component.cpp | ||
) | ||
target_link_libraries(glog_component glog) | ||
|
||
rclcpp_components_register_node(glog_component | ||
PLUGIN "GlogComponent" | ||
EXECUTABLE glog_component_node | ||
) | ||
|
||
ament_auto_package() |
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,29 @@ | ||
# glog_component | ||
|
||
This package provides the glog (google logging library) feature as a ros2 component library. This is used to dynamically load the glog feature with container. | ||
|
||
See the [glog github](https://github.com/google/glog) for the details of its features. | ||
|
||
## Example | ||
|
||
When you load the `glog_component` in container, the launch file can be like below: | ||
|
||
```py | ||
glog_component = ComposableNode( | ||
package="glog_component", | ||
plugin="GlogComponent", | ||
name="glog_component", | ||
) | ||
|
||
container = ComposableNodeContainer( | ||
name="my_container", | ||
namespace="", | ||
package="rclcpp_components", | ||
executable=LaunchConfiguration("container_executable"), | ||
composable_node_descriptions=[ | ||
component1, | ||
component2, | ||
glog_component, | ||
], | ||
) | ||
``` |
28 changes: 28 additions & 0 deletions
28
common/glog_component/include/glog_component/glog_component.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,28 @@ | ||
// Copyright 2023 TIER IV, Inc. | ||
// | ||
// 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 GLOG_COMPONENT__GLOG_COMPONENT_HPP_ | ||
#define GLOG_COMPONENT__GLOG_COMPONENT_HPP_ | ||
|
||
#include <rclcpp/rclcpp.hpp> | ||
|
||
#include <glog/logging.h> | ||
|
||
class GlogComponent : public rclcpp::Node | ||
{ | ||
public: | ||
explicit GlogComponent(const rclcpp::NodeOptions & node_options); | ||
}; | ||
|
||
#endif // GLOG_COMPONENT__GLOG_COMPONENT_HPP_ |
17 changes: 9 additions & 8 deletions
17
sensing/geo_pos_conv/package.xml → common/glog_component/package.xml
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 |
---|---|---|
@@ -1,20 +1,21 @@ | ||
<?xml version="1.0"?> | ||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>geo_pos_conv</name> | ||
<version>2.0.0</version> | ||
<description>The ROS 2 geo_pos_conv package</description> | ||
<maintainer email="[email protected]">Yamato Ando</maintainer> | ||
|
||
<name>glog_component</name> | ||
<version>0.1.0</version> | ||
<description>The glog_component package</description> | ||
<maintainer email="[email protected]">Takamasa Horibe</maintainer> | ||
<license>Apache License 2.0</license> | ||
|
||
<author email="[email protected]">Takamasa Horibe</author> | ||
|
||
<buildtool_depend>ament_cmake</buildtool_depend> | ||
<buildtool_depend>ament_cmake_auto</buildtool_depend> | ||
<buildtool_depend>autoware_cmake</buildtool_depend> | ||
|
||
<depend>libgoogle-glog-dev</depend> | ||
<depend>rclcpp</depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>autoware_lint_common</test_depend> | ||
<depend>rclcpp_components</depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
|
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,25 @@ | ||
// Copyright 2023 TIER IV, Inc. | ||
// | ||
// 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 "glog_component/glog_component.hpp" | ||
|
||
GlogComponent::GlogComponent(const rclcpp::NodeOptions & node_options) | ||
: Node("glog_component", node_options) | ||
{ | ||
google::InitGoogleLogging("glog_component"); | ||
google::InstallFailureSignalHandler(); | ||
} | ||
|
||
#include <rclcpp_components/register_node_macro.hpp> | ||
RCLCPP_COMPONENTS_REGISTER_NODE(GlogComponent) |
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
96 changes: 96 additions & 0 deletions
96
common/traffic_light_utils/test/test_traffic_light_utils.cpp
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,96 @@ | ||
// Copyright 2023 TIER IV, Inc. | ||
// | ||
// 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 "gtest/gtest.h" | ||
#include "traffic_light_utils/traffic_light_utils.hpp" | ||
|
||
namespace traffic_light_utils | ||
{ | ||
|
||
TEST(isRoiValid, roi_validity) | ||
{ | ||
tier4_perception_msgs::msg::TrafficLightRoi test_roi; | ||
test_roi.roi.x_offset = 300; | ||
test_roi.roi.y_offset = 200; | ||
test_roi.roi.width = 340; | ||
test_roi.roi.height = 200; | ||
uint32_t img_width = 640; | ||
uint32_t img_heigh = 480; | ||
EXPECT_FALSE(isRoiValid(test_roi, img_width, img_heigh)); | ||
test_roi.roi.width = 339; | ||
EXPECT_TRUE(isRoiValid(test_roi, img_width, img_heigh)); | ||
} | ||
|
||
TEST(setRoiInvalid, set_roi_size) | ||
{ | ||
tier4_perception_msgs::msg::TrafficLightRoi test_roi; | ||
test_roi.roi.x_offset = 300; | ||
test_roi.roi.y_offset = 200; | ||
test_roi.roi.width = 300; | ||
test_roi.roi.height = 200; | ||
EXPECT_EQ(test_roi.roi.width, (uint32_t)300); | ||
EXPECT_EQ(test_roi.roi.height, (uint32_t)200); | ||
setRoiInvalid(test_roi); | ||
EXPECT_EQ(test_roi.roi.width, (uint32_t)0); | ||
EXPECT_EQ(test_roi.roi.height, (uint32_t)0); | ||
} | ||
|
||
TEST(isSignalUnknown, signal_element) | ||
{ | ||
tier4_perception_msgs::msg::TrafficSignal test_signal; | ||
tier4_perception_msgs::msg::TrafficLightElement element; | ||
element.color = tier4_perception_msgs::msg::TrafficLightElement::UNKNOWN; | ||
element.shape = tier4_perception_msgs::msg::TrafficLightElement::UNKNOWN; | ||
test_signal.elements.push_back(element); | ||
EXPECT_TRUE(isSignalUnknown(test_signal)); | ||
test_signal.elements[0].color = tier4_perception_msgs::msg::TrafficLightElement::RED; | ||
EXPECT_FALSE(isSignalUnknown(test_signal)); | ||
} | ||
|
||
TEST(setSignalUnknown, set_signal_element) | ||
{ | ||
tier4_perception_msgs::msg::TrafficSignal test_signal; | ||
tier4_perception_msgs::msg::TrafficLightElement element; | ||
element.color = tier4_perception_msgs::msg::TrafficLightElement::RED; | ||
element.shape = tier4_perception_msgs::msg::TrafficLightElement::CROSS; | ||
test_signal.elements.push_back(element); | ||
EXPECT_EQ(test_signal.elements[0].color, tier4_perception_msgs::msg::TrafficLightElement::RED); | ||
EXPECT_EQ(test_signal.elements[0].shape, tier4_perception_msgs::msg::TrafficLightElement::CROSS); | ||
setSignalUnknown(test_signal, 1.23f); | ||
EXPECT_EQ( | ||
test_signal.elements[0].color, tier4_perception_msgs::msg::TrafficLightElement::UNKNOWN); | ||
EXPECT_EQ( | ||
test_signal.elements[0].shape, tier4_perception_msgs::msg::TrafficLightElement::UNKNOWN); | ||
EXPECT_FLOAT_EQ(test_signal.elements[0].confidence, (float)1.23); | ||
} | ||
|
||
TEST(getTrafficLightCenter, get_signal) | ||
{ | ||
lanelet::LineString3d lineString; | ||
lanelet::Point3d p0(0, 0, 0, 0); | ||
lanelet::Point3d p1(1, 1, 1, 1); | ||
lanelet::Point3d p2(2, 2, 2, 2); | ||
lanelet::Point3d p3(3, 3, 3, 3); | ||
lineString.push_back(p0); | ||
lineString.push_back(p1); | ||
lineString.push_back(p2); | ||
lineString.push_back(p3); | ||
|
||
lanelet::ConstLineString3d test_light(lineString); | ||
EXPECT_FLOAT_EQ(getTrafficLightCenter(test_light).x(), (float)1.5); | ||
EXPECT_FLOAT_EQ(getTrafficLightCenter(test_light).y(), (float)1.5); | ||
EXPECT_FLOAT_EQ(getTrafficLightCenter(test_light).z(), (float)1.5); | ||
} | ||
|
||
} // namespace traffic_light_utils |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.