-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(component_state_monitor): add component state monitor #2120
Merged
isamu-takagi
merged 2 commits into
autowarefoundation:main
from
isamu-takagi:feature/ad-api/component-state-monitor
Oct 24, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,15 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
project(component_state_monitor) | ||
|
||
find_package(autoware_cmake REQUIRED) | ||
autoware_package() | ||
|
||
ament_auto_add_library(${PROJECT_NAME} SHARED | ||
src/main.cpp | ||
) | ||
|
||
rclcpp_components_register_nodes(${PROJECT_NAME} | ||
"component_state_monitor::StateMonitor" | ||
) | ||
|
||
ament_auto_package(INSTALL_TO_SHARE config launch) |
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,182 @@ | ||
- module: map | ||
mode: [online, planning_simulation] | ||
type: launch | ||
args: | ||
node_name_suffix: vector_map | ||
topic: /map/vector_map | ||
topic_type: autoware_auto_mapping_msgs/msg/HADMapBin | ||
best_effort: false | ||
transient_local: true | ||
warn_rate: 0.0 | ||
error_rate: 0.0 | ||
timeout: 0.0 | ||
|
||
- module: map | ||
mode: [online] | ||
type: launch | ||
args: | ||
node_name_suffix: pointcloud_map | ||
topic: /map/pointcloud_map | ||
topic_type: sensor_msgs/msg/PointCloud2 | ||
best_effort: false | ||
transient_local: true | ||
warn_rate: 0.0 | ||
error_rate: 0.0 | ||
timeout: 0.0 | ||
|
||
- module: localization | ||
mode: [online, planning_simulation] | ||
type: autonomous | ||
args: | ||
node_name_suffix: initialpose3d | ||
topic: /initialpose3d | ||
topic_type: geometry_msgs/msg/PoseWithCovarianceStamped | ||
best_effort: false | ||
transient_local: false | ||
warn_rate: 0.0 | ||
error_rate: 0.0 | ||
timeout: 0.0 | ||
|
||
- module: localization | ||
mode: [online] | ||
type: autonomous | ||
args: | ||
node_name_suffix: pose_twist_fusion_filter_pose | ||
topic: /localization/pose_twist_fusion_filter/pose | ||
topic_type: geometry_msgs/msg/PoseStamped | ||
best_effort: false | ||
transient_local: false | ||
warn_rate: 5.0 | ||
error_rate: 1.0 | ||
timeout: 1.0 | ||
|
||
- module: perception | ||
mode: [online] | ||
type: launch | ||
args: | ||
node_name_suffix: obstacle_segmentation_pointcloud | ||
topic: /perception/obstacle_segmentation/pointcloud | ||
topic_type: sensor_msgs/msg/PointCloud2 | ||
best_effort: true | ||
transient_local: false | ||
warn_rate: 5.0 | ||
error_rate: 1.0 | ||
timeout: 1.0 | ||
|
||
- module: perception | ||
mode: [online, planning_simulation] | ||
type: autonomous | ||
args: | ||
node_name_suffix: object_recognition_objects | ||
topic: /perception/object_recognition/objects | ||
topic_type: autoware_auto_perception_msgs/msg/PredictedObjects | ||
best_effort: false | ||
transient_local: false | ||
warn_rate: 5.0 | ||
error_rate: 1.0 | ||
timeout: 1.0 | ||
|
||
- module: planning | ||
mode: [online, planning_simulation] | ||
type: autonomous | ||
args: | ||
node_name_suffix: mission_planning_route | ||
topic: /planning/mission_planning/route | ||
topic_type: autoware_auto_planning_msgs/msg/HADMapRoute | ||
best_effort: false | ||
transient_local: true | ||
warn_rate: 0.0 | ||
error_rate: 0.0 | ||
timeout: 0.0 | ||
|
||
- module: planning | ||
mode: [online, planning_simulation] | ||
type: autonomous | ||
args: | ||
node_name_suffix: scenario_planning_trajectory | ||
topic: /planning/scenario_planning/trajectory | ||
topic_type: autoware_auto_planning_msgs/msg/Trajectory | ||
best_effort: false | ||
transient_local: false | ||
warn_rate: 5.0 | ||
error_rate: 1.0 | ||
timeout: 1.0 | ||
|
||
- module: control | ||
mode: [online, planning_simulation] | ||
type: autonomous | ||
args: | ||
node_name_suffix: trajectory_follower_control_cmd | ||
topic: /control/trajectory_follower/control_cmd | ||
topic_type: autoware_auto_control_msgs/msg/AckermannControlCommand | ||
best_effort: false | ||
transient_local: false | ||
warn_rate: 5.0 | ||
error_rate: 1.0 | ||
timeout: 1.0 | ||
|
||
- module: control | ||
mode: [online, planning_simulation] | ||
type: autonomous | ||
args: | ||
node_name_suffix: control_command_control_cmd | ||
topic: /control/command/control_cmd | ||
topic_type: autoware_auto_control_msgs/msg/AckermannControlCommand | ||
best_effort: false | ||
transient_local: false | ||
warn_rate: 5.0 | ||
error_rate: 1.0 | ||
timeout: 1.0 | ||
|
||
- module: vehicle | ||
mode: [online, planning_simulation] | ||
type: autonomous | ||
args: | ||
node_name_suffix: vehicle_status_velocity_status | ||
topic: /vehicle/status/velocity_status | ||
topic_type: autoware_auto_vehicle_msgs/msg/VelocityReport | ||
best_effort: false | ||
transient_local: false | ||
warn_rate: 5.0 | ||
error_rate: 1.0 | ||
timeout: 1.0 | ||
|
||
- module: vehicle | ||
mode: [online, planning_simulation] | ||
type: autonomous | ||
args: | ||
node_name_suffix: vehicle_status_steering_status | ||
topic: /vehicle/status/steering_status | ||
topic_type: autoware_auto_vehicle_msgs/msg/SteeringReport | ||
best_effort: false | ||
transient_local: false | ||
warn_rate: 5.0 | ||
error_rate: 1.0 | ||
timeout: 1.0 | ||
|
||
- module: system | ||
mode: [online, planning_simulation] | ||
type: launch | ||
args: | ||
node_name_suffix: system_emergency_control_cmd | ||
topic: /system/emergency/control_cmd | ||
topic_type: autoware_auto_control_msgs/msg/AckermannControlCommand | ||
best_effort: false | ||
transient_local: false | ||
warn_rate: 5.0 | ||
error_rate: 1.0 | ||
timeout: 1.0 | ||
|
||
- module: localization | ||
mode: [online, planning_simulation] | ||
type: autonomous | ||
args: | ||
node_name_suffix: transform_map_to_base_link | ||
topic: /tf | ||
frame_id: map | ||
child_frame_id: base_link | ||
best_effort: false | ||
transient_local: false | ||
warn_rate: 5.0 | ||
error_rate: 1.0 | ||
timeout: 1.0 |
86 changes: 86 additions & 0 deletions
86
system/component_state_monitor/launch/component_state_monitor.launch.py
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,86 @@ | ||
# Copyright 2022 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. | ||
|
||
|
||
from collections import defaultdict | ||
from pathlib import Path | ||
|
||
import launch | ||
from launch.actions import DeclareLaunchArgument | ||
from launch.actions import IncludeLaunchDescription | ||
from launch.actions import OpaqueFunction | ||
from launch.substitutions import LaunchConfiguration | ||
from launch.substitutions import PathJoinSubstitution | ||
from launch_ros.actions import ComposableNodeContainer | ||
from launch_ros.descriptions import ComposableNode | ||
from launch_ros.substitutions import FindPackageShare | ||
import yaml | ||
|
||
|
||
def create_diagnostic_name(row): | ||
return "{}_topic_status".format(row["module"]) | ||
|
||
|
||
def create_topic_monitor_name(row): | ||
diag_name = create_diagnostic_name(row) | ||
return "topic_state_monitor_{}: {}".format(row["args"]["node_name_suffix"], diag_name) | ||
|
||
|
||
def create_topic_monitor_node(row): | ||
tf_mode = "" if "topic_type" in row["args"] else "_tf" | ||
package = FindPackageShare("topic_state_monitor") | ||
include = PathJoinSubstitution([package, f"launch/topic_state_monitor{tf_mode}.launch.xml"]) | ||
diag_name = create_diagnostic_name(row) | ||
arguments = [("diag_name", diag_name)] + [(k, str(v)) for k, v in row["args"].items()] | ||
return IncludeLaunchDescription(include, launch_arguments=arguments) | ||
|
||
|
||
def launch_setup(context, *args, **kwargs): | ||
# create topic monitors | ||
mode = LaunchConfiguration("mode").perform(context) | ||
rows = yaml.safe_load(Path(LaunchConfiguration("file").perform(context)).read_text()) | ||
rows = [row for row in rows if mode in row["mode"]] | ||
topic_monitor_nodes = [create_topic_monitor_node(row) for row in rows] | ||
topic_monitor_names = [create_topic_monitor_name(row) for row in rows] | ||
topic_monitor_param = defaultdict(lambda: defaultdict(list)) | ||
for row in rows: | ||
topic_monitor_param[row["type"]][row["module"]].append(create_topic_monitor_name(row)) | ||
topic_monitor_param = {name: dict(module) for name, module in topic_monitor_param.items()} | ||
|
||
# create component | ||
component = ComposableNode( | ||
namespace="component_state_monitor", | ||
name="component", | ||
package="component_state_monitor", | ||
plugin="component_state_monitor::StateMonitor", | ||
parameters=[{"topic_monitor_names": topic_monitor_names}, topic_monitor_param], | ||
) | ||
container = ComposableNodeContainer( | ||
namespace="component_state_monitor", | ||
name="container", | ||
package="rclcpp_components", | ||
executable="component_container", | ||
composable_node_descriptions=[component], | ||
) | ||
return [container, *topic_monitor_nodes] | ||
|
||
|
||
def generate_launch_description(): | ||
return launch.LaunchDescription( | ||
[ | ||
DeclareLaunchArgument("file"), | ||
DeclareLaunchArgument("mode"), | ||
OpaqueFunction(function=launch_setup), | ||
] | ||
) |
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 @@ | ||
<?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>component_state_monitor</name> | ||
<version>0.1.0</version> | ||
<description>The component_state_monitor package</description> | ||
<maintainer email="isamu.takagi@tier4.jp">Takagi, Isamu</maintainer> | ||
<license>Apache License 2.0</license> | ||
|
||
<buildtool_depend>ament_cmake_auto</buildtool_depend> | ||
|
||
<build_depend>autoware_cmake</build_depend> | ||
|
||
<depend>diagnostic_msgs</depend> | ||
<depend>rclcpp</depend> | ||
<depend>rclcpp_components</depend> | ||
<depend>tier4_system_msgs</depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>autoware_lint_common</test_depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can traffic light recognition results be added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the topic name and expected/error rate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In planning simulation, the topic was not published periodically, so I will merge it once. Please change the config if necessary.