Skip to content

Commit

Permalink
feat: apply autoware_ prefix for fault_injection (#9989)
Browse files Browse the repository at this point in the history
* feat(fault_injection): apply `autoware_` prefix (see below):

  Note:
    * In this commit, I did not organize a folder structure.
      The folder structure will be organized in the next some commits.
    * The changes will follow the Autoware's guideline as below:
        - https://autowarefoundation.github.io/autoware-documentation/main/contributing/coding-guidelines/ros-nodes/directory-structure/#package-folder

Signed-off-by: Junya Sasaki <[email protected]>

* rename(fault_injection): move headers under `include/autoware`:

  * Fixes due to this changes for .hpp/.cpp files will be applied in the next commit

Signed-off-by: Junya Sasaki <[email protected]>

* fix(fault_injection): fix include header paths

  * To follow the previous commit

Signed-off-by: Junya Sasaki <[email protected]>

* rename: `fault_injection` => `autoware_fault_injection`

Signed-off-by: Junya Sasaki <[email protected]>

* Fixed exec_depend

Signed-off-by: Shintaro Sakoda <[email protected]>

---------

Signed-off-by: Junya Sasaki <[email protected]>
Signed-off-by: Shintaro Sakoda <[email protected]>
Co-authored-by: SakodaShintaro <[email protected]>
  • Loading branch information
sasakisasaki and SakodaShintaro authored Jan 23, 2025
1 parent 8eed7e9 commit 4b6a342
Show file tree
Hide file tree
Showing 19 changed files with 62 additions and 59 deletions.
2 changes: 1 addition & 1 deletion launch/tier4_simulator_launch/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>

<exec_depend>autoware_fault_injection</exec_depend>
<exec_depend>dummy_perception_publisher</exec_depend>
<exec_depend>fault_injection</exec_depend>
<exec_depend>simple_planning_simulator</exec_depend>

<test_depend>ament_lint_auto</test_depend>
Expand Down
File renamed without changes.
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
File renamed without changes.
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="[email protected]">Keisuke Shima</maintainer>
<maintainer email="[email protected]">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.

0 comments on commit 4b6a342

Please sign in to comment.