Skip to content

Commit d9f2b65

Browse files
init stuck_behavior
1 parent 168b150 commit d9f2b65

5 files changed

Lines changed: 87 additions & 1 deletion

File tree

mep3_navigation/CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,33 @@ install(
140140
target_link_libraries(move_behavior ruckig::ruckig)
141141
pluginlib_export_plugin_description_file(nav2_core move_behavior.xml)
142142

143+
# stuck_behavior
144+
add_library(
145+
stuck_behavior
146+
SHARED
147+
src/stuck_behavior/stuck_behavior.cpp
148+
)
149+
ament_target_dependencies(
150+
stuck_behavior
151+
rclcpp
152+
nav2_costmap_2d
153+
pluginlib
154+
rclcpp_action
155+
mep3_msgs
156+
can_msgs
157+
)
158+
target_include_directories(
159+
stuck_behavior
160+
PRIVATE
161+
include
162+
)
163+
install(
164+
TARGETS stuck_behavior
165+
DESTINATION lib
166+
)
167+
target_link_libraries(stuck_behavior ruckig::ruckig)
168+
pluginlib_export_plugin_description_file(nav2_core stuck_behavior.xml)
169+
143170
# Assets
144171
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
145172
install(DIRECTORY params DESTINATION share/${PROJECT_NAME})
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#ifndef MEP3_NAVIGATION__STUCK_BEHAVIOR_HPP_
2+
#define MEP3_NAVIGATION__STUCK_BEHAVIOR_HPP_
3+
4+
#include <chrono>
5+
#include <memory>
6+
#include <utility>
7+
8+
#include "nav2_behaviors/timed_behavior.hpp"
9+
#include "mep3_msgs/action/move.hpp"
10+
#include "mep3_msgs/msg/motion_properties.hpp"
11+
#include "nav2_util/node_utils.hpp"
12+
#include "ruckig/ruckig.hpp"
13+
#include "mep3_navigation/stuck_detector.hpp"
14+
15+
namespace mep3_navigation
16+
{
17+
using ActionT = mep3_msgs::action::Move;
18+
19+
class StuckBehavior : public nav2_behaviors::TimedBehavior<ActionT>
20+
{
21+
public:
22+
StuckBehavior();
23+
~StuckBehavior();
24+
25+
virtual nav2_behaviors::Status onRun(const std::shared_ptr<const typename ActionT::Goal> command) final override;
26+
27+
nav2_behaviors::Status onCycleUpdate();
28+
29+
protected:
30+
};
31+
}
32+
33+
#endif // MEP3_NAVIGATION__STUCK_BEHAVIOR_HPP_

mep3_navigation/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<buildtool_depend>ament_cmake</buildtool_depend>
1111
<buildtool_depend>ament_cmake_python</buildtool_depend>
12-
12+
1313
<build_depend>navigation2</build_depend>
1414
<build_depend>nav2_common</build_depend>
1515

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include "mep3_navigation/stuck_behavior/stuck_behavior.hpp"
2+
3+
4+
mep3_navigation::StuckBehavior::StuckBehavior() :
5+
nav2_behaviors::TimedBehavior<ActionT>()
6+
{
7+
}
8+
9+
mep3_navigation::StuckBehavior::~StuckBehavior() = default;
10+
11+
nav2_behaviors::Status mep3_navigation::StuckBehavior::onRun(const std::shared_ptr<const typename ActionT::Goal> command)
12+
{
13+
RCLCPP_INFO(this->logger_, "onRun successful!");
14+
return nav2_behaviors::Status::SUCCEEDED;
15+
}
16+
17+
nav2_behaviors::Status mep3_navigation::StuckBehavior::onCycleUpdate()
18+
{
19+
RCLCPP_INFO(this->logger_, "onCycleUpdate successful!");
20+
return nav2_behaviors::Status::RUNNING;
21+
}

mep3_navigation/stuck_behavior.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<library path="stuck_behavior">
2+
<class type="mep3_navigation::StuckBehavior" base_class_type="nav2_core::Behavior">
3+
<description>Provides primitive but flexible robot motion stuck behavior.</description>
4+
</class>
5+
</library>

0 commit comments

Comments
 (0)