Skip to content

Commit ba0a717

Browse files
mm318wjwwood
authored andcommitted
Add new QoS policy data types to rmw (#173)
* add new qos policy data types Signed-off-by: Miaofei <[email protected]> * address some of the feedback in the pull request Signed-off-by: Miaofei <[email protected]> * correct comments/docblock formatting Signed-off-by: Miaofei <[email protected]>
1 parent 719283e commit ba0a717

File tree

3 files changed

+119
-2
lines changed

3 files changed

+119
-2
lines changed

rmw/include/rmw/qos_profiles.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ static const rmw_qos_profile_t rmw_qos_profile_sensor_data =
2828
5,
2929
RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,
3030
RMW_QOS_POLICY_DURABILITY_VOLATILE,
31+
RMW_QOS_DEADLINE_DEFAULT,
32+
RMW_QOS_LIFESPAN_DEFAULT,
33+
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
34+
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
3135
false
3236
};
3337

@@ -37,6 +41,10 @@ static const rmw_qos_profile_t rmw_qos_profile_parameters =
3741
1000,
3842
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
3943
RMW_QOS_POLICY_DURABILITY_VOLATILE,
44+
RMW_QOS_DEADLINE_DEFAULT,
45+
RMW_QOS_LIFESPAN_DEFAULT,
46+
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
47+
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
4048
false
4149
};
4250

@@ -46,6 +54,10 @@ static const rmw_qos_profile_t rmw_qos_profile_default =
4654
10,
4755
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
4856
RMW_QOS_POLICY_DURABILITY_VOLATILE,
57+
RMW_QOS_DEADLINE_DEFAULT,
58+
RMW_QOS_LIFESPAN_DEFAULT,
59+
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
60+
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
4961
false
5062
};
5163

@@ -55,6 +67,10 @@ static const rmw_qos_profile_t rmw_qos_profile_services_default =
5567
10,
5668
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
5769
RMW_QOS_POLICY_DURABILITY_VOLATILE,
70+
RMW_QOS_DEADLINE_DEFAULT,
71+
RMW_QOS_LIFESPAN_DEFAULT,
72+
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
73+
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
5874
false
5975
};
6076

@@ -64,6 +80,10 @@ static const rmw_qos_profile_t rmw_qos_profile_parameter_events =
6480
1000,
6581
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
6682
RMW_QOS_POLICY_DURABILITY_VOLATILE,
83+
RMW_QOS_DEADLINE_DEFAULT,
84+
RMW_QOS_LIFESPAN_DEFAULT,
85+
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
86+
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
6787
false
6888
};
6989

@@ -73,6 +93,10 @@ static const rmw_qos_profile_t rmw_qos_profile_system_default =
7393
RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT,
7494
RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT,
7595
RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT,
96+
RMW_QOS_DEADLINE_DEFAULT,
97+
RMW_QOS_LIFESPAN_DEFAULT,
98+
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
99+
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
76100
false
77101
};
78102

rmw/include/rmw/ret_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ typedef int32_t rmw_ret_t;
2626
#define RMW_RET_OK 0
2727
#define RMW_RET_ERROR 1
2828
#define RMW_RET_TIMEOUT 2
29+
/// The operation or event handling is not supported.
30+
#define RMW_RET_UNSUPPORTED 3
2931

3032
/// Failed to allocate memory return code.
3133
#define RMW_RET_BAD_ALLOC 10

rmw/include/rmw/types.h

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,37 @@ enum RMW_PUBLIC_TYPE rmw_qos_durability_policy_t
195195
RMW_QOS_POLICY_DURABILITY_UNKNOWN
196196
};
197197

