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 all commits
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,14 @@ 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.
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}'

Comment on lines +306 to +313
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that this is appropriate for the Beginner documentation. The point of the beginner docs is to show one way to do it, not to document all of the nuances and alternate ways to do it. Instead, I'll suggest putting this in another tutorial or how-to guide that talks about ros2 topic pub.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds like I could write a new how-to guide on for Advanced usage of ros2 topic. Seems like a good spot to also talk about hidden topics since the docs don't cover those

Copy link
Contributor

@clalancette clalancette Mar 8, 2024

Choose a reason for hiding this comment

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

Sounds like I could write a new how-to guide on for Advanced usage of ros2 topic. Seems like a good spot to also talk about hidden topics since the docs don't cover those

That sounds very reasonable to me. That could also possibly go into Tutorials/Advanced .

Copy link
Contributor

Choose a reason for hiding this comment

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

@Ryanf55 Would you like to remove this portion from this PR, so we can put the changes to About-Interfaces in? Then when you have time you could write the advanced tutorial.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, I'm swamped now. in the mean time, can we get some capable maintainers to review the two proposed PR's and provide input to the blocks with IDL and JSON not supporting NaN?

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

Expand Down
Loading