Skip to content

Commit

Permalink
Can't read byte-array parameters from parameter dump file
Browse files Browse the repository at this point in the history
  https://github.com/ros2/rclcpp/issues/2442

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
  • Loading branch information
fujitatomoya committed Jan 16, 2025
1 parent 5d5c0b1 commit 04d3995
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions prover_rclcpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ custom_executable(rclcpp_2226)
custom_executable(rclcpp_2379)
custom_executable(rclcpp_2417_pub)
custom_executable(rclcpp_2417_sub)
custom_executable(rclcpp_2442)
custom_executable(rclcpp_2497)
custom_executable(rclcpp_2507)
custom_executable(rclcpp_2645)
Expand Down
26 changes: 26 additions & 0 deletions prover_rclcpp/src/rclcpp_2442.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <cstdio>

#include "rclcpp/rclcpp.hpp"

static constexpr const uint8_t EXAMPLE_ARR[8]{ 0x00, 0x13, 0xA2, 0x00, 0x41, 0x5C, 0x61, 0x86 };

int main(int argc, char ** argv)
{
rclcpp::init(argc, argv);

auto node = rclcpp::Node::make_shared("my_node");
auto param_desc = rcl_interfaces::msg::ParameterDescriptor{};

param_desc.description = "XBee Due address";
auto dueAddrParm = node->declare_parameter(
"byte_arr_param",
std::vector<uint8_t>(EXAMPLE_ARR,
EXAMPLE_ARR + sizeof(EXAMPLE_ARR) / sizeof(EXAMPLE_ARR[0])),
param_desc);
auto p = node->get_parameter("byte_arr_param");
RCLCPP_INFO_STREAM(node->get_logger(), p.get_name() << ":=" << p.value_to_string() << " (initial)");

rclcpp::spin(node);
rclcpp::shutdown();
return 0;
}

0 comments on commit 04d3995

Please sign in to comment.