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 new QoS policy data types to rmw #173

Merged
merged 3 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions rmw/include/rmw/qos_profiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ static const rmw_qos_profile_t rmw_qos_profile_sensor_data =
5,
RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,
RMW_QOS_POLICY_DURABILITY_VOLATILE,
RMW_QOS_DEADLINE_DEFAULT,
RMW_QOS_LIFESPAN_DEFAULT,
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
false
};

Expand All @@ -37,6 +41,10 @@ static const rmw_qos_profile_t rmw_qos_profile_parameters =
1000,
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
RMW_QOS_POLICY_DURABILITY_VOLATILE,
RMW_QOS_DEADLINE_DEFAULT,
RMW_QOS_LIFESPAN_DEFAULT,
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
false
};

Expand All @@ -46,6 +54,10 @@ static const rmw_qos_profile_t rmw_qos_profile_default =
10,
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
RMW_QOS_POLICY_DURABILITY_VOLATILE,
RMW_QOS_DEADLINE_DEFAULT,
RMW_QOS_LIFESPAN_DEFAULT,
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
false
};

Expand All @@ -55,6 +67,10 @@ static const rmw_qos_profile_t rmw_qos_profile_services_default =
10,
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
RMW_QOS_POLICY_DURABILITY_VOLATILE,
RMW_QOS_DEADLINE_DEFAULT,
RMW_QOS_LIFESPAN_DEFAULT,
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
false
};

Expand All @@ -64,6 +80,10 @@ static const rmw_qos_profile_t rmw_qos_profile_parameter_events =
1000,
RMW_QOS_POLICY_RELIABILITY_RELIABLE,
RMW_QOS_POLICY_DURABILITY_VOLATILE,
RMW_QOS_DEADLINE_DEFAULT,
RMW_QOS_LIFESPAN_DEFAULT,
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
false
};

Expand All @@ -73,6 +93,10 @@ static const rmw_qos_profile_t rmw_qos_profile_system_default =
RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT,
RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT,
RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT,
RMW_QOS_DEADLINE_DEFAULT,
RMW_QOS_LIFESPAN_DEFAULT,
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
false
};

Expand Down
2 changes: 2 additions & 0 deletions rmw/include/rmw/ret_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ typedef int32_t rmw_ret_t;
#define RMW_RET_OK 0
#define RMW_RET_ERROR 1
#define RMW_RET_TIMEOUT 2
/// The operation or event handling is not supported.
#define RMW_RET_UNSUPPORTED 3

/// Failed to allocate memory return code.
#define RMW_RET_BAD_ALLOC 10
Expand Down
95 changes: 93 additions & 2 deletions rmw/include/rmw/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,37 @@ enum RMW_PUBLIC_TYPE rmw_qos_durability_policy_t
RMW_QOS_POLICY_DURABILITY_UNKNOWN
};

enum RMW_PUBLIC_TYPE rmw_qos_liveliness_policy_t
{
RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
RMW_QOS_POLICY_LIVELINESS_AUTOMATIC,
RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE,
RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC
};

#define RMW_QOS_DEADLINE_DEFAULT {0, 0}
#define RMW_QOS_LIFESPAN_DEFAULT {0, 0}
#define RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT {0, 0}

