Skip to content

No way to pass a byte array with ros2 run #1436

@marc0777

Description

@marc0777

I've created a simple ROS node that requires a BYTE_ARRAY as a parameter using:

self.declare_parameter("byte_array", [])

There doesn't seem a way however to actually pass a byte array using ros2 run, because it always gets interpreted as an integer array, no matter the way.

ros2 run my_pkg my_node --ros-args -p byte_array:=[0x11,0x12,0x13]
Error while starting My_node node: Trying to set parameter 'byte_array' to '[17, 18, 19]' of type 'INTEGER_ARRAY', expecting type 'BYTE_ARRAY'

ros2 run my_pkg my_node --ros-args --params-file test.yaml
Error while starting My_node node: Trying to set parameter 'byte_array' to '[17, 18, 19]' of type 'INTEGER_ARRAY', expecting type 'BYTE_ARRAY'

Where the test.yaml file looks like:

my_node:
    ros__parameters:
        byte_array: [0x11,0x12,0x13]

Am I doing something wrong or is it simply not implemented?

I'm using ROS humble installed on Ubuntu 22.04 using the ROS apt repositories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions