-
Notifications
You must be signed in to change notification settings - Fork 26
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
Impossible to set timestep lower then 1e-7 #245
Comments
While fixing the bug is relatively trivial, as you just need to substitute For this reason, (unless this functionality is provided in some Ignition or SDFormat library) it is necessary to either just convert a the double to string via stringstream with an arbitrary high precision (24 significant digits should be sufficient, but I am not sure) add or vendor a dependency for this double to shortest exact string. In iDynTree for this in robotology/idyntree#554 / robotology/idyntree@5982124 I imported fpconv, https://github.com/night-shift/fpconv . @diegoferigo let me know which solution you prefer, if stringstream + setprecision(17) or adding fpconv to the repo. |
For the testing, it is a bit tricky as the |
std::to_string truncates the values with 1e-6 precision, and is prone to locale-related bug. Fix robotology-legacy#245
Thanks for catching this bug and providing all the information! Unfortunately it's not straightforward returning A test, however, could be done exploiting The |
If using the
devel
branch I try to run the following script:I get the error (that originates from DART):
Everything instead works fine using a timestep of 1e-6 . Based on a quick debugging, the problem is probably in https://github.com/robotology/gym-ignition/blob/devel/cpp/scenario/gazebo/src/helpers.cpp#L375 , where the timestep value is passed to Gazebo as a string that is converted using
std::to_string
, that is not ideal for two reasons:std::to_string
a string that converted back to double gives the original valuestd::to_string
is subject to locale bugs such as the one described in URDF Parsers' code is implicitly assuming that "C" locale is set robotology/idyntree#288The text was updated successfully, but these errors were encountered: