Skip to content
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
merged 41 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
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 May 25, 2022
ac87381
Meet review items
AlexeyMerzlyakov May 31, 2022
9fd9d6a
Fix next review items
AlexeyMerzlyakov Jun 7, 2022
8be2636
Code cleanup
AlexeyMerzlyakov Jun 7, 2022
e200b46
Support dynamic footprint. More optimizations.
AlexeyMerzlyakov Jun 16, 2022
81337e3
Switch to multiple footprints. Move variables.
AlexeyMerzlyakov Jun 21, 2022
cbac4c1
Update nav2_collision_monitor/include/nav2_collision_monitor/polygon.hpp
AlexeyMerzlyakov Jun 24, 2022
473fa9b
Update nav2_collision_monitor/params/collision_monitor_params.yaml
AlexeyMerzlyakov Jun 24, 2022
ebdafaa
Update nav2_collision_monitor/params/collision_monitor_params.yaml
AlexeyMerzlyakov Jun 24, 2022
e89778a
Update nav2_collision_monitor/params/collision_monitor_params.yaml
AlexeyMerzlyakov Jun 24, 2022
8574f08
Meet smaller review items
AlexeyMerzlyakov Jun 24, 2022
b023d4c
Add fixes found during unit test development
AlexeyMerzlyakov Jul 5, 2022
19c2e09
Fix uncrustify issues
AlexeyMerzlyakov Jul 5, 2022
d1dacb7
Add unit tests
AlexeyMerzlyakov Jul 6, 2022
d8f449c
Fix number of polygons points
AlexeyMerzlyakov Jul 7, 2022
2e4b5b0
Move tests
AlexeyMerzlyakov Jul 7, 2022
281648d
Add kinematics unit test
AlexeyMerzlyakov Jul 7, 2022
a8caf81
Minor tests fixes
AlexeyMerzlyakov Jul 7, 2022
1d06337
Remove commented line
AlexeyMerzlyakov Jul 7, 2022
d844e1a
Add edge case checking testcase and references
AlexeyMerzlyakov Jul 12, 2022
f11243f
Update comment
AlexeyMerzlyakov Jul 12, 2022
7a8dadb
Add README.md
AlexeyMerzlyakov Jul 12, 2022
a626769
Fixed table
AlexeyMerzlyakov Jul 12, 2022
58b93fb
Minor changes in README.md
AlexeyMerzlyakov Jul 12, 2022
4aef45d
Fix README.md for documentation pages
AlexeyMerzlyakov Jul 14, 2022
fa536d1
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov Jul 18, 2022
3cc0231
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov Jul 18, 2022
2850cbd
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov Jul 18, 2022
67972c7
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov Jul 18, 2022
833d733
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov Jul 18, 2022
ac7a084
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov Jul 18, 2022
0ce285e
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov Jul 18, 2022
6052fad
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov Jul 18, 2022
b1257d8
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov Jul 18, 2022
6600214
Update nav2_collision_monitor/README.md
AlexeyMerzlyakov Jul 18, 2022
e58413d
Meet review items
AlexeyMerzlyakov Jul 18, 2022
376a074
Meet review items (part 2)
AlexeyMerzlyakov Jul 18, 2022
4710439
Update polygons picture for README
AlexeyMerzlyakov Jul 19, 2022
a4639aa
Change simulation_time_step to 0.1
AlexeyMerzlyakov Jul 19, 2022
e8b491e
Fix bounding boxes to fit the demo from README.md
AlexeyMerzlyakov Jul 20, 2022
7f4c3bf
Terminology fixes
AlexeyMerzlyakov Jul 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions nav2_collision_monitor/CMakeLists.txt
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

Copy link
Member

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

#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})

ament_package()
77 changes: 77 additions & 0 deletions nav2_collision_monitor/include/nav2_collision_monitor/circle.hpp
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_
Loading