fixed nan interpolation issue#311
Conversation
tfoote
left a comment
There was a problem hiding this comment.
This is working around the symptom by testing it in the same way. It would be much better to not do double comparisons of large values.
If you instead changed the ratio to diff the times into a Duration, that would all be integer math. And then just call Duration::toSec on the results the problem would be avoided completely.
And you also aren't doing floating point comparisions or extra conversions to floating point.
|
How would you do that exactly? |
|
A floating point representation won't have a problem representing a single nanosecond and will not "become" zero. It only looses precision with large values so if you do the differencing in fixed point math. It's safe to do the division using the floating point representation of the deltas (which are small). |
tf2/src/cache.cpp
Outdated
| { | ||
| // Check for zero distance case | ||
| if( two.stamp_ == one.stamp_ ) | ||
| if ((two.stamp_ - one.stamp_).toSec() == 0) |
There was a problem hiding this comment.
This change is not necessary and causes noteable extra computation.
|
Thanks for the fixup, with the revert there's now a whole bunch of unrelated whitespace changes. Generally they're good, but having the unrelated changes in the diffs will make tracking across branches much harder. Please keep the diff minimal to just the code changes. |
|
Closing in favor of #313 |
* Port eigen_kdl.h/cpp to ROS2 Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
fixes #310