Skip to content

Commit 7969626

Browse files
SteveMacenskiGoesMGoesM_serverajtudelaHovorunBh
authored
Jazzy sync 2: August 23, 2024 (#4646)
* Updated README Table once Jazzy jobs turn over (#4482) * add new Jazzy matrix * missing header * test toolg * retry * done! * trim * trim * fix OS[0] * shutdown services in destructor of `ClearCostmapService` (#4495) Signed-off-by: GoesM_server <[email protected]> Co-authored-by: GoesM_server <[email protected]> * adjusting backup speed to be more reasonable (#4501) * Adding Costmap filters to system tests and cleaning up old gazebo classic files (#4502) * removing old files * removing old refs to gazebo classic * porting test body * including in root * Dock panel (#4458) * Initial docking panel Signed-off-by: Alberto Tudela <[email protected]> * Only one goal status Signed-off-by: Alberto Tudela <[email protected]> * Added dock pose Signed-off-by: Alberto Tudela <[email protected]> * Fix size of text Signed-off-by: Alberto Tudela <[email protected]> * Update rviz Signed-off-by: Alberto Tudela <[email protected]> * Update rviz config Signed-off-by: Alberto Tudela <[email protected]> --------- Signed-off-by: Alberto Tudela <[email protected]> * Fix default view (#4504) * Fix logo in nav2 panel (#4505) * Fix logo in nav2 panel Signed-off-by: Alberto Tudela <[email protected]> * Move icon Signed-off-by: Alberto Tudela <[email protected]> --------- Signed-off-by: Alberto Tudela <[email protected]> * Fix world to map coordinate conversion (#4506) Signed-off-by: HovorunBh <[email protected]> * Update README.md Signed-off-by: Steve Macenski <[email protected]> * Add dock id (#4511) * Implement dock id Signed-off-by: redvinaa <[email protected]> * Update tests Signed-off-by: redvinaa <[email protected]> * Update docs Signed-off-by: redvinaa <[email protected]> * Fix virtual override error Signed-off-by: redvinaa <[email protected]> --------- Signed-off-by: redvinaa <[email protected]> * fix(nav2_costmap_2d): make obstacle layer not current on enabled toggle (#4507) Signed-off-by: Kemal Bektas <[email protected]> Co-authored-by: Kemal Bektas <[email protected]> * min_turning_r_ getting param fix (#4510) * min_turning_r_ getting param fix Signed-off-by: Ivan Radionov <[email protected]> * Update nav2_mppi_controller/include/nav2_mppi_controller/motion_models.hpp Signed-off-by: Steve Macenski <[email protected]> Signed-off-by: Ivan Radionov <[email protected]> --------- Signed-off-by: Ivan Radionov <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Co-authored-by: Ivan Radionov <[email protected]> Co-authored-by: Steve Macenski <[email protected]> * fixing gz sim launch file by using gz directly (#4514) * port wait behavior to new gazebo (#4471) Signed-off-by: stevedan <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Co-authored-by: Steve Macenski <[email protected]> * Completely rewritten spin, backup, and drive on heading tests to remove flakiness (#4515) * port backup behavior to new gazebo Signed-off-by: stevedan <[email protected]> * port drive on heading behavior to new gazebo Signed-off-by: stevedan <[email protected]> * completely rewritten spin test * lint * complete flaky test rewrite --------- Signed-off-by: stevedan <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Co-authored-by: stevedan <[email protected]> * Return out of map update if frames mismatch. Signed-off-by Joey Yang (#4517) Signed-off-by: Joey Yang <[email protected]> * Fix error_code_id (#4522) Signed-off-by: redvinaa <[email protected]> * completely shutdown dyn_params_handler_ (s) (#4521) * completely shutdown dny_params_handler_ in nav2_amcl Signed-off-by: GoesM_server <[email protected]> * completely shutdown dyn_param_handler_ in controller_server Signed-off-by: goes <[email protected]> * compeletly shutdown dyn_params_handler in nav2_costmap_2d Signed-off-by: goes <[email protected]> * compeletly shutdown dyn_param_handler in nav2_docking Signed-off-by: goes <[email protected]> * completely shutdown dyn_params_handler in nav2_velocity_smoother Signed-off-by: goes <[email protected]> * compeletly shutdown dyn_param_handler in waypoint_follower Signed-off-by: goes <[email protected]> * typo fixed Signed-off-by: goes <[email protected]> * graceful-controller & dwb_controller Signed-off-by: goes <[email protected]> * mppi-controller Signed-off-by: goes <[email protected]> * navfn_planner & regulated_..controller Signed-off-by: goes <[email protected]> * rotation_..controller & samc_planners Signed-off-by: goes <[email protected]> * A*planner Signed-off-by: goes <[email protected]> * code style Signed-off-by: goes <[email protected]> * 1 Signed-off-by: goes <[email protected]> * fixed Signed-off-by: goes <[email protected]> * fix the usage of weak_ptr Signed-off-by: goes <[email protected]> * code-style Signed-off-by: goes <[email protected]> * weak_ptr released Signed-off-by: goes <[email protected]> * code style Signed-off-by: goes <[email protected]> * code style Signed-off-by: goes <[email protected]> * code style Signed-off-by: goes <[email protected]> * code style update Signed-off-by: goes <[email protected]> * back Signed-off-by: goes <[email protected]> * rebase conflict resovled Signed-off-by: goes <[email protected]> * rebase error fixed Signed-off-by: goes <[email protected]> * fixed2 Signed-off-by: goes <[email protected]> * rebase fixed 3 Signed-off-by: goes <[email protected]> * 33 Signed-off-by: goes <[email protected]> * shared_ptr into weak_ptr Signed-off-by: GoesM <[email protected]> * remove adundant node.resest() Signed-off-by: GoesM <[email protected]> --------- Signed-off-by: GoesM_server <[email protected]> Signed-off-by: goes <[email protected]> Signed-off-by: GoesM <[email protected]> Co-authored-by: GoesM_server <[email protected]> * check nullptr in smoothPlan() (#4544) * check nullptr in smoothPlan() Signed-off-by: GoesM <[email protected]> * code-style Signed-off-by: GoesM <[email protected]> * code-style Signed-off-by: GoesM <[email protected]> * simple change Signed-off-by: GoesM <[email protected]> --------- Signed-off-by: GoesM <[email protected]> Co-authored-by: GoesM <[email protected]> * check nullPtr in `computeControl()` (#4548) Signed-off-by: goes <[email protected]> Co-authored-by: goes <[email protected]> * Straight analytic expansions (#4549) * Add test to verify analytic expansions are straight Signed-off-by: James Ward <[email protected]> * Use continuous scaling of angle when performing analytic expansion Only applies to Hybrid A* - behaviour in lattice planner is unchanged Signed-off-by: James Ward <[email protected]> --------- Signed-off-by: James Ward <[email protected]> * Rviz tool to get cost of costmap cell (#4546) * Added GetCost srv Signed-off-by: Jatin Patil <[email protected]> * Added Service in costmap_2d Signed-off-by: Jatin Patil <[email protected]> * Added Rviz tool Signed-off-by: Jatin Patil <[email protected]> * Fixed Styling Signed-off-by: Jatin Patil <[email protected]> * Fixed Styles and Linting Signed-off-by: Jatin Patil <[email protected]> * Fixed Linting Signed-off-by: Jatin Patil <[email protected]> * Added Bool use_footprint to srv Signed-off-by: Jatin Patil <[email protected]> * Added unit test for costmap costcell cost service Signed-off-by: Jatin Patil <[email protected]> * Fixed unit test script Signed-off-by: Jatin Patil <[email protected]> * Added theta, Updated unit test, Updated rviz tool service call logic Signed-off-by: Jatin Patil <[email protected]> * Updated requested changes Signed-off-by: Jatin Patil <[email protected]> --------- Signed-off-by: Jatin Patil <[email protected]> * Switch to new-style static_transform_publisher arguments. (#4563) These arguments have been the preferred way to use things since at least Humble. This avoids warnings when running it for the tests. Signed-off-by: Chris Lalancette <[email protected]> * Updated slack link (#4565) Signed-off-by: Steve Macenski <[email protected]> * Update README.md (#4589) Signed-off-by: Steve Macenski <[email protected]> * fix flickering visualization (#4561) * Fix Flickering visualization Signed-off-by: Vladyslav Hrynchak <[email protected]> * Refactoring Costmap2DPublisher and Costmap2DROS Signed-off-by: Vladyslav Hrynchak <[email protected]> * Refactoring costmap_2d_ros.cpp Signed-off-by: Vladyslav Hrynchak <[email protected]> * Refactoring Costmap2DPublisher and Costmap2DROS Signed-off-by: Vladyslav Hrynchak <[email protected]> * Update costmap_2d_publisher.cpp Signed-off-by: Vladyslav Hrynchak <[email protected]> * Change map_vis_z from float to double Signed-off-by: Vladyslav Hrynchak <[email protected]> * Add comment to map_vis_z_ parameter Signed-off-by: Vladyslav Hrynchak <[email protected]> --------- Signed-off-by: Vladyslav Hrynchak <[email protected]> * Copy fix-terminate diff from opennav_docking repo (#4598) * Copy fix-terminate diff from opennav_docking repo Signed-off-by: redvinaa <[email protected]> * Lint Signed-off-by: redvinaa <[email protected]> --------- Signed-off-by: redvinaa <[email protected]> * Fix race condition in AMCL for #4537 (#4605) * Fixed timed_behavior.hpp (#4602) Signed-off-by: Vladyslav Hrynchak <[email protected]> * Adding new Nav2 loopback simulator (#4614) * adding Nav2 loopback sim Signed-off-by: Steve Macenski <[email protected]> * drop performance by half * lintin * Add multirobot usecase comment * fixing copy paste error * fixing review comments --------- Signed-off-by: Steve Macenski <[email protected]> * Added laser data from map in nav2_loopback_sim (#4617) * Added laser data from map Signed-off-by: Jatin Patil <[email protected]> * Fixed Linting Signed-off-by: Jatin Patil <[email protected]> * Fixed Linting Signed-off-by: Jatin Patil <[email protected]> * Fixed few requested changes Signed-off-by: Jatin Patil <[email protected]> * Fixed linting Signed-off-by: Jatin Patil <[email protected]> * Requested changes Signed-off-by: Jatin Patil <[email protected]> * Linting Signed-off-by: Jatin Patil <[email protected]> * Added parameters and fixed requested changes Signed-off-by: Jatin Patil <[email protected]> * linting Signed-off-by: Jatin Patil <[email protected]> * Added scan using LineIterator Signed-off-by: Jatin Patil <[email protected]> * LineIterator max_distance or range_max Signed-off-by: Jatin Patil <[email protected]> * min of max_distance or range_max Signed-off-by: Jatin Patil <[email protected]> * final updates working correctly Signed-off-by: Jatin Patil <[email protected]> * Fix lint Signed-off-by: Jatin Patil <[email protected]> * requested changes Signed-off-by: Jatin Patil <[email protected]> * Update nav2_loopback_sim/nav2_loopback_sim/loopback_simulator.py Signed-off-by: Steve Macenski <[email protected]> * Update nav2_loopback_sim/nav2_loopback_sim/loopback_simulator.py Signed-off-by: Steve Macenski <[email protected]> --------- Signed-off-by: Jatin Patil <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Co-authored-by: Steve Macenski <[email protected]> * Making base frame ID for map to base link transform based on base frame ID parameter (#4632) Signed-off-by: Steve Macenski <[email protected]> * Update Smac Planner for rounding to closest bin rather than flooring (#4636) * adding stamped option for loopbacks im (#4637) Signed-off-by: Steve Macenski <[email protected]> --------- Signed-off-by: GoesM_server <[email protected]> Signed-off-by: Alberto Tudela <[email protected]> Signed-off-by: HovorunBh <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Signed-off-by: redvinaa <[email protected]> Signed-off-by: Kemal Bektas <[email protected]> Signed-off-by: Ivan Radionov <[email protected]> Signed-off-by: stevedan <[email protected]> Signed-off-by: Joey Yang <[email protected]> Signed-off-by: goes <[email protected]> Signed-off-by: GoesM <[email protected]> Signed-off-by: James Ward <[email protected]> Signed-off-by: Jatin Patil <[email protected]> Signed-off-by: Chris Lalancette <[email protected]> Signed-off-by: Vladyslav Hrynchak <[email protected]> Co-authored-by: GoesM <[email protected]> Co-authored-by: GoesM_server <[email protected]> Co-authored-by: Alberto Tudela <[email protected]> Co-authored-by: Bohdan <[email protected]> Co-authored-by: Vince Reda <[email protected]> Co-authored-by: Kemal Bektas <[email protected]> Co-authored-by: Kemal Bektas <[email protected]> Co-authored-by: Ivan Radionov <[email protected]> Co-authored-by: Ivan Radionov <[email protected]> Co-authored-by: Stevedan Ogochukwu Omodolor <[email protected]> Co-authored-by: stevedan <[email protected]> Co-authored-by: Joey Yang <[email protected]> Co-authored-by: James Ward <[email protected]> Co-authored-by: Jatin Patil <[email protected]> Co-authored-by: Chris Lalancette <[email protected]> Co-authored-by: Vladyslav Hrynchak <[email protected]>
1 parent dbc0882 commit 7969626

File tree

181 files changed

+4649
-7705
lines changed

Some content is hidden

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

181 files changed

+4649
-7705
lines changed

README.md

Lines changed: 38 additions & 41 deletions
Large diffs are not rendered by default.

nav2_amcl/src/amcl_node.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ AmclNode::on_deactivate(const rclcpp_lifecycle::State & /*state*/)
312312
pose_pub_->on_deactivate();
313313
particle_cloud_pub_->on_deactivate();
314314

315-
// reset dynamic parameter handler
315+
// shutdown and reset dynamic parameter handler
316+
remove_on_set_parameters_callback(dyn_params_handler_.get());
316317
dyn_params_handler_.reset();
317318

318319
// destroy bond connection
@@ -540,8 +541,8 @@ AmclNode::initialPoseReceived(geometry_msgs::msg::PoseWithCovarianceStamped::Sha
540541
global_frame_id_.c_str());
541542
return;
542543
}
543-
if (abs(msg->pose.pose.position.x) > map_->size_x ||
544-
abs(msg->pose.pose.position.y) > map_->size_y)
544+
if (first_map_received_ && (abs(msg->pose.pose.position.x) > map_->size_x ||
545+
abs(msg->pose.pose.position.y) > map_->size_y))
545546
{
546547
RCLCPP_ERROR(
547548
get_logger(), "Received initialpose from message is out of the size of map. Rejecting.");

nav2_behaviors/include/nav2_behaviors/timed_behavior.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,6 @@ class TimedBehavior : public nav2_core::Behavior
237237

238238
while (rclcpp::ok()) {
239239
elasped_time_ = clock_->now() - start_time;
240-
if (action_server_->is_cancel_requested()) {
241-
RCLCPP_INFO(logger_, "Canceling %s", behavior_name_.c_str());
242-
stopRobot();
243-
result->total_elapsed_time = elasped_time_;
244-
onActionCompletion(result);
245-
action_server_->terminate_all(result);
246-
return;
247-
}
248-
249240
// TODO(orduno) #868 Enable preempting a Behavior on-the-fly without stopping
250241
if (action_server_->is_preempt_requested()) {
251242
RCLCPP_ERROR(
@@ -259,6 +250,15 @@ class TimedBehavior : public nav2_core::Behavior
259250
return;
260251
}
261252

253+
if (action_server_->is_cancel_requested()) {
254+
RCLCPP_INFO(logger_, "Canceling %s", behavior_name_.c_str());
255+
stopRobot();
256+
result->total_elapsed_time = elasped_time_;
257+
onActionCompletion(result);
258+
action_server_->terminate_all(result);
259+
return;
260+
}
261+
262262
ResultStatus on_cycle_update_result = onCycleUpdate();
263263
switch (on_cycle_update_result.status) {
264264
case Status::SUCCEEDED:

nav2_bringup/launch/bringup_launch.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def generate_launch_description():
4848
use_composition = LaunchConfiguration('use_composition')
4949
use_respawn = LaunchConfiguration('use_respawn')
5050
log_level = LaunchConfiguration('log_level')
51+
use_localization = LaunchConfiguration('use_localization')
5152

5253
# Map fully qualified names to relative ones so the node's namespace can be prepended.
5354
# In case of the transforms (tf), currently, there doesn't seem to be a better alternative
@@ -99,6 +100,11 @@ def generate_launch_description():
99100
'map', default_value='', description='Full path to map yaml file to load'
100101
)
101102

103+
declare_use_localization_cmd = DeclareLaunchArgument(
104+
'use_localization', default_value='True',
105+
description='Whether to enable localization or not'
106+
)
107+
102108
declare_use_sim_time_cmd = DeclareLaunchArgument(
103109
'use_sim_time',
104110
default_value='false',
@@ -151,7 +157,7 @@ def generate_launch_description():
151157
PythonLaunchDescriptionSource(
152158
os.path.join(launch_dir, 'slam_launch.py')
153159
),
154-
condition=IfCondition(slam),
160+
condition=IfCondition(PythonExpression([slam, ' and ', use_localization])),
155161
launch_arguments={
156162
'namespace': namespace,
157163
'use_sim_time': use_sim_time,
@@ -164,7 +170,7 @@ def generate_launch_description():
164170
PythonLaunchDescriptionSource(
165171
os.path.join(launch_dir, 'localization_launch.py')
166172
),
167-
condition=IfCondition(PythonExpression(['not ', slam])),
173+
condition=IfCondition(PythonExpression(['not ', slam, ' and ', use_localization])),
168174
launch_arguments={
169175
'namespace': namespace,
170176
'map': map_yaml_file,
@@ -210,6 +216,7 @@ def generate_launch_description():
210216
ld.add_action(declare_use_composition_cmd)
211217
ld.add_action(declare_use_respawn_cmd)
212218
ld.add_action(declare_log_level_cmd)
219+
ld.add_action(declare_use_localization_cmd)
213220

214221
# Add the actions to launch all of the navigation nodes
215222
ld.add_action(bringup_cmd_group)

nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,10 @@ def generate_launch_description():
111111
world_sdf = tempfile.mktemp(prefix='nav2_', suffix='.sdf')
112112
world_sdf_xacro = ExecuteProcess(
113113
cmd=['xacro', '-o', world_sdf, ['headless:=', 'False'], world])
114-
start_gazebo_cmd = IncludeLaunchDescription(
115-
PythonLaunchDescriptionSource(
116-
os.path.join(get_package_share_directory('ros_gz_sim'), 'launch',
117-
'gz_sim.launch.py')),
118-
launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items())
114+
start_gazebo_cmd = ExecuteProcess(
115+
cmd=['gz', 'sim', '-r', '-s', world_sdf],
116+
output='screen',
117+
)
119118

120119
remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown(
121120
on_shutdown=[
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# Copyright (C) 2024 Open Navigation LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""This is all-in-one launch script intended for use by nav2 developers."""
16+
17+
import os
18+
19+
from ament_index_python.packages import get_package_share_directory
20+
21+
from launch import LaunchDescription
22+
from launch.actions import (
23+
DeclareLaunchArgument,
24+
GroupAction,
25+
IncludeLaunchDescription,
26+
)
27+
from launch.conditions import IfCondition
28+
from launch.launch_description_sources import PythonLaunchDescriptionSource
29+
from launch.substitutions import LaunchConfiguration
30+
from launch_ros.actions import Node, SetParameter
31+
from launch_ros.descriptions import ParameterFile
32+
33+
from nav2_common.launch import RewrittenYaml
34+
35+
36+
def generate_launch_description():
37+
# Get the launch directory
38+
bringup_dir = get_package_share_directory('nav2_bringup')
39+
loopback_sim_dir = get_package_share_directory('nav2_loopback_sim')
40+
launch_dir = os.path.join(bringup_dir, 'launch')
41+
sim_dir = get_package_share_directory('nav2_minimal_tb3_sim')
42+
43+
# Create the launch configuration variables
44+
namespace = LaunchConfiguration('namespace')
45+
use_namespace = LaunchConfiguration('use_namespace')
46+
map_yaml_file = LaunchConfiguration('map')
47+
params_file = LaunchConfiguration('params_file')
48+
autostart = LaunchConfiguration('autostart')
49+
use_composition = LaunchConfiguration('use_composition')
50+
use_respawn = LaunchConfiguration('use_respawn')
51+
52+
# Launch configuration variables specific to simulation
53+
rviz_config_file = LaunchConfiguration('rviz_config_file')
54+
use_robot_state_pub = LaunchConfiguration('use_robot_state_pub')
55+
use_rviz = LaunchConfiguration('use_rviz')
56+
57+
remappings = [('/tf', 'tf'), ('/tf_static', 'tf_static')]
58+
59+
# Declare the launch arguments
60+
declare_namespace_cmd = DeclareLaunchArgument(
61+
'namespace', default_value='', description='Top-level namespace'
62+
)
63+
64+
declare_use_namespace_cmd = DeclareLaunchArgument(
65+
'use_namespace',
66+
default_value='false',
67+
description='Whether to apply a namespace to the navigation stack',
68+
)
69+
70+
declare_map_yaml_cmd = DeclareLaunchArgument(
71+
'map',
72+
default_value=os.path.join(bringup_dir, 'maps', 'tb3_sandbox.yaml'),
73+
)
74+
75+
declare_params_file_cmd = DeclareLaunchArgument(
76+
'params_file',
77+
default_value=os.path.join(bringup_dir, 'params', 'nav2_params.yaml'),
78+
description='Full path to the ROS2 parameters file to use for all launched nodes',
79+
)
80+
81+
declare_autostart_cmd = DeclareLaunchArgument(
82+
'autostart',
83+
default_value='true',
84+
description='Automatically startup the nav2 stack',
85+
)
86+
87+
declare_use_composition_cmd = DeclareLaunchArgument(
88+
'use_composition',
89+
default_value='True',
90+
description='Whether to use composed bringup',
91+
)
92+
93+
declare_use_respawn_cmd = DeclareLaunchArgument(
94+
'use_respawn',
95+
default_value='False',
96+
description='Whether to respawn if a node crashes. Applied when composition is disabled.',
97+
)
98+
99+
declare_rviz_config_file_cmd = DeclareLaunchArgument(
100+
'rviz_config_file',
101+
default_value=os.path.join(bringup_dir, 'rviz', 'nav2_default_view.rviz'),
102+
description='Full path to the RVIZ config file to use',
103+
)
104+
105+
declare_use_robot_state_pub_cmd = DeclareLaunchArgument(
106+
'use_robot_state_pub',
107+
default_value='True',
108+
description='Whether to start the robot state publisher',
109+
)
110+
111+
declare_use_rviz_cmd = DeclareLaunchArgument(
112+
'use_rviz', default_value='True', description='Whether to start RVIZ'
113+
)
114+
115+
urdf = os.path.join(sim_dir, 'urdf', 'turtlebot3_waffle.urdf')
116+
with open(urdf, 'r') as infp:
117+
robot_description = infp.read()
118+
119+
start_robot_state_publisher_cmd = Node(
120+
condition=IfCondition(use_robot_state_pub),
121+
package='robot_state_publisher',
122+
executable='robot_state_publisher',
123+
name='robot_state_publisher',
124+
namespace=namespace,
125+
output='screen',
126+
parameters=[
127+
{'use_sim_time': True, 'robot_description': robot_description}
128+
],
129+
remappings=remappings,
130+
)
131+
132+
rviz_cmd = IncludeLaunchDescription(
133+
PythonLaunchDescriptionSource(os.path.join(launch_dir, 'rviz_launch.py')),
134+
condition=IfCondition(use_rviz),
135+
launch_arguments={
136+
'namespace': namespace,
137+
'use_namespace': use_namespace,
138+
'use_sim_time': 'True',
139+
'rviz_config': rviz_config_file,
140+
}.items(),
141+
)
142+
143+
bringup_cmd = IncludeLaunchDescription(
144+
PythonLaunchDescriptionSource(os.path.join(launch_dir, 'bringup_launch.py')),
145+
launch_arguments={
146+
'namespace': namespace,
147+
'use_namespace': use_namespace,
148+
'map': map_yaml_file,
149+
'use_sim_time': 'True',
150+
'params_file': params_file,
151+
'autostart': autostart,
152+
'use_composition': use_composition,
153+
'use_respawn': use_respawn,
154+
'use_localization': 'False', # Don't use SLAM, AMCL
155+
}.items(),
156+
)
157+
158+
loopback_sim_cmd = IncludeLaunchDescription(
159+
PythonLaunchDescriptionSource(
160+
os.path.join(loopback_sim_dir, 'loopback_simulation.launch.py')),
161+
launch_arguments={
162+
'params_file': params_file,
163+
}.items(),
164+
)
165+
166+
configured_params = ParameterFile(
167+
RewrittenYaml(
168+
source_file=params_file,
169+
root_key=namespace,
170+
param_rewrites={},
171+
convert_types=True,
172+
),
173+
allow_substs=True,
174+
)
175+
176+
start_map_server = GroupAction(
177+
actions=[
178+
SetParameter('use_sim_time', True),
179+
Node(
180+
package='nav2_map_server',
181+
executable='map_server',
182+
name='map_server',
183+
output='screen',
184+
respawn=use_respawn,
185+
respawn_delay=2.0,
186+
parameters=[configured_params, {'yaml_filename': map_yaml_file}],
187+
remappings=remappings,
188+
),
189+
Node(
190+
package='nav2_lifecycle_manager',
191+
executable='lifecycle_manager',
192+
name='lifecycle_manager_map_server',
193+
output='screen',
194+
parameters=[
195+
configured_params,
196+
{'autostart': autostart}, {'node_names': ['map_server']}],
197+
),
198+
]
199+
)
200+
201+
# Create the launch description and populate
202+
ld = LaunchDescription()
203+
204+
# Declare the launch options
205+
ld.add_action(declare_namespace_cmd)
206+
ld.add_action(declare_use_namespace_cmd)
207+
ld.add_action(declare_map_yaml_cmd)
208+
ld.add_action(declare_params_file_cmd)
209+
ld.add_action(declare_autostart_cmd)
210+
ld.add_action(declare_use_composition_cmd)
211+
212+
ld.add_action(declare_rviz_config_file_cmd)
213+
ld.add_action(declare_use_robot_state_pub_cmd)
214+
ld.add_action(declare_use_rviz_cmd)
215+
ld.add_action(declare_use_respawn_cmd)
216+
217+
# Add the actions to launch all of the navigation nodes
218+
ld.add_action(start_robot_state_publisher_cmd)
219+
ld.add_action(start_map_server)
220+
ld.add_action(loopback_sim_cmd)
221+
ld.add_action(rviz_cmd)
222+
ld.add_action(bringup_cmd)
223+
224+
return ld

nav2_bringup/launch/tb3_simulation_launch.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,11 @@ def generate_launch_description():
214214
world_sdf = tempfile.mktemp(prefix='nav2_', suffix='.sdf')
215215
world_sdf_xacro = ExecuteProcess(
216216
cmd=['xacro', '-o', world_sdf, ['headless:=', headless], world])
217-
gazebo_server = IncludeLaunchDescription(
218-
PythonLaunchDescriptionSource(
219-
os.path.join(get_package_share_directory('ros_gz_sim'), 'launch',
220-
'gz_sim.launch.py')),
221-
launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items(),
222-
condition=IfCondition(use_simulator))
217+
gazebo_server = ExecuteProcess(
218+
cmd=['gz', 'sim', '-r', '-s', world_sdf],
219+
output='screen',
220+
condition=IfCondition(use_simulator)
221+
)
223222

224223
remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown(
225224
on_shutdown=[

0 commit comments

Comments
 (0)