Skip to content

Commit 4a6878c

Browse files
SteveMacenskilanticapadhupradheepsathak93Tobias-Fischer
authored
Galactic sync 5 (#2748)
* Fix typo (#2583) fix typo in warning msg; * Stopping networking-related BT failures from failing task, rather fail specific BT node (#2624) * addig try/catch around non-tree exceptions to fail node * Update bt_action_node.hpp * linting * refactor of #2624 for simplicity (#2629) * removing kinematic limiting from RPP (#2631) * removing kinematic limiting from RPP * update tests * Bug fix: set the BT Navigator "default_nav_to_pose_bt_xml" and "default_nav_through_pose_bt_xml" from the yaml file (#2664) * removing the has_parameter() and replacing with the get_parameter() * fixing navigate_through_poses as well * Adding comment to clarify intent * Footprint collision checking for nav2_regulated_pure_pursuit (#2556) * initial * initial * initialize * un * working * lint fix * wrk * clean_up * remove code repettion * rm unused variable * initialize footprint on configure itself * revert to defaulted constructer * remove rviz change * remove unneccessary changes * review changes * define traverse unkown * set true * reviw changes * styling changes * collision checking condition * used back() * make loop end condition fixed * review changes * fix * removed midpose curvature * removed stop collision check at goal pose * Windows fix (#2672) * Corrected reinitialization in nav2_smac_planner::HybridMotionTable (#2680) - The HybridMotionTable did not reinitialize properly in case the min_turning_radius or the motion_model was changed. * Lifecycle startup fix (#2694) * removed init_timer from lifecycle callback group * lifecycle manager: startup() on autostart_ calling from callback_group_ (Bond::waitUntilFormed needs node spinning in the background) Co-authored-by: Matej Vargovcik <[email protected]> * If not downsampling costmap, default factor to 1 (#2695) * Theta star planner fix (#2703) * add test to check if the goal is unsafe with theta star planner Signed-off-by: Daisuke Sato <[email protected]> * check if a plan is generated (#2698) Signed-off-by: Daisuke Sato <[email protected]> * Always initialize clearing endpoints in voxel layer (#2705) * Prohibit of simultaneous usage of callbacks accessing to pf_ object (#2712) * Fixed min lookahead dist when moving backwards (#2726) Co-authored-by: seasony-vp <[email protected]> * bumping galactic to 1.0.8 for sync Co-authored-by: lantica <[email protected]> Co-authored-by: Pradheep Krishna <[email protected]> Co-authored-by: Sathakkadhullah <[email protected]> Co-authored-by: Tobias Fischer <[email protected]> Co-authored-by: zoltan-lengyel <[email protected]> Co-authored-by: RoboTech Vision <[email protected]> Co-authored-by: Matej Vargovcik <[email protected]> Co-authored-by: Daisuke Sato <[email protected]> Co-authored-by: M. Mostafa Farzan <[email protected]> Co-authored-by: Alexey Merzlyakov <[email protected]> Co-authored-by: dpm-seasony <[email protected]> Co-authored-by: seasony-vp <[email protected]>
1 parent ca37b22 commit 4a6878c

File tree

49 files changed

+188
-130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+188
-130
lines changed

nav2_amcl/include/nav2_amcl/amcl_node.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ class AmclNode : public nav2_util::LifecycleNode
238238
*/
239239
static pf_vector_t uniformPoseGenerator(void * arg);
240240
pf_t * pf_{nullptr};
241+
std::mutex pf_mutex_;
241242
bool pf_init_;
242243
pf_vector_t pf_odom_pose_;
243244
int resample_count_{0};

nav2_amcl/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>nav2_amcl</name>
5-
<version>1.0.7</version>
5+
<version>1.0.8</version>
66
<description>
77
<p>
88
amcl is a probabilistic localization system for a robot moving in

nav2_amcl/src/amcl_node.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ AmclNode::globalLocalizationCallback(
504504
const std::shared_ptr<std_srvs::srv::Empty::Request>/*req*/,
505505
std::shared_ptr<std_srvs::srv::Empty::Response>/*res*/)
506506
{
507+
std::lock_guard<std::mutex> lock(pf_mutex_);
508+
507509
RCLCPP_INFO(get_logger(), "Initializing with uniform distribution");
508510

509511
pf_init_model(
@@ -528,6 +530,8 @@ AmclNode::nomotionUpdateCallback(
528530
void
529531
AmclNode::initialPoseReceived(geometry_msgs::msg::PoseWithCovarianceStamped::SharedPtr msg)
530532
{
533+
std::lock_guard<std::mutex> lock(pf_mutex_);
534+
531535
RCLCPP_INFO(get_logger(), "initialPoseReceived");
532536

533537
if (msg->header.frame_id == "") {
@@ -625,6 +629,8 @@ AmclNode::handleInitialPose(geometry_msgs::msg::PoseWithCovarianceStamped & msg)
625629
void
626630
AmclNode::laserReceived(sensor_msgs::msg::LaserScan::ConstSharedPtr laser_scan)
627631
{
632+
std::lock_guard<std::mutex> lock(pf_mutex_);
633+
628634
// Since the sensor data is continually being published by the simulator or robot,
629635
// we don't want our callbacks to fire until we're in the active state
630636
if (!active_) {return;}
@@ -930,7 +936,7 @@ AmclNode::publishAmclPose(
930936
if (!initial_pose_is_known_) {
931937
if (checkElapsedTime(2s, last_time_printed_msg_)) {
932938
RCLCPP_WARN(
933-
get_logger(), "ACML cannot publish a pose or update the transform. "
939+
get_logger(), "AMCL cannot publish a pose or update the transform. "
934940
"Please set the initial pose...");
935941
last_time_printed_msg_ = now();
936942
}

nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -183,41 +183,17 @@ class BtActionNode : public BT::ActionNodeBase
183183
send_new_goal();
184184
}
185185

186-
// if new goal was sent and action server has not yet responded
187-
// check the future goal handle
188-
if (future_goal_handle_) {
189-
auto elapsed = (node_->now() - time_goal_sent_).to_chrono<std::chrono::milliseconds>();
190-
if (!is_future_goal_handle_complete(elapsed)) {
191-
// return RUNNING if there is still some time before timeout happens
192-
if (elapsed < server_timeout_) {
193-
return BT::NodeStatus::RUNNING;
194-
}
195-
// if server has taken more time to respond than the specified timeout value return FAILURE
196-
RCLCPP_WARN(
197-
node_->get_logger(),
198-
"Timed out while waiting for action server to acknowledge goal request for %s",
199-
action_name_.c_str());
200-
future_goal_handle_.reset();
201-
return BT::NodeStatus::FAILURE;
202-
}
203-
}
204-
205-
// The following code corresponds to the "RUNNING" loop
206-
if (rclcpp::ok() && !goal_result_available_) {
207-
// user defined callback. May modify the value of "goal_updated_"
208-
on_wait_for_result();
209-
210-
auto goal_status = goal_handle_->get_status();
211-
if (goal_updated_ && (goal_status == action_msgs::msg::GoalStatus::STATUS_EXECUTING ||
212-
goal_status == action_msgs::msg::GoalStatus::STATUS_ACCEPTED))
213-
{
214-
goal_updated_ = false;
215-
send_new_goal();
186+
try {
187+
// if new goal was sent and action server has not yet responded
188+
// check the future goal handle
189+
if (future_goal_handle_) {
216190
auto elapsed = (node_->now() - time_goal_sent_).to_chrono<std::chrono::milliseconds>();
217191
if (!is_future_goal_handle_complete(elapsed)) {
192+
// return RUNNING if there is still some time before timeout happens
218193
if (elapsed < server_timeout_) {
219194
return BT::NodeStatus::RUNNING;
220195
}
196+
// if server has taken more time than the specified timeout value return FAILURE
221197
RCLCPP_WARN(
222198
node_->get_logger(),
223199
"Timed out while waiting for action server to acknowledge goal request for %s",
@@ -227,12 +203,48 @@ class BtActionNode : public BT::ActionNodeBase
227203
}
228204
}
229205

230-
callback_group_executor_.spin_some();
206+
// The following code corresponds to the "RUNNING" loop
207+
if (rclcpp::ok() && !goal_result_available_) {
208+
// user defined callback. May modify the value of "goal_updated_"
209+
on_wait_for_result();
210+
211+
auto goal_status = goal_handle_->get_status();
212+
if (goal_updated_ && (goal_status == action_msgs::msg::GoalStatus::STATUS_EXECUTING ||
213+
goal_status == action_msgs::msg::GoalStatus::STATUS_ACCEPTED))
214+
{
215+
goal_updated_ = false;
216+
send_new_goal();
217+
auto elapsed = (node_->now() - time_goal_sent_).to_chrono<std::chrono::milliseconds>();
218+
if (!is_future_goal_handle_complete(elapsed)) {
219+
if (elapsed < server_timeout_) {
220+
return BT::NodeStatus::RUNNING;
221+
}
222+
RCLCPP_WARN(
223+
node_->get_logger(),
224+
"Timed out while waiting for action server to acknowledge goal request for %s",
225+
action_name_.c_str());
226+
future_goal_handle_.reset();
227+
return BT::NodeStatus::FAILURE;
228+
}
229+
}
231230

232-
// check if, after invoking spin_some(), we finally received the result
233-
if (!goal_result_available_) {
234-
// Yield this Action, returning RUNNING
235-
return BT::NodeStatus::RUNNING;
231+
callback_group_executor_.spin_some();
232+
233+
// check if, after invoking spin_some(), we finally received the result
234+
if (!goal_result_available_) {
235+
// Yield this Action, returning RUNNING
236+
return BT::NodeStatus::RUNNING;
237+
}
238+
}
239+
} catch (const std::runtime_error & e) {
240+
if (e.what() == std::string("send_goal failed") ||
241+
e.what() == std::string("Goal was rejected by the action server"))
242+
{
243+
// Action related failure that should not fail the tree, but the node
244+
return BT::NodeStatus::FAILURE;
245+
} else {
246+
// Internal exception to propogate to the tree
247+
throw e;
236248
}
237249
}
238250

nav2_behavior_tree/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>nav2_behavior_tree</name>
5-
<version>1.0.7</version>
5+
<version>1.0.8</version>
66
<description>TODO</description>
77
<maintainer email="[email protected]">Michael Jeronimo</maintainer>
88
<maintainer email="[email protected]">Carlos Orduno</maintainer>

nav2_bringup/bringup/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>nav2_bringup</name>
5-
<version>1.0.7</version>
5+
<version>1.0.8</version>
66
<description>Bringup scripts and configurations for the Nav2 stack</description>
77
<maintainer email="[email protected]">Michael Jeronimo</maintainer>
88
<maintainer email="[email protected]">Steve Macenski</maintainer>

nav2_bringup/nav2_gazebo_spawner/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>nav2_gazebo_spawner</name>
5-
<version>1.0.7</version>
5+
<version>1.0.8</version>
66
<description>Package for spawning a robot model into Gazebo for Nav2</description>
77
<maintainer email="[email protected]">lkumarbe</maintainer>
88
<maintainer email="[email protected]">lkumarbe</maintainer>

nav2_bt_navigator/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>nav2_bt_navigator</name>
5-
<version>1.0.7</version>
5+
<version>1.0.8</version>
66
<description>TODO</description>
77
<maintainer email="[email protected]">Michael Jeronimo</maintainer>
88
<license>Apache-2.0</license>

nav2_bt_navigator/src/navigators/navigate_through_poses.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@ NavigateThroughPosesNavigator::getDefaultBTFilepath(
4747
{
4848
std::string default_bt_xml_filename;
4949
auto node = parent_node.lock();
50-
if (!node->has_parameter("default_nav_through_poses_bt_xml")) {
51-
std::string pkg_share_dir =
52-
ament_index_cpp::get_package_share_directory("nav2_bt_navigator");
53-
std::string tree_file = pkg_share_dir +
54-
"/behavior_trees/navigate_through_poses_w_replanning_and_recovery.xml";
55-
node->declare_parameter("default_nav_through_poses_bt_xml", tree_file);
56-
}
50+
std::string pkg_share_dir =
51+
ament_index_cpp::get_package_share_directory("nav2_bt_navigator");
52+
node->declare_parameter<std::string>(
53+
"default_nav_through_poses_bt_xml",
54+
pkg_share_dir +
55+
"/behavior_trees/navigate_through_poses_w_replanning_and_recovery.xml");
5756
node->get_parameter("default_nav_through_poses_bt_xml", default_bt_xml_filename);
5857

5958
return default_bt_xml_filename;

nav2_bt_navigator/src/navigators/navigate_to_pose.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ NavigateToPoseNavigator::getDefaultBTFilepath(
5353
{
5454
std::string default_bt_xml_filename;
5555
auto node = parent_node.lock();
56-
if (!node->has_parameter("default_nav_to_pose_bt_xml")) {
57-
std::string pkg_share_dir =
58-
ament_index_cpp::get_package_share_directory("nav2_bt_navigator");
59-
std::string tree_file = pkg_share_dir +
60-
"/behavior_trees/navigate_to_pose_w_replanning_and_recovery.xml";
61-
node->declare_parameter("default_nav_to_pose_bt_xml", tree_file);
62-
}
56+
std::string pkg_share_dir =
57+
ament_index_cpp::get_package_share_directory("nav2_bt_navigator");
58+
node->declare_parameter<std::string>(
59+
"default_nav_to_pose_bt_xml",
60+
pkg_share_dir +
61+
"/behavior_trees/navigate_to_pose_w_replanning_and_recovery.xml");
6362
node->get_parameter("default_nav_to_pose_bt_xml", default_bt_xml_filename);
6463

6564
return default_bt_xml_filename;

0 commit comments

Comments
 (0)