split and sort launch file
This commit is contained in:
parent
d0625eb65e
commit
ef563a5dc0
9 changed files with 826 additions and 5 deletions
65
rbs_bringup/launch/simulation.launch.py
Normal file
65
rbs_bringup/launch/simulation.launch.py
Normal file
|
@ -0,0 +1,65 @@
|
|||
import os
|
||||
from launch_ros.actions import Node
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
|
||||
from launch_ros.substitutions import FindPackageShare
|
||||
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
|
||||
from launch.conditions import IfCondition
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
declared_arguments = []
|
||||
declared_arguments.append(
|
||||
DeclareLaunchArgument("sim_gazebo", default_value="false", description="Gazebo Simulation")
|
||||
)
|
||||
declared_arguments.append(
|
||||
DeclareLaunchArgument(
|
||||
"rbs_robot_type",
|
||||
description="Type of robot by name",
|
||||
choices=["ur3", "ur3e", "ur5", "ur5e", "ur10", "ur10e", "ur16e"],
|
||||
default_value="ur5e",
|
||||
)
|
||||
)
|
||||
declared_arguments.append(
|
||||
DeclareLaunchArgument("env_manager", default_value="false", description="Launch env_manager?")
|
||||
)
|
||||
|
||||
sim_gazebo = LaunchConfiguration("sim_gazebo")
|
||||
rbs_robot_type = LaunchConfiguration("rbs_robot_type")
|
||||
env_manager_cond = LaunchConfiguration("env_manager")
|
||||
|
||||
# FIXME: To args when we'll have different files
|
||||
world_config_file = PathJoinSubstitution(
|
||||
[FindPackageShare("rbs_simulation"), "worlds", "mir.sdf"]
|
||||
)
|
||||
# Gazebo nodes
|
||||
gazebo = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
[os.path.join(get_package_share_directory('ros_ign_gazebo'),
|
||||
'launch', 'ign_gazebo.launch.py')]),
|
||||
launch_arguments=[('ign_args', [' -r ',world_config_file, " --physics-engine ignition-physics-dartsim-plugin --render-engine ogre2"])],
|
||||
condition=IfCondition(sim_gazebo))
|
||||
# Spawn robot
|
||||
gazebo_spawn_robot = Node(package='ros_ign_gazebo', executable='create',
|
||||
arguments=[
|
||||
'-name', rbs_robot_type,
|
||||
'-x', '0.0',
|
||||
'-z', '0.0',
|
||||
'-y', '0.0',
|
||||
'-topic', '/robot_description'],
|
||||
output='screen',
|
||||
condition=IfCondition(sim_gazebo))
|
||||
|
||||
env_manager = Node(package="env_manager",
|
||||
executable="main",
|
||||
condition=IfCondition(env_manager_cond)
|
||||
)
|
||||
|
||||
nodes_to_start = [
|
||||
gazebo,
|
||||
gazebo_spawn_robot,
|
||||
env_manager
|
||||
]
|
||||
return LaunchDescription(declared_arguments + nodes_to_start)
|
Loading…
Add table
Add a link
Reference in a new issue