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

support oscillation angle in move_base #335

Merged
merged 5 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
3 changes: 3 additions & 0 deletions mbf_abstract_nav/include/mbf_abstract_nav/move_base_action.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ class MoveBaseAction
//! minimal move distance to not detect an oscillation
double oscillation_distance_;

//! minimal rotation to not detect an oscillation
double oscillation_angle_;

GoalHandle goal_handle_;

std::string name_;
Expand Down
2 changes: 2 additions & 0 deletions mbf_abstract_nav/src/mbf_abstract_nav/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ def add_mbf_abstract_nav_params(gen):
"How long in seconds to allow for oscillation before executing recovery behaviors", 0.0, 0, 60)
gen.add("oscillation_distance", double_t, 0,
"How far in meters the robot must move to be considered not to be oscillating", 0.5, 0, 10)
gen.add("oscillation_angle", double_t, 0,
"How far in radian the robot must rotate to be considered not to be oscillating", 3.14, 0, 6.28)
knorth55 marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 5 additions & 1 deletion mbf_abstract_nav/src/move_base_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ MoveBaseAction::MoveBaseAction(const std::string& name, const mbf_utility::Robot
, action_client_recovery_(private_nh_, "recovery")
, oscillation_timeout_(0)
, oscillation_distance_(0)
, oscillation_angle_(0)
, replanning_thread_shutdown_(false)
, recovery_enabled_(true)
, behaviors_(behaviors)
Expand Down Expand Up @@ -86,6 +87,7 @@ void MoveBaseAction::reconfigure(
replanning_period_.fromSec(0.0);
oscillation_timeout_ = ros::Duration(config.oscillation_timeout);
oscillation_distance_ = config.oscillation_distance;
oscillation_angle_ = config.oscillation_angle;
recovery_enabled_ = config.recovery_enabled;
}

Expand Down Expand Up @@ -150,6 +152,7 @@ void MoveBaseAction::start(GoalHandle &goal_handle)
return;
}
goal_pose_ = goal.target_pose;
last_oscillation_pose_ = robot_pose_;

// wait for server connections
if (!action_client_get_path_.waitForServer(connection_timeout) ||
Expand Down Expand Up @@ -197,7 +200,8 @@ void MoveBaseAction::actionExePathFeedback(
{
// check if oscillating
// moved more than the minimum oscillation distance
if (mbf_utility::distance(robot_pose_, last_oscillation_pose_) >= oscillation_distance_)
if (mbf_utility::distance(robot_pose_, last_oscillation_pose_) >= oscillation_distance_ ||
mbf_utility::angle(robot_pose_, last_oscillation_pose_) >= oscillation_angle_)
{
last_oscillation_reset_ = ros::Time::now();
last_oscillation_pose_ = robot_pose_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ mbf_abstract_nav::MoveBaseFlexConfig CostmapControllerExecution::toAbstract(cons
abstract_config.controller_max_retries = config.controller_max_retries;
abstract_config.oscillation_timeout = config.oscillation_timeout;
abstract_config.oscillation_distance = config.oscillation_distance;
abstract_config.oscillation_angle = config.oscillation_angle;
return abstract_config;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ void CostmapNavigationServer::reconfigure(mbf_costmap_nav::MoveBaseFlexConfig& c
abstract_config.recovery_patience = config.recovery_patience;
abstract_config.oscillation_timeout = config.oscillation_timeout;
abstract_config.oscillation_distance = config.oscillation_distance;
abstract_config.oscillation_angle = config.oscillation_angle;
abstract_config.restore_defaults = config.restore_defaults;
mbf_abstract_nav::AbstractNavigationServer::reconfigure(abstract_config, level);

Expand Down