/// ROS MiddleWare quality of service profile.
typedef struct RMW_PUBLIC_TYPE rmw_qos_profile_t
{
enum rmw_qos_history_policy_t history;
/// Size of the message queue.
size_t depth;
/// Reliabiilty QoS policy setting
enum rmw_qos_reliability_policy_t reliability;
/// Durability QoS policy setting
enum rmw_qos_durability_policy_t durability;
/// The period at which messages are expected to be sent/received
struct rmw_time_t deadline;
wjwwood marked this conversation as resolved.
Show resolved Hide resolved
/// The age at which messages are considered expired and no longer valid
struct rmw_time_t lifespan;
/// Liveliness QoS policy setting
enum rmw_qos_liveliness_policy_t liveliness;
/// The time within which the RMW node or publisher must show that it is alive
struct rmw_time_t liveliness_lease_duration;

/// If true, any ROS specific namespacing conventions will be circumvented.
/**
* In the case of DDS and topics, for example, this means the typical
Expand Down Expand Up @@ -231,8 +254,7 @@ typedef struct RMW_PUBLIC_TYPE rmw_message_info_t

enum {RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT = 0};

// Type mapping of rcutils log severity types to
// rmw specific types.
/// Type mapping of rcutils log severity types to rmw specific types.
typedef enum RMW_PUBLIC_TYPE
{
RMW_LOG_SEVERITY_DEBUG = RCUTILS_LOG_SEVERITY_DEBUG,
Expand All @@ -242,6 +264,75 @@ typedef enum RMW_PUBLIC_TYPE
RMW_LOG_SEVERITY_FATAL = RCUTILS_LOG_SEVERITY_FATAL
} rmw_log_severity_t;

/// QoS Liveliness Changed information provided by a subscription.
typedef struct RMW_PUBLIC_TYPE rmw_liveliness_changed_status_t
{
/**
* The total number of currently active Publishers which publish to the topic associated with
* the Subscription.
* This count increases when a newly matched Publisher asserts its liveliness for the first time
* or when a Publisher previously considered to be not alive reasserts its liveliness.
* The count decreases when a Publisher considered alive fails to assert its liveliness and
* becomes not alive, whether because it was deleted normally or for some other reason.
*/
int32_t alive_count;
mm318 marked this conversation as resolved.
Show resolved Hide resolved
/**
* The total count of current Publishers which publish to the topic associated with the
* Subscription that are no longer asserting their liveliness.
* This count increases when a Publisher considered alive fails to assert its liveliness and
* becomes not alive for some reason other than the normal deletion of that Publisher.
* It decreases when a previously not alive Publisher either reasserts its liveliness or is
* deleted normally.
*/
int32_t not_alive_count;
/// The change in the alive_count since the status was last read.
int32_t alive_count_change;
/// The change in the not_alive_count since the status was last read.
int32_t not_alive_count_change;
} rmw_liveliness_changed_status_t;

/// QoS Requested Deadline Missed information provided by a subscription.
typedef struct RMW_PUBLIC_TYPE rmw_requested_deadline_missed_status_t
{
/**
* Lifetime cumulative number of missed deadlines detected for any instance read by the
* subscription.
* Missed deadlines accumulate; that is, each deadline period the total_count will be incremented
* by one for each instance for which data was not received.
*/
int32_t total_count;
/// The incremental number of deadlines detected since the status was read.
int32_t total_count_change;
} rmw_requested_deadline_missed_status_t;

/// QoS Liveliness Lost information provided by a publisher.
typedef struct RMW_PUBLIC_TYPE rmw_liveliness_lost_status_t
{
/**
* Lifetime cumulative number of times that a previously-alive Publisher became not alive due to
* a failure to actively signal its liveliness within its offered liveliness period.
* This count does not change when an already not alive Publisher simply remains not alive for
* another liveliness period.
*/
int32_t total_count;
/// The change in total_count since the last time the status was last read.
int32_t total_count_change;
} rmw_liveliness_lost_status_t;

/// QoS Deadline Missed information provided by a publisher.
typedef struct RMW_PUBLIC_TYPE rmw_offered_deadline_missed_status_t
{
/**
* Lifetime cumulative number of offered deadline periods elapsed during which a Publisher failed
* to provide data.
* Missed deadlines accumulate; that is, each deadline period the total_count will be incremented
* by one.
*/
int32_t total_count;
/// The change in total_count since the last time the status was last read.
int32_t total_count_change;
} rmw_offered_deadline_missed_status_t;

#ifdef __cplusplus
}
#endif
Expand Down