Skip to content

Commit 0b16e6c

Browse files
JanStaschulatmergify[bot]
authored andcommitted
rclc_executor: improve enum type names (#379)
(cherry picked from commit 14c2c41)
1 parent 60fffda commit 0b16e6c

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

rclc/include/rclc/executor.h

+20-9
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,33 @@ extern "C"
4040
processed in a user-defined order.
4141
*/
4242

43-
/* defines the semantics of data communication
44-
RCLCPP_EXECUTOR - same semantics as in the rclcpp Executor ROS2(Eloquent)
45-
LET - logical execution time
43+
/** Defines the semantics when data is taken from DDS
44+
* SEMANTICS_RCLCPP_EXECUTOR - same semantics as in rclcpp Executor. Data of a subscription
45+
* is taken from DDS just before the corresponding callback
46+
* is called by the Executor.
47+
* SEMANTICS_LOGICAL_EXECUTION_TIME - logical execution time semantics. At one sampling point t
48+
* new data of all ready subscriptions are taken from DDS.
49+
* During (sequential) processing of these callbacks the
50+
* data is used as per sampling point t. If new data arrived
51+
* between the sampling point t and the time point at which
52+
* the callback is called, it would not be considered in this
53+
* `rclc_executor_spin_some` iteration.
4654
*/
4755
typedef enum
4856
{
49-
RCLCPP_EXECUTOR,
50-
LET
57+
RCLC_SEMANTICS_RCLCPP_EXECUTOR,
58+
RCLC_SEMANTICS_LOGICAL_EXECUTION_TIME
5159
} rclc_executor_semantics_t;
5260

61+
/**
62+
* Different types of Executors.
63+
*/
5364
typedef enum
5465
{
55-
NONE,
56-
SINGLE_THREADED,
57-
MULTI_THREADED,
58-
NON_POSIX,
66+
RCLC_EXECUTOR_NOT_INITIALIZED,
67+
RCLC_EXECUTOR_SINGLE_THREADED,
68+
RCLC_EXECUTOR_MULTI_THREADED,
69+
RCLC_EXECUTOR_NON_POSIX,
5970
} rclc_executor_type_t;
6071

6172
/// Type definition for trigger function. With the parameters:

rclc/src/rclc/executor.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ rclc_executor_init(
141141
rclc_executor_set_trigger(executor, rclc_executor_trigger_any, NULL);
142142

143143
// default semantics
144-
rclc_executor_set_semantics(executor, RCLCPP_EXECUTOR);
144+
rclc_executor_set_semantics(executor, RCLC_SEMANTICS_RCLCPP_EXECUTOR);
145145

146146
return ret;
147147
}
@@ -1956,10 +1956,10 @@ rclc_executor_spin_some(rclc_executor_t * executor, const uint64_t timeout_ns)
19561956

19571957
// based on semantics process input data
19581958
switch (executor->data_comm_semantics) {
1959-
case LET:
1959+
case RCLC_SEMANTICS_LOGICAL_EXECUTION_TIME:
19601960
rc = _rclc_let_scheduling(executor);
19611961
break;
1962-
case RCLCPP_EXECUTOR:
1962+
case RCLC_SEMANTICS_RCLCPP_EXECUTOR:
19631963
rc = _rclc_default_scheduling(executor);
19641964
break;
19651965
default:

rclc/test/rclc/test_executor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1903,7 +1903,7 @@ TEST_F(TestDefaultExecutor, semantics_RCLCPP) {
19031903
_pub_int_ptr = &this->pub1;
19041904
_pub_int_msg_ptr = &this->pub1_msg;
19051905
// ------------------------- test case setup ------------------------
1906-
rclc_executor_set_semantics(&executor, RCLCPP_EXECUTOR);
1906+
rclc_executor_set_semantics(&executor, RCLC_SEMANTICS_RCLCPP_EXECUTOR);
19071907
this->pub1_msg.data = 1;
19081908
_cb5_int_value = 0; // received value in subscription2
19091909
rc = rcl_publish(&this->pub1, &this->pub1_msg, nullptr);

0 commit comments

Comments
 (0)