Skip to content
Draft
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ All the configurable parameters are:
| RMW_UXRCE_MAX_SUBSCRIPTIONS | This value sets the maximum number of topic subscriptions for an application. | 4 |
| RMW_UXRCE_MAX_SERVICES | This value sets the maximum number of service servers for an application. | 4 |
| RMW_UXRCE_MAX_CLIENTS | This value sets the maximum number of service clients for an application. | 4 |
| RMW_UXRCE_MAX_TOPICS | This value sets the maximum number of topics for an application. </br> If set to -1 RMW_UXRCE_MAX_TOPICS = RMW_UXRCE_MAX_PUBLISHERS + </br> RMW_UXRCE_MAX_SUBSCRIPTIONS + RMW_UXRCE_MAX_NODES. | -1 |
| RMW_UXRCE_MAX_WAIT_SETS | This value sets the maximum number of wait sets for an application. | 4 |
| RMW_UXRCE_MAX_GUARD_CONDITION | This value sets the maximum number of guard conditions for an application. | 4 |
| RMW_UXRCE_NODE_NAME_MAX_LENGTH | This value sets the maximum number of characters for a node name. | 60 |
Expand Down
4 changes: 0 additions & 4 deletions rmw_microxrcedds_c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ set(RMW_UXRCE_MAX_SERVICES "4" CACHE STRING "This value sets the maximum number
set(RMW_UXRCE_MAX_CLIENTS "4" CACHE STRING "This value sets the maximum number of clients for an application.")
set(RMW_UXRCE_MAX_WAIT_SETS "4" CACHE STRING "This value sets the maximum number of wait sets for an application.")
set(RMW_UXRCE_MAX_GUARD_CONDITION "4" CACHE STRING "This value sets the maximum number of guard conditions for an application.")
set(RMW_UXRCE_MAX_TOPICS "-1" CACHE STRING
"This value sets the maximum number of topics for an application.
If set to -1 RMW_UXRCE_MAX_TOPICS = RMW_UXRCE_MAX_PUBLISHERS + RMW_UXRCE_MAX_SUBSCRIPTIONS + RMW_UXRCE_MAX_NODES.")
option(RMW_UXRCE_ALLOW_DYNAMIC_ALLOCATIONS "Enables increasing static pools with dynamic allocation when needed." OFF)
set(RMW_UXRCE_NODE_NAME_MAX_LENGTH "60" CACHE STRING "This value sets the maximum number of characters for a node name.")
set(RMW_UXRCE_TOPIC_NAME_MAX_LENGTH "60" CACHE STRING "This value sets the maximum number of characters for a topic name.")
Expand Down Expand Up @@ -168,7 +165,6 @@ set(SRCS
src/rmw_guard_condition.c
src/rmw_init.c
src/rmw_logging.c
src/rmw_microxrcedds_topic.c
src/rmw_node.c
src/rmw_node_info_and_types.c
src/rmw_node_names.c
Expand Down
12 changes: 6 additions & 6 deletions rmw_microxrcedds_c/src/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ void on_topic(
"Not available static buffer memory node in on_topic callback",
.node = custom_subscription->owner_node->node_name,
.node_namespace = custom_subscription->owner_node->node_namespace,
.topic_name = custom_subscription->topic_name, .ucdr = ub,
.topic_name = custom_subscription->topic.topic_name, .ucdr = ub,
.size = length,
.type_support.message_callbacks = custom_subscription->type_support_callbacks);
.type_support.message_callbacks = custom_subscription->topic.type_support_callbacks.msg);
return;
}

Expand Down Expand Up @@ -139,9 +139,9 @@ void on_request(
"Not available static buffer memory node in on_request callback",
.node = custom_service->owner_node->node_name,
.node_namespace = custom_service->owner_node->node_namespace,
.topic_name = custom_service->service_name, .ucdr = ub,
.topic_name = custom_service->topic.topic_name, .ucdr = ub,
.size = length,
.type_support.service_callbacks = custom_service->type_support_callbacks);
.type_support.service_callbacks = custom_service->topic.type_support_callbacks.srv);
return;
}

Expand Down Expand Up @@ -200,9 +200,9 @@ void on_reply(
"Not available static buffer memory node in on_reply callback",
.node = custom_client->owner_node->node_name,
.node_namespace = custom_client->owner_node->node_namespace,
.topic_name = custom_client->service_name, .ucdr = ub,
.topic_name = custom_client->topic.topic_name, .ucdr = ub,
.size = length,
.type_support.service_callbacks = custom_client->type_support_callbacks);
.type_support.service_callbacks = custom_client->topic.type_support_callbacks.srv);
return;
}

Expand Down
7 changes: 0 additions & 7 deletions rmw_microxrcedds_c/src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,9 @@
#define RMW_UXRCE_MAX_SUBSCRIPTIONS @RMW_UXRCE_MAX_SUBSCRIPTIONS@
#define RMW_UXRCE_MAX_SERVICES @RMW_UXRCE_MAX_SERVICES@
#define RMW_UXRCE_MAX_CLIENTS @RMW_UXRCE_MAX_CLIENTS@
#define RMW_UXRCE_MAX_TOPICS @RMW_UXRCE_MAX_TOPICS@
#define RMW_UXRCE_MAX_WAIT_SETS @RMW_UXRCE_MAX_WAIT_SETS@
#define RMW_UXRCE_MAX_GUARD_CONDITION @RMW_UXRCE_MAX_GUARD_CONDITION@

#if RMW_UXRCE_MAX_TOPICS == -1
#define RMW_UXRCE_MAX_TOPICS_INTERNAL RMW_UXRCE_MAX_PUBLISHERS + RMW_UXRCE_MAX_SUBSCRIPTIONS
#else
#define RMW_UXRCE_MAX_TOPICS_INTERNAL RMW_UXRCE_MAX_TOPICS
#endif

#define RMW_UXRCE_NODE_NAME_MAX_LENGTH @RMW_UXRCE_NODE_NAME_MAX_LENGTH@
#define RMW_UXRCE_TOPIC_NAME_MAX_LENGTH @RMW_UXRCE_TOPIC_NAME_MAX_LENGTH@
#define RMW_UXRCE_TYPE_NAME_MAX_LENGTH @RMW_UXRCE_TYPE_NAME_MAX_LENGTH@
Expand Down
33 changes: 10 additions & 23 deletions rmw_microxrcedds_c/src/rmw_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.


#ifdef HAVE_C_TYPESUPPORT
#include <rosidl_typesupport_microxrcedds_c/identifier.h>
#endif /* ifdef HAVE_C_TYPESUPPORT */
#ifdef HAVE_CPP_TYPESUPPORT
#include <rosidl_typesupport_microxrcedds_cpp/identifier.h>
#endif /* ifdef HAVE_CPP_TYPESUPPORT */

#include <rmw/rmw.h>
#include <rmw/allocators.h>

#include <rosidl_typesupport_microxrcedds_c/identifier.h>
#include <rosidl_typesupport_microxrcedds_c/service_type_support.h>

#include "./rmw_microros_internal/utils.h"
#include "./rmw_microros_internal/error_handling_internal.h"

Expand Down Expand Up @@ -56,8 +51,8 @@ rmw_create_client(
rmw_client = &custom_client->rmw_client;
rmw_client->data = NULL;
rmw_client->implementation_identifier = rmw_get_implementation_identifier();
rmw_client->service_name = custom_client->service_name;
if ((strlen(service_name) + 1 ) > sizeof(custom_client->service_name)) {
rmw_client->service_name = custom_client->topic.topic_name;
if ((strlen(service_name) + 1 ) > sizeof(custom_client->topic.topic_name)) {
RMW_UROS_TRACE_MESSAGE("failed to allocate string")
goto fail;
}
Expand All @@ -68,26 +63,18 @@ rmw_create_client(
custom_client->session_timeout = RMW_UXRCE_PUBLISH_RELIABLE_TIMEOUT;
custom_client->qos = *qos_policies;

const rosidl_service_type_support_t * type_support_xrce = NULL;
#ifdef ROSIDL_TYPESUPPORT_MICROXRCEDDS_C__IDENTIFIER_VALUE
type_support_xrce = get_service_typesupport_handle(
const rosidl_service_type_support_t * type_support_xrce = get_service_typesupport_handle(
type_support, ROSIDL_TYPESUPPORT_MICROXRCEDDS_C__IDENTIFIER_VALUE);
#endif /* ifdef ROSIDL_TYPESUPPORT_MICROXRCEDDS_C__IDENTIFIER_VALUE */
#ifdef ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_VALUE
if (NULL == type_support_xrce) {
type_support_xrce = get_service_typesupport_handle(
type_support, ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_VALUE);
}
#endif /* ifdef ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_VALUE */

if (NULL == type_support_xrce) {
RMW_UROS_TRACE_MESSAGE("Undefined type support")
goto fail;
}

custom_client->type_support_callbacks =
custom_client->topic.type_support_callbacks.srv =
(const service_type_support_callbacks_t *)type_support_xrce->data;

if (custom_client->type_support_callbacks == NULL) {
if (custom_client->topic.type_support_callbacks.srv == NULL) {
RMW_UROS_TRACE_MESSAGE("type support data is NULL")
goto fail;
}
Expand Down Expand Up @@ -121,7 +108,7 @@ rmw_create_client(
static char req_type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
static char res_type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
generate_service_types(
custom_client->type_support_callbacks, req_type_name, res_type_name,
custom_client->topic.type_support_callbacks.srv, req_type_name, res_type_name,
RMW_UXRCE_TYPE_NAME_MAX_LENGTH);

static char req_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
Expand Down
1 change: 0 additions & 1 deletion rmw_microxrcedds_c/src/rmw_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ rmw_init(
rmw_uxrce_init_publisher_memory(&publisher_memory, custom_publishers, RMW_UXRCE_MAX_PUBLISHERS);
rmw_uxrce_init_service_memory(&service_memory, custom_services, RMW_UXRCE_MAX_SERVICES);
rmw_uxrce_init_client_memory(&client_memory, custom_clients, RMW_UXRCE_MAX_CLIENTS);
rmw_uxrce_init_topic_memory(&topics_memory, custom_topics, RMW_UXRCE_MAX_TOPICS_INTERNAL);
rmw_uxrce_init_init_options_impl_memory(
&init_options_memory, custom_init_options,
RMW_UXRCE_MAX_OPTIONS);
Expand Down

This file was deleted.

35 changes: 12 additions & 23 deletions rmw_microxrcedds_c/src/rmw_microros_internal/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,22 @@ typedef struct rmw_init_options_impl_s rmw_uxrce_init_options_impl_t;

typedef struct rmw_uxrce_topic_t
{
rmw_uxrce_mempool_item_t mem;

uxrObjectId topic_id;
const message_type_support_callbacks_t * message_type_support_callbacks;

struct rmw_uxrce_node_t * owner_node;

union {
const message_type_support_callbacks_t * msg;
const service_type_support_callbacks_t * srv;
} type_support_callbacks;

char topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
} rmw_uxrce_topic_t;

typedef struct rmw_uxrce_service_t
{
rmw_uxrce_mempool_item_t mem;
uxrObjectId service_id;
const service_type_support_callbacks_t * type_support_callbacks;
uint16_t service_data_resquest;

rmw_qos_profile_t qos;
Expand All @@ -139,14 +142,13 @@ typedef struct rmw_uxrce_service_t
struct rmw_uxrce_node_t * owner_node;

rmw_service_t rmw_service;
char service_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
rmw_uxrce_topic_t topic;
} rmw_uxrce_service_t;

typedef struct rmw_uxrce_client_t
{
rmw_uxrce_mempool_item_t mem;
uxrObjectId client_id;
const service_type_support_callbacks_t * type_support_callbacks;
uint16_t client_data_request;

rmw_qos_profile_t qos;
Expand All @@ -156,7 +158,7 @@ typedef struct rmw_uxrce_client_t
struct rmw_uxrce_node_t * owner_node;

rmw_client_t rmw_client;
char service_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
rmw_uxrce_topic_t topic;
} rmw_uxrce_client_t;

typedef struct rmw_uxrce_subscription_t
Expand All @@ -165,15 +167,12 @@ typedef struct rmw_uxrce_subscription_t
uxrObjectId subscriber_id;
uxrObjectId datareader_id;

const message_type_support_callbacks_t * type_support_callbacks;
struct rmw_uxrce_topic_t * topic;

struct rmw_uxrce_node_t * owner_node;
rmw_qos_profile_t qos;
uxrStreamId stream_id;

rmw_subscription_t rmw_subscription;
char topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
rmw_uxrce_topic_t topic;
} rmw_uxrce_subscription_t;

typedef struct rmw_uxrce_publisher_t
Expand All @@ -182,21 +181,16 @@ typedef struct rmw_uxrce_publisher_t
uxrObjectId publisher_id;
uxrObjectId datawriter_id;

const message_type_support_callbacks_t * type_support_callbacks;

rmw_uros_continous_serialization_size cs_cb_size;
rmw_uros_continous_serialization cs_cb_serialization;

struct rmw_uxrce_topic_t * topic;

struct rmw_uxrce_node_t * owner_node;
rmw_qos_profile_t qos;
uxrStreamId stream_id;
int session_timeout;

struct rmw_uxrce_node_t * owner_node;

rmw_publisher_t rmw_publisher;
char topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
rmw_uxrce_topic_t topic;
} rmw_uxrce_publisher_t;

typedef struct rmw_uxrce_node_t
Expand Down Expand Up @@ -279,9 +273,6 @@ extern rmw_uxrce_service_t custom_services[RMW_UXRCE_MAX_SERVICES];
extern rmw_uxrce_mempool_t client_memory;
extern rmw_uxrce_client_t custom_clients[RMW_UXRCE_MAX_CLIENTS];

extern rmw_uxrce_mempool_t topics_memory;
extern rmw_uxrce_topic_t custom_topics[RMW_UXRCE_MAX_TOPICS_INTERNAL];

extern rmw_uxrce_mempool_t static_buffer_memory;
extern rmw_uxrce_static_input_buffer_t custom_static_buffers[RMW_UXRCE_MAX_HISTORY];

Expand Down Expand Up @@ -336,8 +327,6 @@ void rmw_uxrce_fini_client_memory(
rmw_client_t * client);
void rmw_uxrce_fini_service_memory(
rmw_service_t * service);
void rmw_uxrce_fini_topic_memory(
rmw_uxrce_topic_t * topic);

// Memory pools functions

Expand Down
Loading