This repository has been archived by the owner on Jan 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
imprement Consai2r2ParametersClient library for C++ node #59
Merged
Conversation
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
Consai2r2ParametersClientという名前は適切ではない気がしてきました。 consai2r2::description::ParametersClientとかがいいでしょうか |
namespaceを使用するように変更しました。 |
spiralray
force-pushed
the
dev/distribute_params_cpp
branch
from
May 30, 2020 10:30
82767a6
to
a649f19
Compare
使ってみました。使う側簡単でいいですね:+1: 試しにパラメータを1個増やそうとしたんですが、こっちはなかなか大変ですね・・・ |
たしかにパラメータ追加はちょっと手間ですよね… コードクローンが発生しないようにライブラリとして提供する必要性はあると思いますので、取り入れてもらえると嬉しいです。 |
いいですよー。 パッと見で思ったことは
です |
spiralray
force-pushed
the
dev/distribute_params_cpp
branch
from
August 7, 2020 14:29
9fcd4bb
to
a649f19
Compare
referee.hppは削除しました。 |
備忘録として、使用時のファイル変更箇所を残しておきます。 CMakeLists.txt diff --git a/consai2r2_teleop/CMakeLists.txt b/consai2r2_teleop/CMakeLists.txt
index 436ac55..0f47cda 100644
--- a/consai2r2_teleop/CMakeLists.txt
+++ b/consai2r2_teleop/CMakeLists.txt
@@ -17,8 +17,11 @@ find_package(rclcpp_components REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(consai2r2_msgs REQUIRED)
+find_package(consai2r2_description REQUIRED)
-include_directories(include)
+include_directories(include
+ ${consai2r2_description_INCLUDE_DIRS}
+ )
add_library(joystick_component SHARED src/joystick_component.cpp)
target_compile_definitions(joystick_component PRIVATE "RASPIMOUSE_EXAMPLES_BUILDING_DLL")
@@ -28,6 +31,7 @@ ament_target_dependencies(joystick_component
std_msgs
sensor_msgs
consai2r2_msgs
+ consai2r2_description
)
hogehogehoge.cppファイル diff --git a/consai2r2_teleop/src/joystick_component.cpp b/consai2r2_teleop/src/joystick_component.cpp
index 7723e10..3f698d2 100644
--- a/consai2r2_teleop/src/joystick_component.cpp
+++ b/consai2r2_teleop/src/joystick_component.cpp
@@ -26,6 +26,7 @@
#include <utility>
#include "consai2r2_teleop/joystick_component.hpp"
+#include "consai2r2_description/parameters.hpp"
using namespace std::chrono_literals;
@@ -93,7 +94,17 @@ JoystickComponent::JoystickComponent(const rclcpp::NodeOptions & options)
}
RCLCPP_INFO(this->get_logger(), "service not available, waiting again...");
}
+
+ consai2r2::description::Parameters parameters;
+ consai2r2::description::ParametersClient client(this);
+ client.get_parameters(¶meters);
+
+ max_id_ = parameters.sub_id;
- max_id_ = parameters_client->get_parameter("max_id", 15); |
ShotaAk
approved these changes
Aug 8, 2020
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.
LGTM
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
C++ノードで共通パラメータを取得するためのParametersClientsライブラリを作成しました。