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

Add latest time zero-order-hold sync policy #73

Merged
merged 21 commits into from
Aug 16, 2022

Conversation

andermi
Copy link
Contributor

@andermi andermi commented May 13, 2022

Rate logic added to #38.
Computes rates of received messages and pivots on fastest topic; essentially, upsamples slower topics with a zero-order hold.

@andermi andermi marked this pull request as draft May 13, 2022 17:22
@andermi andermi marked this pull request as ready for review May 13, 2022 17:22
@chapulina chapulina self-requested a review May 13, 2022 17:38
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

I've left a few comments inline.

Besides that, it might be nice to add in some documentation to the top of latest_time.h that describes briefly what this sync policy does, and how to use it.

include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
test/test_latest_time_policy.cpp Outdated Show resolved Hide resolved
andermi and others added 4 commits May 16, 2022 11:55
Signed-off-by: Michael Anderson <[email protected]>
Signed-off-by: Michael Anderson <[email protected]>
Signed-off-by: Michael Anderson <[email protected]>
@andermi andermi requested a review from clalancette May 16, 2022 19:46
@andermi
Copy link
Contributor Author

andermi commented May 16, 2022

Thanks @clalancette ! I added some some documentation at the top of the header.

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

The functionality works for me. I have some questions and suggestions. Take it all with a grain of salt since it's my first time touching this repo 😄

include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
test/test_latest_time_policy.cpp Outdated Show resolved Hide resolved
test/test_latest_time_policy.cpp Show resolved Hide resolved
test/test_latest_time_policy.cpp Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
@andermi andermi requested a review from chapulina May 18, 2022 00:34
andermi added 3 commits May 18, 2022 11:39
Signed-off-by: Michael Anderson <[email protected]>
Signed-off-by: Michael Anderson <[email protected]>
andermi added 3 commits May 18, 2022 17:23
Signed-off-by: Michael Anderson <[email protected]>
Signed-off-by: Michael Anderson <[email protected]>
Signed-off-by: Michael Anderson <[email protected]>
Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

Thanks for iterating, LGTM! I'd appreciate a review from one of the maintainers though.

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Overall, looks pretty good to me. I've left a few things inline that I think we should address.

include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
@andermi
Copy link
Contributor Author

andermi commented Jun 6, 2022

@clalancette I think/hope I've addressed your comments.

@andermi andermi requested a review from clalancette June 6, 2022 22:33
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

All right, one last pass. Once these things are fixed, we'll be ready to run CI on it.

include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
include/message_filters/sync_policies/latest_time.h Outdated Show resolved Hide resolved
test/test_latest_time_policy.cpp Show resolved Hide resolved
Signed-off-by: Michael Anderson <[email protected]>
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Looks good to me! The next step here is to run CI, but we are currently having some infrastructure issues with CI. Once those are resolved I'll do the CI run.

@clalancette
Copy link
Contributor

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@andermi
Copy link
Contributor Author

andermi commented Jun 8, 2022

  • Windows Build Status

ugh... timing in windows is unstable in general 😝 . I think I can fix it.

@andermi
Copy link
Contributor Author

andermi commented Jun 8, 2022

I actually did find a small intermittent bug

@clalancette
Copy link
Contributor

Let's run Windows CI again to see where we are at: * Windows Build Status

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

It looks like there are some Windows warnings being introduced by this PR:

https://ci.ros2.org/job/ci_windows/17217/msbuild/new/#issuesContent

test/test_latest_time_policy.cpp Outdated Show resolved Hide resolved
@audrow audrow changed the base branch from master to rolling June 28, 2022 14:19
@quarkytale
Copy link

Retriggered CI

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@quarkytale
Copy link

This is currently blocked by timing issue in windows CI.
There are two EMA filters tuned for Linux:

  1. mean rate for incoming message
  2. mean error from 1 which is similar to stddev

In Linux, a threshold of 10 * EMA#2 is used for detecting if the message rate changed. On windows, the rate change is not being detected the same way.

Signed-off-by: Michael Anderson <[email protected]>
@andermi
Copy link
Contributor Author

andermi commented Aug 12, 2022

@clalancette, @quarkytale I gave it another shot... I spun up ros2 dev on my windows machine.
The test passes using sim /clock to control the test timing

@quarkytale
Copy link

Retriggered Windows CI Build Status

@andermi
Copy link
Contributor Author

andermi commented Aug 16, 2022

Looks like compiler warnings causing unstable. Working through them now.

Signed-off-by: Michael Anderson <[email protected]>
@andermi
Copy link
Contributor Author

andermi commented Aug 16, 2022

@quarkytale would you mind running another one? I fixed the 7 msbuild warnings related to conversion from size_t. Can you see anything else to fix first?

@quarkytale
Copy link

I'm not sure if the warnings were an issue, but good to have them cleared. Seems like some tests are being skipped, that might be the reason for unstable status. Other things that stood out to me:

  • [WARNING] [python.exe-3]: 'SIGINT' sent to process[python.exe-3] not supported on Windows, escalating to 'SIGTERM'
  • [-ERROR-] IO exception has been thrown: java.nio.file.NoSuchFileException: C:\ci\ws\src\ros2\message_filters\include\message_filters\sync_policies\latest_time.h

Let's see if any of these persist: Build Status

Copy link

@quarkytale quarkytale left a comment

Choose a reason for hiding this comment

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

LGTM and CI is green!

@gbiggs gbiggs merged commit e0055f3 into ros2:rolling Aug 16, 2022
@adityapande-1995
Copy link

https://github.com/Mergifyio backport humble

@mergify
Copy link

mergify bot commented Mar 9, 2023

backport humble

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Mar 9, 2023
* adding latest time zoh policy

Signed-off-by: Michael Anderson <[email protected]>

* remove commented code

* Update include/message_filters/sync_policies/latest_time.h

Co-authored-by: Chris Lalancette <[email protected]>

* updates from PR comments

Signed-off-by: Michael Anderson <[email protected]>

* cleanup includes

Signed-off-by: Michael Anderson <[email protected]>

* adding documentation

Signed-off-by: Michael Anderson <[email protected]>

* Update include/message_filters/sync_policies/latest_time.h

Co-authored-by: Louise Poubel <[email protected]>

* address PR comments; add new test for if pivot changes rate and new one is selected

Signed-off-by: Michael Anderson <[email protected]>

* adding message rate step change detection and EMA filter reset

Signed-off-by: Michael Anderson <[email protected]>

* whitespace

Signed-off-by: Michael Anderson <[email protected]>

* whitespace

Signed-off-by: Michael Anderson <[email protected]>

* detect if pivot message is late

Signed-off-by: Michael Anderson <[email protected]>

* add ChangeRateLeading test

Signed-off-by: Michael Anderson <[email protected]>

* whitespace

Signed-off-by: Michael Anderson <[email protected]>

* Update include/message_filters/sync_policies/latest_time.h

Co-authored-by: Chris Lalancette <[email protected]>

* add option to take instance of rclcpp::Clock; make magic numbers configs; other PR comments

Signed-off-by: Michael Anderson <[email protected]>

* clean up; handle zero period

Signed-off-by: Michael Anderson <[email protected]>

* check for late message after avg error is calculated

Signed-off-by: Michael Anderson <[email protected]>

* control test timing with sim time

Signed-off-by: Michael Anderson <[email protected]>

* fix msbuild compiler warnings

Signed-off-by: Michael Anderson <[email protected]>

Signed-off-by: Michael Anderson <[email protected]>
Co-authored-by: Chris Lalancette <[email protected]>
Co-authored-by: Louise Poubel <[email protected]>
(cherry picked from commit e0055f3)
quarkytale pushed a commit that referenced this pull request Mar 10, 2023
* adding latest time zoh policy

Signed-off-by: Michael Anderson <[email protected]>

* remove commented code

* Update include/message_filters/sync_policies/latest_time.h

Co-authored-by: Chris Lalancette <[email protected]>

* updates from PR comments

Signed-off-by: Michael Anderson <[email protected]>

* cleanup includes

Signed-off-by: Michael Anderson <[email protected]>

* adding documentation

Signed-off-by: Michael Anderson <[email protected]>

* Update include/message_filters/sync_policies/latest_time.h

Co-authored-by: Louise Poubel <[email protected]>

* address PR comments; add new test for if pivot changes rate and new one is selected

Signed-off-by: Michael Anderson <[email protected]>

* adding message rate step change detection and EMA filter reset

Signed-off-by: Michael Anderson <[email protected]>

* whitespace

Signed-off-by: Michael Anderson <[email protected]>

* whitespace

Signed-off-by: Michael Anderson <[email protected]>

* detect if pivot message is late

Signed-off-by: Michael Anderson <[email protected]>

* add ChangeRateLeading test

Signed-off-by: Michael Anderson <[email protected]>

* whitespace

Signed-off-by: Michael Anderson <[email protected]>

* Update include/message_filters/sync_policies/latest_time.h

Co-authored-by: Chris Lalancette <[email protected]>

* add option to take instance of rclcpp::Clock; make magic numbers configs; other PR comments

Signed-off-by: Michael Anderson <[email protected]>

* clean up; handle zero period

Signed-off-by: Michael Anderson <[email protected]>

* check for late message after avg error is calculated

Signed-off-by: Michael Anderson <[email protected]>

* control test timing with sim time

Signed-off-by: Michael Anderson <[email protected]>

* fix msbuild compiler warnings

Signed-off-by: Michael Anderson <[email protected]>

Signed-off-by: Michael Anderson <[email protected]>
Co-authored-by: Chris Lalancette <[email protected]>
Co-authored-by: Louise Poubel <[email protected]>
(cherry picked from commit e0055f3)

Co-authored-by: andermi <[email protected]>
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.

6 participants