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

Support floating point special values #351

Open
ghost opened this issue Mar 4, 2019 · 5 comments
Open

Support floating point special values #351

ghost opened this issue Mar 4, 2019 · 5 comments
Labels
backlog enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Mar 4, 2019

Feature request

Right now, it appears that the rosidl will only accept floating point values specified in decimal or exponential form. However, there are several valid special values that can't be specified this way. In particular:

  • NaN
  • +/- infinity
  • It's not clear whether or not signed zero values are supported

Feature description

It would be good to support all floating point special values. In particular, infinities and NaNs can be useful as default values or constants in certain situations.

Implementation considerations

Simply support specification of float32/float64 values (constant and default) by some special strings. e.g.

  • "nan", "+nan" for positive nan
  • "-nan" for negative nan
  • "inf", "+inf", "-inf" similarly
  • "+0", "-0"

Ensure use of these cases are tested and documented.

@bijoua29
Copy link

I think this is the same problem I am seeing when echoing a topic with NaNs.

ros2 topic echo /controller/state
make_tuple(): unable to convert arguments to Python object (compile in debug mode for details)

Is there anyone working on this issue? I am willing to try if someone can point me to where the issue might be.

@oysstu
Copy link
Contributor

oysstu commented Sep 13, 2022

I think this is the same problem I am seeing when echoing a topic with NaNs.

This issue refers to specifying constants and default values in the idl. I think what you are referring to is the issue in ros2/rosidl_python#162. It's currently fixed in rolling, but I don't know if it's going to be backported to humble.

A quick workaround is either running python with -O or exporting PYTHONOPTIMIZE=1 as an environmental variable, that should disable the NaN/Inf assertions.

@bijoua29
Copy link

@oysstu I am on the latest rolling (from a few days ago) and still get an error but the message is slightly different: 'Unable to convert call argument to Python object (compile in debug mode for details)'. Maybe the fix didn't make it into the recent sync. Which package does this reside in so I can check the version I have?

Setting PYTHONOPTIMIZE=1 does fix the problem. I can work with that for the time being.

@clalancette
Copy link
Contributor

Maybe the fix didn't make it into the recent sync.

I just released it yesterday, so it will be in the next sync.

@bijoua29
Copy link

@clalancette Ah perfect. Thanks for following up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants