Skip to content
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: apply autoware_ prefix for fault_injection #9989

Merged
Show file tree
Hide file tree
Changes from 6 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
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
cmake_minimum_required(VERSION 3.14)
project(fault_injection)
project(autoware_fault_injection)

find_package(autoware_cmake REQUIRED)
autoware_package()

find_package(pluginlib REQUIRED)

ament_auto_add_library(fault_injection_node_component SHARED
ament_auto_add_library(${PROJECT_NAME}_node_component SHARED
src/fault_injection_node/fault_injection_node.cpp
)

rclcpp_components_register_node(fault_injection_node_component
PLUGIN "fault_injection::FaultInjectionNode"
EXECUTABLE fault_injection_node
rclcpp_components_register_node(${PROJECT_NAME}_node_component
PLUGIN "autoware::simulator::fault_injection::FaultInjectionNode"
EXECUTABLE ${PROJECT_NAME}_node
)

if(BUILD_TESTING)
Expand All @@ -23,7 +23,7 @@ if(BUILD_TESTING)
)

target_link_libraries(test_fault_injection_node_component
fault_injection_node_component
${PROJECT_NAME}_node_component
)

# launch_testing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Tier IV, Inc.
// Copyright 2025 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.
Expand All @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FAULT_INJECTION__DIAGNOSTIC_STORAGE_HPP_
#define FAULT_INJECTION__DIAGNOSTIC_STORAGE_HPP_
#ifndef AUTOWARE__FAULT_INJECTION__DIAGNOSTIC_STORAGE_HPP_
#define AUTOWARE__FAULT_INJECTION__DIAGNOSTIC_STORAGE_HPP_

#include <diagnostic_aggregator/status_item.hpp>

Expand All @@ -22,7 +22,7 @@
#include <string>
#include <unordered_map>

namespace fault_injection
namespace autoware::simulator::fault_injection
{
using diagnostic_msgs::msg::DiagnosticStatus;

Expand Down Expand Up @@ -65,6 +65,6 @@ class DiagnosticStorage
std::unordered_map<std::string, DiagnosticStatus> event_diag_map_;
};

} // namespace fault_injection
} // namespace autoware::simulator::fault_injection

#endif // FAULT_INJECTION__DIAGNOSTIC_STORAGE_HPP_
#endif // AUTOWARE__FAULT_INJECTION__DIAGNOSTIC_STORAGE_HPP_
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TIER IV, Inc.
// Copyright 2025 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.
Expand Down Expand Up @@ -46,8 +46,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/

#ifndef FAULT_INJECTION__FAULT_INJECTION_DIAG_UPDATER_HPP_
#define FAULT_INJECTION__FAULT_INJECTION_DIAG_UPDATER_HPP_
#ifndef AUTOWARE__FAULT_INJECTION__FAULT_INJECTION_DIAG_UPDATER_HPP_
#define AUTOWARE__FAULT_INJECTION__FAULT_INJECTION_DIAG_UPDATER_HPP_

#include <diagnostic_updater/diagnostic_updater.hpp>

Expand All @@ -57,7 +57,7 @@
#include <utility>
#include <vector>

namespace fault_injection
namespace autoware::simulator::fault_injection
{
class FaultInjectionDiagUpdater : public diagnostic_updater::DiagnosticTaskVector
{
Expand Down Expand Up @@ -240,6 +240,6 @@ class FaultInjectionDiagUpdater : public diagnostic_updater::DiagnosticTaskVecto
std::string hardware_id_;
std::string node_name_;
};
} // namespace fault_injection
} // namespace autoware::simulator::fault_injection

#endif // FAULT_INJECTION__FAULT_INJECTION_DIAG_UPDATER_HPP_
#endif // AUTOWARE__FAULT_INJECTION__FAULT_INJECTION_DIAG_UPDATER_HPP_
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Tier IV, Inc.
// Copyright 2025 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.
Expand All @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FAULT_INJECTION__FAULT_INJECTION_NODE_HPP_
#define FAULT_INJECTION__FAULT_INJECTION_NODE_HPP_
#ifndef AUTOWARE__FAULT_INJECTION__FAULT_INJECTION_NODE_HPP_
#define AUTOWARE__FAULT_INJECTION__FAULT_INJECTION_NODE_HPP_

#include "fault_injection/diagnostic_storage.hpp"
#include "fault_injection/fault_injection_diag_updater.hpp"
#include "autoware/fault_injection/diagnostic_storage.hpp"
#include "autoware/fault_injection/fault_injection_diag_updater.hpp"

#include <rclcpp/rclcpp.hpp>

