Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

AJD-568: Fix to processes dying randomly by introducing an autorespawning node container class #123

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions autoware_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ cmake_minimum_required(VERSION 3.14)
project(autoware_utils)

find_package(autoware_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(rclpy REQUIRED)
autoware_package()

ament_auto_add_library(autoware_utils SHARED
src/autoware_utils.cpp
)

ament_python_install_package(${PROJECT_NAME})

if(BUILD_TESTING)
file(GLOB_RECURSE test_files test/**/*.cpp)
ament_add_ros_isolated_gtest(test_autoware_utils ${test_files})
Expand Down
Empty file.
32 changes: 32 additions & 0 deletions autoware_utils/autoware_utils/respawnable_node_container.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from typing import List
from typing import Optional

from launch.some_substitutions_type import SomeSubstitutionsType
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode


class RespawnableNodeContainer(ComposableNodeContainer):
"""
Action that executes a container node for composable ROS nodes with fixed
respawn flag and time.
"""

def __init__(
self,
*,
name: SomeSubstitutionsType,
namespace: SomeSubstitutionsType,
composable_node_descriptions: Optional[List[ComposableNode]] = None,
respawn=True,
respawn_delay=0.05,
**kwargs
) -> None:
super().__init__(
name=name,
namespace=namespace,
composable_node_descriptions=composable_node_descriptions,
respawn=respawn,
respawn_delay=respawn_delay,
**kwargs
)
2 changes: 2 additions & 0 deletions autoware_utils/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>ament_cmake_python</buildtool_depend>

<build_depend>autoware_cmake</build_depend>

<depend>builtin_interfaces</depend>
<depend>rclcpp</depend>
<depend>rclpy</depend>

<test_depend>ament_cmake_ros</test_depend>

Expand Down