Skip to content

Commit 04d3995

Browse files
committed
Can't read byte-array parameters from parameter dump file
https://github.com/ros2/rclcpp/issues/2442 Signed-off-by: Tomoya Fujita <[email protected]>
1 parent 5d5c0b1 commit 04d3995

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

prover_rclcpp/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ custom_executable(rclcpp_2226)
154154
custom_executable(rclcpp_2379)
155155
custom_executable(rclcpp_2417_pub)
156156
custom_executable(rclcpp_2417_sub)
157+
custom_executable(rclcpp_2442)
157158
custom_executable(rclcpp_2497)
158159
custom_executable(rclcpp_2507)
159160
custom_executable(rclcpp_2645)

prover_rclcpp/src/rclcpp_2442.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <cstdio>
2+
3+
#include "rclcpp/rclcpp.hpp"
4+
5+
static constexpr const uint8_t EXAMPLE_ARR[8]{ 0x00, 0x13, 0xA2, 0x00, 0x41, 0x5C, 0x61, 0x86 };
6+
7+
int main(int argc, char ** argv)
8+
{
9+
rclcpp::init(argc, argv);
10+
11+
auto node = rclcpp::Node::make_shared("my_node");
12+
auto param_desc = rcl_interfaces::msg::ParameterDescriptor{};
13+
14+
param_desc.description = "XBee Due address";
15+
auto dueAddrParm = node->declare_parameter(
16+
"byte_arr_param",
17+
std::vector<uint8_t>(EXAMPLE_ARR,
18+
EXAMPLE_ARR + sizeof(EXAMPLE_ARR) / sizeof(EXAMPLE_ARR[0])),
19+
param_desc);
20+
auto p = node->get_parameter("byte_arr_param");
21+
RCLCPP_INFO_STREAM(node->get_logger(), p.get_name() << ":=" << p.value_to_string() << " (initial)");
22+
23+
rclcpp::spin(node);
24+
rclcpp::shutdown();
25+
return 0;
26+
}

0 commit comments

Comments
 (0)