Deprecates update(float, float) methods and provides update(std::chrono::duration, std::chrono::duration) replacements.#1533
Conversation
…no::duration, std::chrono::duration) replacements.
|
|
||
| if (time_update_timer_ > 0.1f) { | ||
| time_update_timer_ = 0.0f; | ||
| if (time_update_timer_ > std::chrono::nanoseconds(0.1f)) { |
There was a problem hiding this comment.
Is 0.1 nanoseconds for time_update_timer_ and 1 nanoseconds for frame_update_timer_ really the intended behaviour here?
In ros1, it was 0.1 seconds and 1 seconds respectively.
|
It looks like the tests are failing to find headers added by #1529 . Not sure what to do about that. |
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com> Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com> Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com> Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com> Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com> Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com> Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com>
|
Pulls: #1533 |
ahcorde
left a comment
There was a problem hiding this comment.
Windows is failing https://ci.ros2.org/job/ci_windows/24948/console
|
It looks like Windows doesn't like the cast For converting variables, we can just What do we want to do about the |
…o std::chrono::nanoseconds.
|
It looks like the tests are failing to find headers added by #1529 again. Is there a dependency missing in the package.xml or CMakeLists in rolling? |
ahcorde
left a comment
There was a problem hiding this comment.
I made here some suggestions https://github.com/ros2/rviz/compare/ahcorde/suggestions_1533 do you mind to test it?
Looks sensible. I've replaced the |
|
Don't worry, I found it. |
|
@ahcorde Thanks for your help on this so far. It should be ready for you to re-review, when you get a moment. |
…no::duration, std::chrono::duration) replacements. (ros2#1533) Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com> Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
…no::duration, std::chrono::duration) replacements. (ros2#1533) Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com> Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
…no::duration, std::chrono::duration) replacements. (ros2#1533) Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com> Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
…no::duration, std::chrono::duration) replacements. (ros2#1533) Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com> Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
…no::duration, std::chrono::duration) replacements. (ros2#1533) Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com> Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
…no::duration, std::chrono::duration) replacements. (ros2#1533) Signed-off-by: Mark Johnson <104826595+riv-mjohnson@users.noreply.github.com> Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
| void DisplayGroup::update(float wall_dt, float ros_dt) | ||
| { | ||
| this->update(std::chrono::nanoseconds(std::lround(wall_dt)), | ||
| std::chrono::nanoseconds(std::lround(ros_dt))); |
There was a problem hiding this comment.
I am quite rusty on the rviz API but wouldn't it be better to do something like std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::duration<float>(seconds)) here to preserve times like 0.1f?
There was a problem hiding this comment.
Unfortunately, float wall_dt = 0.1f is 0.1 nanoseconds, not 0.1 seconds. See #1322. As such, rounding and losing fractions of a nanosecond shouldn't be a problem.
I made this PR to try and remove the ambiguity.
I don't know what we want to do about preserving existing behaviour vs changing behaviour to match the ros1 / documented behaviour.
There was a problem hiding this comment.
Ah, I did not spend enough time reading your issue. I thought the sec -> ns change just happened in rolling.
* Fix image_common NodeT deprecation warnings from ros-perception/image_common#352 - migrate to NodeInterfaces * Fix image_common rmw_qos_profile_t deprecation warnings from ros-perception/image_common#364 - migrate to rclcpp::QoS * Fix rviz update float deprecation warnings from ros2/rviz#1533 - migrate to std::chrono::duration * Fix geometry2 tf2_ros .h deprecation warnings from ros2/geometry2#805 - migrate Kilted and Rolling to .hpp * Fix geometry2 tf2_ros NodeT deprecation warnings from ros2/geometry2#714 - migrate to NodeInterfaces * Fix rclcpp spin_some deprecation warnings from ros2/rclcpp#2848 - migrate to SingleThreadedExecutor --------- Co-authored-by: Andrea <realeandrea@yahoo.it>
* Fix image_common NodeT deprecation warnings from ros-perception/image_common#352 - migrate to NodeInterfaces * Fix image_common rmw_qos_profile_t deprecation warnings from ros-perception/image_common#364 - migrate to rclcpp::QoS * Fix rviz update float deprecation warnings from ros2/rviz#1533 - migrate to std::chrono::duration * Fix geometry2 tf2_ros .h deprecation warnings from ros2/geometry2#805 - migrate Kilted and Rolling to .hpp * Fix geometry2 tf2_ros NodeT deprecation warnings from ros2/geometry2#714 - migrate to NodeInterfaces * Fix rclcpp spin_some deprecation warnings from ros2/rclcpp#2848 - migrate to SingleThreadedExecutor --------- Co-authored-by: Andrea <realeandrea@yahoo.it>
Description
As detailed in #1322, when rviz was updated from ros1 to ros2, the units used in
update(wall_dt, ros_dt)calls were changed from seconds to nanoseconds. This change was not documented, and a lot of downstream classes (including in this repository) were not updated.This PR attempts to begin rectifying the situation, without introducing breaking changes, by following the ideas listed in #1322. This PR deprecates the
update(float, float)method, and introduces anupdate(std::chrono::duration, std::chrono::duration)replacement.Is this user-facing behavior change?
Not unless users treat deprecation warnings as errors.
Did you use Generative AI?
No
Additional Information
Can this PR be back-ported to Jazzy and Humble when merged?