-
Notifications
You must be signed in to change notification settings - Fork 1.6k
nav2_collision_monitor: collision detector #3500
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
AlexeyMerzlyakov
merged 77 commits into
ros-navigation:main
from
logivations:collision-monitor-publish-action-main
Aug 14, 2023
Merged
Changes from all commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
cc5076f
added drone yml file
b43c968
more updates to drone yaml file
ea9cf96
Merge pull request #1 from logivations/task_AMRFM-1383_Auto-scaling_CI
MaxZubrytskyi d81421f
updates to drone checkout logic
989a760
triggering drone
7879ba6
triggering drone
d666f45
triggering drone2
871ff76
triggering drone3
e0552ee
triggering drone4
1c09f5d
triggering drone5
466180b
triggering drone5
78e73e5
triggering drone6
427986e
new changes1
c1c9161
add PR validattion checks for drone CI
ae07f46
upadte to docker pull step
ab65a31
triggering drone
38e6d2e
Merge pull request #2 from logivations/task_AMRFM-1383_Auto-scaling_CI2
MaxZubrytskyi 09337b5
Merge branch 'ros-planning:main' into master
tonynajjar a68c971
Merge remote-tracking branch 'upstream/main'
a5f870c
Merge branch 'ros-planning:main' into main
tonynajjar 5c9891c
Add Publish action to collision monitor
d218133
Revert "Add Publish action to collision monitor"
cc50772
Initial try
d1780cd
start other thread
7f1b82a
.
b9f4e5a
.
73e41d9
fix
d5de573
revert all changes
9ba1b07
Make new node
5783700
PR changes
2c163fd
fixes
d065661
add frequency as parameter
1e673c7
Merge branch 'ros-planning:main' into main
tonynajjar a5e2cea
Merge remote-tracking branch 'upstream/main' into collision-monitor-p…
8457e48
add CollisionDetectorState msg
618910b
Merge branch 'main' into collision-monitor-publish-action-main
59872b6
change do_nothing to none
c2a178a
cmake fixes
a852208
Merge branch 'ros-planning:main' into master
tonynajjar 8123458
Merge branch 'main' into collision-monitor-publish-action-main
tonynajjar 95faccf
rename main
tonynajjar 2fce805
fix uncrustify
tonynajjar 97afa64
fixes
tonynajjar 00c9cdd
fix build
tonynajjar ef5f8cf
add warning if action type is not none
tonynajjar 99a58ba
adding launch file
tonynajjar ac974a1
Merge branch 'ros-planning:main' into master
joao-corvo a389aef
Merge branch 'ros-planning:main' into master
tonynajjar a21c891
Merge remote-tracking branch 'origin/master' into collision-monitor-p…
395fc51
Delete .drone.yml
a2ec3a9
fixes
49bd4f1
uncrustify
c5055ee
.
57c212e
.
d9073bc
Update README.md
20c7319
Adding tests
348cb3b
amend msg
0b46fab
PR comments
2505c45
add test
661766a
fix
b5fc970
fix
b3e9a78
fix
6c3904e
add check
44fba19
fix
79aff93
Merge remote-tracking branch 'upstream/main'
3896297
Merge branch 'main' into collision-monitor-publish-action-main
5012d6d
fixes
cbcdb64
docu fix
3ed84fc
Add docs
0dd0492
Merge branch 'ros-planning:main' into main
tonynajjar af75803
Merge commit '0dd0492f1b1e87e4b62e30e910ef85bd08662322' into collisio…
19b14b8
fixes
c101712
fix test
70e886b
fix
bf4d508
trigger CI
b5dd2f2
Fixes
2d565ca
fixes
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
159 changes: 159 additions & 0 deletions
159
nav2_collision_monitor/include/nav2_collision_monitor/collision_detector_node.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,159 @@ | ||
| // Copyright (c) 2022 Samsung R&D Institute Russia | ||
| // Copyright (c) 2023 Pixel Robotics GmbH | ||
| // | ||
| // 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__COLLISION_DETECTOR_NODE_HPP_ | ||
| #define NAV2_COLLISION_MONITOR__COLLISION_DETECTOR_NODE_HPP_ | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
| #include <memory> | ||
|
|
||
| #include "rclcpp/rclcpp.hpp" | ||
|
|
||
| #include "tf2/time.h" | ||
| #include "tf2_ros/buffer.h" | ||
| #include "tf2_ros/transform_listener.h" | ||
|
|
||
| #include "nav2_util/lifecycle_node.hpp" | ||
| #include "nav2_msgs/msg/collision_detector_state.hpp" | ||
|
|
||
| #include "nav2_collision_monitor/types.hpp" | ||
| #include "nav2_collision_monitor/polygon.hpp" | ||
| #include "nav2_collision_monitor/circle.hpp" | ||
| #include "nav2_collision_monitor/source.hpp" | ||
| #include "nav2_collision_monitor/scan.hpp" | ||
| #include "nav2_collision_monitor/pointcloud.hpp" | ||
| #include "nav2_collision_monitor/range.hpp" | ||
|
|
||
| namespace nav2_collision_monitor | ||
| { | ||
|
|
||
| /** | ||
| * @brief Collision Monitor ROS2 node | ||
| */ | ||
| class CollisionDetector : public nav2_util::LifecycleNode | ||
| { | ||
| public: | ||
| /** | ||
| * @brief Constructor for the nav2_collision_monitor::CollisionDetector | ||
| * @param options Additional options to control creation of the node. | ||
| */ | ||
| explicit CollisionDetector(const rclcpp::NodeOptions & options = rclcpp::NodeOptions()); | ||
| /** | ||
| * @brief Destructor for the nav2_collision_monitor::CollisionDetector | ||
| */ | ||
| ~CollisionDetector(); | ||
|
|
||
| protected: | ||
| /** | ||
| * @brief: Initializes and obtains ROS-parameters, creates main subscribers and publishers, | ||
| * creates polygons and data sources objects | ||
| * @param state Lifecycle Node's state | ||
| * @return Success or Failure | ||
| */ | ||
| nav2_util::CallbackReturn on_configure(const rclcpp_lifecycle::State & state) override; | ||
| /** | ||
| * @brief: Activates LifecyclePublishers, polygons and main processor, creates bond connection | ||
| * @param state Lifecycle Node's state | ||
| * @return Success or Failure | ||
| */ | ||
| nav2_util::CallbackReturn on_activate(const rclcpp_lifecycle::State & state) override; | ||
| /** | ||
| * @brief: Deactivates LifecyclePublishers, polygons and main processor, destroys bond connection | ||
| * @param state Lifecycle Node's state | ||
| * @return Success or Failure | ||
| */ | ||
| nav2_util::CallbackReturn on_deactivate(const rclcpp_lifecycle::State & state) override; | ||
| /** | ||
| * @brief: Resets all subscribers/publishers, polygons/data sources arrays | ||
| * @param state Lifecycle Node's state | ||
| * @return Success or Failure | ||
| */ | ||
| nav2_util::CallbackReturn on_cleanup(const rclcpp_lifecycle::State & state) override; | ||
| /** | ||
| * @brief Called in shutdown state | ||
| * @param state Lifecycle Node's state | ||
| * @return Success or Failure | ||
| */ | ||
| nav2_util::CallbackReturn on_shutdown(const rclcpp_lifecycle::State & state) override; | ||
|
|
||
| protected: | ||
| /** | ||
| * @brief Supporting routine obtaining all ROS-parameters | ||
| * @return True if all parameters were obtained or false in failure case | ||
| */ | ||
| bool getParameters(); | ||
| /** | ||
| * @brief Supporting routine creating and configuring all polygons | ||
| * @param base_frame_id Robot base frame ID | ||
| * @param transform_tolerance Transform tolerance | ||
| * @return True if all polygons were configured successfully or false in failure case | ||
| */ | ||
| bool configurePolygons( | ||
| const std::string & base_frame_id, | ||
| const tf2::Duration & transform_tolerance); | ||
| /** | ||
| * @brief Supporting routine creating and configuring all data sources | ||
| * @param base_frame_id Robot base frame ID | ||
| * @param odom_frame_id Odometry frame ID. Used as global frame to get | ||
| * source->base time interpolated transform. | ||
| * @param transform_tolerance Transform tolerance | ||
| * @param source_timeout Maximum time interval in which data is considered valid | ||
| * @param base_shift_correction Whether to correct source data towards to base frame movement, | ||
| * considering the difference between current time and latest source time | ||
| * @return True if all sources were configured successfully or false in failure case | ||
| */ | ||
| bool configureSources( | ||
| const std::string & base_frame_id, | ||
| const std::string & odom_frame_id, | ||
| const tf2::Duration & transform_tolerance, | ||
| const rclcpp::Duration & source_timeout, | ||
| const bool base_shift_correction); | ||
|
|
||
| /** | ||
| * @brief Main processing routine | ||
| */ | ||
| void process(); | ||
|
|
||
| /** | ||
| * @brief Polygons publishing routine. Made for visualization. | ||
| */ | ||
| void publishPolygons() const; | ||
|
|
||
| // ----- Variables ----- | ||
|
|
||
| /// @brief TF buffer | ||
| std::shared_ptr<tf2_ros::Buffer> tf_buffer_; | ||
| /// @brief TF listener | ||
| std::shared_ptr<tf2_ros::TransformListener> tf_listener_; | ||
|
|
||
| /// @brief Polygons array | ||
| std::vector<std::shared_ptr<Polygon>> polygons_; | ||
| /// @brief Data sources array | ||
| std::vector<std::shared_ptr<Source>> sources_; | ||
|
|
||
| /// @brief collision monitor state publisher | ||
| rclcpp_lifecycle::LifecyclePublisher<nav2_msgs::msg::CollisionDetectorState>::SharedPtr | ||
| state_pub_; | ||
| /// @brief timer that runs actions | ||
| rclcpp::TimerBase::SharedPtr timer_; | ||
|
|
||
| /// @brief main loop frequency | ||
| double frequency_; | ||
| }; // class CollisionDetector | ||
|
|
||
| } // namespace nav2_collision_monitor | ||
|
|
||
| #endif // NAV2_COLLISION_MONITOR__COLLISION_DETECTOR_NODE_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
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.