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

Break tus #191

Closed
wants to merge 3 commits into from
Closed
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
29 changes: 27 additions & 2 deletions ros_ign_bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,36 @@ endif()

catkin_package()

include_directories(include ${catkin_INCLUDE_DIRS})
include_directories(include src ${catkin_INCLUDE_DIRS})

set(common_sources
src/convert.cpp
src/factories.cpp
src/convert/frame_id.cpp
src/convert/geometry_msgs.cpp
src/convert/nav_msgs.cpp
src/convert/rosgraph_msgs.cpp
src/convert/sensor_msgs.cpp
src/convert/std_msgs.cpp
src/convert/visualization_msgs.cpp
src/factories/geometry_msgs.cpp
src/factories/nav_msgs.cpp
src/factories/rosgraph_msgs.cpp
src/factories/sensor_msgs.cpp
src/factories/std_msgs.cpp
src/factories/visualization_msgs.cpp
)

set(bridge_lib
ros_ign_bridge_lib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI isn't happy

CMake Error at CMakeLists.txt:99 (add_library):
  add_library cannot create target "ros_ign_bridge_lib" because another
  target with the same name already exists.  The existing target is a shared
  library created in source directory

)

add_library(${bridge_lib}
${common_sources}
)
target_link_libraries(${bridge_lib}
${catkin_LIBRARIES}
ignition-msgs${IGN_MSGS_VER}::core
ignition-transport${IGN_TRANSPORT_VER}::core
)

set(bridge_lib
Expand Down
56 changes: 56 additions & 0 deletions ros_ign_bridge/src/convert/frame_id.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2021 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "convert/frame_id.hpp"

namespace ros_ign_bridge
{
// This can be used to replace `::` with `/` to make frame_id compatible with TF
std::string replace_delimiter(const std::string &input,
const std::string &old_delim,
const std::string new_delim)
{
std::string output;
output.reserve(input.size());

std::size_t last_pos = 0;

while (last_pos < input.size())
{
std::size_t pos = input.find(old_delim, last_pos);
output += input.substr(last_pos, pos - last_pos);
if (pos != std::string::npos)
{
output += new_delim;
pos += old_delim.size();
}

last_pos = pos;
}

return output;
}

// Frame id from ROS to ign is not supported right now
// std::string frame_id_ros_to_ign(const std::string &frame_id)
// {
// return replace_delimiter(frame_id, "/", "::");
// }

std::string frame_id_ign_to_ros(const std::string &frame_id)
{
return replace_delimiter(frame_id, "::", "/");
}

} // namespace ros_ign_bridge
36 changes: 36 additions & 0 deletions ros_ign_bridge/src/convert/frame_id.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2021 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef ROS_IGN_BRIDGE__CONVERT__FRAME_ID_HPP__
#define ROS_IGN_BRIDGE__CONVERT__FRAME_ID_HPP__

#include <string>

namespace ros_ign_bridge
{

// This can be used to replace `::` with `/` to make frame_id compatible with TF
std::string replace_delimiter(const std::string &input,
const std::string &old_delim,
const std::string new_delim);

// Frame id from ROS to ign is not supported right now
// std::string frame_id_ros_to_ign(const std::string &frame_id);

std::string frame_id_ign_to_ros(const std::string &frame_id);

} // namespace ros_ign_bridge

#endif // ROS_IGN_BRIDGE__CONVERT__FRAME_ID_HPP__

Loading