You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compared to rviz1, the update dt was suddenly changed from seconds to nanoseconds, which is not documented anywhere I could find even after finding out.
There are multiple issues with this:
It is not documented despite being a substantial semantic change (neither the change nor in the method documentation)
On the contrary, the method documentation even still explicitly states it would be in seconds:
/// Called periodically by the visualization manager.
/**
* \param wall_dt Wall-clock time, in seconds, since the last time the update list was run through.
* \param ros_dt ROS time, in seconds, since the last time the update list was run through.
*/
virtual
void
update(float wall_dt, float ros_dt);
The datatype did not change, which would at least have been an indication of change, but more importantly, a float makes no sense for nanoseconds since there are no decimal places and a significant loss of precision compared to keeping the uint64_t.
In line with all the other changes in ROS 2 using standard library methods where appropriate, this should have been changed to a std::chrono::duration anyway, which would also make the unit explicit.
Proposed solution
Change the update method signature to a chrono duration.
This will require changing existing displays, but the alternative solution to create a second update method with the duration and keeping this method would be unclean and might still cause issues for anyone porting rviz1 displays that use the dt.
This way, this error would move from a semantic hard-to-spot error to a compilation error, which is easy to find and quick to fix.
And neither solution is ABI compatible, so they can only be made for the upcoming distros anyway.
For existing distributions at least the documentation should be changed.
The text was updated successfully, but these errors were encountered:
This will require changing existing displays, but the alternative solution to create a second update method with the duration and keeping this method would be unclean and might still cause issues for anyone porting rviz1 displays that use the dt.
I agree that we should add a method that takes in a std::chrono::duration, but I do think we should add it as a second method, as our usual policy is to not break downstream without a "tick-tock". So we'd definitely be happy to review a PR that added in the method with std::chrono::duration and marked the old method as deprecated.
rviz/rviz_common/src/rviz_common/visualization_manager.cpp
Lines 341 to 360 in 2f82645
Compared to rviz1, the update dt was suddenly changed from seconds to nanoseconds, which is not documented anywhere I could find even after finding out.
There are multiple issues with this:
On the contrary, the method documentation even still explicitly states it would be in seconds:
rviz/rviz_common/include/rviz_common/display.hpp
Lines 152 to 159 in 2f82645
In line with all the other changes in ROS 2 using standard library methods where appropriate, this should have been changed to a
std::chrono::duration
anyway, which would also make the unit explicit.Proposed solution
Change the update method signature to a chrono duration.
This will require changing existing displays, but the alternative solution to create a second update method with the duration and keeping this method would be unclean and might still cause issues for anyone porting rviz1 displays that use the dt.
This way, this error would move from a semantic hard-to-spot error to a compilation error, which is easy to find and quick to fix.
And neither solution is ABI compatible, so they can only be made for the upcoming distros anyway.
For existing distributions at least the documentation should be changed.
The text was updated successfully, but these errors were encountered: