FastDDS配置参数的介绍和使用
一、ReliabilityQoS 的 kind 属性能设置的值(ReliabilityQosPolicyKind):
1、RELIABLEE_RELIABILITY_QOS:可靠的传输。发布端写者在发出数据之后中间件会判断订阅端读者是否成功收到数据。若订阅端没有收到,中间件会通知发布端,发布端的写者就会再发一次订阅端没收到的数据,保证订阅端能收到。在稳定状态下(写者不会再写新的数据),中间件会保证写者的历史记录所有数据能够全部发送给读者。但在写者会发送新数据的情况下,就需要对 History 进行设置,确定写者发送的数据样本哪些作为历史记录保存,哪些需要从历史记录丢弃。
2、BEST_EFFORT_RELIABILITY_QOS:尽力而为的传输。发布端写者在发送数据的时候不会关注订阅端读者是否接受到数据,写者不会因为读者漏接某个数据而再发送一次漏接的数据,依然会继续发送接下来的数据。一般用于更新速率很快,丢失少许数据无碍的情况。是 DataReaders 和 Topics 的默认值。
若发布者和订阅者的ReliabilityQosPolicyKind不同,无法建立通信。
二、ParticipantAttributes
1、ParticipantAttributes类
class ParticipantAttributes
{
public:
//! DomainId to be used by the associated RTPSParticipant (default: 0)
uint32_t domainId = 0;//域值
//!Attributes of the associated RTPSParticipant.
rtps::RTPSParticipantAttributes rtps;//rtps参数详见下文
};
2、RTPSParticipantAttributes类
class RTPSParticipantAttributes
{
public:
RTPSParticipantAttributes()
{
setName("RTPSParticipant");
sendSocketBufferSize = 0;
listenSocketBufferSize = 0;
participantID = -1;
useBuiltinTransports = true;
}
/**
* Default list of Unicast Locators to be used for any Endpoint defined inside this RTPSParticipant in the case
* that it was defined with NO UnicastLocators. At least ONE locator should be included in this list.
* /
/*在以下情况下,用于此RTPSP参与者内定义的任何端点的单播定位器的
*默认列表,它被定义为没有单播定位器。此列表中应至少包含一个定位器
* /
LocatorList_t defaultUnicastLocatorList;
/**
* Default list of Multicast Locators to be used for any Endpoint defined inside this RTPSParticipant in the
* case that it was defined with NO UnicastLocators. This is usually left empty.
*/
/*用于此RTPSP参与者中定义的任何端点的默认多播定位器列表
*如果它被定义为没有单播定位器。这通常是空的。 * /
LocatorList_t defaultMulticastLocatorList;
/*!
* @brief Send socket buffer size for the send resource. Zero value indicates to use default system buffer size.
* Default value: 0.
*/
/*@short发送资源的套接字缓冲区大小。零值表示使用默认系统缓冲区大 小。
*默认值:0。 */
uint32_t sendSocketBufferSize;
/*! Listen socket buffer for all listen resources. Zero value indicates to use default system buffer size.
* Default value: 0.
*/
/*所有侦听资源的侦听套接字缓冲区。零值表示使用默认系统缓冲区大小。
*默认值:0 */
uint32_t listenSocketBufferSize;
//! Builtin parameters.//内置参数,详见下文
BuiltinAttributes builtin;
//!Port Parameters//端口参数,详见下文
PortParameters port;
//!User Data of the participant//参与者的用户数据
std::vector<octet> userData;
//!Participant ID//参与者ID
int32_t participantID;
//!Throughput controller parameters. Leave default for uncontrolled flow.
//吞吐量控制器参数。将默认值保留为不受控制的流量
ThroughputControllerDescriptor throughputController;
//!User defined transports to use alongside or in place of builtins.
//用户定义的运输工具,可与内置工具一起使用或代替内置工具使用
std::vector<std::shared_ptr<fastdds::rtps::TransportDescriptorInterface>> userTransports;
//!Set as false to disable the default UDPv4 implementation.
//设置为false以禁用默认UDPv4实现
bool useBuiltinTransports;
//!Holds allocation limits affecting collections managed by a participant.
//持有影响参与者管理的集合的分配限制
RTPSParticipantAllocationAttributes allocation;
//! Property policies//方针政策?
PropertyPolicy properties;
private:
//!Name of the participant.
//参与者名字
string_255 name;
}
3、BuiltinAttributes类
/**
* Class BuiltinAttributes, to define the behavior of the RTPSParticipant builtin protocols.
* @ingroup RTPS_ATTRIBUTES_MODULE
*/
/*类内置属性,用于定义RTPSP参与内置协议的行为*/
class BuiltinAttributes
{
public:
//! Discovery protocol related attributes
//发现协议相关属性
DiscoverySettings discovery_config;
//!Indicates to use the WriterLiveliness protocol.
//标识是否使用WriterLivelines协议
bool use_WriterLivelinessProtocol = true;
//!TypeLookup Service settings
//类型查找服务设置
TypeLookupSettings typelookup_config;
//!Metatraffic Unicast Locator List
//Metatraffic单播定位器列表
LocatorList_t metatrafficUnicastLocatorList;
//!Metatraffic Multicast Locator List.
//元流量多播定位器列表
LocatorList_t metatrafficMulticastLocatorList;
//! Initial peers.
//初始对等体
LocatorList_t initialPeersList;
//! Memory policy for builtin readers
//内置读卡器的内存策略
MemoryManagementPolicy_t readerHistoryMemoryPolicy = MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE;
//! Maximum payload size for builtin readers
//内置读卡器的最大有效载荷大小
uint32_t readerPayloadSize = BUILTIN_DATA_MAX_SIZE;
//! Memory policy for builtin writers
//内置写入程序的内存策略
MemoryManagementPolicy_t writerHistoryMemoryPolicy =MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE;
//! Maximum payload size for builtin writers
//内置写入程序的最大有效负载大小
uint32_t writerPayloadSize = BUILTIN_DATA_MAX_SIZE;
//! Mutation tries if the port is being used.
//如果端口正在使用,则进行突变尝试
uint32_t mutation_tries = 100u;
//!Set to true to avoid multicast traffic on builtin endpoints
//设置为true以避免内置端点上的多播流量
bool avoid_builtin_multicast = true;
BuiltinAttributes() = default;
};
4、DiscoverySettings类
class DiscoverySettings
{
public:
//! Chosen discovery protocol
DiscoveryProtocol_t discoveryProtocol = DiscoveryProtocol_t::SIMPLE;
/**
* If set to true, SimpleEDP would be used.
*/
bool use_SIMPLE_EndpointDiscoveryProtocol = true;
/**
* If set to true, StaticEDP based on an XML file would be implemented.
* The XML filename must be provided.
*/
bool use_STATIC_EndpointDiscoveryProtocol = false;
/**
* Lease Duration of the RTPSParticipant,
* indicating how much time remote RTPSParticipants should consider this RTPSParticipant alive.
*/
//! Time_t (Duration_t) representing an infinite time. DONT USE IT IN CONSTRUCTORS
//const Time_