実際のところ
- UFactory Lite6用ノード
- Joystick用ノード
- JoystickでUFactory Lite6を動かすpythonアプリ
の三つを起動する例を考えます。
from launch_ros.actions import Node from launch.actions import DeclareLaunchArgument, ExecuteProcess from launch.substitutions import LaunchConfiguration def generate_launch_description(): # デフォルトのパラメータ値を設定 default_robot_ip_left = '192.168.1.XXX' default_hw_ns = 'left_lite6' default_dev_id = '/dev/input/js0' # Launch引数を宣言 return LaunchDescription([ DeclareLaunchArgument( 'robot_ip_left', default_value=default_robot_ip ), DeclareLaunchArgument( 'hw_ns_left', default_value=default_hw_ns ), DeclareLaunchArgument( 'dev_left', default_value=default_dev_id ), # xarm_apiのドライバー起動 Node( package='xarm_api', executable='lite6_driver.launch.py', arguments=['robot_ip:=' + LaunchConfiguration('robot_ip'), 'hw_ns:=' + LaunchConfiguration('hw_ns')], output='screen' ), # joy_linuxノードの起動 Node( package='joy_linux', executable='joy_linux_node', arguments=['--ros-args', '-p', 'dev:=' + LaunchConfiguration('dev_did'), '--remap', 'joy:=/hand'], output='screen' ), # Pythonスクリプトの実行 ExecuteProcess( cmd=['python3', 'dev_ws/joyapp.py'], output='screen' ) ])