Skip to content

Commit 0139a4e

Browse files
committed
Adjust parameters such that the current slam implementation works again
Signed-off-by: Rosalie <rosalie.van.ark@alliander.com>
1 parent bb5519e commit 0139a4e

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

alliander_robotics/alliander_nav2/src/alliander_nav2/config/slam_params.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# SPDX-FileCopyrightText: Alliander N. V.
22
#
33
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Based on: https://github.com/SteveMacenski/slam_toolbox/blob/ros2/config/mapper_params_localization.yaml
46

57
slam_toolbox:
68
ros__parameters:

alliander_robotics/alliander_nav2/src/alliander_nav2/launch/nav2.launch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ def launch_setup(context: LaunchContext) -> list: # noqa: PLR0912, PLR0915
4949
# Define configuration:
5050
lifecycle_nodes_names = []
5151
use_map_localization = True
52+
use_slam_map_localization = False
5253
plugins = ["static_layer", "obstacle_layer", "inflation_layer"]
5354

5455
if nav2.collision_monitor:
5556
lifecycle_nodes_names.append("collision_monitor")
5657
if nav2.slam:
5758
lifecycle_nodes_names.append("slam_toolbox")
5859
use_map_localization = False
60+
use_slam_map_localization = True
5961
if nav2.gps:
6062
if not namespace_gps:
6163
raise ValueError("Namespace for GPS must be provided when using GPS.")
@@ -68,7 +70,7 @@ def launch_setup(context: LaunchContext) -> list: # noqa: PLR0912, PLR0915
6870
"amcl",
6971
]
7072
)
71-
else:
73+
elif not use_slam_map_localization:
7274
plugins.remove("static_layer")
7375
lifecycle_nodes_names.extend(
7476
[
@@ -124,7 +126,7 @@ def launch_setup(context: LaunchContext) -> list: # noqa: PLR0912, PLR0915
124126
{
125127
"global_frame": f"{namespace_vehicle}/odom",
126128
"robot_base_frame": f"{namespace_vehicle}/base_footprint",
127-
"rolling_window": nav2.gps,
129+
"rolling_window": (nav2.gps or nav2.slam),
128130
"width": 10,
129131
"height": 10,
130132
"plugins": plugins,

alliander_robotics/predefined_configurations.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ def config_panther_collision_monitor(self) -> None: # noqa: D102
242242
def config_panther_slam(self) -> None: # noqa: D102
243243
vehicle = Vehicle("panther", (0, 0, 0.2))
244244
vehicle.nav2_config.slam = True
245+
vehicle.nav2_config.navigation = True
246+
vehicle.nav2_config.window_size = 20
245247
lidar = Lidar(
246248
"velodyne",
247249
position=(0.125, 0.185, 0.20),
@@ -251,6 +253,7 @@ def config_panther_slam(self) -> None: # noqa: D102
251253

252254
link(vehicle, lidar)
253255
self.plat_conf.platforms = [vehicle, lidar]
256+
self.sim_conf.world = "walls.sdf"
254257

255258
@register_configuration("panther_lidar_navigation")
256259
def config_panther_lidar_navigation(self) -> None: # noqa: D102

0 commit comments

Comments
 (0)