Skip to content

Commit 05baf83

Browse files
authored
Merge pull request #18 from mleegwt/master
Fixing configuration for Nav2
2 parents 017f9b8 + a484113 commit 05baf83

File tree

6 files changed

+94
-18
lines changed

6 files changed

+94
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Load ROS 2:
66
Navigate to ROS workspace:
77
`cd ros_ws`
88

9-
# Temerature sensor
9+
# Temperature sensor
1010
Build and run temperature sensor node (my SensorID):
1111
`colcon build && source ./install/setup.bash && ros2 run tempreader tempreaderNode --ros-args -p sensorId:=28.C23646D48524 &`
1212

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/bt_navigator:
2+
ros__parameters:
3+
use_sim_time: false
4+
5+
# Path naar je behavior tree XML in de nav2_bringup package
6+
default_bt_xml_filename: >
7+
/opt/ros/jazzy/share/nav2_bt_navigator/behavior_trees/navigate_w_replanning_and_recovery.xml
8+
9+
# (optioneel) schakel recovery nodes in/uit
10+
enable_recovery: true
11+
# (optioneel) namen van recovery plugins
12+
recovery_behaviors: ["spin", "backup"]
13+
14+
# (optioneel) hoeveel keer een recovery maximaal te proberen
15+
expected_planner_frequency: 20.0
Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,54 @@
11
/controller_server:
22
ros__parameters:
33
use_sim_time: false
4-
controller_plugins: ["FollowWaypoints"]
4+
controller_plugins: ["RegulatedPurePursuitController"]
5+
controller_frequency: 10.0
6+
transform_tolerance: 0.1
57

6-
local_costmap:
8+
progress_checker_plugins: ["progress_checker"]
9+
goal_checker_plugins: ["goal_checker"]
10+
11+
progress_checker:
12+
plugin: "nav2_controller::SimpleProgressChecker"
13+
required_movement_radius: 0.5
14+
movement_time_allowance: 10.0
15+
16+
goal_checker:
17+
plugin: "nav2_controller::SimpleGoalChecker"
18+
xy_goal_tolerance: 0.5
19+
yaw_goal_tolerance: 0.2
20+
stateful: true
21+
22+
RegulatedPurePursuitController:
23+
plugin: "nav2_regulated_pure_pursuit_controller::RegulatedPurePursuitController"
24+
lookahead_dist: 0.5
25+
desired_linear_vel: 0.25
26+
27+
/local_costmap:
28+
local_costmap:
29+
ros__parameters:
730
global_frame: local_enu
831
robot_base_frame: base_link
932
update_frequency: 5.0
1033
publish_frequency: 2.0
1134
rolling_window: true
12-
width: 1000.0
13-
height: 1000.0
35+
width: 1000
36+
height: 1000
1437
resolution: 5.0
15-
transform_tolerance: 1.0
16-
inflation_radius: 0.5
38+
transform_tolerance: 0.5
39+
robot_radius: 0.6
1740
cost_scaling_factor: 10.0
1841

19-
plugins:
20-
- name: obstacle_layer
21-
type: "nav2_costmap_2d::ObstacleLayer"
22-
- name: inflation_layer
23-
type: "nav2_costmap_2d::InflationLayer"
42+
static_layer:
43+
enabled: false
44+
45+
plugins: ["obstacle_layer", "inflation_layer"]
46+
47+
obstacle_layer:
48+
plugin: "nav2_costmap_2d::ObstacleLayer"
2449

25-
FollowWaypoints:
26-
plugin: "nav2_controller::FollowWaypoints"
27-
allow_in_place_goal: true
28-
controller_frequency: 10.0
50+
inflation_layer:
51+
plugin: "nav2_costmap_2d::InflationLayer"
52+
inflation_radius: 2.0
53+
cost_scaling_factor: 10.0
2954

ros_ws/src/navigation/config/planner_server.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,26 @@
1010

1111
expected_planner_frequency: 20.0
1212

13-
global_costmap:
13+
/global_costmap:
14+
global_costmap:
15+
ros__parameters:
16+
global_frame: local_enu
17+
robot_base_frame: base_link
18+
rolling_window: true
19+
width: 1000
20+
height: 1000
21+
resolution: 1.0
22+
transform_tolerance: 0.5
23+
robot_radius: 0.6
1424
static_layer:
1525
enabled: false
26+
27+
plugins: ["obstacle_layer", "inflation_layer"]
28+
29+
obstacle_layer:
30+
plugin: "nav2_costmap_2d::ObstacleLayer"
31+
32+
inflation_layer:
33+
plugin: "nav2_costmap_2d::InflationLayer"
34+
inflation_radius: 2.0
35+
cost_scaling_factor: 8.0

ros_ws/src/navigation/launch/nav2_stack.launch.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ def generate_launch_description():
3131
'config',
3232
'navsat.yaml'
3333
)
34+
bt_navigator_yaml = os.path.join(
35+
get_package_share_directory('navigation'),
36+
'config',
37+
'bt_navigator.yaml'
38+
)
3439
nodes = [
3540
Node(
3641
package='tf2_ros',
@@ -95,7 +100,8 @@ def generate_launch_description():
95100
executable='bt_navigator',
96101
name='bt_navigator',
97102
namespace='',
98-
parameters=[{'use_sim_time': False}],
103+
parameters=[ bt_navigator_yaml ],
104+
output='screen'
99105
),
100106
LifecycleNode(
101107
package='nav2_controller',
@@ -125,6 +131,14 @@ def generate_launch_description():
125131
output='screen',
126132
parameters=[behavior_yaml],
127133
),
134+
LifecycleNode(
135+
package='nav2_waypoint_follower',
136+
executable='waypoint_follower',
137+
name='waypoint_follower',
138+
namespace='',
139+
parameters=[{'use_sim_time': False}],
140+
output='screen',
141+
),
128142
Node(
129143
package='robot_localization',
130144
executable='ekf_node',
@@ -161,6 +175,7 @@ def generate_launch_description():
161175
'planner_server',
162176
'behavior_server',
163177
'bt_navigator',
178+
'waypoint_follower'
164179
]
165180
}]
166181
),

ros_ws/src/navigation/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
('share/' + package_name + '/config', ['config/controller_server.yaml']),
1414
('share/' + package_name + '/config', ['config/planner_server.yaml']),
1515
('share/' + package_name + '/config', ['config/behavior_server.yaml']),
16+
('share/' + package_name + '/config', ['config/bt_navigator.yaml']),
1617
('share/' + package_name + '/config', ['config/ekf.yaml']),
1718
('share/' + package_name + '/config', ['config/navsat.yaml']),
1819
('share/' + package_name, ['package.xml']),

0 commit comments

Comments
 (0)