Skip to content

Commit

Permalink
Added xrce agent lauch options
Browse files Browse the repository at this point in the history
  • Loading branch information
nhjschulz committed Aug 29, 2024
1 parent 169e946 commit ef85272
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions launch/dcs_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import launch
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, ExecuteProcess, OpaqueFunction
from launch.conditions import IfCondition
from launch.launch_description_entity import LaunchDescriptionEntity
from launch.substitutions import LaunchConfiguration

Expand Down Expand Up @@ -81,6 +82,16 @@ def _define_launch_args() -> list[DeclareLaunchArgument]:
default_value='true',
description='Enable/disable launch of RadonUlzer process.'
),
DeclareLaunchArgument(
name='launch_xrce',
default_value='false',
description='Enable/disable launch of the XRCE agent process.'
),
DeclareLaunchArgument(
name='xrce_agent',
default_value='/usr/local/bin/MicroXRCEAgent udp4 -p 1883',
description='Define command line for XRCE agent.'
),
DeclareLaunchArgument(
name='log_redirect',
default_value='false',
Expand Down Expand Up @@ -125,11 +136,16 @@ def _launch_setup(context) -> list[LaunchDescriptionEntity]:
if not os.path.isfile(ru_path):
sys.exit(f'RadonUlzer controller not found in {ru_path}')

xrce_agent = ExecuteProcess(
name='XRCE-Agent',
cmd=LaunchConfiguration('xrce_agent').perform(context).split(),
condition=IfCondition(LaunchConfiguration('launch_xrce'))
)

webots = None
if _arg_to_bool(LaunchConfiguration('launch_webots').perform(context)):
# webots with predefined world
#

webots = WebotsLauncher(world=LaunchConfiguration('world').perform(context))

wb_controller_cmd = [wb_ctrl_path]
Expand All @@ -139,28 +155,31 @@ def _launch_setup(context) -> list[LaunchDescriptionEntity]:
# DroidControlship Launcher
#
dcs_controller = ExecuteProcess(
name='DroidControlShip',
cmd=wb_controller_cmd + [
'--robot-name=ZumoComSystem',
dcs_path,
'--cfgFilePath',
os.path.join(dcs_home, 'data', 'config', 'config.json')
],
name='DroidControlShip'
condition=IfCondition(LaunchConfiguration('launch_dcs'))
)

# RadonUlzer Launcher
#
ru_controller = ExecuteProcess(
name='RadonUlzerRC',
cmd=wb_controller_cmd + [
'--robot-name=Zumo',
ru_path,
],
name='RadonUlzerRC'
condition=IfCondition(LaunchConfiguration('launch_ru'))
)

# construct launch description
#
actions = []
actions = [xrce_agent]

if webots:
actions.append(webots)
actions.append(
Expand All @@ -174,11 +193,8 @@ def _launch_setup(context) -> list[LaunchDescriptionEntity]:
)
)

if _arg_to_bool(LaunchConfiguration('launch_dcs').perform(context)):
actions.append(dcs_controller)

if _arg_to_bool(LaunchConfiguration('launch_ru').perform(context)):
actions.append(ru_controller)
actions.append(dcs_controller)
actions.append(ru_controller)

return actions

Expand Down

0 comments on commit ef85272

Please sign in to comment.