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 support use_sim_time for ros2 topic hz/bw/pub. #754

Merged
merged 8 commits into from
Sep 21, 2022
Merged

Add support use_sim_time for ros2 topic hz/bw/pub. #754

merged 8 commits into from
Sep 21, 2022

Conversation

llapx
Copy link
Contributor

@llapx llapx commented Sep 2, 2022

Signed-off-by: Lei Liu Lei.Liu.AP@sony.com

@fujitatomoya
Copy link
Collaborator

address #752

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

@llapx thanks for taking care of this one. this PR is still W.I.P, right? adding node argument does not set simulation time, more implementation required.

@fujitatomoya
Copy link
Collaborator

CCed: @iuhilnehc-ynos @Barry-Xu-2018

@Barry-Xu-2018
Copy link

I think the current change is intermediate version.
@llapx please mark correct status of PR (e.g. Draft) to avoid reviewing incomplete change.

@llapx llapx marked this pull request as draft September 5, 2022 02:13
@llapx llapx marked this pull request as ready for review September 5, 2022 05:49
@llapx
Copy link
Contributor Author

llapx commented Sep 5, 2022

Hi All,

After some more tests, it confirmed that the code work well, in sim_time mode, there's need a sim clock to drive communication, I used ros2 bag record/play --clock to drive ros2 topic hz/bw/pub, thanks!

@fujitatomoya
Copy link
Collaborator

@llapx thanks for checking, can we add some test for each subcommand?

@llapx
Copy link
Contributor Author

llapx commented Sep 5, 2022

@llapx thanks for checking, can we add some test for each subcommand?

OK.

@llapx llapx marked this pull request as draft September 5, 2022 07:30
@llapx llapx marked this pull request as ready for review September 9, 2022 04:37
@fujitatomoya
Copy link
Collaborator

@Barry-Xu-2018 this is ready for review, can you help? i will do the same.

@Barry-Xu-2018
Copy link

this is ready for review, can you help? i will do the same.

Yes. I am reviewing this.

ros2topic/ros2topic/verb/bw.py Outdated Show resolved Hide resolved
ros2topic/ros2topic/verb/bw.py Show resolved Hide resolved
ros2topic/test/test_use_sim_time.py Outdated Show resolved Hide resolved
ros2topic/test/test_use_sim_time.py Show resolved Hide resolved
Copy link

@iuhilnehc-ynos iuhilnehc-ynos left a comment

Choose a reason for hiding this comment

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

some nitpick and TODOs that we can improve.

ros2topic/package.xml Outdated Show resolved Hide resolved
ros2topic/ros2topic/verb/bw.py Outdated Show resolved Hide resolved
ros2topic/ros2topic/verb/bw.py Outdated Show resolved Hide resolved
ros2topic/ros2topic/verb/hz.py Show resolved Hide resolved
@llapx
Copy link
Contributor Author

llapx commented Sep 13, 2022

Thanks for your feedbacks, I will update the code soon.

@llapx llapx marked this pull request as draft September 13, 2022 09:10
@fujitatomoya
Copy link
Collaborator

@llapx is this still draft?

@llapx
Copy link
Contributor Author

llapx commented Sep 14, 2022

@llapx is this still draft?

I have update the code, but some testcase will failed in jenkins, (my local test is OK), I'm finding the reason.

@llapx llapx marked this pull request as ready for review September 14, 2022 02:19
Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
@llapx
Copy link
Contributor Author

llapx commented Sep 14, 2022

I found that most failed test cases not related to this PR, can anyone help to resolve this issue?
https://build.ros2.org/job/Rpr__ros2cli__ubuntu_jammy_amd64/128/testReport/

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

overall lgtm, minor comments.

ros2topic/ros2topic/verb/bw.py Outdated Show resolved Hide resolved
ros2topic/ros2topic/verb/bw.py Outdated Show resolved Hide resolved
ros2topic/ros2topic/verb/bw.py Outdated Show resolved Hide resolved
ros2topic/ros2topic/verb/bw.py Outdated Show resolved Hide resolved
ros2topic/test/test_use_sim_time.py Outdated Show resolved Hide resolved
@fujitatomoya
Copy link
Collaborator

@llapx i will start CI after my comments are resolved. thanks!

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
Copy link

@iuhilnehc-ynos iuhilnehc-ynos left a comment

Choose a reason for hiding this comment

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

LGTM with my comments addressed.

ros2topic/ros2topic/verb/hz.py Show resolved Hide resolved
ros2topic/ros2topic/verb/bw.py Outdated Show resolved Hide resolved
Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
@iuhilnehc-ynos
Copy link

iuhilnehc-ynos commented Sep 16, 2022

I just run CI in linux:

The warning message reported by flake8, @llapx, could you check it?

  ./test/test_use_sim_time.py:16:1: I100 Import statements are in the wrong order. 'import functools' should be before 'import re'
  ./test/test_use_sim_time.py:37:1: I100 Import statements are in the wrong order. 'from rosgraph_msgs.msg import Clock' should be before 'from std_msgs.msg import String'
  ./ros2topic/verb/bw.py:33:1: I100 Import statements are in the wrong order. 'from argparse import ArgumentTypeError' should be before 'import sys'
  ./ros2topic/verb/bw.py:135:27: Q000 Double quotes found but single quotes preferred

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
@llapx
Copy link
Contributor Author

