From 98dcdc00fa53c9a36b9fd79b8108db7d1f507ef7 Mon Sep 17 00:00:00 2001 From: Takamasa Horibe Date: Wed, 23 Aug 2023 21:47:01 +0900 Subject: [PATCH 1/3] feat(glog): add glog in planning and control modules (#4714) * feat(glog): add glog component Signed-off-by: Takamasa Horibe * formatting Signed-off-by: Takamasa Horibe * remove namespace Signed-off-by: Takamasa Horibe * remove license Signed-off-by: Takamasa Horibe * Update launch/tier4_planning_launch/launch/scenario_planning/lane_driving/motion_planning/motion_planning.launch.py Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> * Update launch/tier4_planning_launch/launch/scenario_planning/lane_driving/behavior_planning/behavior_planning.launch.py Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> * Update common/glog_component/CMakeLists.txt Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> * Update launch/tier4_control_launch/launch/control.launch.py Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> * add copyright Signed-off-by: Takamasa Horibe --------- Signed-off-by: Takamasa Horibe Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> --- common/glog_component/CMakeLists.txt | 18 ++++++++++++ common/glog_component/README.md | 29 +++++++++++++++++++ .../include/glog_component/glog_component.hpp | 28 ++++++++++++++++++ common/glog_component/package.xml | 23 +++++++++++++++ common/glog_component/src/glog_component.cpp | 25 ++++++++++++++++ .../launch/control.launch.py | 7 +++++ .../behavior_planning.launch.py | 7 +++++ .../motion_planning/motion_planning.launch.py | 11 +++++++ launch/tier4_planning_launch/package.xml | 1 + 9 files changed, 149 insertions(+) create mode 100644 common/glog_component/CMakeLists.txt create mode 100644 common/glog_component/README.md create mode 100644 common/glog_component/include/glog_component/glog_component.hpp create mode 100644 common/glog_component/package.xml create mode 100644 common/glog_component/src/glog_component.cpp diff --git a/common/glog_component/CMakeLists.txt b/common/glog_component/CMakeLists.txt new file mode 100644 index 0000000000000..c2a68d0130b37 --- /dev/null +++ b/common/glog_component/CMakeLists.txt @@ -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() diff --git a/common/glog_component/README.md b/common/glog_component/README.md new file mode 100644 index 0000000000000..94a40fe32e40d --- /dev/null +++ b/common/glog_component/README.md @@ -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, + ], +) +``` diff --git a/common/glog_component/include/glog_component/glog_component.hpp b/common/glog_component/include/glog_component/glog_component.hpp new file mode 100644 index 0000000000000..d940363d75ac4 --- /dev/null +++ b/common/glog_component/include/glog_component/glog_component.hpp @@ -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 + +#include + +class GlogComponent : public rclcpp::Node +{ +public: + explicit GlogComponent(const rclcpp::NodeOptions & node_options); +}; + +#endif // GLOG_COMPONENT__GLOG_COMPONENT_HPP_ diff --git a/common/glog_component/package.xml b/common/glog_component/package.xml new file mode 100644 index 0000000000000..0d6e7daac1de3 --- /dev/null +++ b/common/glog_component/package.xml @@ -0,0 +1,23 @@ + + + + glog_component + 0.1.0 + The glog_component package + Takamasa Horibe + Apache License 2.0 + + Takamasa Horibe + + ament_cmake + ament_cmake_auto + autoware_cmake + + libgoogle-glog-dev + rclcpp + rclcpp_components + + + ament_cmake + + diff --git a/common/glog_component/src/glog_component.cpp b/common/glog_component/src/glog_component.cpp new file mode 100644 index 0000000000000..9e7e70da6c884 --- /dev/null +++ b/common/glog_component/src/glog_component.cpp @@ -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(GlogComponent) diff --git a/launch/tier4_control_launch/launch/control.launch.py b/launch/tier4_control_launch/launch/control.launch.py index 8cb9c726fcb05..fe09335e1d333 100644 --- a/launch/tier4_control_launch/launch/control.launch.py +++ b/launch/tier4_control_launch/launch/control.launch.py @@ -287,6 +287,12 @@ def launch_setup(context, *args, **kwargs): target_container="/control/control_container", ) + glog_component = ComposableNode( + package="glog_component", + plugin="GlogComponent", + name="glog_component", + ) + # set container to run all required components in the same process container = ComposableNodeContainer( name="control_container", @@ -299,6 +305,7 @@ def launch_setup(context, *args, **kwargs): shift_decider_component, vehicle_cmd_gate_component, operation_mode_transition_manager_component, + glog_component, ], ) diff --git a/launch/tier4_planning_launch/launch/scenario_planning/lane_driving/behavior_planning/behavior_planning.launch.py b/launch/tier4_planning_launch/launch/scenario_planning/lane_driving/behavior_planning/behavior_planning.launch.py index 727f564a9c9e1..62d4c5b7188ee 100644 --- a/launch/tier4_planning_launch/launch/scenario_planning/lane_driving/behavior_planning/behavior_planning.launch.py +++ b/launch/tier4_planning_launch/launch/scenario_planning/lane_driving/behavior_planning/behavior_planning.launch.py @@ -64,6 +64,12 @@ def launch_setup(context, *args, **kwargs): with open(LaunchConfiguration("behavior_path_planner_param_path").perform(context), "r") as f: behavior_path_planner_param = yaml.safe_load(f)["/**"]["ros__parameters"] + glog_component = ComposableNode( + package="glog_component", + plugin="GlogComponent", + name="glog_component", + ) + behavior_path_planner_component = ComposableNode( package="behavior_path_planner", plugin="behavior_path_planner::BehaviorPathPlannerNode", @@ -207,6 +213,7 @@ def launch_setup(context, *args, **kwargs): composable_node_descriptions=[ behavior_path_planner_component, behavior_velocity_planner_component, + glog_component, ], output="screen", ) diff --git a/launch/tier4_planning_launch/launch/scenario_planning/lane_driving/motion_planning/motion_planning.launch.py b/launch/tier4_planning_launch/launch/scenario_planning/lane_driving/motion_planning/motion_planning.launch.py index 34ad4659b5ece..d8c5d7825f19d 100644 --- a/launch/tier4_planning_launch/launch/scenario_planning/lane_driving/motion_planning/motion_planning.launch.py +++ b/launch/tier4_planning_launch/launch/scenario_planning/lane_driving/motion_planning/motion_planning.launch.py @@ -309,6 +309,16 @@ def launch_setup(context, *args, **kwargs): condition=IfCondition(LaunchConfiguration("use_surround_obstacle_check")), ) + glog_component = ComposableNode( + package="glog_component", + plugin="GlogComponent", + name="glog_component", + ) + glog_component_loader = LoadComposableNodes( + composable_node_descriptions=[glog_component], + target_container=container, + ) + group = GroupAction( [ container, @@ -319,6 +329,7 @@ def launch_setup(context, *args, **kwargs): obstacle_cruise_planner_loader, obstacle_cruise_planner_relay_loader, surround_obstacle_checker_loader, + glog_component_loader, ] ) return [group] diff --git a/launch/tier4_planning_launch/package.xml b/launch/tier4_planning_launch/package.xml index 4de0f91c53c6a..39b95286bb6cc 100644 --- a/launch/tier4_planning_launch/package.xml +++ b/launch/tier4_planning_launch/package.xml @@ -60,6 +60,7 @@ external_cmd_selector external_velocity_limit_selector freespace_planner + glog_component mission_planner motion_velocity_smoother obstacle_avoidance_planner From 925201d8c6821794bba341e80bda518fbc685ecb Mon Sep 17 00:00:00 2001 From: Takamasa Horibe Date: Fri, 25 Aug 2023 13:24:16 +0900 Subject: [PATCH 2/3] feat(motion_velocity_smoother.launch): add glog component (#4746) * use node instead of include Signed-off-by: Takamasa Horibe * use container & add glog component Signed-off-by: Takamasa Horibe --------- Signed-off-by: Takamasa Horibe --- .../scenario_planning.launch.xml | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/launch/tier4_planning_launch/launch/scenario_planning/scenario_planning.launch.xml b/launch/tier4_planning_launch/launch/scenario_planning/scenario_planning.launch.xml index 665bd82423ea6..b293c5836817d 100644 --- a/launch/tier4_planning_launch/launch/scenario_planning/scenario_planning.launch.xml +++ b/launch/tier4_planning_launch/launch/scenario_planning/scenario_planning.launch.xml @@ -24,15 +24,25 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + + From 9fcdca25196b9612aaf0a8ad88778efa6f0da99a Mon Sep 17 00:00:00 2001 From: Takamasa Horibe Date: Fri, 25 Aug 2023 13:25:39 +0900 Subject: [PATCH 3/3] feat(mission_planning.launch): add glog in mission planner (#4745) Signed-off-by: Takamasa Horibe --- .../mission_planning.launch.xml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/launch/tier4_planning_launch/launch/mission_planning/mission_planning.launch.xml b/launch/tier4_planning_launch/launch/mission_planning/mission_planning.launch.xml index c1ace97b9788f..ec7545956e774 100644 --- a/launch/tier4_planning_launch/launch/mission_planning/mission_planning.launch.xml +++ b/launch/tier4_planning_launch/launch/mission_planning/mission_planning.launch.xml @@ -1,7 +1,18 @@ - - - + + + + + + + + + + + + + +