diff --git a/point_cloud_transport/CMakeLists.txt b/point_cloud_transport/CMakeLists.txt index 5b39026..c5c9fe2 100644 --- a/point_cloud_transport/CMakeLists.txt +++ b/point_cloud_transport/CMakeLists.txt @@ -72,18 +72,9 @@ target_include_directories(republish_node PUBLIC "$") rclcpp_components_register_nodes(republish_node "point_cloud_transport::Republisher") -add_executable(republish - src/republish_program.cpp - src/utilities/utilities.cpp -) -target_link_libraries(republish - ${PROJECT_NAME} - republish_node -) -ament_target_dependencies(republish - pluginlib - rclcpp_components - rclcpp +rclcpp_components_register_node(republish_node + PLUGIN "point_cloud_transport::Republisher" + EXECUTABLE republish ) # Build list_transports @@ -106,7 +97,6 @@ install(TARGETS ${PROJECT_NAME} EXPORT export_${PROJECT_NAME}) install( TARGETS list_transports - republish RUNTIME DESTINATION lib/${PROJECT_NAME} ) diff --git a/point_cloud_transport/src/republish_program.cpp b/point_cloud_transport/src/republish_program.cpp deleted file mode 100644 index bc1574b..0000000 --- a/point_cloud_transport/src/republish_program.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2023, Czech Technical University in Prague -// Copyright (c) 2019, paplhjak -// Copyright (c) 2009, Willow Garage, Inc. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// - -#include "point_cloud_transport/republish.hpp" - -#include - -#include "utilities/utilities.hpp" - -int main(int argc, char ** argv) -{ - std::vector args = rclcpp::init_and_remove_ros_arguments(argc, argv); - - // remove program name - args.erase(args.begin()); - - std::string in_transport{"raw"}; - std::string out_transport{""}; - - if (point_cloud_transport::has_option(args, "--in_transport")) { - in_transport = point_cloud_transport::get_option(args, "--in_transport"); - } - if (point_cloud_transport::has_option(args, "--out_transport")) { - out_transport = point_cloud_transport::get_option(args, "--out_transport"); - } - - rclcpp::NodeOptions options; - // override default parameters with the desired transform - options.parameter_overrides( - { - {"in_transport", in_transport}, - {"out_transport", out_transport}, - }); - - std::shared_ptr node; - - node = std::make_shared(options); - - rclcpp::spin(node); - - rclcpp::shutdown(); - - return 0; -} diff --git a/point_cloud_transport/src/utilities/utilities.cpp b/point_cloud_transport/src/utilities/utilities.cpp deleted file mode 100644 index 895f151..0000000 --- a/point_cloud_transport/src/utilities/utilities.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2023 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 "utilities.hpp" - -#include -#include - -namespace point_cloud_transport -{ -std::string get_option(const std::vector & args, const std::string & option_name) -{ - for (auto it = args.begin(), end = args.end(); it != end; ++it) { - if (*it == option_name) { - if (it + 1 != end) { - return *(it + 1); - } - } - } - - return ""; -} - -bool has_option(const std::vector & args, const std::string & option_name) -{ - for (auto it = args.begin(), end = args.end(); it != end; ++it) { - if (*it == option_name) { - return true; - } - } - - return false; -} -} // namespace point_cloud_transport diff --git a/point_cloud_transport/src/utilities/utilities.hpp b/point_cloud_transport/src/utilities/utilities.hpp deleted file mode 100644 index fb818bc..0000000 --- a/point_cloud_transport/src/utilities/utilities.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2023 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 UTILITIES__UTILITIES_HPP_ -#define UTILITIES__UTILITIES_HPP_ - -#include -#include - -namespace point_cloud_transport -{ -/// \brief Get the option from a list of arguments -/// \param[in] args List of arguments -/// \param[in] option name to extract -/// \return option value -std::string get_option(const std::vector & args, const std::string & option_name); - -/// \brief Is the option available in the list of arguments -/// \param[in] args List of arguments -/// \param[in] option name to extract -/// \return true if the option exists or false otherwise -bool has_option(const std::vector & args, const std::string & option_name); -} // namespace point_cloud_transport -#endif // UTILITIES__UTILITIES_HPP_