Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yaml parser raises an error "Sequence should be of same type" when meets .nan in list of doubles #555

Closed
iquater opened this issue Jan 16, 2020 · 2 comments · Fixed by #781
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@iquater
Copy link

iquater commented Jan 16, 2020

ros2 launch raises an exception while parsing list with .nan value

  • Operating System:
    • Ubuntu 18.04
  • Installation type:
    • binaries
  • Version or commit hash:
    • dashing
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • rclcpp, rclpy

Steps to reproduce issue

Create python or cpp package:

import rclpy
from rclpy.node import Node


class TestNode(Node):
    def __init__(self):
        super().__init__("parameter_holder")

def main(args=None):
    rclpy.init(args=args)
    parameter_holder = TestNode()
    rclpy.spin(parameter_holder)
    parameter_holder.destroy_node()
    rclpy.shutdown()
    return 0

launch file:

from launch.launch_description import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    return LaunchDescription([
        Node(package='reprod',
             node_executable='param_holder',
             node_name='parameter_holder',
             output='screen',
             parameters=[
                 "/tmp/test.yaml"
             ])
    ])

configuration file

parameter_holder:
    ros__parameters:
        test_list: [1.0, 2.0]
        test_list2: [1.0, .nan]

Expected behavior

Yaml parser should treat .nan as valid double (or float) value.

Actual behavior

Yaml parser treats .nan as string and throws exception:

RuntimeError: Failed to parse yaml params file '/tmp/test.yaml': Sequence should be of same type. Value type 'string' do not belong at line_num 4

@dirk-thomas
Copy link
Member

Loosely related to ros2/rosidl#351.

@ivanpauno ivanpauno added help wanted Extra attention is needed bug Something isn't working labels Jan 30, 2020
@ivanpauno
Copy link
Member

ivanpauno commented Jan 30, 2020

@iquater Thanks for opening the issue. This is not currently supported, but it's a desired feature.
A PR adding support to special floating point values is more than welcomed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants