Skip to content

Serialization No Longer Allows float("inf") for float32 Type #169

@connoranderson

Description

@connoranderson

In galactic release, we were able to use the numeric-limit value of float("inf") for a float32 type. When #128 was introduced (and subsequently we began experimenting with humble release), we observed that the numeric limit checks prevented this use case. This is creating inconsistencies as our c++ code is still able to serialize using std::numeric_limits<T>::infinity but the python code is not able to do so.

Bug report

Required Info:

  • Operating System:
    • ubuntu 22.04
  • Installation type:
    • binaries
  • Version or commit hash:
    • humble
  • DDS implementation:
    • not relevant
  • Client library (if applicable):
    • rclpy

Steps to reproduce issue

my_msg = Msg() # info field is float32
my_msg.info = float("inf")

Expected behavior

Set my_msg.info to INF (formerly would serialize to 3.402823e+40 in galactic)

Actual behavior

AssertionError: The 'info' field must be a float in [-3.402823e+38, 3.402823e+38]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions