Skip to content

Commit 02c2ef1

Browse files
author
iRobot ROS
authored
Merge pull request #37 from mauropasse/mauro/clean-events-executor
Reorder APIs arguments
2 parents f9457a2 + 0efab07 commit 02c2ef1

14 files changed

+59
-28
lines changed

rclcpp/include/rclcpp/executors/events_executor_notify_waitable.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ class EventsExecutorNotifyWaitable final : public EventWaitable
6666
{
6767
for (auto gc : notify_guard_conditions_) {
6868
rcl_ret_t ret = rcl_guard_condition_set_listener_callback(
69-
executor,
69+
gc,
7070
executor_callback,
71+
executor,
7172
this,
72-
gc,
7373
false);
7474

7575
if (RCL_RET_OK != ret) {

rclcpp/include/rclcpp/time_source.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ namespace rclcpp
3232
{
3333
class Clock;
3434

35+
/**
36+
* Time source that will drive the attached clocks.
37+
*
38+
* If the attached node `use_sim_time` parameter is `true`, the attached clocks will
39+
* be updated based on messages received.
40+
*
41+
* The subscription to the clock topic created by the time source can have it's qos reconfigured
42+
* using parameter overrides, particularly the following ones are accepted:
43+
*
44+
* - qos_overrides./clock.depth
45+
* - qos_overrides./clock.durability
46+
* - qos_overrides./clock.history
47+
* - qos_overrides./clock.reliability
48+
*/
3549
class TimeSource
3650
{
3751
public:

rclcpp/src/rclcpp/client.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ ClientBase::set_events_executor_callback(
205205
rmw_listener_cb_t executor_callback) const
206206
{
207207
rcl_ret_t ret = rcl_client_set_listener_callback(
208-
executor,
208+
client_handle_.get(),
209209
executor_callback,
210-
this,
211-
client_handle_.get());
210+
executor,
211+
this);
212212

213213
if (RCL_RET_OK != ret) {
214214
throw std::runtime_error("Couldn't set the EventsExecutor's callback to client");

rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,10 @@ EventsExecutorEntitiesCollector::set_guard_condition_callback(
478478
const rcl_guard_condition_t * guard_condition)
479479
{
480480
rcl_ret_t ret = rcl_guard_condition_set_listener_callback(
481-
associated_executor_,
481+
guard_condition,
482482
&EventsExecutor::push_event,
483+
associated_executor_,
483484
this,
484-
guard_condition,
485485
false /* Discard previous events */);
486486

487487
if (ret != RCL_RET_OK) {
@@ -494,10 +494,10 @@ EventsExecutorEntitiesCollector::unset_guard_condition_callback(
494494
const rcl_guard_condition_t * guard_condition)
495495
{
496496
rcl_ret_t ret = rcl_guard_condition_set_listener_callback(
497+
guard_condition,
497498
nullptr,
498499
nullptr,
499500
nullptr,
500-
guard_condition,
501501
false /* Discard previous events */);
502502

503503
if (ret != RCL_RET_OK) {

rclcpp/src/rclcpp/executors/static_executor_entities_collector.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,7 @@ StaticExecutorEntitiesCollector::add_callback_group(
323323
throw std::runtime_error("Callback group was already added to executor.");
324324
}
325325
if (is_new_node) {
326-
rclcpp::node_interfaces::NodeBaseInterface::WeakPtr node_weak_ptr(node_ptr);
327-
weak_nodes_to_guard_conditions_[node_weak_ptr] = node_ptr->get_notify_guard_condition();
326+
weak_nodes_to_guard_conditions_[node_ptr] = node_ptr->get_notify_guard_condition();
328327
return true;
329328
}
330329
return false;

rclcpp/src/rclcpp/executors/static_single_threaded_executor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,10 @@ StaticSingleThreadedExecutor::execute_ready_executables()
175175
}
176176
// Execute all the ready waitables
177177
for (size_t i = 0; i < entities_collector_->get_number_of_waitables(); ++i) {
178-
if (entities_collector_->get_waitable(i)->is_ready(&wait_set_)) {
179-
std::shared_ptr<void> shared_ptr;
180-
entities_collector_->get_waitable(i)->execute(shared_ptr);
178+
auto waitable = entities_collector_->get_waitable(i);
179+
if (waitable->is_ready(&wait_set_)) {
180+
auto data = waitable->take_data();
181+
waitable->execute(data);
181182
}
182183
}
183184
}

rclcpp/src/rclcpp/node_interfaces/node_timers.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include <string>
1818

19+
#include "tracetools/tracetools.h"
20+
1921
using rclcpp::node_interfaces::NodeTimers;
2022

2123
NodeTimers::NodeTimers(rclcpp::node_interfaces::NodeBaseInterface * node_base)
@@ -44,4 +46,8 @@ NodeTimers::add_timer(
4446
std::string("Failed to notify wait set on timer creation: ") +
4547
rmw_get_error_string().str);
4648
}
49+
TRACEPOINT(
50+
rclcpp_timer_link_node,
51+
static_cast<const void *>(timer->get_timer_handle().get()),
52+
static_cast<const void *>(node_base_->get_rcl_node_handle()));
4753
}

rclcpp/src/rclcpp/qos_event.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ QOSEventHandlerBase::set_events_executor_callback(
7474
rmw_listener_cb_t executor_callback) const
7575
{
7676
rcl_ret_t ret = rcl_event_set_listener_callback(
77-
executor,
77+
&event_handle_,
7878
executor_callback,
79+
executor,
7980
this,
80-
&event_handle_,
8181
false /* Discard previous events */);
8282

8383
if (RCL_RET_OK != ret) {

rclcpp/src/rclcpp/service.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ ServiceBase::set_events_executor_callback(
9191
rmw_listener_cb_t executor_callback) const
9292
{
9393
rcl_ret_t ret = rcl_service_set_listener_callback(
94-
executor,
94+
service_handle_.get(),
9595
executor_callback,
96-
this,
97-
service_handle_.get());
96+
executor,
97+
this);
9898

9999
if (RCL_RET_OK != ret) {
100100
throw std::runtime_error("Couldn't set the EventsExecutor's callback to service");

rclcpp/src/rclcpp/subscription_base.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ SubscriptionBase::set_events_executor_callback(
295295
rmw_listener_cb_t executor_callback) const
296296
{
297297
rcl_ret_t ret = rcl_subscription_set_listener_callback(
298-
executor,
298+
subscription_handle_.get(),
299299
executor_callback,
300-
this,
301-
subscription_handle_.get());
300+
executor,
301+
this);
302302

303303
if (RCL_RET_OK != ret) {
304304
throw std::runtime_error("Couldn't set the EventsExecutor's callback to subscription");

0 commit comments

Comments
 (0)