55from ament_index_python .packages import get_package_share_directory
66from launch import LaunchDescription
77from launch .actions import DeclareLaunchArgument , GroupAction , IncludeLaunchDescription
8+ from launch .conditions import IfCondition
89from launch .launch_description_sources import PythonLaunchDescriptionSource
9- from launch .substitutions import LaunchConfiguration
10- from launch_ros .actions import PushRosNamespace , SetRemap
10+ from launch .substitutions import LaunchConfiguration , PythonExpression
11+ from launch_ros .actions import Node , PushRosNamespace , SetRemap
1112
1213
1314def generate_launch_description ():
@@ -23,8 +24,10 @@ def generate_launch_description():
2324 'joint_states_topic' , default_value = '/old_arm/joint_states' ,
2425 description = 'sensor_msgs/JointState input, with named model joints in radians' ),
2526 DeclareLaunchArgument (
26- 'use_joint_state_publisher_gui' , default_value = 'true' ,
27- description = 'Set false when a live joint-state source is connected' ),
27+ 'use_joint_state_publisher_gui' , default_value = 'false' ,
28+ description = (
29+ 'Opt into the manual joint stepper instead of the upright '
30+ 'motion-test source' )),
2831 DeclareLaunchArgument (
2932 'launch_rviz' , default_value = 'true' ,
3033 description = 'Set false for headless transform validation' ),
@@ -37,6 +40,24 @@ def generate_launch_description():
3740 DeclareLaunchArgument (
3841 'diagnostics_topic' , default_value = '/diagnostics' ,
3942 description = 'DiagnosticArray input for the Engineering Monitor' ),
43+ DeclareLaunchArgument (
44+ 'start_motion_test' , default_value = 'true' ,
45+ description = 'Start the old-arm motion test node' ),
46+ DeclareLaunchArgument (
47+ 'motion_test_segment_duration' , default_value = '3.0' ,
48+ description = 'Seconds for each synchronized motion segment' ),
49+ DeclareLaunchArgument (
50+ 'hardware_mode' , default_value = 'simulation' ,
51+ description = 'Arm mode: simulation or arduino' ),
52+ DeclareLaunchArgument (
53+ 'arduino_port' , default_value = '' ,
54+ description = 'Arduino serial port, for example /dev/ttyACM0' ),
55+ DeclareLaunchArgument (
56+ 'arduino_baud' , default_value = '115200' ,
57+ description = 'Arduino serial baud rate' ),
58+ DeclareLaunchArgument (
59+ 'arduino_dry_run' , default_value = 'false' ,
60+ description = 'Run the Arduino bridge without opening a serial port' ),
4061 ]
4162 station = IncludeLaunchDescription (
4263 PythonLaunchDescriptionSource (
@@ -52,8 +73,43 @@ def generate_launch_description():
5273 'start_temporary_diagnostics_publisher' : 'false' ,
5374 }.items (),
5475 )
76+
77+ motion_test_node = Node (
78+ package = 'waybionic_motion_test' ,
79+ executable = 'motion_test' ,
80+ name = 'old_arm_motion_test' ,
81+ output = 'screen' ,
82+ condition = IfCondition (PythonExpression ([
83+ "'" , LaunchConfiguration ('start_motion_test' ), "' == 'true' and '" ,
84+ LaunchConfiguration ('hardware_mode' ), "' == 'simulation'"
85+ ])),
86+ parameters = [
87+ {'segment_duration' : LaunchConfiguration (
88+ 'motion_test_segment_duration' )}
89+ ],
90+ )
91+
92+ arduino_bridge_node = Node (
93+ package = 'waybionic_hardware' ,
94+ executable = 'arduino_bridge' ,
95+ name = 'waybionic_arduino_bridge' ,
96+ output = 'screen' ,
97+ condition = IfCondition (PythonExpression ([
98+ "'" , LaunchConfiguration ('hardware_mode' ), "' == 'arduino'"
99+ ])),
100+ parameters = [
101+ {'port' : LaunchConfiguration ('arduino_port' )},
102+ {'baud' : LaunchConfiguration ('arduino_baud' )},
103+ {'segment_duration' : LaunchConfiguration (
104+ 'motion_test_segment_duration' )},
105+ {'dry_run' : LaunchConfiguration ('arduino_dry_run' )},
106+ ],
107+ )
108+
55109 return LaunchDescription (arguments + [GroupAction ([
56110 PushRosNamespace ('old_arm' ),
57111 SetRemap (src = 'joint_states' , dst = LaunchConfiguration ('joint_states_topic' )),
58112 station ,
113+ motion_test_node ,
114+ arduino_bridge_node ,
59115 ])])
0 commit comments