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

fix composable node convert multithreaded executor #13

Merged
merged 2 commits into from
Mar 16, 2023
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
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ endif()
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

ament_auto_add_library(cargo_loading_service SHARED
ament_auto_add_executable(cargo_loading_service
src/cargo_loading_service.cpp
src/cargo_loading_service_node.cpp
)

rclcpp_components_register_node(cargo_loading_service
PLUGIN "cargo_loading_service::CargoLoadingService"
EXECUTABLE cargo_loading_service_node)

ament_auto_package(INSTALL_TO_SHARE
launch
)
47 changes: 0 additions & 47 deletions launch/cargo_loading_service.launch.py

This file was deleted.

20 changes: 20 additions & 0 deletions launch/cargo_loading_service.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Copyright 2023 Tier IV, 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.
-->

<launch>
<node pkg="cargo_loading_service" exec="cargo_loading_service" name="cargo_loading_service" output="screen">
</node>
</launch>
4 changes: 0 additions & 4 deletions src/cargo_loading_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,3 @@ void CargoLoadingService::onInfrastructureStatus(const InfrastructureStateArray:
this->get_logger(), "InfrastructureStatus: %s", rosidl_generator_traits::to_yaml(*msg).c_str());
}
} // namespace cargo_loading_service

#include "rclcpp_components/register_node_macro.hpp"

RCLCPP_COMPONENTS_REGISTER_NODE(cargo_loading_service::CargoLoadingService)
32 changes: 32 additions & 0 deletions src/cargo_loading_service_node.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2023 Tier IV, 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 <memory>

#include "cargo_loading_service/cargo_loading_service.hpp"

int main(int argc, char * argv[])
{
rclcpp::NodeOptions options = rclcpp::NodeOptions();
rclcpp::ExecutorOptions exe_options = rclcpp::ExecutorOptions();

rclcpp::init(argc, argv);
auto node = std::make_shared<cargo_loading_service::CargoLoadingService>(options);
auto executor = std::make_shared<rclcpp::executors::MultiThreadedExecutor>(exe_options, 2);
executor->add_node(node);
executor->spin();
rclcpp::shutdown();

return 0;
}