devided launches
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
from launch import LaunchDescription
|
||||||
|
from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument
|
||||||
|
from launch.substitutions import (
|
||||||
|
PathJoinSubstitution,
|
||||||
|
LaunchConfiguration,
|
||||||
|
)
|
||||||
|
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||||
|
from launch_ros.substitutions import FindPackageShare
|
||||||
|
from launch_ros.actions import Node
|
||||||
|
from launch_ros.descriptions import ParameterFile
|
||||||
|
|
||||||
|
def generate_launch_description():
|
||||||
|
pkg_unity_robot_controller = FindPackageShare(package="").find("unity_robot_controller")
|
||||||
|
|
||||||
|
# Launch arguments
|
||||||
|
launch_args = [
|
||||||
|
DeclareLaunchArgument(
|
||||||
|
"namespace", default_value="sirius_bot", description="Top-level namespace"
|
||||||
|
),
|
||||||
|
# DeclareLaunchArgument(
|
||||||
|
# "start_rviz", default_value="True", description="Use basic rviz"
|
||||||
|
# ),
|
||||||
|
]
|
||||||
|
|
||||||
|
joy_config = PathJoinSubstitution([pkg_unity_robot_controller, "config", "joy_config.yaml"])
|
||||||
|
|
||||||
|
joy_node = Node(
|
||||||
|
package="joy",
|
||||||
|
executable="joy_node",
|
||||||
|
name="joy",
|
||||||
|
namespace=LaunchConfiguration("namespace"),
|
||||||
|
output="both",
|
||||||
|
parameters=[
|
||||||
|
ParameterFile(joy_config),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return LaunchDescription(
|
||||||
|
launch_args
|
||||||
|
+ [
|
||||||
|
joy_node,
|
||||||
|
]
|
||||||
|
)
|
||||||
@@ -8,8 +8,11 @@ from launch.launch_description_sources import PythonLaunchDescriptionSource
|
|||||||
from launch_ros.substitutions import FindPackageShare
|
from launch_ros.substitutions import FindPackageShare
|
||||||
from launch_ros.actions import Node
|
from launch_ros.actions import Node
|
||||||
from launch_ros.descriptions import ParameterFile
|
from launch_ros.descriptions import ParameterFile
|
||||||
|
from launch.conditions import IfCondition
|
||||||
|
|
||||||
def generate_launch_description():
|
def generate_launch_description():
|
||||||
|
|
||||||
|
pkg_wave_rover_controller = FindPackageShare(package="").find("wave_rover_controller")
|
||||||
pkg_unity_robot_controller = FindPackageShare(package="").find("unity_robot_controller")
|
pkg_unity_robot_controller = FindPackageShare(package="").find("unity_robot_controller")
|
||||||
|
|
||||||
# Launch arguments
|
# Launch arguments
|
||||||
@@ -22,12 +25,19 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument(
|
DeclareLaunchArgument(
|
||||||
"namespace", default_value="sirius_bot", description="Top-level namespace"
|
"namespace", default_value="sirius_bot", description="Top-level namespace"
|
||||||
),
|
),
|
||||||
# DeclareLaunchArgument(
|
DeclareLaunchArgument(
|
||||||
# "start_rviz", default_value="True", description="Use basic rviz"
|
"use_joy", default_value="False", description="Use joystick for control"
|
||||||
# ),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
joy_config = PathJoinSubstitution([pkg_unity_robot_controller, "config", "joy_config.yaml"])
|
|
||||||
|
joy = IncludeLaunchDescription(
|
||||||
|
PythonLaunchDescriptionSource(
|
||||||
|
PathJoinSubstitution([pkg_wave_rover_controller, "launch", "joy.launch.py"])
|
||||||
|
),
|
||||||
|
launch_arguments={"namespace": LaunchConfiguration("namespace")}.items(),
|
||||||
|
condition=IfCondition(LaunchConfiguration('use_joy'))
|
||||||
|
)
|
||||||
|
|
||||||
model = LaunchConfiguration("joy_model")
|
model = LaunchConfiguration("joy_model")
|
||||||
joy_params = PathJoinSubstitution([pkg_unity_robot_controller,
|
joy_params = PathJoinSubstitution([pkg_unity_robot_controller,
|
||||||
@@ -35,16 +45,16 @@ def generate_launch_description():
|
|||||||
model
|
model
|
||||||
])
|
])
|
||||||
|
|
||||||
joy_node = Node(
|
# joy_node = Node(
|
||||||
package="joy",
|
# package="joy",
|
||||||
executable="joy_node",
|
# executable="joy_node",
|
||||||
name="joy",
|
# name="joy",
|
||||||
namespace=LaunchConfiguration("namespace"),
|
# namespace=LaunchConfiguration("namespace"),
|
||||||
output="both",
|
# output="both",
|
||||||
parameters=[
|
# parameters=[
|
||||||
ParameterFile(joy_config),
|
# ParameterFile(joy_config),
|
||||||
],
|
# ],
|
||||||
)
|
# )
|
||||||
|
|
||||||
joy_wave_rover_controller_node = Node(
|
joy_wave_rover_controller_node = Node(
|
||||||
package="wave_rover_controller",
|
package="wave_rover_controller",
|
||||||
@@ -57,11 +67,10 @@ def generate_launch_description():
|
|||||||
{'serial_port': '/dev/ttyUSB0'}]
|
{'serial_port': '/dev/ttyUSB0'}]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
return LaunchDescription(
|
return LaunchDescription(
|
||||||
launch_args
|
launch_args
|
||||||
+ [
|
+ [
|
||||||
joy_node,
|
joy,
|
||||||
joy_wave_rover_controller_node,
|
joy_wave_rover_controller_node,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user