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

Fix wrong publish timestamp initialization #585

Merged
merged 2 commits into from
May 2, 2023

Conversation

Noel215
Copy link
Contributor

@Noel215 Noel215 commented Apr 27, 2023

With the current implementation the previous_publish_timestamp_ variable was initialized in the on_configure method.

However, when using the simulation, the time source has not been always updated to the ros time and it's initialized to the system time, so the condition for publishing the odometry and the related tf is never satisfied:

system_time + publish_period_ is always > simulation_time

With this fix, previous_publish_timestamp_ starts without an uninitialized clock and whenever the time source changes, it is initialized/changed.

The odometry will be published in 2 cases:

  • Whenever the time source is changed
  • If the publish_rate condition is satisfied

Signed-off-by: Noel Jimenez <noel.jimenez@pal-robotics.com>
Signed-off-by: Noel Jimenez <noel.jimenez@pal-robotics.com>
Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@bmagyar bmagyar merged commit 7cb4128 into ros-controls:master May 2, 2023
@bmagyar
Copy link
Member

bmagyar commented May 2, 2023

@Mergifyio backport humble

@mergify
Copy link
Contributor

mergify bot commented May 2, 2023

backport humble

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request May 2, 2023
* Fix publish timestamp

Signed-off-by: Noel Jimenez <noel.jimenez@pal-robotics.com>

* Document catch purpose

Signed-off-by: Noel Jimenez <noel.jimenez@pal-robotics.com>

---------

Signed-off-by: Noel Jimenez <noel.jimenez@pal-robotics.com>
(cherry picked from commit 7cb4128)
bmagyar pushed a commit that referenced this pull request May 2, 2023
Signed-off-by: Noel Jimenez <noel.jimenez@pal-robotics.com>
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