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

Document NaN support in interfaces and NaN usage in CLI #4210

Open
wants to merge 2 commits into
base: rolling
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions source/Concepts/Basic/About-Interfaces.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a comment, this does not block the PR.

instead of adding the limitation here temporary, can we update the doc after ros2/rosidl#789?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I'm not in a rush to fix the docs, and am happy to revise if we can get a quick review and merge on the ROSIDL PR.


Defining a default value is done by adding a third element to the field definition line, i.e:

Expand Down Expand Up @@ -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
--------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Ryanf55 marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: console

ros2 topic pub /battery sensor_msgs/msg/BatteryState '{voltage: 12.4, temperature: .nan}'

8 ros2 topic hz
^^^^^^^^^^^^^^^

Expand Down
Loading