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 for actions - Do not merge! #51

Open
wants to merge 220 commits into
base: irobot/add-events-executor
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
220 commits
Select commit Hold shift + click to select a range
cfba246
Add EventsExecutor
Oct 2, 2020
e773a0b
Handle intra-process communication
Oct 2, 2020
09c5553
Move apis - Add constness
Oct 2, 2020
e7ddba8
Create raw pointer version of Executor::execute_<ENTITY>
Oct 5, 2020
0696147
Remove exec mutex. Add comments
Oct 5, 2020
f2a7c29
remove not needed APIs
Oct 5, 2020
6de9fd7
Change how to add node gc's to entities collector
Oct 5, 2020
60351b0
Remove comments
Oct 5, 2020
7da26ac
Use EventsExecutorEntitiesCollector
Oct 5, 2020
2169417
restore original StaticExecutorEntitiesCollector
Oct 5, 2020
ca15daa
remove includes
Oct 5, 2020
645c93b
Handle timers from EventsExecutorEntitiesCollector
Oct 5, 2020
16e876b
Not ready for rebuild stuff
Oct 5, 2020
db4d209
Some cleaning
Oct 5, 2020
428522b
Some reorder
Oct 5, 2020
d9039cc
Use or discard previous events: Guard conditions
Oct 6, 2020
f0c9906
Implement spin some
Oct 6, 2020
b6f0922
Remove node from executor support
Oct 6, 2020
dd29fa0
move execute entities to executor.cpp
Oct 6, 2020
8e55fc7
Move apis
Oct 6, 2020
a8bd37d
init entities collector at executor construction
Oct 7, 2020
4c03213
reimplement timers heap -> timers queue
Oct 7, 2020
aa4f736
rename timers queue
Oct 7, 2020
f630da9
update timers queue
Oct 7, 2020
45e5885
Move code
Oct 8, 2020
8bcd14f
Use lambdas directly
Oct 8, 2020
33f1566
Handle default event types
Oct 8, 2020
a5e0d76
Fix spinsome
Oct 8, 2020
a34bc25
Check rclcpp::ok before execute timers
Oct 8, 2020
d67207c
Restore timers heap
Oct 9, 2020
c9d395e
Set interrupt guard condition callback
Oct 9, 2020
10f4074
create TimersManager class, implement spin() variants for EventsExecu…
alsora Oct 9, 2020
295a337
Merge pull request #2 from alsora/asoragna/add-events-executor
Oct 12, 2020
f25d4c6
Rename EventQ -> ExecutorEvent
Oct 12, 2020
a8feedc
rename set_guard_condition_callback -> set_callback
Oct 12, 2020
43a6088
remove unused handle_events() function
alsora Oct 12, 2020
54054f6
add missing predicate to event_queue_cv wait
alsora Oct 12, 2020
78ac324
Update events_executor.cpp
alsora Oct 12, 2020
b91edea
Rename to set_events_executor_callback
Oct 12, 2020
7a5bd1f
Merge pull request #4 from alsora/asoragna/remove-handle
Oct 12, 2020
caf3532
Rename to ExecutorEventCallback
Oct 12, 2020
6454eb8
Merge branch 'irobot/add-events-executor' into mauro-irobot/add-event…
mauropasse Oct 12, 2020
465e2ca
Merge pull request #3 from mauropasse/mauro-irobot/add-events-executor
Oct 12, 2020
89721e9
fix linter errors
alsora Oct 12, 2020
cf8fc9a
rename functions in unit-tests
Oct 12, 2020
e1263ee
Merge pull request #7 from alsora/asoragna/fix-tests
Oct 12, 2020
07876aa
add timers manager test and bug fixes
alsora Oct 12, 2020
c441ea5
Merge branch 'irobot/add-events-executor' into asoragna/add-predicate
alsora Oct 12, 2020
eb0bb01
Merge pull request #5 from alsora/asoragna/add-predicate
Oct 12, 2020
2037ee5
Merge pull request #6 from alsora/asoragna/linter-errors
Oct 12, 2020
3552a80
cleanup entities collector
alsora Oct 13, 2020
198aa9f
Merge pull request #9 from alsora/asoragna/cleanup-entities-collector
Oct 13, 2020
652ccf8
Support events
Oct 13, 2020
292e7a9
Update test_timers_manager.cpp
alsora Oct 13, 2020
38f92d2
Merge pull request #8 from alsora/asoragna/timers-test
Oct 13, 2020
5c36010
override cancel
alsora Oct 13, 2020
427e17c
Merge pull request #10 from alsora/asoragna/override-cancel
Oct 13, 2020
ab92918
Merge pull request #11 from mauropasse/mauro-irobot/add-events-executor
Oct 13, 2020
73d73e8
void return on set_events_executor_callback
Oct 14, 2020
7563538
Update client.hpp
Oct 14, 2020
24ccf6e
Update qos_event.hpp
Oct 14, 2020
78adf05
Merge pull request #12 from mauropasse/mauro-irobot/add-events-executor
Oct 14, 2020
92d2883
clean add/remove node APIs and make sure that event callbacks are rem…
alsora Oct 14, 2020
6f32325
Revert "void return on set_events_executor_callback"
Oct 14, 2020
419054b
Merge pull request #15 from irobot-ros/revert-12-mauro-irobot/add-eve…
Oct 14, 2020
05ca12f
Merge branch 'irobot/add-events-executor' into asoragna/clean-entitie…
Oct 14, 2020
2898804
Merge pull request #14 from alsora/asoragna/clean-entities-collector
Oct 14, 2020
0e022f6
more thread safety and events executor test
alsora Oct 14, 2020
da55bd9
remove atomic and use mutex to protect running_ flag
alsora Oct 14, 2020
aaaa265
Merge pull request #16 from alsora/asoragna/events-executor-tests
Oct 14, 2020
a77ecdb
minor cleanup of comments and spin_some timeout
alsora Oct 15, 2020
719ff15
Merge pull request #17 from alsora/asoragna/minor-clean
Oct 15, 2020
9a17991
complete destruction callback implementation
alsora Oct 16, 2020
37f32ef
remove prints
alsora Oct 16, 2020
e8a59f9
undo whitespace change
alsora Oct 16, 2020
83c5659
use std:: functions for heap and minor fixes
alsora Oct 16, 2020
f96f12a
remove logs
alsora Oct 16, 2020
92aebad
Merge pull request #19 from alsora/asoragna/destruction-callback
Oct 16, 2020
773f8f5
Add callback groups support
Oct 16, 2020
7840433
copy/paste fix
Oct 16, 2020
440b3f0
Add missing unsets
Oct 16, 2020
a1e9f00
use emplace
Oct 16, 2020
236a473
Remove not needed unset_node_entities_callbacks
Oct 16, 2020
7772beb
use insert
Oct 16, 2020
cf4d2e0
fix unit tests
alsora Oct 16, 2020
69b244e
Adress comments
Oct 16, 2020
9a8e451
Remove not needed unset_node_entities_callbacks
Oct 16, 2020
6f41af9
fixes
Oct 16, 2020
8c4db59
Set gc's callback only if new node
Oct 16, 2020
888ce25
fix comments
alsora Oct 19, 2020
a2c3fd2
Merge pull request #21 from alsora/asoragna/fix-unit-tests
Oct 19, 2020
d88d05b
Change set/unset node's notify guard condition location
Oct 19, 2020
2b9eb8d
Don't use weak_nodes list to unset guard conditions
Oct 19, 2020
9b4856f
Add nodes_notify_guard_conditions_ list
Oct 19, 2020
e596a25
Merge pull request #20 from mauropasse/mauro-irobot/add-events-executor
Oct 19, 2020
d541892
make sure that node does not get destroyed while unsetting guard cond…
alsora Oct 19, 2020
dc3b747
Merge pull request #22 from alsora/asoragna/fix-entity-unset
Oct 19, 2020
1e0c24e
fix usage of destruction callback in waitables, add executor notifier
alsora Oct 19, 2020
faf9d1e
add comment
alsora Oct 19, 2020
e9e237a
add functions for setting/unsetting guard conditions
alsora Oct 19, 2020
8688d3b
Merge pull request #23 from alsora/asoragna/cleanup-and-test
Oct 19, 2020
91f1a3b
add unit tests for callback groups and fix some issues
alsora Oct 20, 2020
43c313f
Merge pull request #24 from alsora/asoragna/latest-test
Oct 20, 2020
41cc6c0
Rename ExecutorEventCallback -> EventsExecutorCallback
Oct 20, 2020
6f13d4a
make functions private
alsora Oct 20, 2020
2259a67
Merge pull request #25 from mauropasse/mauro-irobot/add-events-executor
Oct 20, 2020
4df706d
remove commented code
alsora Oct 20, 2020
35741d3
Merge pull request #26 from alsora/asoragna/make-functions-private
Oct 20, 2020
b7174da
Merge remote-tracking branch 'original/master' into irobot/add-events…
Oct 21, 2020
292fe84
Merge pull request #28 from alsora/asoragna/merge-conflicts
Oct 21, 2020
7d6a1e8
fix comments
alsora Oct 21, 2020
c8ee3ca
Merge pull request #29 from alsora/asoragna/fix-comments
Oct 21, 2020
f6a97c5
Add spin_some default arg
Nov 13, 2020
2828376
Merge pull request #30 from mauropasse/mauro/spin-no-args-support
Nov 17, 2020
d1d940e
rename local_event_queue->execution_event_queue
Nov 19, 2020
7ddd6d1
Move rcutils/executor_event_types.h to rmw/
Nov 20, 2020
5971b41
Merge pull request #32 from mauropasse/mauro/pr-events-executor-2
Nov 20, 2020
5689b08
Merge branch 'irobot/add-events-executor' into mauro/pr-events-executor
Nov 20, 2020
fb7c97c
rename event types
Nov 20, 2020
3318c2d
rename set_events_executor_callback to set_listener_callback
Nov 20, 2020
0a5f3f2
Revert. set_listener_callback->set_events_executor_callback
Nov 20, 2020
6c55f0b
Merge pull request #31 from mauropasse/mauro/pr-events-executor
Nov 20, 2020
fe96d74
Add vectors of entities weak pointers
Dec 15, 2020
4958e05
Use map for weak pointers
Dec 15, 2020
e5a3174
Use ownership model on timers
Dec 16, 2020
0c36f1e
Use unordered map
Dec 16, 2020
2c8aa07
release timers ownership when stopping
Dec 16, 2020
97ca9fb
Rename functions
Dec 17, 2020
b0ad69f
Remove entity if expired
Dec 17, 2020
105d39e
Remove entities if not previously removed
Dec 18, 2020
1cf7784
Check if not removed before anything
Dec 18, 2020
78a0158
Optimize get_<entities>
Dec 18, 2020
1d8ed45
rename entity identifiers
Dec 18, 2020
4f6d66c
clarify comment
Dec 18, 2020
f2c2356
clarify comment
Dec 18, 2020
b136181
refactor timers_manager ownership
Dec 18, 2020
323d9b6
Reimplement onwership timers
Dec 18, 2020
43487e2
Correct ownership timers
Jan 13, 2021
cc79109
remove mutex not needed since new ownership model
Jan 14, 2021
fc903e5
Move using TimerPtr to private section
Jan 14, 2021
979ca87
If a timer was removed, re-heapify vector
Jan 14, 2021
e3b258a
rework timers manager weak ownership
alsora Jan 14, 2021
08914c4
undo wrong replace
alsora Jan 14, 2021
ba7e72f
cleanup linter errors
alsora Jan 14, 2021
613e68e
Revert "If a timer was removed, re-heapify vector"
Jan 14, 2021
5fdf5a2
Revert "Move using TimerPtr to private section"
Jan 14, 2021
41c30bf
Merge pull request #5 from alsora/asoragna/entities-ownership
mauropasse Jan 14, 2021
51b5450
EventsExecutorEntitiesCollector: Use shared_from_this()
Jan 15, 2021
c17094e
Merge pull request #33 from mauropasse/mauro/irobot-add-events-executor
Jan 15, 2021
91adf3d
Merge remote-tracking branch 'upstream/master' into asoragna/cleanup-…
Jan 15, 2021
e7a4377
remove some unnecessary diffs
Jan 15, 2021
39e5a7c
Merge pull request #34 from alsora/asoragna/cleanup-events-exec
Jan 15, 2021
176d479
Update timers_manager.hpp documentation
Jan 15, 2021
f04d13c
Update doc
Jan 15, 2021
4603352
update APIs
Jan 18, 2021
baf136e
Fix IPC on EventsExecutor and StaticSingle...
Jan 18, 2021
a767750
Add comment
Jan 18, 2021
c8f19db
Implement take_data on events_executor_notify_waitable
Jan 18, 2021
17180b1
Compiler wants take_data defined on event_waitable.hpp
Jan 18, 2021
d6660a8
Merge pull request #35 from mauropasse/mauro/irobot-add-events-executor
Jan 18, 2021
d9d2885
Implement take_data only on derived classes
Jan 18, 2021
dc341a3
Fix tests compilation
Jan 18, 2021
5c81264
fix linter errors
Jan 18, 2021
ccee397
Fix TimersHeap::validate_and_lock()
Jan 19, 2021
ba9fee0
Fix uncrustify errors
Jan 19, 2021
f3fa8cb
Fix cppcheck
Jan 19, 2021
f9457a2
Merge pull request #36 from mauropasse/mauro/update-events-executor
Jan 19, 2021
98efb4c
Merge branch 'master' into mauro/clean-events-executor
Jan 21, 2021
0efab07
Reorder APIs arguments
Jan 21, 2021
02c2ef1
Merge pull request #37 from mauropasse/mauro/clean-events-executor
Jan 22, 2021
aab59a0
Implement no-op on IPC subscription
Jan 27, 2021
8ec8591
Check if valid msg before dispatch
Feb 1, 2021
b41655b
Add log when ring buffer is full
Feb 1, 2021
02ce349
restore line. This shouldn't happen any more
Feb 1, 2021
08fd037
Fix size_t log type
Feb 1, 2021
51bd25c
remove log about full ring buffer
Feb 1, 2021
a9bfc77
Add events queue abstract class and implem
Feb 4, 2021
5b568fb
Apply PR suggestions
Feb 5, 2021
f73cbdd
Fix ctests
Feb 5, 2021
9c5f037
EntitiesCollector not needed on events_queue
Feb 5, 2021
780af84
Add BoundedEventsQueue
Feb 5, 2021
0317e77
Add unit tests for Simple and Bounded queues
Feb 5, 2021
5780ccf
Set size limit in constructor
Feb 5, 2021
6fb2463
Test all events queue APIs
Feb 8, 2021
c4ac6f9
Remove BoundedQueue, not ready yet for this
Feb 8, 2021
46e3b48
rename rmw_listener_cb_t->rmw_listener_callback_t
Feb 8, 2021
4d78d42
Merge pull request #40 from mauropasse/mauro/add-events-queue-class-2
Feb 8, 2021
3d7deb8
Merge pull request #41 from mauropasse/mauro/rename-data-type
Feb 8, 2021
89b07f6
Merge pull request #38 from mauropasse/mauro/clean-events-executor
Feb 8, 2021
a322119
Ctests fixes
Feb 11, 2021
bb65717
Merge pull request #42 from mauropasse/mauro/fix-ctests
Feb 12, 2021
1bc6294
Check validity of executor pointer
Feb 15, 2021
b39ab21
Merge pull request #44 from mauropasse/mauro/check-push-event-valid-ptr
Feb 15, 2021
f13ffb2
use void * to pass executor ptr
Feb 15, 2021
e6d6426
Merge pull request #45 from mauropasse/mauro/exec-void-ptr
Feb 17, 2021
76a833d
Proper spin_some behaviour on EventsExecutor
Feb 17, 2021
0087392
rework spin_some & spin_all
Feb 18, 2021
d0e8e43
spin_some and spin_all call spin_some_impl
Feb 19, 2021
feef4e2
Use timer_was_ready_at_tp
Feb 19, 2021
bb491bd
Merge pull request #46 from mauropasse/mauro/fix-spin-some-events-exe…
Feb 19, 2021
f978a48
remove smart pointer definitions for virtual class
Feb 19, 2021
3a50ee8
Merge pull request #48 from irobot-ros/asoragna/fix-clang
Feb 22, 2021
191f47a
cleanup events executor class
alsora Feb 20, 2021
6a99496
rework events executor constructor
alsora Feb 20, 2021
c99d764
cleanup timers manager
alsora Feb 20, 2021
b72d124
new implementation of get_head_timeout_unsafe
alsora Feb 20, 2021
00666c1
Merge pull request #49 from irobot-ros/asoragna/cleanup
Feb 23, 2021
80b6ccc
Rework executor callback data
Feb 26, 2021
36e66ed
Use entity_id to compute hash. Add comments
Feb 26, 2021
8e13714
Use RMW renamed file
Feb 26, 2021
2b9b3ad
fix hash type
Feb 26, 2021
930d9a7
Update EventsExecutorCallbackData
Mar 10, 2021
f487f98
Add support for actions on EventsExecutor
Feb 25, 2021
52afe81
Use RCLCPP_SMART_PTR_ALIASES_ONLY
Mar 11, 2021
df37d31
Rename set_events_executor_callback->set_listener_callback
Mar 11, 2021
0d50b6c
Merge pull request #50 from mauropasse/mauro/group-callback-data
Mar 11, 2021
e83285a
Merge branch 'irobot/add-events-executor' into mauro/actions-support-2
Mar 11, 2021
4dc6f67
Changes
Mar 11, 2021
3118251
time_until_trigger return MAX if canceled
Mar 15, 2021
b3dd3a6
time_until_trigger return MAX if canceled
Mar 15, 2021
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
3 changes: 3 additions & 0 deletions rclcpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ set(${PROJECT_NAME}_SRCS
src/rclcpp/executor.cpp
src/rclcpp/executors.cpp
src/rclcpp/expand_topic_or_service_name.cpp
src/rclcpp/executors/events_executor.cpp
src/rclcpp/executors/events_executor_entities_collector.cpp
src/rclcpp/executors/multi_threaded_executor.cpp
src/rclcpp/executors/single_threaded_executor.cpp
src/rclcpp/executors/static_executor_entities_collector.cpp
src/rclcpp/executors/static_single_threaded_executor.cpp
src/rclcpp/executors/timers_manager.cpp
src/rclcpp/future_return_code.cpp
src/rclcpp/graph_listener.cpp
src/rclcpp/guard_condition.cpp
Expand Down
12 changes: 12 additions & 0 deletions rclcpp/include/rclcpp/any_subscription_callback.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ class AnySubscriptionCallback
ConstMessageSharedPtr message, const rclcpp::MessageInfo & message_info)
{
TRACEPOINT(callback_start, static_cast<const void *>(this), true);

// If the message is not valid, return.
if (!message) {
return;
}

if (const_shared_ptr_callback_) {
const_shared_ptr_callback_(message);
} else if (const_shared_ptr_with_info_callback_) {
Expand All @@ -208,6 +214,12 @@ class AnySubscriptionCallback
MessageUniquePtr message, const rclcpp::MessageInfo & message_info)
{
TRACEPOINT(callback_start, static_cast<const void *>(this), true);

// If the message is not valid, return.
if (!message) {
return;
}

if (shared_ptr_callback_) {
typename std::shared_ptr<MessageT> shared_message = std::move(message);
shared_ptr_callback_(shared_message);
Expand Down
12 changes: 12 additions & 0 deletions rclcpp/include/rclcpp/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define RCLCPP__CLIENT_HPP_

#include <atomic>
#include <functional>
#include <future>
#include <map>
#include <memory>
Expand Down Expand Up @@ -50,6 +51,11 @@ namespace node_interfaces
class NodeBaseInterface;
} // namespace node_interfaces

namespace executors
{
class EventsExecutor;
} // namespace executors

class ClientBase
{
public:
Expand Down Expand Up @@ -150,6 +156,12 @@ class ClientBase
bool
exchange_in_use_by_wait_set_state(bool in_use_state);

RCLCPP_PUBLIC
void
set_listener_callback(
rmw_listener_callback_t callback,
const void * user_data);

protected:
RCLCPP_DISABLE_COPY(ClientBase)

Expand Down
2 changes: 1 addition & 1 deletion rclcpp/include/rclcpp/executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ class Executor
RCLCPP_DISABLE_COPY(Executor)

RCLCPP_PUBLIC
void
virtual void
spin_once_impl(std::chrono::nanoseconds timeout);

typedef std::map<rclcpp::node_interfaces::NodeBaseInterface::WeakPtr,
Expand Down
1 change: 1 addition & 0 deletions rclcpp/include/rclcpp/executors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <future>
#include <memory>

#include "rclcpp/executors/events_executor.hpp"
#include "rclcpp/executors/multi_threaded_executor.hpp"
#include "rclcpp/executors/single_threaded_executor.hpp"
#include "rclcpp/executors/static_single_threaded_executor.hpp"
Expand Down
68 changes: 68 additions & 0 deletions rclcpp/include/rclcpp/executors/event_waitable.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright 2020 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RCLCPP__EXECUTORS__EVENT_WAITABLE_HPP_
#define RCLCPP__EXECUTORS__EVENT_WAITABLE_HPP_

#include "rclcpp/waitable.hpp"

namespace rclcpp
{
namespace executors
{

/**
* @brief This class provides a wrapper around the waitable object, that is
* meant to be used with the EventsExecutor.
* The waitset related methods are stubbed out as they should not be called.
* This class is abstract as the execute method of rclcpp::Waitable is not implemented.
* Nodes who want to implement a custom EventWaitable, can derive from this class and override
* the execute method.
*/
class EventWaitable : public rclcpp::Waitable
{
public:
// Constructor
RCLCPP_PUBLIC
EventWaitable() = default;

// Destructor
RCLCPP_PUBLIC
virtual ~EventWaitable() = default;

// Stub API: not used by EventsExecutor
RCLCPP_PUBLIC
bool
is_ready(rcl_wait_set_t * wait_set) final
{
(void)wait_set;
throw std::runtime_error("EventWaitable can't be checked if it's ready");
return false;
}

// Stub API: not used by EventsExecutor
RCLCPP_PUBLIC
bool
add_to_wait_set(rcl_wait_set_t * wait_set) final
{
(void)wait_set;
throw std::runtime_error("EventWaitable can't be added to a wait_set");
return false;
}
};

} // namespace executors
} // namespace rclcpp

#endif // RCLCPP__EXECUTORS__EVENT_WAITABLE_HPP_
Loading