Skip to content

Commit 532d98a

Browse files
authored
Adaptions of navigation behavior (#13)
* using NavFn planner + DWB local planner * added custom behavior tree for MiR * added robot footprint * adapted a few parameters * visualization updates in rviz
1 parent 8f8988a commit 532d98a

File tree

8 files changed

+591
-36
lines changed

8 files changed

+591
-36
lines changed

mir_description/rviz/mir_visu_full.rviz

Lines changed: 485 additions & 0 deletions
Large diffs are not rendered by default.

mir_driver/launch/mir_launch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def generate_launch_description():
3939

4040
DeclareLaunchArgument(
4141
'rviz_config_file',
42-
default_value=os.path.join(mir_description_dir, 'rviz', 'mir_visualization.rviz'),
42+
default_value=os.path.join(mir_description_dir, 'rviz', 'mir_visu_full.rviz'),
4343
description='Define rviz config file to be used.'),
4444

4545
DeclareLaunchArgument(

mir_gazebo/launch/mir_gazebo_launch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def generate_launch_description():
6666

6767
declare_rviz_config_arg = DeclareLaunchArgument(
6868
'rviz_config_file',
69-
default_value=os.path.join(mir_gazebo_dir, 'rviz', 'mir_visualization.rviz'),
69+
default_value=os.path.join(mir_description_dir, 'rviz', 'mir_visu_full.rviz'),
7070
description='Define rviz config file to be used.')
7171

7272
declare_gui_arg = DeclareLaunchArgument(

mir_navigation/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ find_package(rviz2)
2323

2424

2525
install(DIRECTORY
26-
config launch rviz maps
26+
config launch rviz maps behavior_trees
2727
DESTINATION share/${PROJECT_NAME}
2828
)
2929

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
<!--
3+
This Behavior Tree replans the global path periodically at 1 Hz and it also has
4+
recovery actions specific to planning / control as well as general system issues.
5+
This will be continuous if a kinematically valid planner is selected.
6+
-->
7+
<root main_tree_to_execute="MainTree">
8+
<BehaviorTree ID="MainTree">
9+
<RecoveryNode number_of_retries="6" name="NavigateRecovery">
10+
<PipelineSequence name="NavigateWithReplanning">
11+
<RateController hz="1.0">
12+
<RecoveryNode number_of_retries="1" name="ComputePathToPose">
13+
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
14+
<ReactiveFallback name="ComputePathToPoseRecoveryFallback">
15+
<GoalUpdated/>
16+
<ClearEntireCostmap name="ClearGlobalCostmap-Context" service_name="global_costmap/clear_entirely_global_costmap"/>
17+
</ReactiveFallback>
18+
</RecoveryNode>
19+
</RateController>
20+
<RecoveryNode number_of_retries="1" name="FollowPath">
21+
<FollowPath path="{path}" controller_id="FollowPath"/>
22+
<ReactiveFallback name="FollowPathRecoveryFallback">
23+
<GoalUpdated/>
24+
<ClearEntireCostmap name="ClearLocalCostmap-Context" service_name="local_costmap/clear_entirely_local_costmap"/>
25+
</ReactiveFallback>
26+
</RecoveryNode>
27+
</PipelineSequence>
28+
<ReactiveFallback name="RecoveryFallback">
29+
<GoalUpdated/>
30+
<RoundRobin name="RecoveryActions">
31+
<Sequence name="ClearingActions">
32+
<ClearEntireCostmap name="ClearLocalCostmap-Subtree" service_name="local_costmap/clear_entirely_local_costmap"/>
33+
<ClearEntireCostmap name="ClearGlobalCostmap-Subtree" service_name="global_costmap/clear_entirely_global_costmap"/>
34+
</Sequence>
35+
<Spin spin_dist="0.79"/>
36+
<Wait wait_duration="3"/>
37+
<BackUp backup_dist="1" backup_speed="0.5"/>
38+
</RoundRobin>
39+
</ReactiveFallback>
40+
</RecoveryNode>
41+
</BehaviorTree>
42+
</root>

mir_navigation/config/mir_mapping_async_sim.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ slam_toolbox:
2626
debug_logging: true
2727
throttle_scans: 1
2828
transform_publish_period: 0.02 #if 0 never publishes odometry
29-
map_update_interval: 1.0
29+
map_update_interval: 0.01
3030
resolution: 0.05
3131
max_laser_range: 20.0 #for rastering images
3232
minimum_time_interval: 0.5
3333
transform_timeout: 0.5
34-
tf_buffer_duration: 30.
34+
tf_buffer_duration: 300.
3535
stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps
3636
enable_interactive_mode: true
3737

mir_navigation/config/mir_nav_params.yaml

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ amcl:
3030
save_pose_rate: 0.5
3131
sigma_hit: 0.2
3232
tf_broadcast: true
33-
transform_tolerance: 1.0
33+
transform_tolerance: 2.0
3434
update_min_a: 0.2
3535
update_min_d: 0.25
3636
z_hit: 0.5
@@ -47,6 +47,7 @@ amcl_rclcpp_node:
4747
ros__parameters:
4848
use_sim_time: True
4949

50+
5051
bt_navigator:
5152
ros__parameters:
5253
use_sim_time: True
@@ -62,6 +63,9 @@ bt_navigator:
6263
# nav2_bt_navigator/navigate_to_pose_w_replanning_and_recovery.xml
6364
# nav2_bt_navigator/navigate_through_poses_w_replanning_and_recovery.xml
6465
# They can be set here or via a RewrittenYaml remap from a parent launch file to Nav2.
66+
#
67+
# Note: Not quite correct, params that are not mentioned can not be substituted!
68+
plugin_lib_names:
6569
plugin_lib_names:
6670
- nav2_compute_path_to_pose_action_bt_node
6771
- nav2_compute_path_through_poses_action_bt_node
@@ -107,35 +111,33 @@ controller_server:
107111
min_x_velocity_threshold: 0.001
108112
min_y_velocity_threshold: 0.5
109113
min_theta_velocity_threshold: 0.001
114+
failure_tolerance: 0.1
115+
# speed_limit_topic : "speed_limit"
110116
progress_checker_plugin: "progress_checker"
111-
goal_checker_plugin: "goal_checker"
117+
goal_checker_plugins: ["goal_checker"]
112118
controller_plugins: ["FollowPath"]
113119

114120
# Progress checker parameters
115121
progress_checker:
116122
plugin: "nav2_controller::SimpleProgressChecker"
117123
required_movement_radius: 0.5
118124
movement_time_allowance: 10.0
119-
# Goal checker parameters
120125
goal_checker:
121126
plugin: "nav2_controller::SimpleGoalChecker"
122127
xy_goal_tolerance: 0.25
123-
yaw_goal_tolerance: 0.25
128+
yaw_goal_tolerance: 0.15
124129
stateful: True
125-
# DWB parameters
126130
FollowPath:
127131
plugin: "dwb_core::DWBLocalPlanner"
128132
debug_trajectory_details: True
129133
min_vel_x: 0.0
130134
min_vel_y: 0.0
131-
max_vel_x: 0.26
135+
max_vel_x: 2.5
132136
max_vel_y: 0.0
133137
max_vel_theta: 1.0
134138
min_speed_xy: 0.0
135-
max_speed_xy: 0.26
139+
max_speed_xy: 2.5
136140
min_speed_theta: 0.0
137-
# Add high threshold velocity for turtlebot 3 issue.
138-
# https://github.com/ROBOTIS-GIT/turtlebot3_simulations/issues/75
139141
acc_lim_x: 2.5
140142
acc_lim_y: 0.0
141143
acc_lim_theta: 3.2
@@ -153,26 +155,27 @@ controller_server:
153155
trans_stopped_velocity: 0.25
154156
short_circuit_trajectory_evaluation: True
155157
stateful: True
156-
critics: ["RotateToGoal", "Oscillation", "BaseObstacle", "GoalAlign", "PathAlign", "PathDist", "GoalDist"]
158+
critics: ["RotateToGoal", "Oscillation", "BaseObstacle", "GoalAlign", "PathAlign", "PathDist", "GoalDist", "ObstacleFootprint"]
157159
BaseObstacle.scale: 0.02
158-
PathAlign.scale: 32.0
159-
PathAlign.forward_point_distance: 0.1
160-
GoalAlign.scale: 24.0
161160
GoalAlign.forward_point_distance: 0.1
161+
GoalAlign.scale: 24.0
162+
PathAlign.scale: 32.0
163+
PathAlign.forward_point_distance: 0.325
162164
PathDist.scale: 32.0
163165
GoalDist.scale: 24.0
164-
RotateToGoal.scale: 32.0
165-
RotateToGoal.slowing_factor: 5.0
166+
RotateToGoal.scale: 24.0
167+
RotateToGoal.xy_goal_tolerance: 0.25
168+
RotateToGoal.slowing_factor: 2.0
166169
RotateToGoal.lookahead_time: -1.0
167-
170+
168171
controller_server_rclcpp_node:
169172
ros__parameters:
170173
use_sim_time: True
171174

172175
local_costmap:
173176
local_costmap:
174177
ros__parameters:
175-
update_frequency: 10.0
178+
update_frequency: 5.0
176179
publish_frequency: 2.0
177180
global_frame: odom
178181
robot_base_frame: base_link
@@ -181,12 +184,15 @@ local_costmap:
181184
width: 3
182185
height: 3
183186
resolution: 0.05
184-
robot_radius: 0.5
187+
# offset: front / back from base_link
188+
# footprint: '[ [front, width/2], [back, width/2], [-back, -width/2], [front, -width/2] ]'
189+
footprint: '[ [0.5, 0.25], [-0.4, 0.25], [-0.4, -0.25], [0.5, -0.25] ]'
190+
footprint_padding: 0.01
185191
plugins: ["voxel_layer", "inflation_layer"]
186192
inflation_layer:
187193
plugin: "nav2_costmap_2d::InflationLayer"
194+
inflation_radius: 0.55
188195
cost_scaling_factor: 3.0
189-
inflation_radius: 0.8
190196
voxel_layer:
191197
plugin: "nav2_costmap_2d::VoxelLayer"
192198
enabled: True
@@ -203,6 +209,11 @@ local_costmap:
203209
clearing: True
204210
marking: True
205211
data_type: "LaserScan"
212+
raytrace_max_range: 3.0
213+
raytrace_min_range: 0.0
214+
obstacle_max_range: 2.5
215+
obstacle_min_range: 0.0
216+
expected_update_rate: 0.0
206217
static_layer:
207218
map_subscribe_transient_local: True
208219
always_send_full_costmap: True
@@ -221,27 +232,41 @@ global_costmap:
221232
global_frame: map
222233
robot_base_frame: base_link
223234
use_sim_time: True
224-
robot_radius: 0.5
225-
resolution: 0.05
235+
# offset: front / back from base_link
236+
# footprint: '[ [front, width/2], [back, width/2], [-back, -width/2], [front, -width/2] ]'
237+
footprint: '[ [0.5, 0.25], [-0.4, 0.25], [-0.4, -0.25], [0.5, -0.25] ]'
238+
footprint_padding: 0.01
226239
track_unknown_space: true
227240
plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
228241
obstacle_layer:
229242
plugin: "nav2_costmap_2d::ObstacleLayer"
230243
enabled: True
231244
observation_sources: scan
245+
footprint_clearing_enabled: true
246+
max_obstacle_height: 2.0
247+
combination_method: 1
232248
scan:
233249
topic: /scan
250+
obstacle_max_range: 2.5
251+
obstacle_min_range: 0.0
252+
raytrace_max_range: 3.0
253+
raytrace_min_range: 0.0
234254
max_obstacle_height: 2.0
255+
min_obstacle_height: 0.0
235256
clearing: True
236257
marking: True
237258
data_type: "LaserScan"
259+
inf_is_valid: false
238260
static_layer:
239261
plugin: "nav2_costmap_2d::StaticLayer"
240262
map_subscribe_transient_local: True
241263
inflation_layer:
242264
plugin: "nav2_costmap_2d::InflationLayer"
265+
enabled: true
266+
inflation_radius: 0.55
243267
cost_scaling_factor: 3.0
244-
inflation_radius: 0.8
268+
inflate_unknown: false
269+
inflate_around_unknown: true
245270
always_send_full_costmap: True
246271
global_costmap_client:
247272
ros__parameters:
@@ -258,10 +283,10 @@ map_server:
258283
map_saver:
259284
ros__parameters:
260285
use_sim_time: True
261-
save_map_timeout: 5000
286+
save_map_timeout: 5.0
262287
free_thresh_default: 0.25
263288
occupied_thresh_default: 0.65
264-
map_subscribe_transient_local: False
289+
map_subscribe_transient_local: True
265290

266291
planner_server:
267292
ros__parameters:
@@ -271,7 +296,7 @@ planner_server:
271296
GridBased:
272297
plugin: "nav2_navfn_planner/NavfnPlanner"
273298
tolerance: 0.5
274-
use_astar: false
299+
use_astar: true
275300
allow_unknown: true
276301

277302
planner_server_rclcpp_node:

mir_navigation/launch/include/navigation.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def generate_launch_description():
3232
command_topic = LaunchConfiguration('cmd_vel_topic')
3333
autostart = LaunchConfiguration('autostart')
3434
params_file = LaunchConfiguration('params_file')
35-
default_bt_xml_filename = LaunchConfiguration('default_bt_xml_filename')
35+
default_nav_to_pose_bt_xml = LaunchConfiguration('default_nav_to_pose_bt_xml')
3636
map_subscribe_transient_local = LaunchConfiguration('map_subscribe_transient_local')
3737

3838
lifecycle_nodes = ['controller_server',
@@ -52,9 +52,11 @@ def generate_launch_description():
5252
('cmd_vel', command_topic)]
5353

5454
# Create our own temporary YAML files that include substitutions
55+
# Watch out for parameters that don't exist in yaml - will not be substituted of course (default_nav_to_pose_bt_xml)
56+
# TODO: Needs to be addressed in nav2
5557
param_substitutions = {
5658
'use_sim_time': use_sim_time,
57-
'default_bt_xml_filename': default_bt_xml_filename,
59+
'default_nav_to_pose_bt_xml': default_nav_to_pose_bt_xml,
5860
'autostart': autostart,
5961
'map_subscribe_transient_local': map_subscribe_transient_local}
6062

@@ -90,10 +92,9 @@ def generate_launch_description():
9092
description='Full path to the ROS2 parameters file to use'),
9193

9294
DeclareLaunchArgument(
93-
'default_bt_xml_filename',
95+
'default_nav_to_pose_bt_xml',
9496
default_value=os.path.join(
95-
get_package_share_directory('nav2_bt_navigator'),
96-
'behavior_trees', 'navigate_w_replanning_and_recovery.xml'),
97+
mir_nav_dir, 'behavior_trees', 'navigate_to_pose_w_replanning_and_recovery.xml'),
9798
description='Full path to the behavior tree xml file to use'),
9899

99100
DeclareLaunchArgument(
@@ -128,7 +129,9 @@ def generate_launch_description():
128129
executable='bt_navigator',
129130
name='bt_navigator',
130131
output='screen',
131-
parameters=[configured_params],
132+
parameters=[
133+
configured_params,
134+
{'default_nav_to_pose_bt_xml' : default_nav_to_pose_bt_xml}],
132135
remappings=remappings),
133136

134137
Node(

0 commit comments

Comments
 (0)