forked from autowarefoundation/autoware.universe
-
Notifications
You must be signed in to change notification settings - Fork 31
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 #772 from tier4/add-glog
feat(launch): enable glog to print stack trace autonatically when the process die in planning/control modules
- Loading branch information
Showing
11 changed files
with
182 additions
and
12 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_ |
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,23 @@ | ||
<?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>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> | ||
<depend>rclcpp_components</depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</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,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
17 changes: 14 additions & 3 deletions
17
launch/tier4_planning_launch/launch/mission_planning/mission_planning.launch.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
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
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