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

Replace Clock().now() to node.get_clock().now() in diagnostic_updater.py #299

Merged
merged 1 commit into from
May 4, 2023

Conversation

h-wata
Copy link
Contributor

@h-wata h-wata commented Apr 25, 2023

Description

In this PR, the Clock import in the diagnostic_updater.py has been replaced with node.get_clock().
This ensures that the correct ROS_TIME is used when the use_sim_time parameter is set in the ros2 node.

Environment

ros 2 : Humble

Ref

Verifying the Changes

  • Terminal1
ros2 launch gazebo_ros gazebo.launch.py
  • Terminal2
ros2 run diagnostic_updater example.py --ros-args -p use_sim_time:=true # or false
  • Terminal3
ros2 topic echo /diagnostics --field header.stamp.sec

Before

header.stamp is System Time regardless of use_sim_time.

After

header.stamp is ROS Time when use_sim_time is true.

@ct2034
Copy link
Collaborator

ct2034 commented Apr 25, 2023

Thanks for your pull request 👍

@ct2034 ct2034 self-assigned this Apr 26, 2023
@ct2034 ct2034 merged commit 8b7c40b into ros:ros2 May 4, 2023
@h-wata h-wata deleted the fix/diag_updater branch May 4, 2023 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants