Skip to content

Commit

Permalink
Forward port changes from humble to master branch (#98)
Browse files Browse the repository at this point in the history
* Use new Blueberry v2.0.3 feature request-response and its discovery (#84)

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>

* Remove cppcheck from linter job and use Ubuntu 22.04

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>

* Include 'iceoryx_hoofs' legacy header and use 'iox::into' for string
conversion

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>

* Fix dependency of name conversion lib (#81)

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>

* Call correct destructor (#81)

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>

* Use 'rcutils_get_executable_name' to get the name of the process (#94)

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>

* Set C++ standard in accordance with iceoryx (#93)

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>

* Address review findings (#84)

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>

---------

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
  • Loading branch information
mossmaurice authored Sep 20, 2023
1 parent 590037d commit 91080ff
Show file tree
Hide file tree
Showing 30 changed files with 1,132 additions and 73 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
jobs:
lint:
name: ament_${{ matrix.linter }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
linter: [cppcheck, cpplint, uncrustify, xmllint, copyright]
linter: [cpplint, uncrustify, xmllint, copyright]
steps:
- uses: actions/checkout@v2
- uses: ros-tooling/setup-ros@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v2
- name: Setup ROS
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ Unfortunately, not all features are yet fully fleshed out.
| `ros2 node list` | :heavy_check_mark: |
| `ros2 node info` | :heavy_check_mark: |
| `ros2 interface *` | :heavy_check_mark: |
| `ros2 service *` | :x: (coming with iceoryx v2.0) |
| `ros2 param list` | :x: (coming with iceoryx v2.0) |
| `ros2 service *` | :heavy_check_mark: |
| `ros2 param list` | :x: |
| `rqt_graph` | :heavy_check_mark: |
| `rqt_top` | :heavy_check_mark: |
| `rqt_console` | :heavy_check_mark: |
Expand Down
18 changes: 15 additions & 3 deletions rmw_iceoryx_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@ if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
# Set C++ standard in accordance with iceoryx
# https://github.com/eclipse-iceoryx/iceoryx/blob/v2.0.3/iceoryx_hoofs/cmake/IceoryxPlatform.cmake#L26-L38
if(LINUX)
set(CMAKE_CXX_STANDARD 14)
elseif(QNX)
set(CMAKE_CXX_STANDARD 14)
elseif(WIN32)
set(CMAKE_CXX_STANDARD 17)
elseif(APPLE)
set(CMAKE_CXX_STANDARD 17)
elseif(UNIX)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand Down Expand Up @@ -38,6 +49,7 @@ find_package(rosidl_typesupport_introspection_cpp REQUIRED)
add_library(rmw_iceoryx_serialization SHARED
src/internal/iceoryx_deserialize.cpp
src/internal/iceoryx_serialize.cpp
src/internal/iceoryx_type_info_introspection.cpp
)
target_include_directories(rmw_iceoryx_serialization
PUBLIC include
Expand All @@ -50,7 +62,6 @@ ament_target_dependencies(rmw_iceoryx_serialization
)
add_library(rmw_iceoryx_name_conversion SHARED
src/internal/iceoryx_name_conversion.cpp
src/internal/iceoryx_type_info_introspection.cpp
src/internal/iceoryx_topic_names_and_types.cpp
src/internal/iceoryx_get_topic_endpoint_info.cpp
)
Expand All @@ -59,6 +70,7 @@ target_include_directories(rmw_iceoryx_name_conversion
)
target_link_libraries(rmw_iceoryx_name_conversion
iceoryx_posh::iceoryx_posh
rmw_iceoryx_serialization
)
ament_target_dependencies(rmw_iceoryx_name_conversion
rcpputils
Expand Down
12 changes: 12 additions & 0 deletions rmw_iceoryx_cpp/include/rmw_iceoryx_cpp/iceoryx_deserialize.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -16,6 +17,7 @@
#define RMW_ICEORYX_CPP__ICEORYX_DESERIALIZE_HPP_

struct rosidl_message_type_support_t;
struct rosidl_service_type_support_t;

namespace rmw_iceoryx_cpp
{
Expand All @@ -26,5 +28,15 @@ void deserialize(
const rosidl_message_type_support_t * type_supports,
void * ros_message);

void deserializeRequest(
const char * serialized_msg,
const rosidl_service_type_support_t * type_supports,
void * ros_message);

void deserializeResponse(
const char * serialized_msg,
const rosidl_service_type_support_t * type_supports,
void * ros_message);

} // namespace rmw_iceoryx_cpp
#endif // RMW_ICEORYX_CPP__ICEORYX_DESERIALIZE_HPP_
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2021 by ZhenshengLee. All rights reserved.
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -24,6 +25,7 @@
#include "iceoryx_dust/cxx/std_string_support.hpp"

struct rosidl_message_type_support_t;
struct rosidl_service_type_support_t;

namespace rmw_iceoryx_cpp
{
Expand Down Expand Up @@ -72,5 +74,10 @@ get_iceoryx_service_description(
const std::string & topic,
const rosidl_message_type_support_t * type_supports);

iox::capro::ServiceDescription
get_iceoryx_service_description(
const std::string & topic,
const rosidl_service_type_support_t * type_supports);

} // namespace rmw_iceoryx_cpp
#endif // RMW_ICEORYX_CPP__ICEORYX_NAME_CONVERSION_HPP_
12 changes: 12 additions & 0 deletions rmw_iceoryx_cpp/include/rmw_iceoryx_cpp/iceoryx_serialize.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -18,6 +19,7 @@
#include <vector>

struct rosidl_message_type_support_t;
struct rosidl_service_type_support_t;

namespace rmw_iceoryx_cpp
{
Expand All @@ -27,5 +29,15 @@ void serialize(
const rosidl_message_type_support_t * type_supports,
std::vector<char> & payload_vector);

void serializeRequest(
const void * ros_message,
const rosidl_service_type_support_t * type_supports,
std::vector<char> & payload_vector);

void serializeResponse(
const void * ros_message,
const rosidl_service_type_support_t * type_supports,
std::vector<char> & payload_vector);

} // namespace rmw_iceoryx_cpp
#endif // RMW_ICEORYX_CPP__ICEORYX_SERIALIZE_HPP_
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,6 +36,7 @@ void fill_topic_containers(
std::map<std::string, std::vector<std::string>> & topic_publishers_);

std::map<std::string, std::string> get_topic_names_and_types();
std::map<std::string, std::string> get_service_names_and_types();

std::map<std::string, std::vector<std::string>> get_nodes_and_publishers();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
// Copyright (c) 2021 - 2023 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,7 @@
#include <utility>

struct rosidl_message_type_support_t;
struct rosidl_service_type_support_t;

namespace rmw_iceoryx_cpp
{
Expand All @@ -35,15 +36,26 @@ enum class TypeSupportLanguage
const std::pair<TypeSupportLanguage, const rosidl_message_type_support_t *> get_type_support(
const rosidl_message_type_support_t * type_supports);

/// @brief Wraps get_service_typesupport_handle() and does error handling
/// @return std::pair containing enum TypeSupportLanguage and handle to the type support
const std::pair<TypeSupportLanguage, const rosidl_service_type_support_t *> get_type_support(
const rosidl_service_type_support_t * type_supports);

bool iceoryx_is_fixed_size(const rosidl_message_type_support_t * type_supports);
bool iceoryx_is_fixed_size(const rosidl_service_type_support_t * type_supports);

bool iceoryx_is_valid_type_support(const rosidl_message_type_support_t * type_supports);
bool iceoryx_is_valid_type_support(const rosidl_service_type_support_t * type_supports);

size_t iceoryx_get_message_size(const rosidl_message_type_support_t * type_supports);
size_t iceoryx_get_request_size(const rosidl_service_type_support_t * type_supports);
size_t iceoryx_get_response_size(const rosidl_service_type_support_t * type_supports);

std::string iceoryx_get_message_name(const rosidl_message_type_support_t * type_supports);
std::string iceoryx_get_service_name(const rosidl_service_type_support_t * type_supports);

std::string iceoryx_get_message_namespace(const rosidl_message_type_support_t * type_supports);
std::string iceoryx_get_service_namespace(const rosidl_service_type_support_t * type_supports);

void iceoryx_init_message(
const rosidl_message_type_support_t * type_supports,
Expand Down
2 changes: 1 addition & 1 deletion rmw_iceoryx_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>rmw_iceoryx_cpp</name>
<version>1.0.1</version>
<version>2.0.3</version>
<description>rmw implementation for Bosch's zero copy middleware iceoryx</description>
<maintainer email="simon.hoinkis@apex.ai">Simon Hoinkis</maintainer>
<license>Apache License 2.0</license>
Expand Down
39 changes: 38 additions & 1 deletion rmw_iceoryx_cpp/src/internal/iceoryx_deserialize.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
// Copyright (c) 2021 - 2023 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@

#include "rosidl_typesupport_introspection_c/identifier.h"
#include "rosidl_typesupport_introspection_c/message_introspection.h"
#include "rosidl_typesupport_introspection_c/service_introspection.h"

#include "rosidl_typesupport_introspection_cpp/identifier.hpp"
#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
Expand Down Expand Up @@ -50,4 +51,40 @@ void deserialize(
}
}

void deserializeRequest(
const char * serialized_msg,
const rosidl_service_type_support_t * type_supports,
void * ros_message)
{
auto ts = get_type_support(type_supports);

if (ts.first == TypeSupportLanguage::CPP) {
auto members_cpp =
static_cast<const rosidl_typesupport_introspection_cpp::ServiceMembers *>(ts.second->data);
rmw_iceoryx_cpp::details_cpp::deserializeRequest(serialized_msg, members_cpp, ros_message);
} else if (ts.first == TypeSupportLanguage::C) {
auto members_c =
static_cast<const rosidl_typesupport_introspection_c__ServiceMembers *>(ts.second->data);
rmw_iceoryx_cpp::details_c::deserializeRequest(serialized_msg, members_c, ros_message);
}
}

void deserializeResponse(
const char * serialized_msg,
const rosidl_service_type_support_t * type_supports,
void * ros_message)
{
auto ts = get_type_support(type_supports);

if (ts.first == TypeSupportLanguage::CPP) {
auto members_cpp =
static_cast<const rosidl_typesupport_introspection_cpp::ServiceMembers *>(ts.second->data);
rmw_iceoryx_cpp::details_cpp::deserializeResponse(serialized_msg, members_cpp, ros_message);
} else if (ts.first == TypeSupportLanguage::C) {
auto members_c =
static_cast<const rosidl_typesupport_introspection_c__ServiceMembers *>(ts.second->data);
rmw_iceoryx_cpp::details_c::deserializeResponse(serialized_msg, members_c, ros_message);
}
}

} // namespace rmw_iceoryx_cpp
18 changes: 18 additions & 0 deletions rmw_iceoryx_cpp/src/internal/iceoryx_deserialize_typesupport_c.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +28,7 @@

#include "rosidl_typesupport_introspection_c/field_types.h"
#include "rosidl_typesupport_introspection_c/message_introspection.h"
#include "rosidl_typesupport_introspection_c/service_introspection.h"

#include "./iceoryx_serialization_common.hpp"

Expand Down Expand Up @@ -239,6 +241,22 @@ const char * deserialize(
return serialized_msg;
}

const char * deserializeResponse(
const char * serialized_msg,
const rosidl_typesupport_introspection_c__ServiceMembers * service_members,
void * ros_message)
{
return deserialize(serialized_msg, service_members->response_members_, ros_message);
}

const char * deserializeRequest(
const char * serialized_msg,
const rosidl_typesupport_introspection_c__ServiceMembers * service_members,
void * ros_message)
{
return deserialize(serialized_msg, service_members->request_members_, ros_message);
}

} // namespace details_c
} // namespace rmw_iceoryx_cpp
#endif // INTERNAL__ICEORYX_DESERIALIZE_TYPESUPPORT_C_HPP_
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -24,7 +25,7 @@
#include <vector>

#include "rosidl_typesupport_introspection_cpp/field_types.hpp"
#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
#include "rosidl_typesupport_introspection_cpp/service_introspection.hpp"

#include "./iceoryx_serialization_common.hpp"

Expand Down Expand Up @@ -309,6 +310,22 @@ const char * deserialize(
return serialized_msg;
}

const char * deserializeResponse(
const char * serialized_msg,
const rosidl_typesupport_introspection_cpp::ServiceMembers * service_members,
void * ros_message)
{
return deserialize(serialized_msg, service_members->response_members_, ros_message);
}

const char * deserializeRequest(
const char * serialized_msg,
const rosidl_typesupport_introspection_cpp::ServiceMembers * service_members,
void * ros_message)
{
return deserialize(serialized_msg, service_members->request_members_, ros_message);
}

} // namespace details_cpp
} // namespace rmw_iceoryx_cpp
#endif // INTERNAL__ICEORYX_DESERIALIZE_TYPESUPPORT_CPP_HPP_
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2021 by ZhenshengLee. All rights reserved.
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -117,7 +118,7 @@ fill_rmw_publisher_end_info(

int i = 0;
// store all data in rmw_topic_endpoint_info_array_t
for (const auto node_full_name : full_name_array) {
for (const auto & node_full_name : full_name_array) {
auto name_n_space = get_name_n_space_from_node_full_name(node_full_name);
auto rmw_topic_endpoint_info = rmw_get_zero_initialized_topic_endpoint_info();
// duplicate and store the topic_name
Expand Down Expand Up @@ -204,7 +205,7 @@ fill_rmw_subscriber_end_info(

int i = 0;
// store all data in rmw_topic_endpoint_info_array_t
for (const auto node_full_name : full_name_array) {
for (const auto & node_full_name : full_name_array) {
auto name_n_space = get_name_n_space_from_node_full_name(node_full_name);
auto rmw_topic_endpoint_info = rmw_get_zero_initialized_topic_endpoint_info();
// duplicate and store the topic_name
Expand Down
Loading

0 comments on commit 91080ff

Please sign in to comment.