llapx commented Sep 19, 2022

I just run CI in linux:

The warning message reported by flake8, @llapx, could you check it?

  ./test/test_use_sim_time.py:16:1: I100 Import statements are in the wrong order. 'import functools' should be before 'import re'
  ./test/test_use_sim_time.py:37:1: I100 Import statements are in the wrong order. 'from rosgraph_msgs.msg import Clock' should be before 'from std_msgs.msg import String'
  ./ros2topic/verb/bw.py:33:1: I100 Import statements are in the wrong order. 'from argparse import ArgumentTypeError' should be before 'import sys'
  ./ros2topic/verb/bw.py:135:27: Q000 Double quotes found but single quotes preferred

Updated.

@iuhilnehc-ynos
Copy link

CI:

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

@fujitatomoya
Copy link
Collaborator

@wjwwood can you do final review?

ros2topic/ros2topic/verb/bw.py Outdated Show resolved Hide resolved
ros2topic/ros2topic/verb/bw.py Outdated Show resolved Hide resolved
Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
@fujitatomoya
Copy link
Collaborator

CI:

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

@fujitatomoya fujitatomoya merged commit 36ff517 into ros2:rolling Sep 21, 2022
@fujitatomoya
Copy link
Collaborator

Do we want backport this to humble? it extends sub-options. @clalancette

@clalancette
Copy link
Contributor

Do we want backport this to humble? it extends sub-options. @clalancette

To put this in, we'll also have to put in #581 . I have a minor concern that doing the parameter_overrides there can introduce a small change in behavior, but I could be convinced it could be OK.

Regardless, I think we should let this sit in Rolling for a bit before we backport it, just to see if anyone runs into issues.

@fujitatomoya
Copy link
Collaborator

@clalancette can we add these feature to humble? dependent PR has been already in humble, i think this is useful (almost mandatory) for user development. what would you think?
if we have a go, we will manage the CI.

@fujitatomoya
Copy link
Collaborator

@clalancette friendly ping.

@fujitatomoya
Copy link
Collaborator

@Mergifyio backport humble

fujitatomoya pushed a commit that referenced this pull request Nov 9, 2022
* Add support use_sim_time for ros2 topic hz/bw/pub.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Add testcase.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Update code.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Update code again.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Add warning log.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Revert STEADY_TIME.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Fix flake8 warnings.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Update code.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
fujitatomoya pushed a commit that referenced this pull request Nov 9, 2022
* Add support use_sim_time for ros2 topic hz/bw/pub.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Add testcase.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Update code.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Update code again.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Add warning log.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Revert STEADY_TIME.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Fix flake8 warnings.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Update code.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
@fujitatomoya
Copy link
Collaborator

I am not sure why @Mergifyio does not work at this moment, create backport for humble #777

@wjwwood
Copy link
Member

wjwwood commented Nov 9, 2022

Yeah that's weird, it gave the 👍 like it noticed...

ivanpauno pushed a commit that referenced this pull request Nov 22, 2022
* Add support use_sim_time for ros2 topic hz/bw/pub.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Add testcase.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Update code.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Update code again.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Add warning log.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Revert STEADY_TIME.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Fix flake8 warnings.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

* Update code.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Co-authored-by: Lei Liu <64953129+llapx@users.noreply.github.com>
@Crola1702
Copy link
Contributor

Hey @llapx @fujitatomoya.

This PR added test_use_sim_time.test_pub_times test. And it is failing flaky since it was added (Reported here: #772)

Log output:

FAIL: test_use_sim_time.TestROS2TopicUseSimTime.test_pub_times
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/ws/install_isolated/launch_testing/lib/python3.10/site-packages/launch_testing/markers.py", line 57, in _wrapper
    return func(self, *args, **kwargs)
  File "/tmp/ws/src/ros2/ros2cli/ros2topic/test/test_use_sim_time.py", line 124, in test_pub_times
    assert command.wait_for_shutdown(timeout=1)
AssertionError: assert False
 +  where False = <bound method ProcessProxy.wait_for_shutdown of <launch_testing.tools.process.ProcessProxy object at 0x7f0bc09f9330>>(timeout=1)
 +    where <bound method ProcessProxy.wait_for_shutdown of <launch_testing.tools.process.ProcessProxy object at 0x7f0bc09f9330>> = <launch_testing.tools.process.ProcessProxy object at 0x7f0bc09f9330>.wait_for_shutdown

It's failing on this line of code.

What do you think about this problem? Maybe we could increase the timeout in the test?

Reference build: https://build.ros2.org/view/Rci/job/Rci__nightly-debug_ubuntu_jammy_amd64/284/

@fujitatomoya
Copy link
Collaborator

What do you think about this problem? Maybe we could increase the timeout in the test?

yeah i do think so, comparing to other places, timeout could be too short.

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

7 participants