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! #17

Open
wants to merge 41 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
41 commits
Select commit Hold shift + click to select a range
57d7241
Add apis: set entities callback
Oct 2, 2020
5a2fa8c
Add set_guard_condition_callback api
Oct 2, 2020
694d4a7
Move apis - Add constness
Oct 2, 2020
bcc26b1
Use or discard previous events: Guard conditions
Oct 6, 2020
3c3411f
Merge pull request #1 from mauropasse/mauro/add-events-executor
Oct 12, 2020
092885f
Rename to set_events_executor_callback
Oct 12, 2020
de9b4b6
Rename Event_callback -> ExecutorEventCallback
Oct 12, 2020
059675f
update name
Oct 12, 2020
4f94bad
Merge pull request #2 from mauropasse/mauro-irobot/add-events-executor
Oct 12, 2020
f36f0ac
Add events support
Oct 13, 2020
172f7b6
Merge pull request #3 from mauropasse/mauro-irobot/add-events-executor
Oct 13, 2020
2d63886
void return on set_events_executor_callback
Oct 14, 2020
1f30c6d
Merge pull request #4 from mauropasse/mauro-irobot/add-events-executor
Oct 14, 2020
e0957fc
Revert "void return on set_events_executor_callback"
Oct 14, 2020
55d37ca
Merge pull request #5 from irobot-ros/revert-4-mauro-irobot/add-event…
Oct 14, 2020
476fd63
Rename ExecutorEventCallback -> EventsExecutorCallback
Oct 20, 2020
138c5a1
Merge pull request #6 from mauropasse/mauro-irobot/add-events-executor
Oct 20, 2020
08114c3
Rename set_events_executor_callback->set_listener_callback
Nov 19, 2020
b5cbca0
Use data types when setting callbacks
Nov 20, 2020
02ed67c
Merge pull request #8 from mauropasse/mauro/pr-events-executor-2
Nov 20, 2020
1e4469e
Move rcutils/executor_event_types.h to rmw/
Nov 20, 2020
78c4232
Merge pull request #9 from mauropasse/mauro/pr-events-executor-2
Nov 20, 2020
6166601
Merge branch 'irobot/add-events-executor' into mauro/pr-events-executor
Nov 20, 2020
77ab417
rename event types
Nov 20, 2020
1850030
Rename executor_context->callback_context
Nov 20, 2020
5136110
Merge pull request #7 from mauropasse/mauro/pr-events-executor
Nov 20, 2020
527e32c
Rename callback_context->user_data
Dec 1, 2020
76c982e
Merge pull request #10 from mauropasse/mauro/events-executor-PR-fixes
Dec 1, 2020
57475b9
Merge remote-tracking branch 'upstream/master' into irobot/add-events…
Jan 21, 2021
fd9c5de
Reorder APIs arguments
Jan 21, 2021
c0d2cd7
Merge pull request #11 from mauropasse/mauro/clean-events-executor
Jan 22, 2021
82d4119
rename rmw_listener_cb_t->rmw_listener_callback_t
Feb 8, 2021
ffd59eb
Merge pull request #12 from mauropasse/mauro/clean-events-executor
Feb 8, 2021
7d7e59a
use void * to pass executor ptr
Feb 15, 2021
2d7af4e
Merge pull request #13 from mauropasse/mauro/use-void-ptr
Feb 17, 2021
d97b249
Rework executor callback data
Feb 26, 2021
af95c9e
Merge pull request #14 from mauropasse/mauro/group-callback-data
Feb 26, 2021
205bee5
Use RMW renamed file
Feb 26, 2021
62fdb7b
Merge pull request #15 from mauropasse/mauro/group-callback-data
Mar 1, 2021
1fce4a0
Add support to actions
Feb 25, 2021
8b906a1
Update file name
Mar 11, 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
10 changes: 10 additions & 0 deletions rcl/include/rcl/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ extern "C"
#include "rcl/node.h"
#include "rcl/visibility_control.h"

#include "rmw/listener_callback_type.h"

/// Internal rcl client implementation struct.
struct rcl_client_impl_t;

Expand Down Expand Up @@ -407,6 +409,14 @@ RCL_PUBLIC
bool
rcl_client_is_valid(const rcl_client_t * client);

RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_client_set_listener_callback(
const rcl_client_t * client,
rmw_listener_callback_t listener_callback,
const void * user_data);

