Skip to content

inconsistent parameter service behavior with non-exist parameter request. #1482

Closed

Description

@fujitatomoya

Bug report

  • Operating System:
    • ubuntu20.04
  • Installation type:
    • source build
  • Version or commit hash:
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • rclcpp

once node is created, there are built-in services to access parameters. there seems to be inconsistent behavior for these services between describe_parameters / get_parameter_types and get_parameters. describe_parameters / get_parameter_types services return empty if request include non-exist parameter name. on the other hand get_parameters always returns the same size with request which includes non-exist parameter name.

Steps to reproduce issue

  • describe_parameters
root@5c7a784cba7f:~/ros2_ws/colcon_ws# ros2 service call /talker/describe_parameters rcl_interfaces/srv/DescribeParameters "names: [use_sim_time, not_exist]"
waiting for service to become available...
requester: making request: rcl_interfaces.srv.DescribeParameters_Request(names=['use_sim_time', 'not_exist'])

response:
rcl_interfaces.srv.DescribeParameters_Response(descriptors=[])

-> empty since there is undeclared parameter non_exist. (it prints WARN message on server that failed to describe non_exist)

  • get_parameter_types
root@5c7a784cba7f:~/ros2_ws/colcon_ws# ros2 service call /talker/get_parameter_types rcl_interfaces/srv/GetParameterTypes "names: [use_sim_time, not_exist]"
waiting for service to become available...
requester: making request: rcl_interfaces.srv.GetParameterTypes_Request(names=['use_sim_time', 'not_exist'])

response:
rcl_interfaces.srv.GetParameterTypes_Response(types=[])

-> empty since there is undeclared parameter non_exist. (it prints WARN message on server that failed to get type non_exist)

  • get_parameters
root@5c7a784cba7f:~/ros2_ws/colcon_ws# ros2 service call /talker/get_parameters rcl_interfaces/srv/GetParameters "names: [use_sim_time, not_exist]"
requester: making request: rcl_interfaces.srv.GetParameters_Request(names=['use_sim_time', 'not_exist'])

response:
rcl_interfaces.srv.GetParameters_Response(values=[rcl_interfaces.msg.ParameterValue(type=1, bool_value=False, integer_value=0, double_value=0.0, string_value='', byte_array_value=[], bool_array_value=[], integer_array_value=[], double_array_value=[], string_array_value=[]), rcl_interfaces.msg.ParameterValue(type=0, bool_value=False, integer_value=0, double_value=0.0, string_value='', byte_array_value=[], bool_array_value=[], integer_array_value=[], double_array_value=[], string_array_value=[])])

-> return default Parameter for non_exist request.

Expected behavior

I think it would be nice to have consistent behavior based on NodeParameters::allow_undeclared_(default false)

Actual behavior

behavior is inconsistent.

Additional information

further more, there is not even consistent with rclpy. if we use rclpy and provided built-in parameter services,

  • get_parameters returns the same size with request, it will return default ParameterValue for non_exist. (same with rclcpp)
  • describe_parameters returns the same size with request, it will return default ParameterDescriptor for for non_exist.
  • get_parameter_types returns the same size with request, it will return default type = 0 for for non_exist.

Activity

  1. fujitatomoya commented on Nov 27, 2020

    @fujitatomoya
    CollaboratorAuthor
  2. brawner commented on Dec 15, 2020

    @brawner
    Contributor

    @fujitatomoya can this be closed?

  3. fujitatomoya commented on Dec 15, 2020

    @fujitatomoya
    CollaboratorAuthor

    @brawner
    CC: @clalancette

    no, not yet. I didn't start implementation, still waiting for design comment. (see #1453 (comment) and #1453 (comment))

  4. added
    bug
    on Jan 8, 2021
  5. ivanpauno commented on Jan 8, 2021

    @ivanpauno
    Member

    Closing as linked PRs were merged, feel free to reopen if this is not solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions