-
Notifications
You must be signed in to change notification settings - Fork 91
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
[WIP] Testing of migration to ROS2 Humble #737
Draft
nhatao
wants to merge
3
commits into
at-wat:master
Choose a base branch
from
nhatao:humble
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
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,35 +1,21 @@ | ||
cmake_minimum_required(VERSION 3.1.3) | ||
cmake_minimum_required(VERSION 3.5) | ||
project(neonavigation_common) | ||
find_package(ament_cmake_auto REQUIRED) | ||
ament_auto_find_build_dependencies() | ||
|
||
set(CATKIN_DEPENDS | ||
roscpp | ||
) | ||
|
||
find_package(catkin REQUIRED COMPONENTS ${CATKIN_DEPENDS}) | ||
catkin_package( | ||
INCLUDE_DIRS include | ||
CATKIN_DEPENDS ${CATKIN_DEPENDS} | ||
) | ||
|
||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
include_directories(include ${catkin_INCLUDE_DIRS}) | ||
include_directories(include) | ||
ament_auto_add_library(neonavigation_common SHARED | ||
src/neonavigation_node.cpp) | ||
|
||
|
||
if(CATKIN_ENABLE_TESTING) | ||
find_package(rostest REQUIRED) | ||
find_package(std_msgs REQUIRED) | ||
find_package(std_srvs REQUIRED) | ||
add_subdirectory(test) | ||
|
||
find_package(roslint REQUIRED) | ||
roslint_cpp() | ||
roslint_add_test() | ||
if(BUILD_TESTING) | ||
set(ament_cmake_copyright_FOUND TRUE) | ||
set(ament_cmake_uncrustify_FOUND TRUE) | ||
set(ament_cmake_cpplint_FOUND TRUE) | ||
ament_auto_find_test_dependencies() | ||
ament_lint_auto_find_test_dependencies() | ||
endif() | ||
|
||
|
||
install(DIRECTORY include/${PROJECT_NAME}/ | ||
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} | ||
) | ||
ament_auto_package() |
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
84 changes: 84 additions & 0 deletions
84
neonavigation_common/include/neonavigation_common/neonavigation_node.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,84 @@ | ||
/* | ||
* Copyright (c) 2024, the neonavigation authors | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* * Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef NEONAVIGATION_COMMON__NEONAVIGATION_NODE_HPP_ | ||
#define NEONAVIGATION_COMMON__NEONAVIGATION_NODE_HPP_ | ||
|
||
#include <string> | ||
#include <variant> | ||
#include <vector> | ||
#include <unordered_map> | ||
|
||
#include <rclcpp/rclcpp.hpp> | ||
#include <rcl_interfaces/msg/set_parameters_result.hpp> | ||
|
||
#include <neonavigation_common_msgs/srv/get_logger_levels.hpp> | ||
#include <neonavigation_common_msgs/srv/set_logger_levels.hpp> | ||
|
||
namespace neonavigation_common | ||
{ | ||
class NeonavigationNode : public rclcpp::Node | ||
{ | ||
public: | ||
explicit NeonavigationNode(const std::string& node_name, const rclcpp::NodeOptions& options); | ||
|
||
// Disable copy and move. declare_dynamic_parameter() will not work correctly if copied. | ||
NeonavigationNode& operator=(const NeonavigationNode&) = delete; | ||
NeonavigationNode(const NeonavigationNode&) = delete; | ||
|
||
protected: | ||
OnSetParametersCallbackHandle::SharedPtr parameter_handler_; | ||
bool parameter_handler_disabled_; | ||
using ParamType = std::variant<int64_t*, double*, bool*, std::string*>; | ||
std::unordered_map<std::string, ParamType> params_; | ||
rclcpp::Service<neonavigation_common_msgs::srv::GetLoggerLevels>::SharedPtr get_loggers_service_; | ||
rclcpp::Service<neonavigation_common_msgs::srv::SetLoggerLevels>::SharedPtr set_loggers_service_; | ||
|
||
template <typename T> | ||
void declare_dynamic_parameter(const std::string& name, T* const param, const T& default_value) | ||
{ | ||
// Disable cbParameter while declaring parameters | ||
parameter_handler_disabled_ = true; | ||
*param = declare_parameter(name, default_value); | ||
params_[name] = param; | ||
parameter_handler_disabled_ = false; | ||
} | ||
|
||
void create_logger_services(); | ||
rcl_interfaces::msg::SetParametersResult cbParameter(const std::vector<rclcpp::Parameter>& parameters); | ||
|
||
// This function is called after a parameter is updated. | ||
virtual void onDynamicParameterUpdated(const std::vector<rclcpp::Parameter>&) | ||
{ | ||
} | ||
}; | ||
|
||
} // namespace neonavigation_common | ||
|
||
#endif // NEONAVIGATION_COMMON__NEONAVIGATION_NODE_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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
<?xml version="1.0"?> | ||
<package format="2"> | ||
<?xml-model | ||
href="http://download.ros.org/schema/package_format3.xsd" | ||
schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>neonavigation_common</name> | ||
<version>0.17.1</version> | ||
<description>Common headers for neonavigation meta-package</description> | ||
|
@@ -8,11 +11,15 @@ | |
<license>BSD</license> | ||
<author email="[email protected]">Atsushi Watanabe</author> | ||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
<buildtool_depend>ament_cmake</buildtool_depend> | ||
<buildtool_depend>ament_cmake_auto</buildtool_depend> | ||
<depend>rclcpp</depend> | ||
<depend>neonavigation_common_msgs</depend> | ||
|
||
<depend>roscpp</depend> | ||
<test_depend>roslint</test_depend> | ||
<test_depend>rostest</test_depend> | ||
<test_depend>std_srvs</test_depend> | ||
<test_depend>std_msgs</test_depend> | ||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>ament_lint_common</test_depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
declare_dynamic_parameter()
function is added to replacedynamic_reconfigure
.