#ifdef __cplusplus
}
#endif
Expand Down
9 changes: 9 additions & 0 deletions rcl/include/rcl/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ RCL_PUBLIC
bool
rcl_event_is_valid(const rcl_event_t * event);

RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_event_set_listener_callback(
const rcl_event_t * event,
rmw_listener_callback_t listener_callback,
const void * user_data,
bool use_previous_events);

#ifdef __cplusplus
}
#endif
Expand Down
11 changes: 11 additions & 0 deletions rcl/include/rcl/guard_condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ extern "C"
#include "rcl/types.h"
#include "rcl/visibility_control.h"

#include "rmw/listener_callback_type.h"

/// Internal rcl guard condition implementation struct.
struct rcl_guard_condition_impl_t;

Expand Down Expand Up @@ -258,6 +260,15 @@ RCL_WARN_UNUSED
rmw_guard_condition_t *
rcl_guard_condition_get_rmw_handle(const rcl_guard_condition_t * guard_condition);

RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_guard_condition_set_listener_callback(
const rcl_guard_condition_t * guard_condition,
rmw_listener_callback_t listener_callback,
const void * user_data,
bool use_previous_events);

#ifdef __cplusplus
}
#endif
Expand Down
10 changes: 10 additions & 0 deletions rcl/include/rcl/service.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ extern "C"
#include "rcl/node.h"
#include "rcl/visibility_control.h"

#include "rmw/listener_callback_type.h"

/// Internal rcl implementation struct.
struct rcl_service_impl_t;

Expand Down Expand Up @@ -421,6 +423,14 @@ RCL_PUBLIC
bool
rcl_service_is_valid(const rcl_service_t * service);

RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_service_set_listener_callback(
const rcl_service_t * service,
rmw_listener_callback_t listener_callback,
const void * user_data);

#ifdef __cplusplus
}
#endif
Expand Down
9 changes: 9 additions & 0 deletions rcl/include/rcl/subscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern "C"
#include "rcl/node.h"
#include "rcl/visibility_control.h"

#include "rmw/listener_callback_type.h"
#include "rmw/message_sequence.h"

/// Internal rcl implementation struct.
Expand Down Expand Up @@ -604,6 +605,14 @@ RCL_PUBLIC
bool
rcl_subscription_can_loan_messages(const rcl_subscription_t * subscription);

RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_subscription_set_listener_callback(
const rcl_subscription_t * subscription,
rmw_listener_callback_t listener_callback,
const void * user_data);

#ifdef __cplusplus
}
#endif
Expand Down
13 changes: 13 additions & 0 deletions rcl/src/rcl/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,19 @@ rcl_client_is_valid(const rcl_client_t * client)
client->impl->rmw_handle, "client's rmw handle is invalid", return false);
return true;
}

rcl_ret_t
rcl_client_set_listener_callback(
const rcl_client_t * client,
rmw_listener_callback_t listener_callback,
const void * user_data)
{
return rmw_client_set_listener_callback(
client->impl->rmw_handle,
listener_callback,
user_data);
}

#ifdef __cplusplus
}
#endif
14 changes: 14 additions & 0 deletions rcl/src/rcl/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,20 @@ rcl_event_is_valid(const rcl_event_t * event)
return true;
}

rcl_ret_t
rcl_event_set_listener_callback(
const rcl_event_t * event,
rmw_listener_callback_t listener_callback,
const void * user_data,
bool use_previous_events)
{
return rmw_event_set_listener_callback(
&event->impl->rmw_handle,
listener_callback,
user_data,
use_previous_events);
}

#ifdef __cplusplus
}
#endif
14 changes: 14 additions & 0 deletions rcl/src/rcl/guard_condition.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,20 @@ rcl_guard_condition_get_rmw_handle(const rcl_guard_condition_t * guard_condition
return guard_condition->impl->rmw_handle;
}

rcl_ret_t
rcl_guard_condition_set_listener_callback(
const rcl_guard_condition_t * guard_condition,
rmw_listener_callback_t listener_callback,
const void * user_data,
bool use_previous_events)
{
return rmw_guard_condition_set_listener_callback(
guard_condition->impl->rmw_handle,
listener_callback,
user_data,
use_previous_events);
}

#ifdef __cplusplus
}
#endif
13 changes: 13 additions & 0 deletions rcl/src/rcl/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,19 @@ rcl_service_is_valid(const rcl_service_t * service)
return true;
}

rcl_ret_t
rcl_service_set_listener_callback(
const rcl_service_t * service,
rmw_listener_callback_t listener_callback,
const void * user_data)
{
return rmw_service_set_listener_callback(
service->impl->rmw_handle,
listener_callback,
user_data);
}


