-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Collision monitor #2982
Merged
SteveMacenski
merged 41 commits into
ros-navigation:main
from
AlexeyMerzlyakov:collision-monitor
Jul 20, 2022
Merged
Collision monitor #2982
Changes from 4 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
270191e
Add Collision Monitor node
AlexeyMerzlyakov ac87381
Meet review items
AlexeyMerzlyakov 9fd9d6a
Fix next review items
AlexeyMerzlyakov 8be2636
Code cleanup
AlexeyMerzlyakov e200b46
Support dynamic footprint. More optimizations.
AlexeyMerzlyakov 81337e3
Switch to multiple footprints. Move variables.
AlexeyMerzlyakov cbac4c1
Update nav2_collision_monitor/include/nav2_collision_monitor/polygon.hpp
AlexeyMerzlyakov 473fa9b
Update nav2_collision_monitor/params/collision_monitor_params.yaml
AlexeyMerzlyakov ebdafaa
Update nav2_collision_monitor/params/collision_monitor_params.yaml
AlexeyMerzlyakov e89778a
Update nav2_collision_monitor/params/collision_monitor_params.yaml
AlexeyMerzlyakov 8574f08
Meet smaller review items
AlexeyMerzlyakov b023d4c
Add fixes found during unit test development
AlexeyMerzlyakov 19c2e09
Fix uncrustify issues
AlexeyMerzlyakov d1dacb7
Add unit tests
AlexeyMerzlyakov d8f449c
Fix number of polygons points
AlexeyMerzlyakov 2e4b5b0
Move tests
AlexeyMerzlyakov 281648d
Add kinematics unit test
AlexeyMerzlyakov a8caf81
Minor tests fixes
AlexeyMerzlyakov 1d06337
Remove commented line
AlexeyMerzlyakov d844e1a
Add edge case checking testcase and references
AlexeyMerzlyakov f11243f
Update comment
AlexeyMerzlyakov 7a8dadb
Add README.md
AlexeyMerzlyakov a626769
Fixed table
AlexeyMerzlyakov 58b93fb
Minor changes in README.md
AlexeyMerzlyakov 4aef45d
Fix README.md for documentation pages
AlexeyMerzlyakov fa536d1
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov 3cc0231
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov 2850cbd
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov 67972c7
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov 833d733
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov ac7a084
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov 0ce285e
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov 6052fad
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov b1257d8
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov 6600214
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov e58413d
Meet review items
AlexeyMerzlyakov 376a074
Meet review items (part 2)
AlexeyMerzlyakov 4710439
Update polygons picture for README
AlexeyMerzlyakov a4639aa
Change simulation_time_step to 0.1
AlexeyMerzlyakov e8b491e
Fix bounding boxes to fit the demo from README.md
AlexeyMerzlyakov 7f4c3bf
Terminology fixes
AlexeyMerzlyakov 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 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,108 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(nav2_collision_monitor) | ||
|
||
### Dependencies ### | ||
|
||
find_package(ament_cmake REQUIRED) | ||
find_package(rclcpp REQUIRED) | ||
find_package(rclcpp_components REQUIRED) | ||
find_package(sensor_msgs REQUIRED) | ||
find_package(geometry_msgs REQUIRED) | ||
find_package(tf2 REQUIRED) | ||
find_package(tf2_ros REQUIRED) | ||
find_package(tf2_geometry_msgs REQUIRED) | ||
find_package(nav2_msgs REQUIRED) | ||
find_package(nav2_common REQUIRED) | ||
find_package(nav2_util REQUIRED) | ||
|
||
### Header ### | ||
|
||
nav2_package() | ||
|
||
### Libraries and executables ### | ||
|
||
include_directories( | ||
include | ||
) | ||
|
||
set(dependencies | ||
rclcpp | ||
rclcpp_components | ||
sensor_msgs | ||
geometry_msgs | ||
tf2 | ||
tf2_ros | ||
tf2_geometry_msgs | ||
nav2_msgs | ||
nav2_util | ||
) | ||
|
||
set(executable_name collision_monitor) | ||
set(library_name ${executable_name}_core) | ||
|
||
add_library(${library_name} SHARED | ||
src/collision_monitor_node.cpp | ||
src/polygon_base.cpp | ||
src/polygon.cpp | ||
src/circle.cpp | ||
src/source_base.cpp | ||
src/scan.cpp | ||
src/pointcloud.cpp | ||
src/kinematics.cpp | ||
) | ||
|
||
add_executable(${executable_name} | ||
src/main.cpp | ||
) | ||
|
||
ament_target_dependencies(${library_name} | ||
${dependencies} | ||
) | ||
|
||
target_link_libraries(${executable_name} | ||
${library_name} | ||
) | ||
|
||
ament_target_dependencies(${executable_name} | ||
${dependencies} | ||
) | ||
|
||
rclcpp_components_register_nodes(${library_name} "nav2_collision_monitor::CollisionMonitor") | ||
|
||
### Install ### | ||
|
||
install(TARGETS ${library_name} | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib | ||
RUNTIME DESTINATION bin | ||
) | ||
|
||
install(TARGETS ${executable_name} | ||
RUNTIME DESTINATION lib/${PROJECT_NAME} | ||
) | ||
|
||
install(DIRECTORY include/ | ||
DESTINATION include/ | ||
) | ||
|
||
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}) | ||
install(DIRECTORY params DESTINATION share/${PROJECT_NAME}) | ||
|
||
### Testing ### | ||
|
||
# ToDo - later | ||
#if(BUILD_TESTING) | ||
# find_package(ament_lint_auto REQUIRED) | ||
# # the following line skips the linter which checks for copyrights | ||
# set(ament_cmake_copyright_FOUND TRUE) | ||
# ament_lint_auto_find_test_dependencies() | ||
# add_subdirectory(test) | ||
#endif() | ||
|
||
### Ament stuff ### | ||
|
||
ament_export_include_directories(include) | ||
ament_export_libraries(${library_name}) | ||
ament_export_dependencies(${dependencies}) | ||
|
||
SteveMacenski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ament_package() |
77 changes: 77 additions & 0 deletions
77
nav2_collision_monitor/include/nav2_collision_monitor/circle.hpp
This file contains 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,77 @@ | ||
// Copyright (c) 2022 Samsung Research Russia | ||
// | ||
// 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__CIRCLE_HPP_ | ||
#define NAV2_COLLISION_MONITOR__CIRCLE_HPP_ | ||
|
||
#include <vector> | ||
#include <string> | ||
|
||
#include "nav2_collision_monitor/polygon_base.hpp" | ||
|
||
namespace nav2_collision_monitor | ||
{ | ||
|
||
/** | ||
* @brief Circle shape implementaiton | ||
*/ | ||
class Circle : public PolygonBase | ||
{ | ||
public: | ||
/** | ||
* @brief Circle class constructor | ||
*/ | ||
Circle( | ||
const nav2_util::LifecycleNode::WeakPtr & node, | ||
const std::string & polygon_name, | ||
const std::string & base_frame_id, | ||
const double simulation_time_step); | ||
/** | ||
* @brief Circle class destructor | ||
*/ | ||
virtual ~Circle(); | ||
|
||
/** | ||
* @brief Gets polygon points, approximated for circle. | ||
* To be used in visualization purposes. | ||
* @param poly Output polygon points (vertices) | ||
*/ | ||
virtual void getPolygon(std::vector<Point> & poly); | ||
|
||
/** | ||
* @brief Gets number of points inside circle | ||
* @param points Input array of points to be checked | ||
* @return Number of points inside circle. If there are no points, | ||
* returns zero-value | ||
*/ | ||
virtual int getPointsInside(const std::vector<Point> & points); | ||
|
||
protected: | ||
/** | ||
* @brief Supporting routine obtaining all ROS-parameters. | ||
* Implementation for Circle class. Calls PolygonBase::getParameters() inside. | ||
* @param polygon_topic Output name of polygon publishing topic | ||
* @return True if all parameters were obtained or false in failure case | ||
*/ | ||
virtual bool getParameters(std::string & polygon_topic); | ||
|
||
/// @brief Radius of the circle | ||
double radius_; | ||
/// @brief (radius * radius) value. Stored for optimization. | ||
double radius_squared_; | ||
}; // class Circle | ||
|
||
} // namespace nav2_collision_monitor | ||
|
||
#endif // NAV2_COLLISION_MONITOR__CIRCLE_HPP_ |
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.
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.
TODO
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.
Also, missing a readme, but like the tests, I'm fine waiting on that until we hammer out the big items in the review