-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add velocity based polygon #3708
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 36 commits into
ros-navigation:main
from
kaichie:add_polygon_velocity
Feb 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
a2622f7
add velocity based polygon
kaichie ac4045f
fix header, copyright and variable name change
kaichie 763b432
optimise polygon update
kaichie 489392a
optimise duplicated code with setPolygonShape
kaichie 727060c
add warning log for uncovered speed
kaichie 3d9e979
Merge remote-tracking branch 'upstream/main' into add_polygon_velocity
kaichie 50fd22c
update feedback
kaichie b6a05e2
rename polygon velocity to velocity polygon
kaichie b0a1093
cleanup
kaichie f1de5f9
fix typo
kaichie 43c28d0
add dynamic support for velocity polygon
kaichie c2098b6
Merge remote-tracking branch 'upstream/main' into add_polygon_velocity
kaichie f6b2b19
wrap try catch for getting parameters
kaichie 7f9f55a
update naming and linting
kaichie 1230ede
use switch case
kaichie cd1af8a
Revert "use switch case"
kaichie 2c4181e
fix proper return for invalid parameters
kaichie 400d45e
remove topic parameter for velocity polygon
kaichie b97cbb7
fix formatting manually
kaichie 5dc403b
continue if points are not defined
kaichie 3db0146
Merge branch 'main' into add_polygon_velocity
kaichie 8491ed4
Merge branch 'main' into add_polygon_velocity
kaichie a5c48a7
Merge branch 'main' into add_polygon_velocity
kaichie abab066
rewrite velocity polygon with polygon base class
kaichie 620c7c2
update review comments and description
kaichie 898d8c0
add VelocityPolygon to detector node
kaichie 940225c
review update
kaichie 0a7fe8c
fix cpplint
kaichie 680f7ca
Merge remote-tracking branch 'upstream/main' into add_polygon_velocity
kaichie 5c5d184
Update nav2_collision_monitor/src/velocity_polygon.cpp
kaichie 49d7b71
add velocity polygon tests
kaichie ee69105
fix cpplint
kaichie 10d59e1
add in-line comment
kaichie bbcb930
fix push back
kaichie df2cb95
minor change and update README
kaichie e150e85
update README
kaichie 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
103 changes: 103 additions & 0 deletions
103
nav2_collision_monitor/include/nav2_collision_monitor/polygon_velocity.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,103 @@ | ||
| // Copyright (c) 2022 Samsung R&D Institute Russia | ||
kaichie marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // | ||
| // 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 NAV2_COLLISION_MONITOR__POLYGON_VELOCITY_HPP_ | ||
| #define NAV2_COLLISION_MONITOR__POLYGON_VELOCITY_HPP_ | ||
|
|
||
| #include <memory> | ||
kaichie marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include "rclcpp/rclcpp.hpp" | ||
|
|
||
| #include "nav2_collision_monitor/types.hpp" | ||
|
|
||
| namespace nav2_collision_monitor | ||
| { | ||
|
|
||
| /** | ||
| * @brief Polygon velocity class. | ||
| * This class contains all the points of the polygon and | ||
| * the expected condition of the velocity based polygon. | ||
| */ | ||
| class PolygonVelocity | ||
SteveMacenski marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| public: | ||
| /** | ||
| * @brief PolygonVelocity constructor | ||
| * @param poly Points of the polygon | ||
| * @param polygon_name Name of polygon | ||
| * @param linear_max Maximum twist linear velocity | ||
| * @param linear_min Minimum twist linear velocity | ||
| * @param direction_max Maximum twist direction angle | ||
| * @param direction_min Minimum twist direction angle | ||
| * @param theta_max Maximum twist rotational speed | ||
| * @param theta_min Minimum twist rotational speed | ||
| */ | ||
| PolygonVelocity( | ||
| const std::vector<Point> & poly, | ||
| const std::string & polygon_name, | ||
| const double & linear_max, | ||
| const double & linear_min, | ||
| const double & direction_max, | ||
| const double & direction_min, | ||
| const double & theta_max, | ||
| const double & theta_min); | ||
| /** | ||
| * @brief PolygonVelocity destructor | ||
| */ | ||
| virtual ~PolygonVelocity(); | ||
|
|
||
| /** | ||
| * @brief Check if the velocities and direction is in expected range. | ||
| * @param cmd_vel_in Robot twist command input | ||
| * @return True if speed and direction is within the condition | ||
| */ | ||
| bool isInRange(const Velocity & cmd_vel_in); | ||
|
|
||
| /** | ||
| * @brief Check if the velocities and direction is in expected range. | ||
| * @param cmd_vel_in Robot twist command input | ||
| * @return True if speed and direction is within the condition | ||
| */ | ||
| std::vector<Point> getPolygon(); | ||
|
|
||
| protected: | ||
| // ----- Variables ----- | ||
|
|
||
| /// @brief Collision monitor node logger stored for further usage | ||
| rclcpp::Logger logger_{rclcpp::get_logger("collision_monitor")}; | ||
|
|
||
| // Basic parameters | ||
| /// @brief Points of the polygon | ||
| std::vector<Point> poly_; | ||
| /// @brief Name of polygon | ||
| std::string polygon_name_; | ||
| /// @brief Maximum twist linear velocity | ||
| double linear_max_; | ||
| /// @brief Minimum twist linear velocity | ||
| double linear_min_; | ||
| /// @brief Maximum twist direction angle | ||
| double direction_max_; | ||
| /// @brief Minimum twist direction angle | ||
| double direction_min_; | ||
| /// @brief Maximum twist rotational speed | ||
| double theta_max_; | ||
| /// @brief Minimum twist rotational speed | ||
| double theta_min_; | ||
| }; // class PolygonVelocity | ||
|
|
||
| } // namespace nav2_collision_monitor | ||
|
|
||
| #endif // NAV2_COLLISION_MONITOR__POLYGON_VELOCITY_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
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
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.