Skip to content

Panic on empty list in params.yaml #636

Description

@balthasarschuess

Specifying an empty array parameter causes a panic.
I think this happens, because the yaml parser cannot determine the type of the array, when it is empty.

node_name:
  ros__parameters:
    my_param: []

ros2 run <package> <binary> --ros-args --params-file <path_to_file>

thread 'main' panicked at /code/ros2_ws/install/rclrs/share/rclrs/rust/src/parameter
/value.rs:455:9:     
assertion `left == right` failed                                                    
  left: 0                                                                            
  right: 1                                                                           
stack backtrace:                                                                    
   0: __rustc::rust_begin_unwind                                                    
   1: core::panicking::panic_fmt                                                       
   2: core::panicking::assert_failed_inner                                          
   3: core::panicking::assert_failed                                                   
   4: rclrs::parameter::value::ParameterValue::from_rcl_variant
   5: rclrs::parameter::override_map::resolve_parameter_overrides         
   6: rclrs::parameter::ParameterInterface::new                                     
   7: rclrs::node::node_options::NodeOptions::build 

the error occurs on

let node = executor.create_node("node_name");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions