text: import os
  
  from ament_index_python.packages import get_package_share_directory
  
  from launch import LaunchDescription
  from launch.actions import DeclareLaunchArgument, EmitEvent, RegisterEventHandler
  from launch.event_handlers import OnProcessExit
  from launch.events import Shutdown
  from launch.substitutions import LaunchConfiguration
  from launch_ros.actions import Node
  
  
  def generate_launch_description():
  	# Get the directory
  	dingo_dir = get_package_share_directory('dingo_viz')
  
  	# Create the launch configuration variables
  	rviz_config_file = LaunchConfiguration('rviz_config')
  
  	# Declare the launch arguments
  	declare_rviz_config_file_cmd = DeclareLaunchArgument(
  		'rviz_config',
  		default_value=os.path.join(dingo_dir, 'rviz', 'robot.rviz'),
  		description='Full path to the RVIZ config file to use')
  
  	# Launch rviz
  	start_rviz_cmd = Node(
  		package='rviz2',
  		executable='rviz2',
  		arguments=['-d', rviz_config_file],
  		output='screen')
  
  	exit_event_handler = RegisterEventHandler(
  		event_handler=OnProcessExit(
  			target_action=start_rviz_cmd,
  			on_exit=EmitEvent(event=Shutdown(reason='rviz exited'))))
  
  	# Create the launch description and populate
  	ld = LaunchDescription()
  
  	# Declare the launch options
  	ld.add_action(declare_rviz_config_file_cmd)
  
  	# Add any conditioned actions
  	ld.add_action(start_rviz_cmd)
  
  	# Add other nodes and processes we need
  	ld.add_action(exit_event_handler)
  
  	return ld
  