Skip to content

Commit 51d50a4

Browse files
authored
feat(tier4_control_launch): switch control cmd topic (#1685)
feat: switch control cmd topic Signed-off-by: TetsuKawa <kawaguchitnon@icloud.com>
1 parent a1cced3 commit 51d50a4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

launch/tier4_control_launch/launch/control.launch.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
from launch_ros.substitutions import FindPackageShare
3131
import yaml
3232

33+
def get_control_cmd_topic(context):
34+
is_redundant = LaunchConfiguration('launch_redundancy_system_components').perform(context)
35+
system_run_mode = LaunchConfiguration('system_run_mode').perform(context)
36+
37+
if is_redundant.lower() == 'true' and system_run_mode.lower() == 'planning_simulation':
38+
return '/main/control/command/control_cmd'
39+
return '/control/command/control_cmd'
3340

3441
def launch_setup(context, *args, **kwargs):
3542
with open(LaunchConfiguration("vehicle_param_file").perform(context), "r") as f:
@@ -218,7 +225,7 @@ def launch_setup(context, *args, **kwargs):
218225
("input/kinematics", "/localization/kinematic_state"),
219226
("input/acceleration", "/localization/acceleration"),
220227
("output/vehicle_cmd_emergency", "/control/command/emergency_cmd"),
221-
("output/control_cmd", "/control/command/control_cmd"),
228+
("output/control_cmd", get_control_cmd_topic(context)),
222229
("output/gear_cmd", "/control/command/gear_cmd"),
223230
("output/turn_indicators_cmd", "/control/command/turn_indicators_cmd"),
224231
("output/hazard_lights_cmd", "/control/command/hazard_lights_cmd"),

0 commit comments

Comments
 (0)