Skip to content

Commit

Permalink
[rmw_connextdds] New RMW discovery options (#108)
Browse files Browse the repository at this point in the history
* Use the new discovery params

Signed-off-by: Michael X. Grey <grey@openrobotics.org>

* Update to latest rmw API

Signed-off-by: Michael X. Grey <grey@openrobotics.org>

* Fix typo

Signed-off-by: Michael X. Grey <grey@openrobotics.org>

* Fix memory management

Signed-off-by: Michael X. Grey <grey@openrobotics.org>

* Make sure NDDS_DISCOVERY_PEERS is not empty when ROS_AUTOMATIC_DISCOVERY_RANGE is LOCALHOST
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* fix up finalize logic

Signed-off-by: William Woodall <william@osrfoundation.org>

* typo

Signed-off-by: William Woodall <william@osrfoundation.org>

* check the return code of ensure_length()

Signed-off-by: William Woodall <william@osrfoundation.org>

* fixup use of memcpy when copying a string

Signed-off-by: William Woodall <william@osrfoundation.org>

* improve formatting of domain_tag string

Signed-off-by: William Woodall <william@osrfoundation.org>

* use c++17 [[fallthrough]] attribute

Signed-off-by: William Woodall <william@osrfoundation.org>

* change style of switch statement

Signed-off-by: William Woodall <william@osrfoundation.org>

* undo change to request c++17 vs 14 since we're not using fallthrough

Signed-off-by: William Woodall <william@osrfoundation.org>

* Handle all discovery options in rmw_context.cpp
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* Reset multicast_receive_addresses instead of setting NDDS_DISCOVERY_PEERS
Signed-off-by: Andrea Sorbini <asorbini@rti.com>

* error when range is NOT_SET

Signed-off-by: William Woodall <william@osrfoundation.org>

* fixup review comments

Signed-off-by: William Woodall <william@osrfoundation.org>

* fix a zero initialization issue

Signed-off-by: William Woodall <william@osrfoundation.org>

* remove redundant break statement

Signed-off-by: William Woodall <william@osrfoundation.org>

* Init discovery_options when initializing node options

Signed-off-by: Shane Loretz <sloretz@google.com>

* Set maximum participant ID to 32 on localhost

Signed-off-by: Shane Loretz <sloretz@google.com>

* Skipping adding peers when automatic_discovery_range is SYSTEM_DEFAULT

Signed-off-by: Shane Loretz <sloretz@google.com>

* Try solving los of precision warning on Windows

Signed-off-by: Shane Loretz <sloretz@google.com>

* Fix windows warning

Signed-off-by: Shane Loretz <sloretz@google.com>

---------

Signed-off-by: Michael X. Grey <grey@openrobotics.org>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@google.com>
Co-authored-by: Shane Loretz <sloretz@google.com>
Co-authored-by: Andrea Sorbini <asorbini@rti.com>
Co-authored-by: William Woodall <william@osrfoundation.org>
  • Loading branch information
4 people authored Apr 8, 2023
1 parent 4f26729 commit 022cc46
Show file tree
Hide file tree
Showing 5 changed files with 324 additions and 81 deletions.
17 changes: 10 additions & 7 deletions rmw_connextdds_common/include/rmw_connextdds/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <mutex>
#include <regex>
#include <string>
#include <memory>

#include "rmw_connextdds/dds_api.hpp"
#include "rmw_connextdds/log.hpp"
Expand Down Expand Up @@ -78,8 +79,11 @@ struct rmw_context_impl_s
DDS_DataReader * dr_publications;
DDS_DataReader * dr_subscriptions;

/* Keep track of whether the DomainParticipant is localhost only */
bool localhost_only;
/* Keep track of what discovery settings were used when initializing */
rmw_discovery_options_t * discovery_options;

/* Manage the memory of the domain tag */
char * domain_tag;

/* Global configuration for QoS profiles */
std::string qos_ctx_name;
Expand Down Expand Up @@ -160,7 +164,8 @@ struct rmw_context_impl_s
dr_participants(nullptr),
dr_publications(nullptr),
dr_subscriptions(nullptr),
localhost_only(base->options.localhost_only == RMW_LOCALHOST_ONLY_ENABLED)
discovery_options(nullptr),
domain_tag(nullptr)
{
/* destructor relies on these being initialized properly */
common.thread_is_running.store(false);
Expand All @@ -180,17 +185,15 @@ struct rmw_context_impl_s
// node_count is increased
rmw_ret_t
initialize_node(
const char * const node_name,
const char * const node_namespace,
const bool localhost_only);
const rmw_discovery_options_t * const discovery_options);

// Destroys the participant, when node_count reaches 0.
rmw_ret_t
finalize_node();

// Initialize the DomainParticipant associated with the context.
rmw_ret_t
initialize_participant(const bool localhost_only);
initialize_participant();

// Enable the DomainParticipant associated with the context.
rmw_ret_t
Expand Down
Loading

0 comments on commit 022cc46

Please sign in to comment.