Skip to content

Commit cfed5d6

Browse files
Use new Blueberry v2.0.3 feature request-response and its discovery (#84)
* Implement create and destroy methods for service and client (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Implement wrapper classes for client and server and add type introspection methods accordingly (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Update Readme (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Implement 'rmw_send_request', 'rmw_take_request' and 'rmw_take_response' (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Add fixed-size path for 'rmw_send_response' and 'rmw_take_response' (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Create server and client abstraction (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Fix 'is_fixed_size' for ROS 2 services (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Properly destroy services and clients and add serialization for services (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Fix typo leading to a segfault (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Attach servers and clients to waitset (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Remove debug prints and add de-serialization to 'rmw_send_response' (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Add missing remove-from-waitset part (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Do not send 'request_header' over user payload (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Properly save the sample in 'rwm_take_request' (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Fix lost responses issue (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Implement 'rmw_get_service_names_and_types' (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Format all the things (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Update CI and docs (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Add copyright notice to all touched files (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Fix cpplint warnings (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Update Ubuntu version to be able to build for humble (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Check request pointer for 'nullptr' (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Remove out-commented code and implement setting the GUID (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Move the code to inside the happy-path lambda for client server communication (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Use default alignment when loaning for request/response (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Remove sleeps in 'rmw_send_response' as fix will be in 'v2.0.3' release (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> * Update version number in package.xml (#76) Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai> --------- Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
1 parent b8d5472 commit cfed5d6

26 files changed

+1110
-84
lines changed

.github/workflows/custom_repos.repos

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Integration build rmw_iceoryx
33
on:
44
push:
55
branches:
6-
- master
6+
- humble
77
pull_request:
88

99
jobs:
@@ -12,18 +12,17 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
os: [ubuntu-20.04]
15+
os: [ubuntu-22.04]
1616
steps:
1717
- uses: actions/checkout@v2
1818
- name: Setup ROS
1919
uses: ros-tooling/setup-ros@master
20+
with:
21+
required-ros-distributions: humble
2022
- name: Install Iceoryx Dependencies
2123
run: sudo apt-get update && sudo apt-get install -y cmake libacl1-dev libncurses5-dev pkg-config
2224
- name: Build & Test
2325
uses: ros-tooling/action-ros-ci@master
2426
with:
2527
package-name: rmw_iceoryx_cpp
26-
target-ros2-distro: rolling
27-
vcs-repo-file-url: |
28-
https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos
29-
${{ github.workspace }}/.github/workflows/custom_repos.repos
28+
target-ros2-distro: humble

README.md

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,13 @@ To install rmw_iceoryx in a ROS 2 workspace with the latest ROS version, just ex
1515
```bash
1616
mkdir -p ~/iceoryx_ws/src
1717
cd $_
18-
# LATEST_ROS_VERSION could be e.g. galactic
18+
# LATEST_ROS_VERSION could be e.g. humble
1919
git clone --branch LATEST_ROS_VERSION https://github.com/ros2/rmw_iceoryx.git
2020
```
2121

2222
For alternative installation instructions and more details about iceoryx's internals, please see [iceoryx's GitHub repo](https://github.com/eclipse/iceoryx).
2323

2424
rmw_iceoryx is compatible with ROS 2 starting with Eloquent release.
25-
26-
If you want to use ROS 2 rolling, you need to checkout the `master` branch of both rmw_iceoryx and iceoryx:
27-
28-
```bash
29-
cd ~/iceoryx_ws/
30-
wget https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos
31-
# Change the line of Eclipse iceoryx to "version: master"
32-
vcs import src < ros2.repos
33-
34-
cd ~/iceoryx_ws/src
35-
git clone --branch master https://github.com/ros2/rmw_iceoryx.git
36-
```
37-
3825
Assuming you have ROS 2 installed correctly, you can compile the iceoryx workspace with colcon:
3926

4027
```bash
@@ -47,7 +34,7 @@ colcon build
4734
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
4835
```
4936

50-
That's it! You've installed rmw_iceoryx and are ready to rumble.
37+
That's it! You've installed iceoryx and are ready to rumble.
5138

5239
Working with rmw_iceoryx_cpp
5340
============================
@@ -154,8 +141,8 @@ Unfortunately, not all features are yet fully fleshed out.
154141
| `ros2 node list` | :heavy_check_mark: |
155142
| `ros2 node info` | :heavy_check_mark: |
156143
| `ros2 interface *` | :heavy_check_mark: |
157-
| `ros2 service *` | :x: (coming with iceoryx v2.0) |
158-
| `ros2 param list` | :x: (coming with iceoryx v2.0) |
144+
| `ros2 service *` | :heavy_check_mark: |
145+
| `ros2 param list` | :x: |
159146
| `rqt_graph` | :heavy_check_mark: |
160147
| `rqt_top` | :heavy_check_mark: |
161148
| `rqt_console` | :heavy_check_mark: |

rmw_iceoryx_cpp/include/rmw_iceoryx_cpp/iceoryx_deserialize.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2+
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
23
//
34
// Licensed under the Apache License, Version 2.0 (the "License");
45
// you may not use this file except in compliance with the License.
@@ -16,6 +17,7 @@
1617
#define RMW_ICEORYX_CPP__ICEORYX_DESERIALIZE_HPP_
1718

1819
struct rosidl_message_type_support_t;
20+
struct rosidl_service_type_support_t;
1921

2022
namespace rmw_iceoryx_cpp
2123
{
@@ -26,5 +28,15 @@ void deserialize(
2628
const rosidl_message_type_support_t * type_supports,
2729
void * ros_message);
2830

31+
void deserializeRequest(
32+
const char * serialized_msg,
33+
const rosidl_service_type_support_t * type_supports,
34+
void * ros_message);
35+
36+
void deserializeResponse(
37+
const char * serialized_msg,
38+
const rosidl_service_type_support_t * type_supports,
39+
void * ros_message);
40+
2941
} // namespace rmw_iceoryx_cpp
3042
#endif // RMW_ICEORYX_CPP__ICEORYX_DESERIALIZE_HPP_

rmw_iceoryx_cpp/include/rmw_iceoryx_cpp/iceoryx_name_conversion.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
22
// Copyright (c) 2021 by ZhenshengLee. All rights reserved.
3+
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
34
//
45
// Licensed under the Apache License, Version 2.0 (the "License");
56
// you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
2324
#include "iceoryx_hoofs/cxx/string.hpp"
2425

2526
struct rosidl_message_type_support_t;
27+
struct rosidl_service_type_support_t;
2628

2729
namespace rmw_iceoryx_cpp
2830
{
@@ -71,5 +73,10 @@ get_iceoryx_service_description(
7173
const std::string & topic,
7274
const rosidl_message_type_support_t * type_supports);
7375

76+
iox::capro::ServiceDescription
77+
get_iceoryx_service_description(
78+
const std::string & topic,
79+
const rosidl_service_type_support_t * type_supports);
80+
7481
} // namespace rmw_iceoryx_cpp
7582
#endif // RMW_ICEORYX_CPP__ICEORYX_NAME_CONVERSION_HPP_

rmw_iceoryx_cpp/include/rmw_iceoryx_cpp/iceoryx_serialize.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2+
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
23
//
34
// Licensed under the Apache License, Version 2.0 (the "License");
45
// you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
1819
#include <vector>
1920

2021
struct rosidl_message_type_support_t;
22+
struct rosidl_service_type_support_t;
2123

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

32+
void serializeRequest(
33+
const void * ros_message,
34+
const rosidl_service_type_support_t * type_supports,
35+
std::vector<char> & payload_vector);
36+
37+
void serializeResponse(
38+
const void * ros_message,
39+
const rosidl_service_type_support_t * type_supports,
40+
std::vector<char> & payload_vector);
41+
3042
} // namespace rmw_iceoryx_cpp
3143
#endif // RMW_ICEORYX_CPP__ICEORYX_SERIALIZE_HPP_

rmw_iceoryx_cpp/include/rmw_iceoryx_cpp/iceoryx_topic_names_and_types.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2+
// Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
23
//
34
// Licensed under the Apache License, Version 2.0 (the "License");
45
// you may not use this file except in compliance with the License.
@@ -35,6 +36,7 @@ void fill_topic_containers(
3536
std::map<std::string, std::vector<std::string>> & topic_publishers_);
3637

3738
std::map<std::string, std::string> get_topic_names_and_types();
39+
std::map<std::string, std::string> get_service_names_and_types();
3840

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

rmw_iceoryx_cpp/include/rmw_iceoryx_cpp/iceoryx_type_info_introspection.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2-
// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
2+
// Copyright (c) 2021 - 2023 by Apex.AI Inc. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
2020
#include <utility>
2121

2222
struct rosidl_message_type_support_t;
23+
struct rosidl_service_type_support_t;
2324

2425
namespace rmw_iceoryx_cpp
2526
{
@@ -35,15 +36,26 @@ enum class TypeSupportLanguage
3536
const std::pair<TypeSupportLanguage, const rosidl_message_type_support_t *> get_type_support(
3637
const rosidl_message_type_support_t * type_supports);
3738

39+
/// @brief Wraps get_service_typesupport_handle() and does error handling
40+
/// @return std::pair containing enum TypeSupportLanguage and handle to the type support
41+
const std::pair<TypeSupportLanguage, const rosidl_service_type_support_t *> get_type_support(
42+
const rosidl_service_type_support_t * type_supports);
43+
3844
bool iceoryx_is_fixed_size(const rosidl_message_type_support_t * type_supports);
45+
bool iceoryx_is_fixed_size(const rosidl_service_type_support_t * type_supports);
3946

4047
bool iceoryx_is_valid_type_support(const rosidl_message_type_support_t * type_supports);
48+
bool iceoryx_is_valid_type_support(const rosidl_service_type_support_t * type_supports);
4149

4250
size_t iceoryx_get_message_size(const rosidl_message_type_support_t * type_supports);
51+
size_t iceoryx_get_request_size(const rosidl_service_type_support_t * type_supports);
52+
size_t iceoryx_get_response_size(const rosidl_service_type_support_t * type_supports);
4353

4454
std::string iceoryx_get_message_name(const rosidl_message_type_support_t * type_supports);
55+
std::string iceoryx_get_service_name(const rosidl_service_type_support_t * type_supports);
4556

4657
std::string iceoryx_get_message_namespace(const rosidl_message_type_support_t * type_supports);
58+
std::string iceoryx_get_service_namespace(const rosidl_service_type_support_t * type_supports);
4759

4860
void iceoryx_init_message(
4961
const rosidl_message_type_support_t * type_supports,

rmw_iceoryx_cpp/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="2">
44
<name>rmw_iceoryx_cpp</name>
5-
<version>1.0.1</version>
5+
<version>2.0.3</version>
66
<description>rmw implementation for Bosch's zero copy middleware iceoryx</description>
77
<maintainer email="karsten.knese@us.bosch.com">Karsten Knese</maintainer>
88
<license>Apache License 2.0</license>

rmw_iceoryx_cpp/src/internal/iceoryx_deserialize.cpp

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2-
// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
2+
// Copyright (c) 2021 - 2023 by Apex.AI Inc. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
1717

1818
#include "rosidl_typesupport_introspection_c/identifier.h"
1919
#include "rosidl_typesupport_introspection_c/message_introspection.h"
20+
#include "rosidl_typesupport_introspection_c/service_introspection.h"
2021

2122
#include "rosidl_typesupport_introspection_cpp/identifier.hpp"
2223
#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
@@ -50,4 +51,40 @@ void deserialize(
5051
}
5152
}
5253

54+
void deserializeRequest(
55+
const char * serialized_msg,
56+
const rosidl_service_type_support_t * type_supports,
57+
void * ros_message)
58+
{
59+
auto ts = get_type_support(type_supports);
60+
61+
if (ts.first == TypeSupportLanguage::CPP) {
62+
auto members_cpp =
63+
static_cast<const rosidl_typesupport_introspection_cpp::ServiceMembers *>(ts.second->data);
64+
rmw_iceoryx_cpp::details_cpp::deserializeRequest(serialized_msg, members_cpp, ros_message);
65+
} else if (ts.first == TypeSupportLanguage::C) {
66+
auto members_c =
67+
static_cast<const rosidl_typesupport_introspection_c__ServiceMembers *>(ts.second->data);
68+
rmw_iceoryx_cpp::details_c::deserializeRequest(serialized_msg, members_c, ros_message);
69+
}
70+
}
71+
72+
void deserializeResponse(
73+
const char * serialized_msg,
74+
const rosidl_service_type_support_t * type_supports,
75+
void * ros_message)
76+
{
77+
auto ts = get_type_support(type_supports);
78+
79+
if (ts.first == TypeSupportLanguage::CPP) {
80+
auto members_cpp =
81+
static_cast<const rosidl_typesupport_introspection_cpp::ServiceMembers *>(ts.second->data);
82+
rmw_iceoryx_cpp::details_cpp::deserializeResponse(serialized_msg, members_cpp, ros_message);
83+
} else if (ts.first == TypeSupportLanguage::C) {
84+
auto members_c =
85+
static_cast<const rosidl_typesupport_introspection_c__ServiceMembers *>(ts.second->data);
86+
rmw_iceoryx_cpp::details_c::deserializeResponse(serialized_msg, members_c, ros_message);
87+
}
88+
}
89+
5390
} // namespace rmw_iceoryx_cpp

0 commit comments

Comments
 (0)