From 8e3d27ef0dda808d93c46d34ff18bd25681ed497 Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Tue, 5 Mar 2024 10:12:43 -0700 Subject: [PATCH 1/2] Document NaN support in interfaces and NaN usage in CLI Signed-off-by: Ryan Friedman --- source/Concepts/Basic/About-Interfaces.rst | 3 +++ .../Understanding-ROS2-Topics.rst | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/source/Concepts/Basic/About-Interfaces.rst b/source/Concepts/Basic/About-Interfaces.rst index 5c0d3a0ae3e..a071e7e8a3c 100644 --- a/source/Concepts/Basic/About-Interfaces.rst +++ b/source/Concepts/Basic/About-Interfaces.rst @@ -183,6 +183,7 @@ Field default value Default values can be set to any field in the message type. Currently default values are not supported for string arrays and complex types (i.e. types not present in the built-in-types table above; that applies to all nested messages). +Special floating point values such as ``NaN``, ``+infinity``, and ``-infinity`` are not yet supported as default values. Defining a default value is done by adding a third element to the field definition line, i.e: @@ -227,6 +228,8 @@ For example: Constants names have to be UPPERCASE +Special floating point values such as ``NaN``, ``+infinity``, and ``-infinity`` are not yet supported as constant values. + Services -------- diff --git a/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst b/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst index 46b0215ba1a..7585dbbd518 100644 --- a/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst +++ b/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst @@ -303,6 +303,13 @@ If the message does not use a full header, but just has a field with type ``buil ros2 topic pub /reference sensor_msgs/msg/TimeReference '{header: "auto", time_ref: "now", source: "dumy"}' +Certain messages use ``NaN`` as a significant value. This is supported in YAML. For example, with a ``sensor_msgs/msg/BatteryState``, +the temperature field may not be measured. If so, it should be set to ``NaN``. + +.. code-block:: console + + ros2 topic pub /battery sensor_msgs/msg/BatteryState '{voltage: 12.4, temperature: .nan}' + 8 ros2 topic hz ^^^^^^^^^^^^^^^ From 527c634ccb1ea9fb59bbb98aa827bf63d0ca27de Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 5 Mar 2024 16:35:02 -0700 Subject: [PATCH 2/2] Remove note about YAML support Co-authored-by: Tomoya Fujita Signed-off-by: Ryan --- .../Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst b/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst index 7585dbbd518..d4f33fc18cd 100644 --- a/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst +++ b/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst @@ -303,8 +303,9 @@ If the message does not use a full header, but just has a field with type ``buil ros2 topic pub /reference sensor_msgs/msg/TimeReference '{header: "auto", time_ref: "now", source: "dumy"}' -Certain messages use ``NaN`` as a significant value. This is supported in YAML. For example, with a ``sensor_msgs/msg/BatteryState``, -the temperature field may not be measured. If so, it should be set to ``NaN``. +Certain messages use ``NaN`` as a significant value. +For example, with a ``sensor_msgs/msg/BatteryState``, the temperature field may not be measured. +If so, it should be set to ``NaN``. .. code-block:: console