Skip to content

Commit

Permalink
Merge pull request #15 from ros2/qos
Browse files Browse the repository at this point in the history
Added support for QoS profiles
  • Loading branch information
esteve committed Aug 7, 2015
2 parents d5bd0c2 + 0d18b6a commit daf7dca
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 3 deletions.
64 changes: 64 additions & 0 deletions rmw/include/rmw/qos_profiles.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2015 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 ROS_MIDDLEWARE_INTERFACE_ROS_MIDDLEWARE_INTERFACE_QOS_PROFILES_H_
#define ROS_MIDDLEWARE_INTERFACE_ROS_MIDDLEWARE_INTERFACE_QOS_PROFILES_H_

#if __cplusplus
extern "C"
{
#endif

#include "types.h"

const static rmw_qos_profile_t rmw_qos_profile_sensor_data =
{
RMW_QOS_POLICY_KEEP_LAST_HISTORY,
5,
RMW_QOS_POLICY_BEST_EFFORT
};

const static rmw_qos_profile_t rmw_qos_profile_parameters =
{
RMW_QOS_POLICY_KEEP_LAST_HISTORY,
1000,
RMW_QOS_POLICY_RELIABLE
};

const static rmw_qos_profile_t rmw_qos_profile_default =
{
RMW_QOS_POLICY_KEEP_ALL_HISTORY,
10,
RMW_QOS_POLICY_RELIABLE
};

const static rmw_qos_profile_t rmw_qos_profile_services_default =
{
RMW_QOS_POLICY_KEEP_ALL_HISTORY,
10,
RMW_QOS_POLICY_RELIABLE
};

const static rmw_qos_profile_t rmw_qos_profile_parameter_events =
{
RMW_QOS_POLICY_KEEP_ALL_HISTORY,
1000,
RMW_QOS_POLICY_RELIABLE
};

#if __cplusplus
}
#endif

#endif /* ROS_MIDDLEWARE_INTERFACE_ROS_MIDDLEWARE_INTERFACE_QOS_PROFILES_H_ */
7 changes: 4 additions & 3 deletions rmw/include/rmw/rmw.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern "C"
#include <rosidl_generator_c/message_type_support.h>
#include <rosidl_generator_c/service_type_support.h>

#include "qos_profiles.h"
#include "types.h"
#include "visibility_control.h"

Expand Down Expand Up @@ -63,7 +64,7 @@ rmw_create_publisher(
const rmw_node_t * node,
const rosidl_message_type_support_t * type_support,
const char * topic_name,
size_t queue_size);
const rmw_qos_profile_t & qos_policies = rmw_qos_profile_default);

RMW_PUBLIC
RMW_WARN_UNUSED
Expand All @@ -82,8 +83,8 @@ rmw_create_subscription(
const rmw_node_t * node,
const rosidl_message_type_support_t * type_support,
const char * topic_name,
size_t queue_size,
bool ignore_local_publications);
const rmw_qos_profile_t & qos_policies = rmw_qos_profile_default,
bool ignore_local_publications = false);

RMW_PUBLIC
RMW_WARN_UNUSED
Expand Down
19 changes: 19 additions & 0 deletions rmw/include/rmw/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ typedef struct RMW_PUBLIC_TYPE rmw_time_t
uint64_t nsec;
} rmw_time_t;

enum RMW_PUBLIC_TYPE rmw_qos_reliability_policy_t
{
RMW_QOS_POLICY_RELIABLE,
RMW_QOS_POLICY_BEST_EFFORT
};

enum RMW_PUBLIC_TYPE rmw_qos_history_policy_t
{
RMW_QOS_POLICY_KEEP_LAST_HISTORY,
RMW_QOS_POLICY_KEEP_ALL_HISTORY
};

typedef struct RMW_PUBLIC_TYPE rmw_qos_profile_t
{
enum rmw_qos_history_policy_t history;
size_t depth;
enum rmw_qos_reliability_policy_t reliability;
} rmw_qos_profile_t;

#if __cplusplus
}
#endif
Expand Down

0 comments on commit daf7dca

Please sign in to comment.