-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do the reading through a separate node
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
- Loading branch information
M. Fatih Cırıt
committed
Jul 20, 2023
1 parent
6bbee43
commit 2bc885a
Showing
9 changed files
with
119 additions
and
27 deletions.
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
39 changes: 39 additions & 0 deletions
39
autoware_version_manager/include/autoware_version_manager/autoware_version_reader.hpp
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,39 @@ | ||
// Copyright 2023 The Autoware Foundation | ||
// | ||
// 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. | ||
|
||
#ifndef AUTOWARE_VERSION_MANAGER__AUTOWARE_VERSION_READER_HPP_ | ||
#define AUTOWARE_VERSION_MANAGER__AUTOWARE_VERSION_READER_HPP_ | ||
|
||
#include "autoware_version_manager/version_types.hpp" | ||
|
||
#include <rclcpp/rclcpp.hpp> | ||
|
||
namespace autoware_version_manager | ||
{ | ||
class AutowareVersionReaderNode : public rclcpp::Node | ||
{ | ||
public: | ||
explicit AutowareVersionReaderNode(const rclcpp::NodeOptions & node_options); | ||
|
||
const VersionAutoware & get_version_autoware() const; | ||
const VersionInterface & get_version_component_interface() const; | ||
|
||
private: | ||
VersionAutoware version_autoware_; | ||
VersionInterface version_component_interface_; | ||
}; | ||
|
||
} // namespace autoware_version_manager | ||
|
||
#endif // AUTOWARE_VERSION_MANAGER__AUTOWARE_VERSION_READER_HPP_ |
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
8 changes: 1 addition & 7 deletions
8
autoware_version_manager/launch/autoware_version_manager.launch.xml
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 |
---|---|---|
@@ -1,10 +1,4 @@ | ||
<?xml version="1.0"?> | ||
<launch> | ||
<arg name="path_version_autoware" default="$(find-pkg-share autoware_version_manager)/data/version-autoware.yaml"/> | ||
<arg name="path_version_component_interface" default="$(find-pkg-share autoware_version_manager)/data/version-component-interface.yaml"/> | ||
|
||
<node pkg="autoware_version_manager" exec="autoware_version_manager_exe" name="autoware_version_manager" output="screen"> | ||
<param name="path_version_autoware" value="$(var path_version_autoware)"/> | ||
<param name="path_version_component_interface" value="$(var path_version_component_interface)"/> | ||
</node> | ||
<node pkg="autoware_version_manager" exec="autoware_version_manager_exe" name="autoware_version_manager" output="screen"/> | ||
</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
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,63 @@ | ||
// Copyright 2023 The Autoware Foundation | ||
// | ||
// 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. | ||
|
||
#include "autoware_version_manager/autoware_version_reader.hpp" | ||
|
||
#include "include/parse_version.hpp" | ||
|
||
#include <ament_index_cpp/get_package_share_directory.hpp> | ||
#include <rclcpp/rclcpp.hpp> | ||
|
||
namespace autoware_version_manager | ||
{ | ||
|
||
AutowareVersionReaderNode::AutowareVersionReaderNode(const rclcpp::NodeOptions & node_options) | ||
: rclcpp::Node("autoware_version_reader_node", node_options) | ||
{ | ||
try { | ||
const std::filesystem::path path_version_autoware = | ||
ament_index_cpp::get_package_share_directory("autoware_version_manager") + | ||
"/data/version-autoware.yaml"; | ||
const std::filesystem::path path_version_component_interface = | ||
ament_index_cpp::get_package_share_directory("autoware_version_manager") + | ||
"/data/version-component-interface.yaml"; | ||
|
||
version_autoware_ = parse_version::parse_autoware_version(path_version_autoware); | ||
version_component_interface_ = | ||
parse_version::parse_interface_version(path_version_component_interface); | ||
} catch (const std::exception & e) { | ||
RCLCPP_ERROR(get_logger(), "Exception: %s", e.what()); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
RCLCPP_INFO( | ||
get_logger(), "Autoware version: %d.%02d.%d", version_autoware_.year, version_autoware_.month, | ||
version_autoware_.micro); | ||
|
||
RCLCPP_INFO( | ||
get_logger(), "Component interface version: %d.%d.%d", version_component_interface_.major, | ||
version_component_interface_.minor, version_component_interface_.patch); | ||
} | ||
|
||
const VersionAutoware & AutowareVersionReaderNode::get_version_autoware() const | ||
{ | ||
return version_autoware_; | ||
} | ||
|
||
const VersionInterface & AutowareVersionReaderNode::get_version_component_interface() const | ||
{ | ||
return version_component_interface_; | ||
} | ||
|
||
} // namespace autoware_version_manager |
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
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