Bug report
- Operating System:
- Arch Linux 4.20.8-arch1-1-ARCH
- Installation type:
- Version or commit hash:
- DDS implementation:
Steps to reproduce issue
rclpy:
- Create a node with a parameter of an array type, such as integer array:
import rclpy
from rclpy.parameter import Parameter
def main(args=None):
rclpy.init(args=args)
node = rclpy.create_node('param_array')
node.set_parameters([Parameter("foo", Parameter.Type.INTEGER_ARRAY, [0, 0])])
def timer_callback():
node.get_logger().info('Value: {}, type: {}'.format(
node.get_parameter("foo").value,
type(node.get_parameter("foo").value)))
timer = node.create_timer(1, timer_callback)
rclpy.spin(node)
node.destroy_node()
rclpy.shutdown()
if __name__ == '__main__':
main()
- Set parameter using
ros2 param set:
ros2 param set /param_array foo "[1, 1]"
rclcpp:
- Create a node with a parameter of an array type, such as integer array:
std::vector<int64_t> foo;
get_parameter("foo", foo);
- Set parameter using
ros2 param set
Expected behavior
Array parameter set successfully.
Actual behavior
rclpy:
No exception, but parameter is set to the raw string value:
[INFO] [param_array]: Value: [0, 0], type: <class 'list'>
[INFO] [param_array]: Value: [0, 0], type: <class 'list'>
# param set is run
[INFO] [param_array]: Value: [1, 1], type: <class 'str'>
[INFO] [param_array]: Value: [1, 1], type: <class 'str'>
[INFO] [param_array]: Value: [1, 1], type: <class 'str'>
rclcpp:
ParameterTypeException thrown:
terminate called after throwing an instance of 'rclcpp::ParameterTypeException'
what(): expected [integer_array] got [string]
Bug report
Steps to reproduce issue
rclpy:
ros2 param set:rclcpp:
ros2 param setExpected behavior
Array parameter set successfully.
Actual behavior
rclpy:
No exception, but parameter is set to the raw string value:
rclcpp:
ParameterTypeException thrown: