def generate_launch_description(): sl = SimpleLauncher() #sl.include('gazebo_ros', 'gazebo.launch.py', #launch_arguments={'gui': 'True','headless': 'False'}) for robot in ['turtlebot1']: with sl.group(ns=robot): sl.robot_state_publisher( 'turtlebot3_description', 'turtlebot3_' + TURTLEBOT3_MODEL + '.urdf.xacro', xacro_args={'prefix': sl.name_join(robot, '/')} #parameters={'frame_prefix': robot + '/'},gz_plugins=True ) spawn_args = [ '-topic', 'robot_description', '-entity', robot, '-robot_namespace', robot ] sl.node('gazebo_ros', 'spawn_entity.py', arguments=spawn_args) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() x = '0' y = '0' z = '0.1' yaw = '0' pitch = '3.14' roll = '0' sl.include('baxter_description', 'baxter_state_publisher_launch.py') sl.node('tf2_ros', 'static_transform_publisher', arguments=[ x, y, z, yaw, pitch, roll, 'right_gripper', 'left_gripper_desired' ]) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() joint_name = [ 'right_e0', 'left_e0', 'right_e1', 'left_e1', 'right_s0', 'left_s0', 'right_s1', 'left_s1', 'right_w0', 'left_w0', 'right_w1', 'left_w1', 'right_w2', 'left_w2' ] for joint in joint_name: with sl.group(ns=joint): sl.include('move_joint', 'slider_launch.py', launch_arguments=[('name', joint)]) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() sl.declare_arg('name', 'turtlebot1') sl.declare_arg('use_sim_time', False) sl.declare_arg('rviz', True) sl.declare_arg('use_nav', False) sl.declare_arg('map', sl.find('nav_tutorial', 'batS.yaml')) sl.declare_arg( 'map_server', default_value=True, description='Whether run a map server (will be in the global namespace' ) robot = sl.arg('name') with sl.group(if_arg='rviz'): this_dir = os.path.dirname(__file__) sl.node('rviz2', 'rviz2', arguments=[ '-d', sl.path_join(this_dir, sl.name_join(robot, '.rviz')) ]) with sl.group(if_arg='map_server'): sl.node('nav2_map_server', 'map_server', name='map_server', parameters={'yaml_filename': sl.arg('map')}) sl.node('nav2_lifecycle_manager', 'lifecycle_manager', name='map_server_manager', output='screen', parameters={ 'autostart': True, 'node_names': ['map_server'] }) def configure(rewrites): rewrites.update({'use_sim_time': sl.arg('use_sim_time')}) return RewrittenYaml( #source_file=sl.find('nav2_bringup', 'nav2_params.yaml'), source_file=sl.find('nav_tutorial', 'nav_param.yaml'), root_key=robot, param_rewrites=rewrites, convert_types=True) remappings = {'map': '/map', '/scan': 'scan'} with sl.group(ns=robot): # start amcl anyway rewrites = { 'base_frame_id': sl.name_join(robot, '/base_link'), 'odom_frame_id': sl.name_join(robot, '/odom'), 'map_topic': '/map' } sl.node('nav2_amcl', 'amcl', parameters=[configure(rewrites)] + [{ 'set_initial_pose': True }], remappings=remappings) sl.node('nav2_lifecycle_manager', 'lifecycle_manager', name='amcl_manager', output='screen', parameters=[{ 'autostart': True, 'node_names': ['amcl'] }]) # start nav stack only if autonomous nav with sl.group(if_arg='use_nav'): nav_nodes = [ ('nav2_controller', 'controller_server'), ('nav2_planner', 'planner_server'), ('nav2_recoveries', 'recoveries_server'), ('nav2_bt_navigator', 'bt_navigator'), ] rewrites = { 'robot_base_frame': sl.name_join(robot, '/base_link'), 'base_frame_id': sl.name_join(robot, '/base_link'), 'default_bt_xml_filename': sl.find('nav2_bt_navigator', 'navigate_w_replanning_time.xml'), 'map_topic': '/map', 'topic': sl.name_join('/', robot, '/scan'), 'global_frame': sl.name_join(robot, '/odom') } configured_params = configure(rewrites) lifecycle_nodes = [] for pkg, executable in nav_nodes: sl.node(pkg, executable, name=executable, parameters=[configured_params], remappings=remappings) lifecycle_nodes.append(executable) sl.node('nav2_lifecycle_manager', 'lifecycle_manager', name='nav_manager', output='screen', parameters=[{ 'autostart': True, 'node_names': lifecycle_nodes }]) with sl.group(unless_arg='use_nav'): sl.node('slider_publisher', 'slider_publisher', arguments=[sl.find('nav_tutorial', 'cmd_sliders.yaml')]) return sl.launch_description()
def generate_launch_description(): ''' Example of AMCL (pure localization) for BB8 ''' sl = SimpleLauncher() robot = 'bb8' with sl.group(ns=robot): sl.node('lab4_navigation', 'vel2joints.py', parameters=[{ 'static_tf': False }]) # generate description sl.robot_state_publisher('lab4_navigation', 'bb.xacro', 'urdf', xacro_args={'name': robot}) # fire up slider publisher for cmd_vel cmd_file = sl.find('lab4_navigation', 'cmd_sliders.yaml') sl.node('slider_publisher', 'slider_publisher', name='cmd_vel_manual', arguments=[cmd_file]) # launch AMCL node with remappings sl.node('nav2_amcl', 'amcl', name='amcl', parameters=[sl.find('lab4_navigation', 'amcl_param.yaml')], arguments='--ros-args --log-level warn') # run lifecycle manager just for AMCL sl.node('nav2_lifecycle_manager', 'lifecycle_manager', name='lifecycle_manager', output='screen', parameters=[{ 'autostart': True, 'node_names': ['amcl'] }]) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() sl.robot_state_publisher('baxter_description', 'baxter.urdf.xacro') sl.node('bridge_manager', 'static_bridge_joint_states') sl.node('bridge_manager', 'static_bridge_left_joint_command') sl.node('bridge_manager', 'static_bridge_right_joint_command') rviz_config = sl.find('bridge_manager', 'baxter_sim_config.rviz', 'launch/') sl.node('rviz2', 'rviz2', arguments=['-d', rviz_config]) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() sl.declare_arg('map', default_value=sl.find('nav_tutorial', 'batS.yaml')) sl.declare_arg('perfect_loc', default_value=False) sl.include('map_simulator', 'simulation2d_launch.py', launch_arguments= sl.arg_map(['map'])) sl.declare_arg('name', 'turtlebot1') robot = sl.arg('name') with sl.group(ns=robot): sl.robot_state_publisher('turtlebot3_description','turtlebot3_' + TURTLEBOT3_MODEL + '.urdf.xacro', xacro_args={'prefix': sl.name_join(sl.arg('name'), '/')}) sl.node('map_simulator', 'spawn', parameters = [{'zero_joints': True, 'static_tf_odom': sl.arg('perfect_loc'), 'radius': .2, 'robot_color': [50,50,50], 'laser_color': [0,255,0]}]) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() sl.declare_arg('map', default_value=sl.find('nav_tutorial', 'batS.yaml')) sl.declare_arg('map_server', default_value=True) sl.include('map_simulator', 'simulation2d_launch.py', launch_arguments=sl.arg_map(['map', 'map_server']).items()) # run RViz2 rviz_config_file = sl.find('nav_tutorial', 'config.rviz') sl.node('rviz2', 'rviz2', output='log', arguments=['-d', rviz_config_file]) return sl.launch_description()
def generate_launch_description(): ''' Example of AMCL (pure localization) for BB8 ''' sl = SimpleLauncher() sl.declare_arg('robot', 'bb8') robot = sl.arg('robot') robot_type = sl.py_eval("''.join(c for c in '", robot, "' if not c.isdigit())") sl.declare_arg('use_nav', False) use_nav = sl.arg('use_nav') nav_nodes = [('nav2_controller', 'controller_server'), ('nav2_planner', 'planner_server'), ('nav2_bt_navigator', 'bt_navigator')] node_names = [] print(robot.describe()) with sl.group(ns=robot): sl.node('lab4_navigation', 'vel2joints.py', parameters=[{ 'static_tf': True }]) # generate description sl.robot_state_publisher('lab4_navigation', sl.name_join(robot_type, '.xacro'), 'urdf', xacro_args={'name': robot}) with sl.group(unless_arg='use_nav'): # fire up slider publisher for cmd_vel cmd_file = sl.find('lab4_navigation', 'cmd_sliders.yaml') sl.node('slider_publisher', 'slider_publisher', name='cmd_vel_manual', arguments=[cmd_file]) with sl.group(if_arg='use_nav'): # launch navigation nodes with remappings for pkg, executable in nav_nodes: robot_rad = sl.py_eval("'", robot_type, "'=='bb'and .27 or .16") configured_params = RewrittenYaml( source_file=sl.find('lab4_navigation', 'nav_param.yaml'), root_key=robot, param_rewrites={ 'robot_base_frame': sl.py_eval("''.join(c for c in '", robot, "') + '/base_link'"), 'global_frame': sl.py_eval("''.join(c for c in '", robot, "') + '/odom'"), 'topic': sl.py_eval("'/' + ''.join(c for c in '", robot, "') + '/scan'"), 'robot_radius': robot_rad, 'default_bt_xml_filename': sl.find('nav2_bt_navigator', 'navigate_w_replanning_time.xml') }, convert_types=True) sl.node( pkg, executable, name=executable, parameters=[configured_params], ) node_names.append(executable) # run lifecycle manager just for navigation nodes sl.node('nav2_lifecycle_manager', 'lifecycle_manager', name='lifecycle_manager', output='screen', parameters=[{ 'autostart': True, 'node_names': node_names }]) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() sl.declare_arg('namespace', default_value='bluerov2') sl.declare_arg('gazebo',default_value=False) parameters = {'use_sim_time': sl.arg('gazebo')} with sl.group(ns=sl.arg('namespace')): # load joint (camera tilt) controller only if needed with sl.group(if_arg='gazebo'): tilt_params = sl.find('bluerov2_control','tilt_control.yaml') sl.node('iauv_control', 'joint_gz_pid',parameters = [tilt_params]) # load body controller anyway sl.node('iauv_control', 'body_pid', parameters = parameters) return sl.launch_description()
def generate_launch_description(): ''' Run the given nodes in the robot's namespace ''' sl = SimpleLauncher() sl.declare_arg('robot',default_value='turtlebot1') with sl.group(ns=sl.arg('robot')): configured_params = RewrittenYaml( source_file=sl.find('nav_tutorial', 'xbox.yaml'), root_key=sl.arg('robot'), convert_types=True, param_rewrites={}) sl.node('joy','joy_node', parameters=[{ 'dev': '/dev/input/js0', 'deadzone': 0.3, 'autorepeat_rate': 20.0, }]) sl.node('teleop_twist_joy', 'teleop_node', name='teleop_twist_joy_node', parameters=[configured_params]) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() sl.declare_arg('namespace', default_value='bluerov2') sl.declare_arg('use_ned_frame',default_value=False) sl.declare_arg('gazebo',default_value=False) sl.declare_arg('debug', default_value=0) sl.declare_gazebo_axes() namespace=sl.arg('namespace') # Request sim time value to the global node with sl.group(ns=namespace): # xacro parsing + change moving joints to fixed / no Gazebo here frame = sl.py_eval_str("'world_ned' if ", sl.arg('use_ned_frame'), " else 'world'") xacro_args = {'namespace': namespace, 'inertial_reference_frame': frame, 'gazebo_use': sl.arg('gazebo'), 'debug': sl.arg('debug')} sl.robot_state_publisher('bluerov2_description', 'bluerov2_default.xacro', xacro_args=xacro_args) #description = sl.robot_description('bluerov2_description', 'bluerov2_default.xacro', xacro_args=xacro_args) #description_fixed = sl.name_join("'",Command(sl.name_join(['ros2 run bluerov2_control to_fixed_joints.py', #' -d ', description, #' --keep_moving ', 'tilt'])),"'") #sl.node('robot_state_publisher', 'robot_state_publisher', parameters={'robot_description': description}) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() sl.declare_arg('namespace', default_value='bluerov2') sl.declare_arg('use_ned_frame', default_value=False) sl.declare_arg('debug', default_value=0) sl.declare_arg('ground_truth', default_value=True) sl.declare_gazebo_axes() namespace = sl.arg('namespace') # Request sim time value to the global node #res = is_sim_time(return_param=False, use_subprocess=True) res = True # robot state publicher sl.include('bluerov2_description', 'state_publisher_launch.py', launch_arguments={ 'namespace': sl.arg('namespace'), 'use_ned_frame': sl.arg('use_ned_frame'), 'gazebo': 'true', 'debug': sl.arg('debug') }) with sl.group(ns=namespace): # URDF spawner description_topic = sl.py_eval("'/' + '", namespace, "' + '/robot_description'") spawn_args = [ '-gazebo_namespace', '/gazebo', '-topic', description_topic, '-entity', namespace ] spawn_args += sl.gazebo_axes_args() sl.node('gazebo_ros', 'spawn_entity.py', parameters={'use_sim_time': res}, arguments=spawn_args) # ground truth to tf if needed with sl.group(if_arg='ground_truth'): sl.node('odom_to_tf', 'odom_to_tf', parameters={'odom_topic': 'pose_gt'}) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() # load descriptions for robot in ('r2d2', 'bb8', 'd0'): with sl.group(ns=robot): sl.robot_state_publisher('ros2_2020', robot + '.xacro') # run Python simulation sl.node('ros2_2020', 'simulation.py', output='screen') # run RViz2 rviz_config_file = sl.find('ros2_2020', 'config.rviz') sl.node('rviz2', 'rviz2', output='log', arguments=['-d', rviz_config_file]) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() sl.declare_arg('name', 'right_e0') sl.node('slider_publisher', 'slider_publisher', name = sl.arg('name'), arguments = [sl.find('move_joint', 'single_joint.yaml')]) #sl.node('move_joint', 'move_joint', parameters = {'joint_name': 'right_e0'}, remappings = {'joint_setpoint': 'setpoint'}.items()) sl.node('move_joint', 'move_joint', parameters = {'joint_name': sl.arg('name')}, remappings = {'joint_setpoint': 'setpoint'}.items()) return sl.launch_description()
def generate_launch_description(): sl = SimpleLauncher() sl.declare_arg('gui', default_value=True) sl.declare_arg('spawn', default_value=True) sl.include('uuv_gazebo_worlds','auv_underwater_world.launch', launch_arguments={'gui': sl.arg('gui')}) with sl.group(if_arg='spawn'): sl.include('bluerov2_description', 'upload_bluerov2_launch.py') return sl.launch_description()