Skip to content

Commit

Permalink
add basic astar launch demo
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Jul 15, 2024
1 parent 7bd1873 commit db0531f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
68 changes: 68 additions & 0 deletions mrpt_tutorials/launch/demo_astar_planner_gridmap.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# ROS 2 launch file for example in mrpt_tutorials
#
# See repo online: https://github.com/mrpt-ros-pkg/mrpt_navigation
#

from launch import LaunchDescription
from launch.substitutions import TextSubstitution
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from ament_index_python import get_package_share_directory
from launch.launch_description_sources import PythonLaunchDescriptionSource
import os


def generate_launch_description():
tutsDir = get_package_share_directory("mrpt_tutorials")
# print('tutsDir : ' + tutsDir)

mrpt_astar_planner_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('mrpt_tps_astar_planner'), 'launch',
'tps_astar_planner.launch.py')]),
launch_arguments={
'topic_goal_sub': '/goal_pose',
'show_gui': 'True',
'topic_obstacles_gridmap_sub': '/mrpt_map/map_gridmap',
'topic_static_maps': '/mrpt_map/map_gridmap',
'topic_wp_seq_pub': '/waypoints',
}.items()
)

mrpt_map_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('mrpt_map_server'), 'launch',
'mrpt_map_server.launch.py')]),
launch_arguments={
'map_yaml_file': os.path.join(tutsDir, 'maps', 'demo_world2.yaml'),
}.items()
)

mvsim_node = Node(
package='mvsim',
executable='mvsim_node',
name='mvsim',
output='screen',
parameters=[
# os.path.join(tutsDir, 'params', 'mvsim_ros2_params.yaml'),
{
"world_file": os.path.join(tutsDir, 'mvsim', 'demo_world2.world.xml'),
"do_fake_localization": True,
"show_gui": True,
}]
)

rviz2_node = Node(
package='rviz2',
executable='rviz2',
name='rviz2',
arguments=[
'-d', [os.path.join(tutsDir, 'rviz2', 'gridmap.rviz')]]
)
return LaunchDescription([
mrpt_map_launch,
mrpt_astar_planner_launch,
mvsim_node,
rviz2_node
])
2 changes: 1 addition & 1 deletion mrpt_tutorials/maps/demo_world2.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
image: demo_world2.png
resolution: 0.25
origin: [0.0, 0.0, 0.0]
origin: [-5.0, -5.0, 0.0]
occupied_thresh: 0.65
free_thresh: 0.196
negate: 0

0 comments on commit db0531f

Please sign in to comment.