Skip to content

Conversation

@sloretz
Copy link
Contributor

@sloretz sloretz commented Nov 10, 2017

This PR is split from #127. It has performance improvements to the executor that get the 1kHz timer test to pass consistently. If you've already reviewed #127 the new changes are:

  • Implemented WaitSet class as a cpython extension
    • Executor updated to use it
  • Moved sigint handler to a library for sharing between _rclpy and _rclpy_wait_set

Changes that were already in #127

  • wait_for_callbacks refactored readability + performance
  • Fixed bug where wait_for_callbacks could yield the wrong node
  • Removed underscores from imported names
  • added utilty timeout_sec_to_nsec
  • SingleThreadedExecutor and MultiThreadedExecutor reuse the iterator from wait_for_callbacks over multiple spin_once calls

CI

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

@sloretz sloretz added the in progress Actively being worked on (Kanban column) label Nov 10, 2017
@sloretz sloretz self-assigned this Nov 10, 2017
@sloretz sloretz force-pushed the rclpy_executor_refactor branch from a0729e0 to 1bcf742 Compare November 14, 2017 18:05
@sloretz sloretz added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Nov 15, 2017
@sloretz sloretz changed the title [WIP] Rclpy executor refactor Executor bug fixes and WaitSet refactor Nov 15, 2017
Moved wait set code to its own class for code reuse

Added timeout_sec_to_nsec()

wait_for_service() implemented with timers

Added unit tests for timeout_sec_to_nsec()

Added test for WaitSet class

Use negative timeouts to mean block forever

Double quotes to single quotes

Added wait_for_service() tests and fixed bugs it caught

Eliminate blind exception warning

Reduce flakiness of test by increasing time to 0.1s

Comment says negative timeouts block forever

Use :returns:

Move add_subscriptions()

arugments -> arguments

Daemon as keyword arg

Remove unnecessary namespace argument

Use S_TO_NS in test

More tests using S_TO_NS

Use monotonic clock for testing timer time

Increased test timeout by 30 seconds

CheckExact -> IsValid

Fixed wait_set not clearing ready_pointers

Remove unnecessary namespace keyword arg

Non-blocking wait

remove expression that always evaluates to True

Raise ValueError on invalid capsule

Simplified timeout_sec_to_nsec

Added 'WaitSet.destroy()' and made executor use it

GraphListener periodically checks if rclpy is shutdown

Misc fixes after pycapsule names

Wait set class always clears entities before waiting

Remove underscore on import

Reformat timeout line

Use () when raising exceptions

Removed _ on imports

Executor optimizations

~5% less overhead in wait_for_ready_callbacks()

Fixed executor yielding entities to wrong node

Also refactored some code to a sub-generator

Use list() only where necessary

Docstring in imperitive mood

Executors reuse iterator

moved some wait_set code into C

Avoid another list comprehension

Replaced WaitSet with C code in executor

Remove test code

Use lists instead of set

Use locally defined function instead of member function

Shorten code using macro

Move everything to new wait_set code

protect against ImportError.path being None (#134)

Free memory when things don't go as planned (#138)
Python library _rclpy could not be imported due to rclpy_sigint.dll not
being on PATH. This uses 'APPEND_LIBRARY_DIRS' argument to
ament_add_nose_test to add that directory to the path.
@sloretz sloretz force-pushed the rclpy_executor_refactor branch from 1bcf742 to a3e3ece Compare November 15, 2017 16:20
@sloretz sloretz mentioned this pull request Nov 27, 2017
@sloretz sloretz added in progress Actively being worked on (Kanban column) and removed in review Waiting for review (Kanban column) labels Nov 28, 2017
@mikaelarguedas
Copy link
Member

@sloretz Will this PR be replaced by favor of https://github.com/ros2/rclpy/pull/173/files when we switch to pybind11?
Are all the changes you want to the waitset part of this other PR or should this branch be kept?

@sloretz
Copy link
Contributor Author

sloretz commented Mar 8, 2018

@mikaelarguedas There is a little bit of code in here that might make it to a future PR, but most of the code here has already made it or will be replaced by a switch to pybind11. The code worth saving is in a fork, so I'll close this and delete the branch.

@sloretz sloretz closed this Mar 8, 2018
@sloretz sloretz removed the in progress Actively being worked on (Kanban column) label Mar 8, 2018
@sloretz sloretz deleted the rclpy_executor_refactor branch March 8, 2018 22:49
YuanYuYuan pushed a commit to YuanYuYuan/rclpy that referenced this pull request Nov 12, 2025
Trying to figure out which tests are flaky and fix, adding debug info…
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.

3 participants