Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
0c1850c
Add support in subscription
nadavelkabets May 26, 2025
b403045
add callback support in cpp subscription
nadavelkabets May 26, 2025
2838f1e
working subscription
nadavelkabets May 26, 2025
34426ae
simplify code
nadavelkabets May 26, 2025
381c98e
Add support for services
nadavelkabets May 26, 2025
bdeaf01
fixed bugs
nadavelkabets May 26, 2025
6d0081d
Add support for client
nadavelkabets May 27, 2025
7fb9e62
add get_logger_name to pybind exports
nadavelkabets May 27, 2025
411311a
fix typo in function nam
nadavelkabets May 27, 2025
daf3548
working demo
nadavelkabets May 27, 2025
f5f81be
Add support for client and service
nadavelkabets May 27, 2025
413122c
Add spin_once and wrap_future
nadavelkabets May 27, 2025
f3fce5d
Check if should stop once
nadavelkabets May 27, 2025
41efd94
Crash an asyncio task awaiting rclpy future
nadavelkabets May 28, 2025
3cfa6d1
added tests
nadavelkabets May 28, 2025
07d438a
more tests and fixes
nadavelkabets May 28, 2025
ae1d4aa
more tests
nadavelkabets May 28, 2025
4f80aaf
linting
nadavelkabets May 28, 2025
eb75261
add context and log exceptions in tasks
nadavelkabets May 28, 2025
cb6d929
timer works but 100% cpu :(
nadavelkabets May 28, 2025
6d86f8a
improve timer performance
nadavelkabets May 29, 2025
5c05394
Add on reset callback to timer
nadavelkabets May 29, 2025
784bd3d
fix general issues
nadavelkabets May 29, 2025
0564508
stuff
nadavelkabets May 29, 2025
9895720
remove destroy_callback
nadavelkabets May 29, 2025
3d11398
fix spin until future complete
nadavelkabets May 29, 2025
4bc7675
Proper shutdown
nadavelkabets May 29, 2025
3b87138
Add AbstractExecutor
nadavelkabets May 29, 2025
9bf08eb
Add create_future In standard executor
nadavelkabets May 29, 2025
eece070
add global get_executor and set_executor
nadavelkabets May 31, 2025
bf5ed4a
Remove chain_future
nadavelkabets May 31, 2025
ab92fe0
Add AsyncioExecutor to test_executor
nadavelkabets May 31, 2025
eb7cb65
Fix copyright and uncrustify
nadavelkabets Jun 1, 2025
8448fc6
Fix pep257 and cpplint
nadavelkabets Jun 1, 2025
076243c
Fix flake8
nadavelkabets Jun 1, 2025
44baf2f
Add support for ros time in timers
nadavelkabets Jun 1, 2025
c4d1111
Add support for coroutines as timer callbacks
nadavelkabets Jun 1, 2025
7cd937e
Fix bug when adding a node with destroyed timer
nadavelkabets Jun 1, 2025
7b3be3a
Manage tasks from timers
nadavelkabets Jun 1, 2025
f4590d8
Add timeout to shutdown and clear all tasks before closing the loop
nadavelkabets Jun 3, 2025
c965d4a
Export task management to TaskHandler class
nadavelkabets Jun 3, 2025
4192ba1
Add tests for TaskHandler
nadavelkabets Jun 3, 2025
5c69ac6
Add test for timer with active ros time
nadavelkabets Jun 9, 2025
7ced9ba
Remove global get_executor and set_executor
nadavelkabets Jun 9, 2025
9e5bee3
wip: correct spin_once behavior
nadavelkabets Jun 11, 2025
6781fb6
Passing tests again
nadavelkabets Jun 11, 2025
495fd36
Also passing the spin_once tests
nadavelkabets Jun 11, 2025
69e513b
Improve performance
nadavelkabets Jun 12, 2025
e624bc7
Add AsyncioSleep with sleep_for_async() capability
nadavelkabets Jun 12, 2025
ebc9289
Bring back wrap_future
nadavelkabets Jun 12, 2025
6296176
Remove Generic from AbstractExecutor
nadavelkabets Jun 12, 2025
f2a17a9
Improve AsyncioClock tests
nadavelkabets Jun 12, 2025
3bcce0b
Add missing tests from test_executor
nadavelkabets Jun 12, 2025
f1f3dc8
Linting and formatting
nadavelkabets Jun 12, 2025
e88f71a
Replace std_msgs with test_msgs in tests
nadavelkabets Jun 12, 2025
429a60a
Throw CancelledError into cancelled task
nadavelkabets Jun 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rclpy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ if(BUILD_TESTING)
test/test_validate_topic_name.py
test/test_waitable.py
test/test_wait_for_message.py
test/test_asyncio_executor.py
)

foreach(_test_path ${_rclpy_pytest_tests})
Expand Down
24 changes: 24 additions & 0 deletions rclpy/rclpy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

import threading
import time
import traceback
from types import TracebackType
from typing import Callable
from typing import Dict
from typing import Generic
from typing import Optional
Expand All @@ -25,6 +27,7 @@
from rclpy.clock import Clock
from rclpy.context import Context
from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
from rclpy.logging import get_logger
from rclpy.qos import QoSProfile
from rclpy.service_introspection import ServiceIntrospectionState
from rclpy.task import Future
Expand Down Expand Up @@ -243,3 +246,24 @@ def __exit__(
exc_tb: Optional[TracebackType],
) -> None:
self.destroy()

def get_logger_name(self) -> str:
with self.handle:
return self.__client.get_logger_name()

def set_on_new_response_callback(self, callback: Callable[[int], None]) -> None:
logger = get_logger(self.get_logger_name())

def safe_callback(number_of_events: int):
try:
callback(number_of_events)
except Exception:
logger.error(
f'Caught exception in on response callback for client: {self.service_name}'
)
logger.error(traceback.format_exc())

self.__client.set_on_new_response_callback(safe_callback)

def clear_on_new_response_callback(self) -> None:
self.__client.clear_on_new_response_callback()
6 changes: 2 additions & 4 deletions rclpy/rclpy/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def __new__(cls, *,
clock_type: ClockType = ClockType.SYSTEM_TIME) -> 'Clock':
if not isinstance(clock_type, ClockType):
raise TypeError('Clock type must be a ClockType enum')
if clock_type is ClockType.ROS_TIME:
if clock_type is ClockType.ROS_TIME and cls is Clock:
self: 'Clock' = super().__new__(ROSClock)
else:
self = super().__new__(cls)
Expand Down Expand Up @@ -316,9 +316,7 @@ def sleep_for(self, rel_time: Duration, context: Optional[Context] = None) -> bo
class ROSClock(Clock):

def __new__(cls) -> 'ROSClock':
self = super().__new__(Clock, clock_type=ClockType.ROS_TIME)
assert isinstance(self, ROSClock)
return self
return super().__new__(cls, clock_type=ClockType.ROS_TIME)

@property
def ros_time_is_active(self) -> bool:
Expand Down
Loading