Expand All @@ -25,7 +25,7 @@
#include <string>
#include <vector>

namespace fault_injection
namespace autoware::simulator::fault_injection
{
using tier4_simulation_msgs::msg::SimulationEvents;

Expand All @@ -49,6 +49,6 @@ class FaultInjectionNode : public rclcpp::Node
DiagnosticStorage diagnostic_storage_;
};

} // namespace fault_injection
} // namespace autoware::simulator::fault_injection

#endif // FAULT_INJECTION__FAULT_INJECTION_NODE_HPP_
#endif // AUTOWARE__FAULT_INJECTION__FAULT_INJECTION_NODE_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<launch>
<arg name="input/simulation_events" default="/simulation/events"/>
<arg name="config_file" default="$(find-pkg-share autoware_fault_injection)/config/fault_injection.param.yaml"/>
<arg name="log-level" default="info"/>

<node pkg="autoware_fault_injection" exec="autoware_fault_injection_node" name="autoware_fault_injection" output="screen" args="--ros-args --log-level fault_injection:=$(var log-level)">
<remap from="~/input/simulation_events" to="$(var input/simulation_events)"/>
<param from="$(var config_file)"/>
</node>
</launch>
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?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>fault_injection</name>
<name>autoware_fault_injection</name>
<version>0.40.0</version>
<description>fault_injection</description>
<description>The fault_injection package</description>
<maintainer email="keisuke.shima@tier4.jp">Keisuke Shima</maintainer>
<maintainer email="junya.sasaki@tier4.jp">Junya Sasaki</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "fault_injection/fault_injection_node.hpp"
#include "autoware/fault_injection/fault_injection_node.hpp"

#include <autoware/universe_utils/ros/update_param.hpp>

Expand All @@ -21,7 +21,7 @@
#include <unordered_map>
#include <vector>

namespace
namespace autoware::simulator::fault_injection
{
std::vector<std::string> split(const std::string & str, const char delim)
{
Expand All @@ -33,10 +33,7 @@ std::vector<std::string> split(const std::string & str, const char delim)
}
return elems;
}
} // namespace

namespace fault_injection
{
#ifdef ROS_DISTRO_GALACTIC
using rosidl_generator_traits::to_yaml;
#endif
Expand Down Expand Up @@ -101,7 +98,7 @@ std::vector<DiagConfig> FaultInjectionNode::read_event_diag_list()

return diag_configs;
}
} // namespace fault_injection
} // namespace autoware::simulator::fault_injection

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(fault_injection::FaultInjectionNode)
RCLCPP_COMPONENTS_REGISTER_NODE(autoware::simulator::fault_injection::FaultInjectionNode)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<launch>
<include file="$(find-pkg-share autoware_fault_injection)/launch/fault_injection.launch.xml">
<arg name="log-level" value="debug"/>
<arg name="config_file" value="$(find-pkg-share autoware_fault_injection)/config/test_event_diag.param.yaml"/>
</include>
</launch>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Tier IV, Inc.
// Copyright 2025 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Tier IV, Inc.
// Copyright 2025 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.
Expand All @@ -12,14 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "fault_injection/diagnostic_storage.hpp"
#include "autoware/fault_injection/diagnostic_storage.hpp"

#include <gtest/gtest.h>

#include <memory>
#include <string>
#include <vector>

namespace autoware::simulator::fault_injection
{

class TestDiagnosticStorage : public ::testing::Test
{
protected:
Expand All @@ -30,8 +33,8 @@ class TestDiagnosticStorage : public ::testing::Test
}
}

fault_injection::DiagnosticStorage storage_;
const std::vector<fault_injection::DiagConfig> diag_config{
DiagnosticStorage storage_;
const std::vector<DiagConfig> diag_config{
{"foo", "foo_diag"},
};
};
Expand All @@ -52,3 +55,5 @@ TEST_F(TestDiagnosticStorage, raise_exception_with_wrong_key)
{
EXPECT_ANY_THROW(storage_.getDiag("invalid_name"));
}

} // namespace autoware::simulator::fault_injection
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Tier IV, Inc.
# Copyright 2025 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.
Expand Down Expand Up @@ -35,7 +35,7 @@
@pytest.mark.launch_test
def generate_test_description():
test_fault_injection_launch_file = os.path.join(
get_package_share_directory("fault_injection"),
get_package_share_directory("autoware_fault_injection"),
"launch",
"test_fault_injection.launch.xml",
)
Expand Down
10 changes: 0 additions & 10 deletions simulator/fault_injection/launch/fault_injection.launch.xml

This file was deleted.

This file was deleted.

Loading