#ifdef __cplusplus
}
#endif
12 changes: 12 additions & 0 deletions rcl/src/rcl/subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,18 @@ rcl_subscription_can_loan_messages(const rcl_subscription_t * subscription)
return subscription->impl->rmw_handle->can_loan_messages;
}

rcl_ret_t
rcl_subscription_set_listener_callback(
const rcl_subscription_t * subscription,
rmw_listener_callback_t listener_callback,
const void * user_data)
{
return rmw_subscription_set_listener_callback(
subscription->impl->rmw_handle,
listener_callback,
user_data);
}

#ifdef __cplusplus
}
#endif
33 changes: 33 additions & 0 deletions rcl_action/include/rcl_action/action_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ extern "C"
#include "rcl/macros.h"
#include "rcl/node.h"

#include "rmw/listener_callback_type.h"


/// Internal action client implementation struct.
struct rcl_action_client_impl_t;
Expand Down Expand Up @@ -741,6 +743,37 @@ bool
rcl_action_client_is_valid(
const rcl_action_client_t * action_client);

/// Get the action client events ID.
/**
* This function fills the array passed as argument
* with the action client events ID.
* The IDs are pointers to the action client entities
* which respond to action client events.
* \param[in] action_client pointer to the action client
* \param[in] events_id the array to store the IDs
*/
RCL_ACTION_PUBLIC
void
rcl_action_client_get_events_id(
const rcl_action_client_t * action_client,
const void * events_id[]);

/// Set the action client listeners callback
/**
* This function set the listener callbacks to the
* entities conforming the action client.
* \param[in] action_client pointer to the action client
* \param[in] listener_callback the listener callback
* \param[in] user_data array of data used by the callbacks
*/
RCL_ACTION_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_action_client_set_listeners_callback(
const rcl_action_client_t * action_client,
rmw_listener_callback_t listener_callback,
const void * user_data[]);

#ifdef __cplusplus
}
#endif
Expand Down
33 changes: 33 additions & 0 deletions rcl_action/include/rcl_action/action_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ extern "C"
#include "rcl/node.h"
#include "rcl/time.h"

#include "rmw/listener_callback_type.h"

#include "rosidl_runtime_c/action_type_support_struct.h"

/// Internal rcl_action implementation struct.
Expand Down Expand Up @@ -930,6 +932,37 @@ RCL_WARN_UNUSED
bool
rcl_action_server_is_valid_except_context(const rcl_action_server_t * action_server);

/// Get the action server events ID.
/**
* This function fills the array passed as argument
* with the action server events ID.
* The IDs are pointers to the action server entities
* which respond to action server events.
* \param[in] action_server pointer to the action server
* \param[in] events_id the array to store the IDs
*/
RCL_ACTION_PUBLIC
void
rcl_action_server_get_events_id(
const rcl_action_server_t * action_server,
const void * events_id[]);

/// Set the action server listeners callback
/**
* This function set the listener callbacks to the
* entities conforming the action server.
* \param[in] action_server pointer to the action server
* \param[in] listener_callback the listener callback
* \param[in] user_data array of data used by the callbacks
*/
RCL_ACTION_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_action_server_set_listeners_callback(
const rcl_action_server_t * action_server,
rmw_listener_callback_t listener_callback,
const void * user_data[]);

#ifdef __cplusplus
}
#endif
Expand Down
20 changes: 20 additions & 0 deletions rcl_action/include/rcl_action/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,26 @@ typedef enum rcl_action_goal_event_t
GOAL_EVENT_NUM_EVENTS
} rcl_action_goal_event_t;

/// Action client entities
typedef enum rcl_action_client_entity_type_t
{
GOAL_CLIENT = 0,
RESULT_CLIENT,
CANCEL_CLIENT,
FEEDBACK_SUBSCRIPTION,
STATUS_SUBSCRIPTION,
ACTION_CLIENT_NUM_ENTITIES
} rcl_action_client_entity_type_t;

/// Action server entities
typedef enum rcl_action_server_entity_type_t
{
GOAL_SERVICE = 0,
CANCEL_SERVICE,
RESULT_SERVICE,
ACTION_SERVER_NUM_ENTITIES
} rcl_action_server_entity_type_t;

/// Return a rcl_action_goal_info_t with members set to zero values.
RCL_ACTION_PUBLIC
RCL_WARN_UNUSED
Expand Down
Loading