-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Bound closest pose by costmap and turnaround point #2812
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
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
43c0f49
created integrated distance util
sathak93 602df8e
chng transform begin , end and always limit lp pt
sathak93 9df341c
chg trnsfm begin end and use euclidean distance
sathak93 3ad7986
linting fix
sathak93 132d085
linting fix
sathak93 d0c80e7
limit trnsfm to cusp
sathak93 106e10f
Merge branch 'main' of https://github.com/sathak93/navigation2 into p…
sathak93 a63bf16
remove print
sathak93 5f3baa6
linting fix
sathak93 3674943
lint fix
sathak93 9487dbb
hypot
sathak93 4a9f473
Merge pull request #1 from sathak93/path_segment_pr
Aposhian 6e5c45b
use direction change as upper bound for closest pose
Aposhian 0d5ff98
bound closest waypoint by direction change
Aposhian c3b744c
use max_transform_dist for closest_pose_upper_bound
Aposhian cc14180
remove first_element_beyond optimization todo
Aposhian 2bcbfd9
added path_utils for test path generation
Aposhian 175377e
initial test for path_utils
Aposhian 6a1da0b
added full failing test for path_utils
Aposhian 20c7edf
fixed path_utils segfault
Aposhian 11d3ddd
properly initialize straight transform
Aposhian f179622
fixed right turn infinite loop
Aposhian bebf697
fixed path_utils transforms for half-turns
Aposhian 4b788bd
all path_utils tests passing
Aposhian 2901642
added half turn test for path_utils
Aposhian fbcfd33
remove unused dependencies from test_path_utils
Aposhian e925749
move path_utils classes into path_building_blocks namespace
Aposhian edf088f
use hypot for euclidean_distance
Aposhian 77c88bf
rename findDirectionChange to findCusp
Aposhian 6e4c6cd
use integrated distance for lookahead distance
Aposhian 6d7f854
Revert "use integrated distance for lookahead distance"
Aposhian 80eeb3c
parameterize transformation_begin bound
Aposhian 4d32c0a
change default to a regular constant
Aposhian e8a1aa6
use std::hypot for x, y, z
Aposhian babb55f
initial failing test for transformGlobalPlan
Aposhian 4de99e7
refactor transform global plan into separate test fixture
Aposhian 279682b
make TransformGlobalPlan test fixture, and fix transforms
Aposhian 842d4e1
no_pruning_on_large_costmap test passing
Aposhian 8803c3d
added another transformGlobalPlan test
Aposhian 9f8bb38
added a test for all poses outside of costmap
Aposhian 74517ef
added good shortcut test for transformGlobalPlan
Aposhian 598e140
added more tests for rpp costmap pruning
Aposhian 0ed294f
cpplint
Aposhian bd00378
remove unused rclcpp::init and rclcpp::shutdown
Aposhian ca8c7b7
change default max_distance_between_iterations to max_costmap_extent
Aposhian 4ec587b
rename max_distance_between_iterations to max_robot_pose_search_dist
Aposhian 0c597b9
increase default dwb prune distance
Aposhian e2ce471
add initial docs for max_robot_pose_search_dist to README
Aposhian cd3ee1c
add note about when to set max_robot_pose_search_dist
Aposhian 842c66e
rename first_element_beyond to first_after_integrated_distance
Aposhian c614119
renamed findCusp to findVelocitySignChange
Aposhian a8ded84
move path_utils to RPP tests
Aposhian 4dae993
only check velocity sign change when reversing is enabled
Aposhian 88f2cc6
do not check cusp for dwb transformed plan end
Aposhian 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,15 @@ | ||
| # tests for regulated PP | ||
| ament_add_gtest(test_regulated_pp | ||
| test_regulated_pp.cpp | ||
| path_utils/path_utils.cpp | ||
| ) | ||
| ament_target_dependencies(test_regulated_pp | ||
| ${dependencies} | ||
| ) | ||
| target_link_libraries(test_regulated_pp | ||
| ${library_name} | ||
| ) | ||
|
|
||
| # Path utils test | ||
| ament_add_gtest(test_path_utils path_utils/test_path_utils.cpp path_utils/path_utils.cpp) | ||
| ament_target_dependencies(test_path_utils nav_msgs geometry_msgs) |
88 changes: 88 additions & 0 deletions
88
nav2_regulated_pure_pursuit_controller/test/path_utils/path_utils.cpp
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,88 @@ | ||
| // Copyright (c) 2022 Adam Aposhian | ||
| // | ||
| // 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 "path_utils.hpp" | ||
|
|
||
| #include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" | ||
|
|
||
| namespace path_utils | ||
| { | ||
|
|
||
| void append_transform_to_path( | ||
| nav_msgs::msg::Path & path, | ||
| tf2::Transform & relative_transform) | ||
| { | ||
| // Add a new empty pose | ||
| path.poses.emplace_back(); | ||
| // Get the previous, last pose (after the emplace_back so the reference isn't invalidated) | ||
| auto & previous_pose = *(path.poses.end() - 2); | ||
| auto & new_pose = path.poses.back(); | ||
|
|
||
| // get map_transform of previous_pose | ||
| tf2::Transform map_transform; | ||
| tf2::fromMsg(previous_pose.pose, map_transform); | ||
|
|
||
| tf2::Transform full_transform; | ||
| full_transform.mult(map_transform, relative_transform); | ||
|
|
||
| tf2::toMsg(full_transform, new_pose.pose); | ||
| new_pose.header.frame_id = previous_pose.header.frame_id; | ||
| } | ||
|
|
||
| void Straight::append(nav_msgs::msg::Path & path, double spacing) const | ||
| { | ||
| auto num_points = std::floor(length_ / spacing); | ||
| path.poses.reserve(path.poses.size() + num_points); | ||
| tf2::Transform translation(tf2::Quaternion::getIdentity(), tf2::Vector3(spacing, 0.0, 0.0)); | ||
| for (size_t i = 1; i <= num_points; ++i) { | ||
| append_transform_to_path(path, translation); | ||
| } | ||
| } | ||
|
|
||
| double chord_length(double radius, double radians) | ||
| { | ||
| return 2 * radius * sin(radians / 2); | ||
| } | ||
|
|
||
| void Arc::append(nav_msgs::msg::Path & path, double spacing) const | ||
| { | ||
| double length = radius_ * std::abs(radians_); | ||
| size_t num_points = std::floor(length / spacing); | ||
| double radians_per_step = radians_ / num_points; | ||
| tf2::Transform transform( | ||
| tf2::Quaternion(tf2::Vector3(0.0, 0.0, 1.0), radians_per_step), | ||
| tf2::Vector3(chord_length(radius_, std::abs(radians_per_step)), 0.0, 0.0)); | ||
| path.poses.reserve(path.poses.size() + num_points); | ||
| for (size_t i = 0; i < num_points; ++i) { | ||
| append_transform_to_path(path, transform); | ||
| } | ||
| } | ||
|
|
||
| nav_msgs::msg::Path generate_path( | ||
| geometry_msgs::msg::PoseStamped start, | ||
| double spacing, | ||
| std::initializer_list<std::unique_ptr<PathSegment>> segments) | ||
| { | ||
| nav_msgs::msg::Path path; | ||
| path.header = start.header; | ||
| path.poses.push_back(start); | ||
| for (const auto & segment : segments) { | ||
| segment->append(path, spacing); | ||
| } | ||
| return path; | ||
| } | ||
|
|
||
| } // namespace path_utils |
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.