Skip to content

Commit 4d94d65

Browse files
authored
[Robotics][its-planner] Fix for differential drive and Ackermann steering scenarios (#1450)
1 parent e976c4f commit 4d94d65

File tree

12 files changed

+2037
-47
lines changed

12 files changed

+2037
-47
lines changed

robotics-ai-suite/components/its-planner/its_planner/CMakeLists.txt

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ install(TARGETS ${library_name}
8484
RUNTIME DESTINATION lib/${PROJECT_NAME}
8585
)
8686

87-
install(TARGETS ${executable_name}
88-
RUNTIME DESTINATION lib/${PROJECT_NAME}
89-
)
90-
9187
install(DIRECTORY include/
9288
DESTINATION include/
9389
)
@@ -96,6 +92,31 @@ install(FILES global_planner_plugin.xml
9692
DESTINATION share/${PROJECT_NAME}
9793
)
9894

95+
# Install launch files
96+
install(DIRECTORY launch/
97+
DESTINATION share/${PROJECT_NAME}/launch
98+
FILES_MATCHING PATTERN "*.py"
99+
)
100+
101+
# Install configuration files - ROS distro specific
102+
if($ENV{ROS_DISTRO} STREQUAL "humble")
103+
# Humble specific files
104+
install(FILES
105+
nav2_params_humble.yaml
106+
nav2_params_dubins_humble.yaml
107+
navigate_w_recovery_humble.xml
108+
DESTINATION share/${PROJECT_NAME}
109+
)
110+
else()
111+
# Default to jazzy for newer distros
112+
install(FILES
113+
nav2_params_jazzy.yaml
114+
nav2_params_dubins_jazzy.yaml
115+
navigate_w_recovery_jazzy.xml
116+
DESTINATION share/${PROJECT_NAME}
117+
)
118+
endif()
119+
99120
if(BUILD_TESTING)
100121
find_package(ament_lint_auto REQUIRED)
101122
find_package(ament_cmake_gtest REQUIRED)

robotics-ai-suite/components/its-planner/its_planner/humble/debian/rules

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ override_dh_auto_install:
6464
# CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
6565
if [ -f "/opt/ros/humble/setup.sh" ]; then . "/opt/ros/humble/setup.sh"; fi && \
6666
install -d $(CURDIR)/debian/ros-humble-its-planner/opt/ros/humble/share/its_planner
67-
install -m 0755 $(CURDIR)/nav2_params.yaml $(CURDIR)/debian/ros-humble-its-planner/opt/ros/humble/share/its_planner
68-
install -m 0755 $(CURDIR)/nav2_params_dubins.yaml $(CURDIR)/debian/ros-humble-its-planner/opt/ros/humble/share/its_planner
69-
install -m 0755 $(CURDIR)/navigate_w_recovery.xml $(CURDIR)/debian/ros-humble-its-planner/opt/ros/humble/share/its_planner
67+
install -d $(CURDIR)/debian/ros-humble-its-planner/opt/ros/humble/share/its_planner/launch
68+
install -m 0755 $(CURDIR)/nav2_params_humble.yaml $(CURDIR)/debian/ros-humble-its-planner/opt/ros/humble/share/its_planner
69+
install -m 0755 $(CURDIR)/nav2_params_dubins_humble.yaml $(CURDIR)/debian/ros-humble-its-planner/opt/ros/humble/share/its_planner
70+
install -m 0755 $(CURDIR)/navigate_w_recovery_humble.xml $(CURDIR)/debian/ros-humble-its-planner/opt/ros/humble/share/its_planner
71+
install -m 0755 $(CURDIR)/launch/*.py $(CURDIR)/debian/ros-humble-its-planner/opt/ros/humble/share/its_planner/launch/
7072
dh_auto_install

robotics-ai-suite/components/its-planner/its_planner/jazzy/debian/rules

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ override_dh_auto_install:
6464
# CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
6565
if [ -f "/opt/ros/jazzy/setup.sh" ]; then . "/opt/ros/jazzy/setup.sh"; fi && \
6666
install -d $(CURDIR)/debian/ros-jazzy-its-planner/opt/ros/jazzy/share/its_planner
67-
install -m 0755 $(CURDIR)/nav2_params.yaml $(CURDIR)/debian/ros-jazzy-its-planner/opt/ros/jazzy/share/its_planner
68-
install -m 0755 $(CURDIR)/nav2_params_dubins.yaml $(CURDIR)/debian/ros-jazzy-its-planner/opt/ros/jazzy/share/its_planner
69-
install -m 0755 $(CURDIR)/navigate_w_recovery.xml $(CURDIR)/debian/ros-jazzy-its-planner/opt/ros/jazzy/share/its_planner
67+
install -d $(CURDIR)/debian/ros-jazzy-its-planner/opt/ros/jazzy/share/its_planner/launch
68+
install -m 0755 $(CURDIR)/nav2_params_jazzy.yaml $(CURDIR)/debian/ros-jazzy-its-planner/opt/ros/jazzy/share/its_planner
69+
install -m 0755 $(CURDIR)/nav2_params_dubins_jazzy.yaml $(CURDIR)/debian/ros-jazzy-its-planner/opt/ros/jazzy/share/its_planner
70+
install -m 0755 $(CURDIR)/navigate_w_recovery_jazzy.xml $(CURDIR)/debian/ros-jazzy-its-planner/opt/ros/jazzy/share/its_planner
71+
install -m 0755 $(CURDIR)/launch/*.py $(CURDIR)/debian/ros-jazzy-its-planner/opt/ros/jazzy/share/its_planner/launch/
7072
dh_auto_install
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright (C) 2025 Intel Corporation
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
import os
17+
from ament_index_python.packages import get_package_share_directory
18+
from launch import LaunchDescription
19+
from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable
20+
from launch.launch_description_sources import PythonLaunchDescriptionSource
21+
22+
23+
def get_ros_distro():
24+
"""Gets the ROS 2 distribution name"""
25+
return os.environ.get('ROS_DISTRO', 'humble')
26+
27+
28+
def generate_launch_description():
29+
nav2_bringup_dir = get_package_share_directory('nav2_bringup')
30+
its_planner_dir = get_package_share_directory('its_planner')
31+
32+
# Automatic ROS version detection
33+
ros_distro = get_ros_distro()
34+
35+
# File selection based on distribution
36+
if ros_distro == 'humble':
37+
params_file = os.path.join(its_planner_dir, 'nav2_params_dubins_humble.yaml')
38+
bt_xml_file = os.path.join(its_planner_dir, 'navigate_w_recovery_humble.xml')
39+
else: # jazzy or newer distributions
40+
params_file = os.path.join(its_planner_dir, 'nav2_params_dubins_jazzy.yaml')
41+
bt_xml_file = os.path.join(its_planner_dir, 'navigate_w_recovery_jazzy.xml')
42+
43+
print(f"ROS Distro: {ros_distro}")
44+
print(f"Params file: {params_file}")
45+
print(f"Params file exists: {os.path.exists(params_file)}")
46+
print(f"BT XML file: {bt_xml_file}")
47+
print(f"BT XML file exists: {os.path.exists(bt_xml_file)}")
48+
49+
set_log_level = SetEnvironmentVariable(
50+
'RCUTILS_LOGGING_SEVERITY_THRESHOLD', 'INFO'
51+
)
52+
53+
nav2_launch = IncludeLaunchDescription(
54+
PythonLaunchDescriptionSource(
55+
os.path.join(nav2_bringup_dir, 'launch', 'tb3_simulation_launch.py')
56+
),
57+
launch_arguments={
58+
'headless': 'False',
59+
'use_sim_time': 'true',
60+
'params_file': params_file,
61+
'default_nav_to_pose_bt_xml': bt_xml_file,
62+
'default_nav_through_poses_bt_xml': bt_xml_file,
63+
}.items()
64+
)
65+
66+
return LaunchDescription([
67+
set_log_level,
68+
nav2_launch
69+
])
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright (C) 2025 Intel Corporation
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
import os
17+
from ament_index_python.packages import get_package_share_directory
18+
from launch import LaunchDescription
19+
from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable
20+
from launch.launch_description_sources import PythonLaunchDescriptionSource
21+
22+
23+
def get_ros_distro():
24+
"""Gets the ROS 2 distribution name"""
25+
return os.environ.get('ROS_DISTRO', 'humble')
26+
27+
28+
def generate_launch_description():
29+
nav2_bringup_dir = get_package_share_directory('nav2_bringup')
30+
its_planner_dir = get_package_share_directory('its_planner')
31+
32+
# Automatic ROS version detection
33+
ros_distro = get_ros_distro()
34+
35+
# File selection based on distribution
36+
if ros_distro == 'humble':
37+
params_file = os.path.join(its_planner_dir, 'nav2_params_humble.yaml')
38+
bt_xml_file = os.path.join(its_planner_dir, 'navigate_w_recovery_humble.xml')
39+
else: # jazzy or newer distributions
40+
params_file = os.path.join(its_planner_dir, 'nav2_params_jazzy.yaml')
41+
bt_xml_file = os.path.join(its_planner_dir, 'navigate_w_recovery_jazzy.xml')
42+
43+
print(f"ROS Distro: {ros_distro}")
44+
print(f"Params file: {params_file}")
45+
print(f"Params file exists: {os.path.exists(params_file)}")
46+
print(f"BT XML file: {bt_xml_file}")
47+
print(f"BT XML file exists: {os.path.exists(bt_xml_file)}")
48+
49+
set_log_level = SetEnvironmentVariable(
50+
'RCUTILS_LOGGING_SEVERITY_THRESHOLD', 'INFO'
51+
)
52+
53+
nav2_launch = IncludeLaunchDescription(
54+
PythonLaunchDescriptionSource(
55+
os.path.join(nav2_bringup_dir, 'launch', 'tb3_simulation_launch.py')
56+
),
57+
launch_arguments={
58+
'headless': 'False',
59+
'use_sim_time': 'true',
60+
'params_file': params_file,
61+
'default_bt_xml_filename': bt_xml_file,
62+
}.items()
63+
)
64+
65+
return LaunchDescription([
66+
set_log_level,
67+
nav2_launch
68+
])

0 commit comments

Comments
 (0)