Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adaptations for iceoryx #70 #14

Merged
merged 1 commit into from
Mar 25, 2020
Merged
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
6 changes: 4 additions & 2 deletions iceoryx_ros2_bridge/src/iceoryx_ros2_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ int main(int argc, char ** argv)

auto service_desc =
rmw_iceoryx_cpp::get_iceoryx_service_description(topic, ts);
iceoryx_pubs.emplace_back(std::make_shared<iox::popo::Publisher>(service_desc, node_name));
iceoryx_pubs.emplace_back(std::make_shared<iox::popo::Publisher>(
service_desc, iox::cxx::CString100(iox::cxx::TruncateToCapacity, node_name)));
iceoryx_pubs.back()->offer();

std::function<void(std::shared_ptr<rmw_serialized_message_t>)> cb =
Expand Down Expand Up @@ -268,7 +269,8 @@ int main(int argc, char ** argv)

auto service_desc =
rmw_iceoryx_cpp::get_iceoryx_service_description(topic, ts);
iceoryx_subs.emplace_back(std::make_shared<iox::popo::Subscriber>(service_desc, node_name));
iceoryx_subs.emplace_back(std::make_shared<iox::popo::Subscriber>(
service_desc, iox::cxx::CString100(iox::cxx::TruncateToCapacity, node_name)));
iceoryx_subs.back()->subscribe(10); // TODO(karsten1987): find a decent queue size

auto cb =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <tuple>

#include "iceoryx_posh/capro/service_description.hpp"
#include "iceoryx_utils/cxx/string.hpp"

class rosidl_message_type_support_t;

Expand Down
7 changes: 4 additions & 3 deletions rmw_iceoryx_cpp/src/internal/iceoryx_name_conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ get_iceoryx_service_description(
type_name = package_name + "/" + type_name;

auto serviceDescriptionTuple = get_service_description_elements(topic_name, type_name);

return iox::capro::ServiceDescription(
std::get<0>(serviceDescriptionTuple),
std::get<1>(serviceDescriptionTuple),
std::get<2>(serviceDescriptionTuple));
iox::capro::IdString(iox::cxx::TruncateToCapacity, std::get<0>(serviceDescriptionTuple)),
iox::capro::IdString(iox::cxx::TruncateToCapacity, std::get<1>(serviceDescriptionTuple)),
iox::capro::IdString(iox::cxx::TruncateToCapacity, std::get<2>(serviceDescriptionTuple)));
}

} // namespace rmw_iceoryx_cpp
16 changes: 8 additions & 8 deletions rmw_iceoryx_cpp/src/internal/iceoryx_topic_names_and_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,23 @@ void fill_topic_containers(

for (auto & receiver : port_sample->m_receiverList) {
auto name_and_type = rmw_iceoryx_cpp::get_name_n_type_from_iceoryx_service_description(
std::string(receiver.m_caproServiceID.to_cstring()),
std::string(receiver.m_caproInstanceID.to_cstring()),
std::string(receiver.m_caproEventMethodID.to_cstring()));
std::string(receiver.m_caproServiceID.c_str()),
std::string(receiver.m_caproInstanceID.c_str()),
std::string(receiver.m_caproEventMethodID.c_str()));

names_n_types[std::get<0>(name_and_type)] = std::get<1>(name_and_type);
subscribers_topics[std::string(receiver.m_runnable.to_cstring())].push_back(
subscribers_topics[std::string(receiver.m_runnable.c_str())].push_back(
std::get<0>(
name_and_type));
}
for (auto & sender : port_sample->m_senderList) {
auto name_and_type = rmw_iceoryx_cpp::get_name_n_type_from_iceoryx_service_description(
std::string(sender.m_caproServiceID.to_cstring()),
std::string(sender.m_caproInstanceID.to_cstring()),
std::string(sender.m_caproEventMethodID.to_cstring()));
std::string(sender.m_caproServiceID.c_str()),
std::string(sender.m_caproInstanceID.c_str()),
std::string(sender.m_caproEventMethodID.c_str()));

names_n_types[std::get<0>(name_and_type)] = std::get<1>(name_and_type);
publishers_topics[std::string(sender.m_runnable.to_cstring())].push_back(
publishers_topics[std::string(sender.m_runnable.c_str())].push_back(
std::get<0>(
name_and_type));
}
Expand Down
3 changes: 2 additions & 1 deletion rmw_iceoryx_cpp/src/rmw_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ rmw_create_node(
}
RMW_TRY_PLACEMENT_NEW(
iceoryx_runnable, iceoryx_runnable,
goto fail, iox::runtime::Runnable, full_name);
goto fail, iox::runtime::Runnable,
iox::cxx::CString100(iox::cxx::TruncateToCapacity, full_name));

node_info = static_cast<IceoryxNodeInfo *>(rmw_allocate(sizeof(IceoryxNodeInfo)));
if (!node_info) {
Expand Down
2 changes: 1 addition & 1 deletion rmw_iceoryx_cpp/src/rmw_node_names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ rmw_get_node_names(
node_names_set.clear();
for (auto & process : process_sample->m_processList) {
for (auto & runnable : process.m_runnables) {
node_names_set.insert(std::string(runnable.to_cstring()));
node_names_set.insert(std::string(runnable.c_str()));
}
}
process_receiver.releaseChunk(latest_chunk_header);
Expand Down
3 changes: 2 additions & 1 deletion rmw_iceoryx_cpp/src/rmw_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ rmw_create_publisher(

RMW_TRY_PLACEMENT_NEW(
iceoryx_sender, iceoryx_sender,
goto fail, iox::popo::Publisher, service_description, node_full_name);
goto fail, iox::popo::Publisher, service_description,
iox::cxx::CString100(iox::cxx::TruncateToCapacity, node_full_name));
iceoryx_sender->offer(); // make the sender visible

// allocate iceoryx_publisher
Expand Down
3 changes: 2 additions & 1 deletion rmw_iceoryx_cpp/src/rmw_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ rmw_create_subscription(
}
RMW_TRY_PLACEMENT_NEW(
iceoryx_receiver, iceoryx_receiver, goto fail,
iox::popo::Subscriber, service_description, node_full_name)
iox::popo::Subscriber, service_description,
iox::cxx::CString100(iox::cxx::TruncateToCapacity, node_full_name))
// instant subscribe, queue size form qos settings
iceoryx_receiver->subscribe(qos_policies->depth);

Expand Down