198+
enum RMW_PUBLIC_TYPE rmw_qos_liveliness_policy_t
199+
{
200+
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
201+
RMW_QOS_POLICY_LIVELINESS_AUTOMATIC,
202+
RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE,
203+
RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC
204+
};
205+
206+
#define RMW_QOS_DEADLINE_DEFAULT {0, 0}
207+
#define RMW_QOS_LIFESPAN_DEFAULT {0, 0}
208+
#define RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT {0, 0}
209+
198210
/// ROS MiddleWare quality of service profile.
199211
typedef struct RMW_PUBLIC_TYPE rmw_qos_profile_t
200212
{
201213
enum rmw_qos_history_policy_t history;
202214
/// Size of the message queue.
203215
size_t depth;
216+
/// Reliabiilty QoS policy setting
204217
enum rmw_qos_reliability_policy_t reliability;
218+
/// Durability QoS policy setting
205219
enum rmw_qos_durability_policy_t durability;
220+
/// The period at which messages are expected to be sent/received
221+
struct rmw_time_t deadline;
222+
/// The age at which messages are considered expired and no longer valid
223+
struct rmw_time_t lifespan;
224+
/// Liveliness QoS policy setting
225+
enum rmw_qos_liveliness_policy_t liveliness;
226+
/// The time within which the RMW node or publisher must show that it is alive
227+
struct rmw_time_t liveliness_lease_duration;
228+
206229
/// If true, any ROS specific namespacing conventions will be circumvented.
207230
/**
208231
* In the case of DDS and topics, for example, this means the typical
@@ -231,8 +254,7 @@ typedef struct RMW_PUBLIC_TYPE rmw_message_info_t
231254

232255
enum {RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT = 0};
233256

234-
// Type mapping of rcutils log severity types to
235-
// rmw specific types.
257+
/// Type mapping of rcutils log severity types to rmw specific types.
236258
typedef enum RMW_PUBLIC_TYPE
237259
{
238260
RMW_LOG_SEVERITY_DEBUG = RCUTILS_LOG_SEVERITY_DEBUG,
@@ -242,6 +264,75 @@ typedef enum RMW_PUBLIC_TYPE
242264
RMW_LOG_SEVERITY_FATAL = RCUTILS_LOG_SEVERITY_FATAL
243265
} rmw_log_severity_t;
244266

267+
/// QoS Liveliness Changed information provided by a subscription.
268+
typedef struct RMW_PUBLIC_TYPE rmw_liveliness_changed_status_t
269+
{
270+
/**
271+
* The total number of currently active Publishers which publish to the topic associated with
272+
* the Subscription.
273+
* This count increases when a newly matched Publisher asserts its liveliness for the first time
274+
* or when a Publisher previously considered to be not alive reasserts its liveliness.
275+
* The count decreases when a Publisher considered alive fails to assert its liveliness and
276+
* becomes not alive, whether because it was deleted normally or for some other reason.
277+
*/
278+
int32_t alive_count;
279+
/**
280+
* The total count of current Publishers which publish to the topic associated with the
281+
* Subscription that are no longer asserting their liveliness.
282+
* This count increases when a Publisher considered alive fails to assert its liveliness and
283+
* becomes not alive for some reason other than the normal deletion of that Publisher.
284+
* It decreases when a previously not alive Publisher either reasserts its liveliness or is
285+
* deleted normally.
286+
*/
287+
int32_t not_alive_count;
288+
/// The change in the alive_count since the status was last read.
289+
int32_t alive_count_change;
290+
/// The change in the not_alive_count since the status was last read.
291+
int32_t not_alive_count_change;
292+
} rmw_liveliness_changed_status_t;
293+
294+
/// QoS Requested Deadline Missed information provided by a subscription.
295+
typedef struct RMW_PUBLIC_TYPE rmw_requested_deadline_missed_status_t
296+
{
297+
/**
298+
* Lifetime cumulative number of missed deadlines detected for any instance read by the
299+
* subscription.
300+
* Missed deadlines accumulate; that is, each deadline period the total_count will be incremented
301+
* by one for each instance for which data was not received.
302+
*/
303+
int32_t total_count;
304+
/// The incremental number of deadlines detected since the status was read.
305+
int32_t total_count_change;
306+
} rmw_requested_deadline_missed_status_t;
307+
308+
/// QoS Liveliness Lost information provided by a publisher.
309+
typedef struct RMW_PUBLIC_TYPE rmw_liveliness_lost_status_t
310+
{
311+
/**
312+
* Lifetime cumulative number of times that a previously-alive Publisher became not alive due to
313+
* a failure to actively signal its liveliness within its offered liveliness period.
314+
* This count does not change when an already not alive Publisher simply remains not alive for
315+
* another liveliness period.
316+
*/
317+
int32_t total_count;
318+
/// The change in total_count since the last time the status was last read.
319+
int32_t total_count_change;
320+
} rmw_liveliness_lost_status_t;
321+
322+
/// QoS Deadline Missed information provided by a publisher.
323+
typedef struct RMW_PUBLIC_TYPE rmw_offered_deadline_missed_status_t
324+
{
325+
/**
326+
* Lifetime cumulative number of offered deadline periods elapsed during which a Publisher failed
327+
* to provide data.
328+
* Missed deadlines accumulate; that is, each deadline period the total_count will be incremented
329+
* by one.
330+
*/
331+
int32_t total_count;
332+
/// The change in total_count since the last time the status was last read.
333+
int32_t total_count_change;
334+
} rmw_offered_deadline_missed_status_t;
335+
245336
#ifdef __cplusplus
246337
}
247338
#endif

0 commit comments

Comments
 (0)