-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Move dwb goal/progress checker plugins to nav2_controller #1857
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
Merged
SteveMacenski
merged 9 commits into
ros-navigation:master
from
siddhya:controller_plugin
Jul 20, 2020
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d7979ee
Move dwb goal/progress checker plugins to nav2_controller
siddhya 2d466a8
Move goal/progress checker plugins to nav2_controller
siddhya 73197ad
Move goal/progress checker plugins to nav2_controller
siddhya e271cd8
Update bringup.yaml for new plugins in nav2_controller
siddhya 20ef7d5
Fix doc errors and update remaining yaml files
siddhya 6558ec8
Remove mention of goal_checker from dwb docs
siddhya 2dfc4b9
Add .plugin params to doc
siddhya 9d93bae
Tests for progress_checker plugin
siddhya 30740cf
Tweak plugin names/description in doc
siddhya 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| ament_add_gtest(pctest progress_checker.cpp) | ||
| target_link_libraries(pctest simple_progress_checker) | ||
| ament_add_gtest(gctest goal_checker.cpp) | ||
| target_link_libraries(gctest simple_goal_checker stopped_goal_checker) |
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,135 @@ | ||
| /* | ||
| * Software License Agreement (BSD License) | ||
| * | ||
| * Copyright (c) 2017, Locus Robotics | ||
| * All rights reserved. | ||
| * | ||
| * 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 <memory> | ||
| #include <string> | ||
|
|
||
| #include "gtest/gtest.h" | ||
| #include "nav2_controller/plugins/simple_progress_checker.hpp" | ||
| #include "nav_2d_utils/conversions.hpp" | ||
| #include "nav2_util/lifecycle_node.hpp" | ||
|
|
||
| using nav2_controller::SimpleProgressChecker; | ||
|
|
||
| class TestLifecycleNode : public nav2_util::LifecycleNode | ||
| { | ||
| public: | ||
| explicit TestLifecycleNode(const std::string & name) | ||
| : nav2_util::LifecycleNode(name) | ||
| { | ||
| } | ||
|
|
||
| nav2_util::CallbackReturn on_configure(const rclcpp_lifecycle::State &) | ||
| { | ||
| return nav2_util::CallbackReturn::SUCCESS; | ||
| } | ||
|
|
||
| nav2_util::CallbackReturn on_activate(const rclcpp_lifecycle::State &) | ||
| { | ||
| return nav2_util::CallbackReturn::SUCCESS; | ||
| } | ||
|
|
||
| nav2_util::CallbackReturn on_deactivate(const rclcpp_lifecycle::State &) | ||
| { | ||
| return nav2_util::CallbackReturn::SUCCESS; | ||
| } | ||
|
|
||
| nav2_util::CallbackReturn on_cleanup(const rclcpp_lifecycle::State &) | ||
| { | ||
| return nav2_util::CallbackReturn::SUCCESS; | ||
| } | ||
|
|
||
| nav2_util::CallbackReturn onShutdown(const rclcpp_lifecycle::State &) | ||
| { | ||
| return nav2_util::CallbackReturn::SUCCESS; | ||
| } | ||
|
|
||
| nav2_util::CallbackReturn onError(const rclcpp_lifecycle::State &) | ||
| { | ||
| return nav2_util::CallbackReturn::SUCCESS; | ||
| } | ||
| }; | ||
|
|
||
| void checkMacro( | ||
| nav2_core::ProgressChecker & pc, | ||
| double x0, double y0, | ||
| double x1, double y1, | ||
| int delay, | ||
| bool expected_result) | ||
| { | ||
| pc.reset(); | ||
| geometry_msgs::msg::PoseStamped pose0, pose1; | ||
| pose0.pose.position.x = x0; | ||
| pose0.pose.position.y = y0; | ||
| pose1.pose.position.x = x1; | ||
| pose1.pose.position.y = y1; | ||
| EXPECT_TRUE(pc.check(pose0)); | ||
| rclcpp::sleep_for(std::chrono::seconds(delay)); | ||
| if (expected_result) { | ||
| EXPECT_TRUE(pc.check(pose1)); | ||
| } else { | ||
| EXPECT_FALSE(pc.check(pose1)); | ||
| } | ||
| } | ||
|
|
||
| TEST(SimpleProgressChecker, progress_checker_reset) | ||
| { | ||
| auto x = std::make_shared<TestLifecycleNode>("progress_checker"); | ||
|
|
||
| nav2_core::ProgressChecker * pc = new SimpleProgressChecker; | ||
| pc->reset(); | ||
| delete pc; | ||
| EXPECT_TRUE(true); | ||
| } | ||
|
|
||
| TEST(SimpleProgressChecker, unit_tests) | ||
| { | ||
| auto x = std::make_shared<TestLifecycleNode>("progress_checker"); | ||
|
|
||
| SimpleProgressChecker pc; | ||
| pc.initialize(x, "nav2_controller"); | ||
| checkMacro(pc, 0, 0, 0, 0, 1, true); | ||
| checkMacro(pc, 0, 0, 1, 0, 1, true); | ||
| checkMacro(pc, 0, 0, 0, 1, 1, true); | ||
| checkMacro(pc, 0, 0, 1, 0, 11, true); | ||
| checkMacro(pc, 0, 0, 0, 1, 11, true); | ||
| checkMacro(pc, 0, 0, 0, 0, 11, false); | ||
| } | ||
|
|
||
| int main(int argc, char ** argv) | ||
| { | ||
| rclcpp::init(argc, argv); | ||
| testing::InitGoogleTest(&argc, argv); | ||
| return RUN_ALL_TESTS(); | ||
| } | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how the reset method is being tested. Also, do we need
EXPECT_TRUE(true);?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making sure it doesn't crash as the next test is dependent on it. EXPECT_TRUE is used as a convention for returning from TEST functions. I have based these tests on the already available goal_checker tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah alright, thanks for explaining it:)