Skip to content

Commit

Permalink
added launch file
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-Khadar committed Jan 8, 2025
1 parent 67a271a commit 1c0c1b8
Show file tree
Hide file tree
Showing 3 changed files with 1,555 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import os

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.actions import IncludeLaunchDescription
from launch.conditions import IfCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution

from launch_ros.actions import Node


def generate_launch_description():
# Configure ROS nodes for launch

# Setup project paths
pkg_project_bringup = get_package_share_directory('subjugator_bringup')
pkg_project_gazebo = get_package_share_directory('subjugator_gazebo')
pkg_project_description = get_package_share_directory('subjugator_description')
pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim')

# # Load the SDF file from "description" package
# sdf_file = os.path.join(pkg_project_description, 'models', 'diff_drive', 'model.sdf')
# with open(sdf_file, 'r') as infp:
# robot_desc = infp.read()

# Setup to launch the simulator and Gazebo world
gz_sim = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')),
launch_arguments={'gz_args': PathJoinSubstitution([
pkg_project_gazebo,
'worlds',
'robosub_2024.world'
])}.items(),
)

# # Takes the description and joint angles as inputs and publishes the 3D poses of the robot links
# robot_state_publisher = Node(
# package='robot_state_publisher',
# executable='robot_state_publisher',
# name='robot_state_publisher',
# output='both',
# parameters=[
# {'use_sim_time': True},
# {'robot_description': robot_desc},
# ]
# )

# # Visualize in RViz
# rviz = Node(
# package='rviz2',
# executable='rviz2',
# arguments=['-d', os.path.join(pkg_project_bringup, 'config', 'diff_drive.rviz')],
# condition=IfCondition(LaunchConfiguration('rviz'))
# )

# Bridge ROS topics and Gazebo messages for establishing communication
# bridge = Node(
# package='ros_gz_bridge',
# executable='parameter_bridge',
# parameters=[{
# 'config_file': os.path.join(pkg_project_bringup, 'config', 'ros_gz_example_bridge.yaml'),
# 'qos_overrides./tf_static.publisher.durability': 'transient_local',
# }],
# output='screen'
# )

return LaunchDescription([
gz_sim,
# DeclareLaunchArgument('rviz', default_value='true',
# description='Open RViz.'),
# bridge,
# robot_state_publisher,
# rviz
])
Loading

0 comments on commit 1c0c1b8

Please sign in to comment.