diff --git a/launch/tier4_system_launch/launch/system.main.mrm-v0.6.tmp.launch.xml b/launch/tier4_system_launch/launch/system.main.mrm-v0.6.tmp.launch.xml index b65eb2c205dbd..08b294e3c7c10 100644 --- a/launch/tier4_system_launch/launch/system.main.mrm-v0.6.tmp.launch.xml +++ b/launch/tier4_system_launch/launch/system.main.mrm-v0.6.tmp.launch.xml @@ -161,10 +161,10 @@ - + - - + + diff --git a/launch/tier4_system_launch/package.xml b/launch/tier4_system_launch/package.xml index c8315b5f97fd6..2d751e8c40a8c 100644 --- a/launch/tier4_system_launch/package.xml +++ b/launch/tier4_system_launch/package.xml @@ -13,10 +13,8 @@ component_state_monitor control_cmd_switcher - control_cmd_switcher emergency_handler - leader_election_converter - leader_election_converter + redundancy_switcher_interface system_error_monitor system_monitor diff --git a/system/leader_election_converter/CMakeLists.txt b/system/redundancy_switcher_interface/CMakeLists.txt similarity index 82% rename from system/leader_election_converter/CMakeLists.txt rename to system/redundancy_switcher_interface/CMakeLists.txt index 697b9a3b74d13..98b96a74804cf 100644 --- a/system/leader_election_converter/CMakeLists.txt +++ b/system/redundancy_switcher_interface/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.14) -project(leader_election_converter) +project(redundancy_switcher_interface) find_package(autoware_cmake REQUIRED) autoware_package() @@ -15,14 +15,14 @@ target_include_directories(common_converter PRIVATE ) ament_auto_add_library(${PROJECT_NAME} SHARED - src/node/leader_election_converter.cpp + src/node/redundancy_switcher_interface.cpp ) target_include_directories(${PROJECT_NAME} PRIVATE src/common/converter) target_link_libraries(${PROJECT_NAME} common_converter) rclcpp_components_register_node(${PROJECT_NAME} - PLUGIN "leader_election_converter::LeaderElectionConverter" + PLUGIN "redundancy_switcher_interface::RedundancySwitcherInterface" EXECUTABLE ${PROJECT_NAME}_node EXECUTOR MultiThreadedExecutor ) diff --git a/system/leader_election_converter/README.md b/system/redundancy_switcher_interface/README.md similarity index 86% rename from system/leader_election_converter/README.md rename to system/redundancy_switcher_interface/README.md index 5f61820be7e83..a5c9f421e2477 100644 --- a/system/leader_election_converter/README.md +++ b/system/redundancy_switcher_interface/README.md @@ -1,8 +1,8 @@ -# leader_election_converter +# redundancy_switcher_interface ## Overview -The leader election converter node is responsible for relaying UDP packets and ROS2 topics between the leader_election invoked by systemd and Autoware executed on ROS2. +The redundancy switcher interface node is responsible for relaying UDP packets and ROS2 topics between the redundancy_switcher invoked by systemd and Autoware executed on ROS2. ## availability converter @@ -42,9 +42,9 @@ The log converter receive udp packets into a structure called `ElectionCommuni | udp receiver | none | `struct ElectionCommunication` | messages among election nodes. | | udp receiver | none | `struct ElectionStatus` | Leader Election status. | | publisher | `/system/election/communication` | `tier4_system_msgs/msg/ElectionCommunication` | messages among election nodes. | -| publisher | `/system/election/status` | `tier4_system_msgs/msg/MrmState` | Leader Election status. | +| publisher | `/system/election/status` | `autoware_adapi_v1_msgs/msg/MrmState` | Leader Election status. | | publisher | `/system/fail_safe/over_all/mrm_state` | `autoware_adapi_v1_msgs/msg/mrm_state` | System-wide MRM status. | ## Parameters -{{ json_to_markdown("system/leader_election_converter/schema/leader_election_converter.schema.json") }} +{{ json_to_markdown("system/redundancy_switcher_interface/schema/redundancy_switcher_interface.schema.json") }} diff --git a/system/leader_election_converter/config/leader_election_converter.param.yaml b/system/redundancy_switcher_interface/config/redundancy_switcher_interface.param.yaml similarity index 100% rename from system/leader_election_converter/config/leader_election_converter.param.yaml rename to system/redundancy_switcher_interface/config/redundancy_switcher_interface.param.yaml diff --git a/system/leader_election_converter/launch/leader_election_converter.launch.xml b/system/redundancy_switcher_interface/launch/redundancy_switcher_interface.launch.xml similarity index 84% rename from system/leader_election_converter/launch/leader_election_converter.launch.xml rename to system/redundancy_switcher_interface/launch/redundancy_switcher_interface.launch.xml index 2078fc7fd7d42..ca93400e4cee8 100644 --- a/system/leader_election_converter/launch/leader_election_converter.launch.xml +++ b/system/redundancy_switcher_interface/launch/redundancy_switcher_interface.launch.xml @@ -1,5 +1,5 @@ - + @@ -7,7 +7,7 @@ - + diff --git a/system/leader_election_converter/package.xml b/system/redundancy_switcher_interface/package.xml similarity index 86% rename from system/leader_election_converter/package.xml rename to system/redundancy_switcher_interface/package.xml index d9341c8fe2df3..cdd352db63b35 100644 --- a/system/leader_election_converter/package.xml +++ b/system/redundancy_switcher_interface/package.xml @@ -1,9 +1,9 @@ - leader_election_converter + redundancy_switcher_interface 0.1.0 - The leader election converter package + The redundancy switcher interface package TetsuKawa Apache License 2.0 diff --git a/system/leader_election_converter/schema/leader_election_converter.schema.json b/system/redundancy_switcher_interface/schema/redundancy_switcher_interface.schema.json similarity index 94% rename from system/leader_election_converter/schema/leader_election_converter.schema.json rename to system/redundancy_switcher_interface/schema/redundancy_switcher_interface.schema.json index c54fdf2210221..065e9fdc65346 100644 --- a/system/leader_election_converter/schema/leader_election_converter.schema.json +++ b/system/redundancy_switcher_interface/schema/redundancy_switcher_interface.schema.json @@ -1,9 +1,9 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Parameters for leader election converter", + "title": "Parameters for redundancy switcher interface", "type": "object", "definitions": { - "leader_election_converter": { + "redundancy_switcher_interface": { "type": "object", "properties": { "availability_dest_ip": { @@ -77,7 +77,7 @@ "type": "object", "properties": { "ros__parameters": { - "$ref": "#/definitions/leader_election_converter" + "$ref": "#/definitions/redundancy_switcher_interface" } }, "required": ["ros__parameters"], diff --git a/system/leader_election_converter/src/common/converter/availability_converter.cpp b/system/redundancy_switcher_interface/src/common/converter/availability_converter.cpp similarity index 97% rename from system/leader_election_converter/src/common/converter/availability_converter.cpp rename to system/redundancy_switcher_interface/src/common/converter/availability_converter.cpp index 24eae8f98d986..936e35310c4d7 100644 --- a/system/leader_election_converter/src/common/converter/availability_converter.cpp +++ b/system/redundancy_switcher_interface/src/common/converter/availability_converter.cpp @@ -19,7 +19,7 @@ #include #include -namespace leader_election_converter +namespace redundancy_switcher_interface { AvailabilityConverter::AvailabilityConverter(rclcpp::Node * node) : node_(node) @@ -80,4 +80,4 @@ void AvailabilityConverter::convertToUdp( } } -} // namespace leader_election_converter +} // namespace redundancy_switcher_interface diff --git a/system/leader_election_converter/src/common/converter/availability_converter.hpp b/system/redundancy_switcher_interface/src/common/converter/availability_converter.hpp similarity index 96% rename from system/leader_election_converter/src/common/converter/availability_converter.hpp rename to system/redundancy_switcher_interface/src/common/converter/availability_converter.hpp index a0dd5ebb422bb..b451b36f042de 100644 --- a/system/leader_election_converter/src/common/converter/availability_converter.hpp +++ b/system/redundancy_switcher_interface/src/common/converter/availability_converter.hpp @@ -25,7 +25,7 @@ #include #include -namespace leader_election_converter +namespace redundancy_switcher_interface { struct Availability @@ -62,6 +62,6 @@ class AvailabilityConverter sub_operation_mode_availability_; }; -} // namespace leader_election_converter +} // namespace redundancy_switcher_interface #endif // COMMON__CONVERTER__AVAILABILITY_CONVERTER_HPP_ diff --git a/system/leader_election_converter/src/common/converter/log_converter.cpp b/system/redundancy_switcher_interface/src/common/converter/log_converter.cpp similarity index 90% rename from system/leader_election_converter/src/common/converter/log_converter.cpp rename to system/redundancy_switcher_interface/src/common/converter/log_converter.cpp index a1e9ee6cd89dd..677e5b0bbadb7 100644 --- a/system/leader_election_converter/src/common/converter/log_converter.cpp +++ b/system/redundancy_switcher_interface/src/common/converter/log_converter.cpp @@ -19,7 +19,7 @@ #include #include -namespace leader_election_converter +namespace redundancy_switcher_interface { LogConverter::LogConverter(rclcpp::Node * node) @@ -103,7 +103,8 @@ void LogConverter::convertElectionCommunicationToTopic(const ElectionCommunicati msg.node_id = (node_msg.msg >> 8) & 0xFF; msg.type = node_msg.msg & 0xFF; msg.term = (node_msg.msg >> 16) & 0xFF; - msg.link = (node_msg.msg >> 24) & 0xFF; + msg.path = (node_msg.msg >> 24) & 0x0F; + msg.link = (node_msg.msg >> 28) & 0x0F; msg.heartbeat = (node_msg.msg >> 56) & 0x0F; msg.checksum = (node_msg.msg >> 60) & 0x0F; pub_election_communication_->publish(msg); @@ -112,13 +113,13 @@ void LogConverter::convertElectionCommunicationToTopic(const ElectionCommunicati void LogConverter::convertElectionStatusToTopic(const ElectionStatus & status) { tier4_system_msgs::msg::ElectionStatus election_status; - autoware_adapi_v1_msgs::msg::MrmState mrm_status; + autoware_adapi_v1_msgs::msg::MrmState mrm_state; election_status.stamp = node_->now(); election_status.leader_id = status.leader_id; election_status.path_info = status.path_info; - election_status.mrm_state.state = status.state; - election_status.mrm_state.behavior.type = status.behavior; + election_status.mrm_state.state = status.mrm_state.state; + election_status.mrm_state.behavior = status.mrm_state.behavior; election_status.election_start_count = status.election_start_count; election_status.in_election = status.in_election; election_status.has_received_availability = status.has_received_availability; @@ -130,10 +131,10 @@ void LogConverter::convertElectionStatusToTopic(const ElectionStatus & status) election_status.is_sub_vcu_connected = status.is_sub_vcu_connected; pub_election_status_->publish(election_status); - mrm_status.stamp = node_->now(); - mrm_status.state = status.state; - mrm_status.behavior = status.behavior; - pub_over_all_mrm_state_->publish(mrm_status); + mrm_state.stamp = node_->now(); + mrm_state.state = status.mrm_state.state; + mrm_state.behavior = mrm_state.behavior; + pub_over_all_mrm_state_->publish(mrm_state); } -} // namespace leader_election_converter +} // namespace redundancy_switcher_interface diff --git a/system/leader_election_converter/src/common/converter/log_converter.hpp b/system/redundancy_switcher_interface/src/common/converter/log_converter.hpp similarity index 94% rename from system/leader_election_converter/src/common/converter/log_converter.hpp rename to system/redundancy_switcher_interface/src/common/converter/log_converter.hpp index 24972b7117dbd..64cb7ce95cf7a 100644 --- a/system/leader_election_converter/src/common/converter/log_converter.hpp +++ b/system/redundancy_switcher_interface/src/common/converter/log_converter.hpp @@ -29,7 +29,7 @@ #include #include -namespace leader_election_converter +namespace redundancy_switcher_interface { typedef struct ElectionCommunication @@ -41,8 +41,7 @@ typedef struct ElectionStatus { tier4_system_msgs::msg::ElectionStatus::_leader_id_type leader_id; tier4_system_msgs::msg::ElectionStatus::_path_info_type path_info; - tier4_system_msgs::msg::MrmState::_state_type state; - tier4_system_msgs::msg::MrmBehavior::_type_type behavior; + tier4_system_msgs::msg::ElectionStatus::_mrm_state_type mrm_state; tier4_system_msgs::msg::ElectionStatus::_election_start_count_type election_start_count; tier4_system_msgs::msg::ElectionStatus::_in_election_type in_election; tier4_system_msgs::msg::ElectionStatus::_has_received_availability_type has_received_availability; @@ -86,6 +85,6 @@ class LogConverter std::atomic is_election_status_running_; }; -} // namespace leader_election_converter +} // namespace redundancy_switcher_interface #endif // COMMON__CONVERTER__LOG_CONVERTER_HPP_ diff --git a/system/leader_election_converter/src/common/converter/mrm_converter.cpp b/system/redundancy_switcher_interface/src/common/converter/mrm_converter.cpp similarity index 97% rename from system/leader_election_converter/src/common/converter/mrm_converter.cpp rename to system/redundancy_switcher_interface/src/common/converter/mrm_converter.cpp index deeb8fa7b7dcb..3be4cce6d8d7f 100644 --- a/system/leader_election_converter/src/common/converter/mrm_converter.cpp +++ b/system/redundancy_switcher_interface/src/common/converter/mrm_converter.cpp @@ -19,7 +19,7 @@ #include #include -namespace leader_election_converter +namespace redundancy_switcher_interface { MrmConverter::MrmConverter(rclcpp::Node * node) : node_(node), is_udp_receiver_running_(true) @@ -95,4 +95,4 @@ void MrmConverter::convertToTopic(const MrmRequest & mrm_request) pub_mrm_request_->publish(mrm_request_msg); } -} // namespace leader_election_converter +} // namespace redundancy_switcher_interface diff --git a/system/leader_election_converter/src/common/converter/mrm_converter.hpp b/system/redundancy_switcher_interface/src/common/converter/mrm_converter.hpp similarity index 96% rename from system/leader_election_converter/src/common/converter/mrm_converter.hpp rename to system/redundancy_switcher_interface/src/common/converter/mrm_converter.hpp index f01c5759cdb0b..71b168d0cdb6d 100644 --- a/system/leader_election_converter/src/common/converter/mrm_converter.hpp +++ b/system/redundancy_switcher_interface/src/common/converter/mrm_converter.hpp @@ -28,7 +28,7 @@ #include #include -namespace leader_election_converter +namespace redundancy_switcher_interface { typedef struct MrmState @@ -69,6 +69,6 @@ class MrmConverter std::atomic is_udp_receiver_running_; }; -} // namespace leader_election_converter +} // namespace redundancy_switcher_interface #endif // COMMON__CONVERTER__MRM_CONVERTER_HPP_ diff --git a/system/leader_election_converter/src/common/converter/udp_receiver.hpp b/system/redundancy_switcher_interface/src/common/converter/udp_receiver.hpp similarity index 97% rename from system/leader_election_converter/src/common/converter/udp_receiver.hpp rename to system/redundancy_switcher_interface/src/common/converter/udp_receiver.hpp index 3a3e9f7075004..6ad799531b12e 100644 --- a/system/leader_election_converter/src/common/converter/udp_receiver.hpp +++ b/system/redundancy_switcher_interface/src/common/converter/udp_receiver.hpp @@ -29,7 +29,7 @@ #include #include -namespace leader_election_converter +namespace redundancy_switcher_interface { template @@ -146,6 +146,6 @@ void UdpReceiver::receive() } } -} // namespace leader_election_converter +} // namespace redundancy_switcher_interface #endif // COMMON__CONVERTER__UDP_RECEIVER_HPP_ diff --git a/system/leader_election_converter/src/common/converter/udp_sender.hpp b/system/redundancy_switcher_interface/src/common/converter/udp_sender.hpp similarity index 95% rename from system/leader_election_converter/src/common/converter/udp_sender.hpp rename to system/redundancy_switcher_interface/src/common/converter/udp_sender.hpp index 15cb16774a24e..2e8877330a217 100644 --- a/system/leader_election_converter/src/common/converter/udp_sender.hpp +++ b/system/redundancy_switcher_interface/src/common/converter/udp_sender.hpp @@ -25,7 +25,7 @@ #include #include -namespace leader_election_converter +namespace redundancy_switcher_interface { template @@ -77,6 +77,6 @@ void UdpSender::send(const T & data) } } -} // namespace leader_election_converter +} // namespace redundancy_switcher_interface #endif // COMMON__CONVERTER__UDP_SENDER_HPP_ diff --git a/system/leader_election_converter/src/node/leader_election_converter.cpp b/system/redundancy_switcher_interface/src/node/redundancy_switcher_interface.cpp similarity index 86% rename from system/leader_election_converter/src/node/leader_election_converter.cpp rename to system/redundancy_switcher_interface/src/node/redundancy_switcher_interface.cpp index abd136fdea39c..fea7e796fec7c 100644 --- a/system/leader_election_converter/src/node/leader_election_converter.cpp +++ b/system/redundancy_switcher_interface/src/node/redundancy_switcher_interface.cpp @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "leader_election_converter.hpp" +#include "redundancy_switcher_interface.hpp" #include -namespace leader_election_converter +namespace redundancy_switcher_interface { -LeaderElectionConverter::LeaderElectionConverter(const rclcpp::NodeOptions & node_options) -: Node("leader_election_converter", node_options), +RedundancySwitcherInterface::RedundancySwitcherInterface(const rclcpp::NodeOptions & node_options) +: Node("redundancy_switcher_interface", node_options), availability_converter_(this), mrm_converter_(this), log_converter_(this) @@ -56,7 +56,7 @@ LeaderElectionConverter::LeaderElectionConverter(const rclcpp::NodeOptions & nod log_converter_.setUdpElectionStatusReceiver(election_status_src_ip_, election_status_src_port_); } -} // namespace leader_election_converter +} // namespace redundancy_switcher_interface #include -RCLCPP_COMPONENTS_REGISTER_NODE(leader_election_converter::LeaderElectionConverter) +RCLCPP_COMPONENTS_REGISTER_NODE(redundancy_switcher_interface::RedundancySwitcherInterface) diff --git a/system/leader_election_converter/src/node/leader_election_converter.hpp b/system/redundancy_switcher_interface/src/node/redundancy_switcher_interface.hpp similarity index 77% rename from system/leader_election_converter/src/node/leader_election_converter.hpp rename to system/redundancy_switcher_interface/src/node/redundancy_switcher_interface.hpp index 87381b2968097..3b2846387c6d4 100644 --- a/system/leader_election_converter/src/node/leader_election_converter.hpp +++ b/system/redundancy_switcher_interface/src/node/redundancy_switcher_interface.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef NODE__LEADER_ELECTION_CONVERTER_HPP_ -#define NODE__LEADER_ELECTION_CONVERTER_HPP_ +#ifndef NODE__REDUNDANCY_SWITCHER_INTERFACE_HPP_ +#define NODE__REDUNDANCY_SWITCHER_INTERFACE_HPP_ #include "availability_converter.hpp" #include "log_converter.hpp" @@ -24,13 +24,13 @@ #include #include -namespace leader_election_converter +namespace redundancy_switcher_interface { -class LeaderElectionConverter : public rclcpp::Node +class RedundancySwitcherInterface : public rclcpp::Node { public: - explicit LeaderElectionConverter(const rclcpp::NodeOptions & node_options); + explicit RedundancySwitcherInterface(const rclcpp::NodeOptions & node_options); private: std::string availability_dest_ip_; @@ -49,6 +49,6 @@ class LeaderElectionConverter : public rclcpp::Node LogConverter log_converter_; }; -} // namespace leader_election_converter +} // namespace redundancy_switcher_interface -#endif // NODE__LEADER_ELECTION_CONVERTER_HPP_ +#endif // NODE__REDUNDANCY_SWITCHER_INTERFACE_HPP_