ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I think I have a fairly good answer now which I found in the official documentation, a bit hidden in my oppinion.
Here is the link: https://docs.ros.org/en/foxy/Tutorials/Intermediate/Launch/Using-ROS2-Launch-For-Large-Projects.html
And here is my solution:
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.actions import GroupAction
from launch_ros.actions import PushRosNamespace
ROBOT_NAMESPACE="leorover"
def generate_launch_description():
leorover_realsense_node = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('leorover_realsense'), 'launch'),
'/d455_launch.py'])
)
leorover_imu_filter_node = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('leorover_imu_filter'), 'launch'),
'/imu_filter.launch.py'])
)
leorover_rtabmap_node = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('leorover_rtabmap'), 'launch'),
'/realsense_d455.launch.py'])
)
bringup_with_namespace = GroupAction(
actions=[
PushRosNamespace(ROBOT_NAMESPACE),
leorover_realsense_node,
leorover_imu_filter_node,
leorover_rtabmap_node
]
)
return LaunchDescription([
bringup_with_namespace
])
Any comments and tips to further improve it would be appreciated. But with that, I think I answered my own question. Sorry for bothering anyone and I hope this actually helps other people that could not find the solution right away.