-
Notifications
You must be signed in to change notification settings - Fork 190
[ros2component] Add tests for ros2component #390
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
Open
BMarchi
wants to merge
9
commits into
rolling
Choose a base branch
from
BMarchi/add_test_for_ros2component
base: rolling
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fee00b5
Add tests for ros2component
BMarchi c848cd2
Add missing dependencies
BMarchi 2bff91b
Make use of the composition package and separate verbs in different t…
BMarchi 9c2dda2
Add examples repository for ros2component
BMarchi f1c21f3
Address PR comments
BMarchi 3a440c4
Modify talker
BMarchi 03f74e6
Increase retries for list and improve load verb test
BMarchi 1b0461a
Improve unload verb test
BMarchi e0b2e92
Address PR comments
BMarchi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| cmake_minimum_required(VERSION 3.5) | ||
|
|
||
| project(ros2component_fixtures) | ||
BMarchi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Default to C++14 | ||
| if(NOT CMAKE_CXX_STANDARD) | ||
| set(CMAKE_CXX_STANDARD 14) | ||
| endif() | ||
|
|
||
| if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| add_compile_options(-Wall -Wextra -Wpedantic) | ||
| endif() | ||
|
|
||
| find_package(ament_cmake REQUIRED) | ||
| find_package(rclcpp REQUIRED) | ||
| find_package(rclcpp_components REQUIRED) | ||
| find_package(std_msgs REQUIRED) | ||
|
|
||
| include_directories(include) | ||
|
|
||
| # create ament index resource which references the libraries in the binary dir | ||
| set(node_plugins "") | ||
|
|
||
| add_library(talker_component SHARED | ||
| src/talker_component.cpp) | ||
BMarchi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| target_compile_definitions(talker_component | ||
| PRIVATE "ROS2COMPONENT_FIXTURES_BUILDING_DLL") | ||
| ament_target_dependencies(talker_component | ||
| "rclcpp" | ||
| "rclcpp_components" | ||
| "std_msgs") | ||
| rclcpp_components_register_nodes(talker_component "ros2component_fixtures::Talker") | ||
| set(node_plugins "${node_plugins}ros2component_fixtures::Talker;$<TARGET_FILE:talker_component>\n") | ||
|
|
||
| add_library(listener_component SHARED | ||
| src/listener_component.cpp) | ||
BMarchi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| target_compile_definitions(listener_component | ||
| PRIVATE "ROS2COMPONENT_FIXTURES_BUILDING_DLL") | ||
| ament_target_dependencies(listener_component | ||
| "rclcpp" | ||
| "rclcpp_components" | ||
| "std_msgs") | ||
| rclcpp_components_register_nodes(listener_component "ros2component_fixtures::Listener") | ||
| set(node_plugins "${node_plugins}ros2component_fixtures::Listener;$<TARGET_FILE:listener_component>\n") | ||
BMarchi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # since the package installs libraries without exporting them | ||
| # it needs to make sure that the library path is being exported | ||
| if(NOT WIN32) | ||
| ament_environment_hooks( | ||
| "${ament_cmake_package_templates_ENVIRONMENT_HOOK_LIBRARY_PATH}") | ||
| endif() | ||
|
|
||
| install(TARGETS | ||
| talker_component | ||
| listener_component | ||
| ARCHIVE DESTINATION lib | ||
| LIBRARY DESTINATION lib | ||
| RUNTIME DESTINATION bin) | ||
|
|
||
| ament_package() | ||
37 changes: 37 additions & 0 deletions
37
ros2component_fixtures/include/ros2component_fixtures/listener_component.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // Copyright 2019 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 ROS2COMPONENT_FIXTURES__LISTENER_COMPONENT_HPP_ | ||
| #define ROS2COMPONENT_FIXTURES__LISTENER_COMPONENT_HPP_ | ||
|
|
||
| #include "ros2component_fixtures/visibility_control.h" | ||
| #include "rclcpp/rclcpp.hpp" | ||
| #include "std_msgs/msg/string.hpp" | ||
|
|
||
| namespace ros2component_fixtures | ||
| { | ||
|
|
||
| class Listener : public rclcpp::Node | ||
| { | ||
| public: | ||
| ROS2COMPONENT_FIXTURES_PUBLIC | ||
| explicit Listener(const rclcpp::NodeOptions & options); | ||
|
|
||
| private: | ||
| rclcpp::Subscription<std_msgs::msg::String>::SharedPtr sub_; | ||
| }; | ||
|
|
||
| } // namespace ros2component_fixtures | ||
|
|
||
| #endif // ROS2COMPONENT_FIXTURES__LISTENER_COMPONENT_HPP_ |
42 changes: 42 additions & 0 deletions
42
ros2component_fixtures/include/ros2component_fixtures/talker_component.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright 2019 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 ROS2COMPONENT_FIXTURES__TALKER_COMPONENT_HPP_ | ||
| #define ROS2COMPONENT_FIXTURES__TALKER_COMPONENT_HPP_ | ||
|
|
||
| #include "ros2component_fixtures/visibility_control.h" | ||
| #include "rclcpp/rclcpp.hpp" | ||
| #include "std_msgs/msg/string.hpp" | ||
|
|
||
| namespace ros2component_fixtures | ||
| { | ||
|
|
||
| class Talker : public rclcpp::Node | ||
| { | ||
| public: | ||
| ROS2COMPONENT_FIXTURES_PUBLIC | ||
| explicit Talker(const rclcpp::NodeOptions & options); | ||
|
|
||
| protected: | ||
| void on_timer(); | ||
|
|
||
| private: | ||
| size_t count_; | ||
| rclcpp::Publisher<std_msgs::msg::String>::SharedPtr pub_; | ||
| rclcpp::TimerBase::SharedPtr timer_; | ||
| }; | ||
|
|
||
| } // namespace ros2component_fixtures | ||
|
|
||
| #endif // ROS2COMPONENT_FIXTURES__TALKER_COMPONENT_HPP_ |
58 changes: 58 additions & 0 deletions
58
ros2component_fixtures/include/ros2component_fixtures/visibility_control.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // Copyright 2019 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 ROS2COMPONENT_FIXTURES__VISIBILITY_CONTROL_H_ | ||
| #define ROS2COMPONENT_FIXTURES__VISIBILITY_CONTROL_H_ | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" | ||
| { | ||
| #endif | ||
|
|
||
| // This logic was borrowed (then namespaced) from the examples on the gcc wiki: | ||
| // https://gcc.gnu.org/wiki/Visibility | ||
|
|
||
| #if defined _WIN32 || defined __CYGWIN__ | ||
| #ifdef __GNUC__ | ||
| #define ROS2COMPONENT_FIXTURES_EXPORT __attribute__ ((dllexport)) | ||
| #define ROS2COMPONENT_FIXTURES_IMPORT __attribute__ ((dllimport)) | ||
| #else | ||
| #define ROS2COMPONENT_FIXTURES_EXPORT __declspec(dllexport) | ||
| #define ROS2COMPONENT_FIXTURES_IMPORT __declspec(dllimport) | ||
| #endif | ||
| #ifdef ROS2COMPONENT_FIXTURES_BUILDING_DLL | ||
| #define ROS2COMPONENT_FIXTURES_PUBLIC ROS2COMPONENT_FIXTURES_EXPORT | ||
| #else | ||
| #define ROS2COMPONENT_FIXTURES_PUBLIC ROS2COMPONENT_FIXTURES_IMPORT | ||
| #endif | ||
| #define ROS2COMPONENT_FIXTURES_PUBLIC_TYPE ROS2COMPONENT_FIXTURES_PUBLIC | ||
| #define ROS2COMPONENT_FIXTURES_LOCAL | ||
| #else | ||
| #define ROS2COMPONENT_FIXTURES_EXPORT __attribute__ ((visibility("default"))) | ||
| #define ROS2COMPONENT_FIXTURES_IMPORT | ||
| #if __GNUC__ >= 4 | ||
| #define ROS2COMPONENT_FIXTURES_PUBLIC __attribute__ ((visibility("default"))) | ||
| #define ROS2COMPONENT_FIXTURES_LOCAL __attribute__ ((visibility("hidden"))) | ||
| #else | ||
| #define ROS2COMPONENT_FIXTURES_PUBLIC | ||
| #define ROS2COMPONENT_FIXTURES_LOCAL | ||
| #endif | ||
| #define ROS2COMPONENT_FIXTURES_PUBLIC_TYPE | ||
| #endif | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif // ROS2COMPONENT_FIXTURES__VISIBILITY_CONTROL_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <?xml version="1.0"?> | ||
| <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
| <package format="3"> | ||
| <name>ros2component_fixtures</name> | ||
| <version>0.1.0</version> | ||
| <description>Examples for ros2component cli</description> | ||
| <maintainer email="[email protected]">Dirk Thomas</maintainer> | ||
| <license>Apache License 2.0</license> | ||
|
|
||
| <buildtool_depend>ament_cmake</buildtool_depend> | ||
|
|
||
| <build_depend>rclcpp</build_depend> | ||
| <build_depend>rclcpp_components</build_depend> | ||
| <build_depend>std_msgs</build_depend> | ||
|
|
||
| <exec_depend>rclcpp</exec_depend> | ||
| <exec_depend>rclcpp_components</exec_depend> | ||
| <exec_depend>std_msgs</exec_depend> | ||
|
|
||
| <test_depend>ament_cmake_pytest</test_depend> | ||
| <test_depend>ament_lint_auto</test_depend> | ||
| <test_depend>ament_lint_common</test_depend> | ||
|
|
||
| <export> | ||
| <build_type>ament_cmake</build_type> | ||
| </export> | ||
| </package> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.