def generate_launch_description(): bringup_cmd_group = GroupAction([ Node( package='apriltag_docking', executable='controller', name='autodock_controller', output='screen', parameters = [config]), Node( package='rviz2', executable='rviz2', name='rviz2', arguments=['-d', rviz_config_dir], condition=IfCondition(open_rviz) ), IncludeLaunchDescription( PythonLaunchDescriptionSource(os.path.join(tag_launch_dir,'tag_gazebo.launch.py')), launch_arguments={'image_topic': image_topic, 'camera_name': camera_name}.items()) ]) ld = LaunchDescription() ld.add_action(bringup_cmd_group) return ld
def main(argv=sys.argv[1:]): launchFile = os.path.join(os.getenv('TEST_LAUNCH_DIR'), 'costmap_map_server.launch.py') testExecutable = os.getenv('TEST_EXECUTABLE') lifecycle_manager = launch_ros.actions.Node( package='nav2_lifecycle_manager', node_executable='lifecycle_manager', node_name='lifecycle_manager', output='screen', parameters=[{'node_names': ['map_server']}, {'autostart': True}]) ld = LaunchDescription([ IncludeLaunchDescription(PythonLaunchDescriptionSource([launchFile])), lifecycle_manager ]) test1_action = ExecuteProcess( cmd=[testExecutable], name='costmap_tests', output='screen' ) lts = LaunchTestService() lts.add_test_action(ld, test1_action) ls = LaunchService(argv=argv) ls.include_launch_description(ld) return lts.run(ls)
def generate_launch_description(): gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource( [FindPackageShare("gazebo_ros"), '/launch/gazebo.launch.py']), ) pkg_share = FindPackageShare('pilsbot_description').find('pilsbot_description') urdf_dir = os.path.join(pkg_share, 'urdf') xacro_file = os.path.join(urdf_dir, 'pilsbot.urdf.xacro') robot_desc = Command('xacro {}'.format(xacro_file)) params = {'robot_description': robot_desc, 'use_sim_time': True} robot_description = Node(package='robot_state_publisher', executable='robot_state_publisher', output='both', parameters=[params]) spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', arguments=['-topic', '/robot_description', '-entity', 'pilsbot'], output='screen') return LaunchDescription([ gazebo, robot_description, spawn_entity, ])
def generate_launch_description(): gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource([ os.path.join(get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py' ]), ) gazebo_ros2_control_demos_path = os.path.join( get_package_share_directory('gazebo_ros2_control_demos')) xacro_file = os.path.join(gazebo_ros2_control_demos_path, 'urdf', 'test_cart_position_pid.xacro.urdf') doc = xacro.parse(open(xacro_file)) xacro.process_doc(doc) params = {'robot_description': doc.toxml()} node_robot_state_publisher = Node(package='robot_state_publisher', executable='robot_state_publisher', output='screen', parameters=[params]) spawn_entity = Node( package='gazebo_ros', executable='spawn_entity.py', arguments=['-topic', 'robot_description', '-entity', 'cartpole'], output='screen') return LaunchDescription([ gazebo, node_robot_state_publisher, spawn_entity, ])
def generate_launch_description(): package_dir = get_package_share_directory('webots_ros2_universal_robot') webots = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('webots_ros2_core'), 'launch', 'robot_launch.py') ), launch_arguments={ 'executable': 'webots_robotic_arm_node', 'world': os.path.join(package_dir, 'worlds', 'universal_robot_rviz.wbt') }.items() ) # Rviz node rviz_config = os.path.join(package_dir, 'resource', 'view_robot_dynamic.rviz') rviz = Node( package='rviz2', executable='rviz2', output='log', arguments=['--display-config=' + rviz_config] ) return LaunchDescription([ rviz, webots ])
def generate_launch_description(): world = os.path.join(get_package_share_directory('ign_moveit2'), 'worlds', 'ur5_rg2_follow.sdf') # Launch Arguments use_sim_time = LaunchConfiguration('use_sim_time', default=True) return LaunchDescription([ # Launch Arguments DeclareLaunchArgument('use_sim_time', default_value=use_sim_time, description="If true, use simulated clock"), # Launch gazebo environment IncludeLaunchDescription(PythonLaunchDescriptionSource([ os.path.join(get_package_share_directory('ros_ign_gazebo'), 'launch', 'ign_gazebo.launch.py') ]), launch_arguments=[('ign_args', [world, ' -r'])]), # Box pose (IGN -> ROS2) Node(package='ros_ign_bridge', executable='parameter_bridge', name='parameter_bridge_box_pose', output='screen', arguments=[ '/model/box/pose@geometry_msgs/msg/Pose[ignition.msgs.Pose' ], parameters=[{ 'use_sim_time': use_sim_time }]), ])
def generate_launch_description(): log_level = 'info' cmd_vel_mux_config = PathJoinSubstitution([ FindPackageShare('rocket_kaya_bringup'), 'config', 'rocket_kaya_cmd_vel_mux.yaml', ]) base_launch_path = PathJoinSubstitution([ FindPackageShare('rocket_kaya_controller'), 'launch', 'rocket_kaya_controller.launch.py', ]) cmd_vel_mux = Node( package='twist_mux', executable='twist_mux', name='cmd_vel_mux', # remappings=[('/cmd_vel_out', '/cmd_vel')], parameters=[cmd_vel_mux_config], output='both', arguments=['--ros-args', '--log-level', log_level], emulate_tty=True, ) base_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource(base_launch_path)) return LaunchDescription([ cmd_vel_mux, base_launch, ])
def generate_launch_description(): package_dir = get_package_share_directory('webots_ros2_tiago') webots = IncludeLaunchDescription(PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('webots_ros2_core'), 'launch', 'robot_launch.py')), launch_arguments={ 'executable': 'webots_differential_drive_node', 'world': os.path.join(package_dir, 'worlds', 'ros_tiago.wbt'), 'node_parameters': os.path.join(package_dir, 'resource', 'tiago.yaml'), }.items()) # Rviz node use_rviz = launch.substitutions.LaunchConfiguration('rviz', default=False) rviz_config = os.path.join( get_package_share_directory('webots_ros2_tiago'), 'resource', 'odometry.rviz') rviz = launch_ros.actions.Node( package='rviz2', node_executable='rviz2', output='screen', arguments=['--display-config=' + rviz_config], condition=launch.conditions.IfCondition(use_rviz)) return launch.LaunchDescription([webots, rviz])
def generate_launch_description(): pkg_description = FindPackageShare("my_robot_description").find( "my_robot_description") model_file = os.path.join(pkg_description, "urdf", "my_robot.urdf.xacro") pkg_gazebo = FindPackageShare("my_robot_gazebo").find("my_robot_gazebo") gazebo_path = os.path.join( FindPackageShare("gazebo_ros").find("gazebo_ros"), "launch") with open("/tmp/my_robot.urdf", "w") as stream: stream.write(xacro.process_file(model_file).toxml()) robot_state_publisher_node = Node( package='robot_state_publisher', node_executable='robot_state_publisher', arguments=["/tmp/my_robot.urdf"], output='screen', ) gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource([gazebo_path, '/gazebo.launch.py'])) # GAZEBO_MODEL_PATH has to be correctly set for Gazebo to be able to find the model spawn_entity = Node( package='gazebo_ros', node_executable='spawn_entity.py', arguments=['-entity', 'my_robot', '-topic', "/robot_description"], # arguments = ['-entity', 'my_robot', '-file', "/tmp/my_robot.urdf"], output='screen', ) return LaunchDescription( [gazebo, spawn_entity, robot_state_publisher_node])
def __init__(self, name, package_name, launchfile_name, component_parameters=None): self.name = name self._package_name = package_name self._launchfile_name = launchfile_name self._launch_arguments = list() if component_parameters is not None: # IncludeLaunchDescription requires the arguments as a list and the values as strings, so the values are converted to strings for arg_key, arg_value in component_parameters.items(): self._launch_arguments.append((arg_key, str(arg_value))) launchfile_path = path.join( get_package_share_directory(self._package_name), "launch", self._launchfile_name) launch_description_source = PythonLaunchDescriptionSource( launchfile_path) self.launch_description = LaunchDescription([ IncludeLaunchDescription(launch_description_source, launch_arguments=self._launch_arguments) ])
def generate_launch_description(): return LaunchDescription([ # Arguments first DeclareLaunchArgument('offline', default_value='false'), # Drivers IncludeLaunchDescription( PythonLaunchDescriptionSource([launch_file('drivers.launch.py')]), condition=UnlessCondition(LaunchConfiguration('offline')), ), # TODO: Process GPS sentences into Fix #<include file="$(find robomagellan)/launch/compute/gps.launch.xml" /> # TODO: Process IMU into usable values #<include file="$(find robomagellan)/launch/compute/imu.launch.xml" /> # TODO: Local frame localization (base_link to odom) #<include file="$(find robomagellan)/launch/compute/ekf_local.launch.xml" /> # TODO: Global frame localization (map to odom) #<include file="$(find robomagellan)/launch/compute/ekf_global.launch.xml" /> # TODO: Setup global localization # TODO: add navigation, yeah, that is totally one line ])
def generate_launch_description(): ip = launch_ros.actions.Node( package='system_status', executable='system_status', output='both', # "screen", "log" or "both" name='system_status', ) robot = IncludeLaunchDescription( PythonLaunchDescriptionSource( [ThisLaunchFileDir(), '/robot.launch.py']), ) watchdog = launch_ros.actions.Node( package='robot_spawner_pkg', executable='watchdog', namespace=utils.get_robot_name('robot'), ) # Create the launch description and populate ld = LaunchDescription() ld.add_action(ip) ld.add_action(robot) ld.add_action(watchdog) return ld
def generate_launch_description(): pkg_share1 = FindPackageShare('robot_tennis').find('robot_tennis') pkg_share2 = FindPackageShare('gazebo_ros').find('gazebo_ros') model_file = os.path.join(pkg_share1, 'urdf', "robot_tennis.urdf") #mesh_file = os.path.join(pkg_share1, 'meshs', "pince2.dae") path = os.path.join(pkg_share2, 'launch', "gazebo.launch.py") #rviz_config_file = os.path.join(pkg_share, 'config', "display.rviz") robot_state_publisher_node = Node( package="robot_state_publisher", node_executable="robot_state_publisher", arguments=[model_file] #, mesh_file] ) rqt_robot_steering_node = Node(package="rqt_robot_steering", node_executable="rqt_robot_steering") gazebo = IncludeLaunchDescription(PythonLaunchDescriptionSource([path]), ) # GAZEBO_MODEL_PATH has to be correctly set for Gazebo to be able to find the model spawn_entity = Node( package='gazebo_ros', node_executable='spawn_entity.py', arguments=['-entity', 'robot_tennis', '-topic', '/robot_description']) return LaunchDescription([ robot_state_publisher_node, gazebo, spawn_entity, rqt_robot_steering_node ])
def generate_launch_description(): # Declare arguments declared_arguments = [] declared_arguments.append( DeclareLaunchArgument( "prefix", default_value='""', description="Prefix of the joint names, useful for \ multi-robot setup. If changed than also joint names in the controllers' configuration \ have to be updated.", )) declared_arguments.append( DeclareLaunchArgument( "use_fake_hardware", default_value="true", description= "Start robot with fake hardware mirroring command to its states.", )) declared_arguments.append( DeclareLaunchArgument( "fake_sensor_commands", default_value="false", description= "Enable fake command interfaces for sensors used for simple simulations. \ Used only if 'use_fake_hardware' parameter is true.", )) declared_arguments.append( DeclareLaunchArgument("slowdown", default_value="3.0", description="Slowdown factor of the RRbot.")) declared_arguments.append( DeclareLaunchArgument( "robot_controller", default_value="forward_position_controller", description="Robot controller to start.", )) # Initialize Arguments prefix = LaunchConfiguration("prefix") use_fake_hardware = LaunchConfiguration("use_fake_hardware") fake_sensor_commands = LaunchConfiguration("fake_sensor_commands") slowdown = LaunchConfiguration("slowdown") robot_controller = LaunchConfiguration("robot_controller") base_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( [ThisLaunchFileDir(), "/rrbot_base.launch.py"]), launch_arguments={ "controllers_file": "rrbot_multi_interface_forward_controllers.yaml", "description_file": "rrbot_system_multi_interface.urdf.xacro", "prefix": prefix, "use_fake_hardware": use_fake_hardware, "fake_sensor_commands": fake_sensor_commands, "slowdown": slowdown, "robot_controller": robot_controller, }.items(), ) return LaunchDescription(declared_arguments + [base_launch])
def generate_launch_description(): # Sim use_sim_time = LaunchConfiguration('use_sim_time', default='false') # Launch folder launch_file_dir = os.path.join(get_package_share_directory(pkg_name), dir_model) return LaunchDescription([ IncludeLaunchDescription( PythonLaunchDescriptionSource([launch_file_dir, '/state_publisher.launch.py']), launch_arguments={'use_sim_time': use_sim_time}.items(), ), ExecuteProcess( name='START-RASTREATOR', cmd=['ros2', 'launch', 'rastreator_wheelmotor', 'start.launch.py'], output = 'screen', shell='True' ), ExecuteProcess( name='START-JOYSTICK', cmd=['ros2', 'launch', 'rastreator_joystick', 'start.launch.py'], output = 'screen', shell='True' ), ExecuteProcess( name='START-LIDAR', cmd=['ros2', 'launch', 'rastreator_bringup', 'lidar.launch.py'], output = 'screen', shell='True' ) ])
def generate_launch_description(): return LaunchDescription([ Node(name='gym_node', package='gym_duckietown_ros2_agent', executable='rosagent', output='screen'), Node( name='view_node', package='rqt_image_view', executable='rqt_image_view', #parameters = ['/None/corrected_image/compressed'], output='screen'), Node(name='line_center_node', package='line_detect_center', executable='line_detect_center', output='screen'), Node(name='line_right_node', package='line_detect_right', executable='line_detect_right', output='screen'), IncludeLaunchDescription( PythonLaunchDescriptionSource([ get_package_share_directory('apriltag_ros'), '/launch/tag_16h5_all.launch.py' ])), ])
def generate_launch_description(): # Get the launch directory teb_launch_dir = os.path.join( get_package_share_directory('teb_local_planner'), 'launch') nav2_bringup_launch_dir = os.path.join( get_package_share_directory('nav2_bringup'), 'launch') map_yaml_file = LaunchConfiguration('map') declare_map_yaml_cmd = DeclareLaunchArgument( 'map', description='Full path to map yaml file to load') params_file = os.path.join(teb_launch_dir, 'teb_params.yaml') bringup_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_launch_dir, 'nav2_bringup_launch.py')), launch_arguments={ 'params_file': params_file, 'autostart': "true", 'use_sim_time': "true", 'map': map_yaml_file }.items(), ) ld = LaunchDescription() ld.add_action(bringup_cmd) ld.add_action(declare_map_yaml_cmd) return ld
def generate_launch_description(): # Webots package_dir = get_package_share_directory('webots_ros2_universal_robot') webots = IncludeLaunchDescription(PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('webots_ros2_core'), 'launch', 'robot_launch.py')), launch_arguments={ 'executable': 'webots_robotic_arm_node', 'world': os.path.join(package_dir, 'worlds', 'universal_robot.wbt'), }.items()) # Copy .rviz config file and update path ro URDF file. templateRvizFile = os.path.join( get_package_share_directory('webots_ros2_ur_e_description'), 'rviz', 'view_robot') + '.rviz' home = Path.home() customRvizFile = os.path.join(home, 'webots_ros2_ur_e_description.rviz') if not os.path.exists( os.path.join(home, 'webots_ros2_ur_e_description.rviz')): with open(templateRvizFile, 'r') as f: content = f.read() content = content.replace( 'package://webots_ros2_ur_e_description', get_package_share_directory('webots_ros2_ur_e_description')) with open(customRvizFile, 'w') as f2: f2.write(content) # Rviz node rviz = launch_ros.actions.Node(package='rviz2', executable='rviz2', arguments=['-d', customRvizFile], output='screen') return launch.LaunchDescription([rviz, webots])
def generate_launch_description(): use_sim_time = LaunchConfiguration('use_sim_time', default='false') kobuki_navigation_path = get_package_share_directory('kobuki_navigation') urg_node_prefix = get_package_share_directory('urg_node') kobuki_urdf = os.path.join(kobuki_navigation_path,'urdf', 'kobuki_carto.urdf') return LaunchDescription([ DeclareLaunchArgument( 'use_sim_time', default_value='false', description='Use simulation (Gazebo) clock if true'), Node( package="turtlebot2_drivers", node_executable="kobuki_node", node_name="kobuki_node", output="screen"), Node( package="urg_node", node_executable="urg_node", output="screen", arguments=["__params:="+ urg_node_prefix+ "/launch/urg_node.yaml"], on_exit=launch.actions.Shutdown()), IncludeLaunchDescription( PythonLaunchDescriptionSource([kobuki_navigation_path, '/launch/robot.launch.py']), launch_arguments={ 'use_sim_time': use_sim_time}.items(), ), ])
def generate_launch_description(): pkg_gazebo_ros = get_package_share_directory('gazebo_ros') pkg_dolly_gazebo = get_package_share_directory('dolly_gazebo') pkg_dolly_drive = get_package_share_directory('dolly_drive') # Gazebo launch gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(pkg_gazebo_ros, 'launch', 'gazebo.launch.py'), )) # Follow node follow = Node(package='dolly_drive', node_executable='dolly_follow', output='screen', remappings=[('cmd_vel', '/dolly/cmd_vel'), ('laser_scan', '/dolly/laser_scan')]) return LaunchDescription([ DeclareLaunchArgument('world', default_value=[ os.path.join(pkg_dolly_gazebo, 'worlds', 'dolly_empty.world'), '' ], description='SDF world file'), gazebo, follow, ])
def generate_launch_description(): params1 = duplicate_params(rs_launch.configurable_parameters, '1') params2 = duplicate_params(rs_launch.configurable_parameters, '2') return LaunchDescription( rs_launch.declare_configurable_parameters(params1) + rs_launch.declare_configurable_parameters(params2) + [ IncludeLaunchDescription( PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/rs_launch.py']), launch_arguments=set_configurable_parameters(params1).items(), ), IncludeLaunchDescription( PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/rs_launch.py']), launch_arguments=set_configurable_parameters(params2).items(), ), ])
def generate_launch_description(): use_sim_time = LaunchConfiguration('use_sim_time', default='false') # Parameters params_dir = LaunchConfiguration( 'params_dir', default=os.path.join( get_package_share_directory(pkg_name), param_folder, param_file)) # Nav2 dir nav2_launch_file_dir = os.path.join(get_package_share_directory('nav2_bringup'), 'launch') return LaunchDescription([ DeclareLaunchArgument( 'params', default_value=params_dir, description='Full path to param file to load'), DeclareLaunchArgument( 'use_sim_time', default_value='false', description='Use simulation (Gazebo) clock if true'), IncludeLaunchDescription( PythonLaunchDescriptionSource([nav2_launch_file_dir, '/navigation_launch.py']), launch_arguments={ 'use_sim_time': use_sim_time, 'params': params_dir}.items(), ) ])
def generate_launch_description(): use_sim_time = LaunchConfiguration('use_sim_time', default='true') world_file_name = 'vmegarover_sample.world' world = os.path.join(get_package_share_directory('megarover_samples_ros2'), 'worlds', world_file_name) sdf_dir = os.path.join( get_package_share_directory('megarover_samples_ros2'), 'models/vmegarover') sdf_file = os.path.join(sdf_dir, 'vmegarover.sdf') launch_file_dir = os.path.join( get_package_share_directory('megarover_samples_ros2'), 'launch') pkg_gazebo_ros = get_package_share_directory('gazebo_ros') return LaunchDescription([ IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(pkg_gazebo_ros, 'launch', 'gzserver.launch.py')), launch_arguments={'world': world}.items(), ), IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(pkg_gazebo_ros, 'launch', 'gzclient.launch.py')), ), Node(package='gazebo_ros', executable='spawn_entity.py', name='spawn_entity', output='screen', arguments=[ '-entity', 'vmegarover', '-x', '0', '-y', '0', '-z', '1', '-file', sdf_file, ]), IncludeLaunchDescription( PythonLaunchDescriptionSource( [launch_file_dir, '/robot_state_publisher.launch.py']), launch_arguments={'use_sim_time': use_sim_time}.items(), ), ])
def generate_launch_description(): #gui1 = launch.actions.DeclareLaunchArgument( 'gui', default_value='false') #print(gui1) use_sim_time = LaunchConfiguration('use_sim_time', default='true') #world_file_name = 'turtlebot3_houses/' + TURTLEBOT3_MODEL + '.model' world_file_name = 'wlroom.world' world = os.path.join(get_package_share_directory('turtlebot3_gazebo'), 'worlds', world_file_name) launch_file_dir = os.path.join( get_package_share_directory('turtlebot3_gazebo'), 'launch') spawn_launch_dir = os.path.join( get_package_share_directory('robot_spawner_pkg'), 'launch') #urdffile = os.path.join(get_package_share_directory('turtlebot_description'),'' requestname = TURTLEBOT3_MODEL namespacename = '' x = '0.0' y = '0.0' z = '0.0' #doc=xacro.process_file() guiz = LaunchConfiguration('guic', default='false') gui = 'true' print(str(gui)) #guic.parse mycmd = 'gzserver' if (gui == 'true'): mycmd = 'gazebo' print("full") else: print("headless") print("mycmd", mycmd) print("world", world) # return LaunchDescription([ ExecuteProcess( cmd=[mycmd, '--verbose', '-s', 'libgazebo_ros_factory.so', world], output='both'), IncludeLaunchDescription( PythonLaunchDescriptionSource( [launch_file_dir, '/robot_state_publisher.launch.py']), launch_arguments={'use_sim_time': use_sim_time}.items(), ), launch_ros.actions.Node( package='robot_spawner_pkg', executable='spawn_turtlebot', output='both', arguments=[requestname, namespacename, x, y, z]), # IncludeLaunchDescription( # PythonLaunchDescriptionSource([launch_file_dir, '/burger_tf_pub.launch.py']), # launch_arguments={'use_sim_time': use_sim_time}.items(), # ) # launch_ros.actions.Node( # package='gazebo_ros', node_executable='spawn_model', node_name='spawn_urdf', # arguments='-urdf -model turtlebot3_$(arg model) -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description' # ) ])
def generate_launch_description(): use_sim_time = LaunchConfiguration('use_sim_time', default='true') pkg_gazebo_ros = get_package_share_directory('gazebo_ros') pkg_working_gazebo = get_package_share_directory('urdf_tutorial') urdf_file_name = 'urdf/robot_4wd.urdf.xml' print("urdf_file_name : {}".format(urdf_file_name)) urdf = os.path.join(get_package_share_directory('urdf_tutorial'), urdf_file_name) # Gazebo launch gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(pkg_gazebo_ros, 'launch', 'gazebo.launch.py'), )) with open(urdf, 'r') as infp: robot_desc = infp.read() return LaunchDescription([ DeclareLaunchArgument( 'world', # default_value='false', default_value=[ os.path.join(pkg_working_gazebo, 'worlds', 'emptyworld.world'), '' ], description='Use simulation (Gazebo) clock if true'), gazebo, DeclareLaunchArgument( 'use_sim_time', default_value='true', description='se simulation (Gazebo) clock if true'), Node(package='robot_state_publisher', executable='robot_state_publisher', name='robot_state_publisher', output='screen', parameters=[{ 'use_sim_time': use_sim_time, 'robot_description': robot_desc }], arguments=[urdf]), Node(package='joint_state_publisher', executable='joint_state_publisher', name='joint_state_publisher', parameters=[{ 'use_sim_time': use_sim_time }], output='screen'), Node(package='gazebo_ros', executable='spawn_entity.py', parameters=[{ 'use_sim_time': use_sim_time }], arguments=['-topic', '/robot_description', '-entity', 'myrobot'], output='screen') ])
def generate_launch_description(): # ROS packages pkg_mammoth_description = get_package_share_directory( 'mammoth_description') pkg_mammoth_gazebo = get_package_share_directory('mammoth_gazebo') pkg_ros_ign_gazebo = get_package_share_directory('ros_ign_gazebo') # Launch arguments robot_desc, urdf_file = generate_robot_model(pkg_mammoth_description) # Nodes ign_gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(pkg_ros_ign_gazebo, 'launch', 'ign_gazebo.launch.py')), launch_arguments={ 'ign_args': '-r ' + pkg_mammoth_gazebo + '/worlds/test.sdf' }.items(), ) ign_bridge = Node( package='ros_ign_bridge', executable='parameter_bridge', arguments=[ '/world/test/clock@rosgraph_msgs/msg/Clock[ignition.msgs.Clock', '/model/mammoth/tf@tf2_msgs/msg/TFMessage[ignition.msgs.Pose_V', '/model/mammoth/cmd_vel@geometry_msgs/msg/Twist]ignition.msgs.Twist', '/model/mammoth/odometry@nav_msgs/msg/Odometry[ignition.msgs.Odometry', '/model/mammoth/joint_state@sensor_msgs/msg/JointState[ignition.msgs.Model', '/lidar@sensor_msgs/msg/LaserScan[ignition.msgs.LaserScan', '/lidar/points@sensor_msgs/msg/PointCloud2[ignition.msgs.PointCloudPacked', '/imu@sensor_msgs/msg/Imu[ignition.msgs.IMU' ], output='screen', remappings=[ ('/world/test/clock', '/clock'), ('/model/mammoth/tf', '/tf'), ('/model/mammoth/cmd_vel', '/mammoth/cmd_vel'), ('/model/mammoth/odometry', '/mammoth/odom'), ('/model/mammoth/joint_state', 'joint_states'), ('/lidar', '/mammoth/raw_scan'), ('/lidar/points', '/mammoth/raw_points'), ('/imu', '/mammoth/imu'), ]) ign_spawn_robot = Node(package='ros_ign_gazebo', executable='create', arguments=[ '-name', 'mammoth', '-x', '0', '-z', '0', '-Y', '0', '-topic', 'robot_description' ], output='screen') return LaunchDescription([ # Nodes ign_gazebo, ign_bridge, ign_spawn_robot, ])
def generate_launch_description(): gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource([os.path.join( get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), ) gazebo_ros2_control_demos_path = os.path.join( get_package_share_directory('gazebo_ros2_control_demos')) xacro_file = os.path.join(gazebo_ros2_control_demos_path, 'urdf', 'test_cart_position.xacro.urdf') doc = xacro.parse(open(xacro_file)) xacro.process_doc(doc) params = {'robot_description': doc.toxml()} node_robot_state_publisher = Node( package='robot_state_publisher', executable='robot_state_publisher', output='screen', parameters=[params] ) spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', arguments=['-topic', 'robot_description', '-entity', 'cartpole'], output='screen') load_joint_state_controller = ExecuteProcess( cmd=['ros2', 'control', 'load_controller', '--set-state', 'start', 'joint_state_broadcaster'], output='screen' ) load_joint_trajectory_controller = ExecuteProcess( cmd=['ros2', 'control', 'load_controller', '--set-state', 'start', 'joint_trajectory_controller'], output='screen' ) return LaunchDescription([ RegisterEventHandler( event_handler=OnProcessExit( target_action=spawn_entity, on_exit=[load_joint_state_broadcaster], ) ), RegisterEventHandler( event_handler=OnProcessExit( target_action=load_joint_state_broadcaster, on_exit=[load_joint_trajectory_controller], ) ), gazebo, node_robot_state_publisher, spawn_entity, ])
def generate_launch_description(): # Declare arguments declared_arguments = [] declared_arguments.append( DeclareLaunchArgument( "robot_ip", description="IP address by which the robot can be reached.", ) ) declared_arguments.append( DeclareLaunchArgument( "use_fake_hardware", default_value="false", description="Start robot with fake hardware mirroring command to its states.", ) ) declared_arguments.append( DeclareLaunchArgument( "fake_sensor_commands", default_value="false", description="Enable fake command interfaces for sensors used for simple simulations. \ Used only if 'use_fake_hardware' parameter is true.", ) ) declared_arguments.append( DeclareLaunchArgument( "initial_joint_controller", default_value="joint_trajectory_controller", description="Initially loaded robot controller.", ) ) declared_arguments.append( DeclareLaunchArgument( "activate_joint_controller", default_value="true", description="Activate loaded joint controller.", ) ) # Initialize Arguments robot_ip = LaunchConfiguration("robot_ip") use_fake_hardware = LaunchConfiguration("use_fake_hardware") fake_sensor_commands = LaunchConfiguration("fake_sensor_commands") initial_joint_controller = LaunchConfiguration("initial_joint_controller") activate_joint_controller = LaunchConfiguration("activate_joint_controller") base_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource([ThisLaunchFileDir(), "/ur_control.launch.py"]), launch_arguments={ "ur_type": "ur5", "robot_ip": robot_ip, "use_fake_hardware": use_fake_hardware, "fake_sensor_commands": fake_sensor_commands, "initial_joint_controller": initial_joint_controller, "activate_joint_controller": activate_joint_controller, }.items(), ) return LaunchDescription(declared_arguments + [base_launch])
def generate_launch_description_lobot_arm(use_gui: bool = False): # Get gazebo_ros package path sim_share_path = get_package_share_directory('arm_simulation') # Launch param server params_server = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(sim_share_path, 'launch', 'params_server.launch.py')), ) # Launch arm spawner arm_spawner = IncludeLaunchDescription(PythonLaunchDescriptionSource( os.path.join(sim_share_path, 'launch', 'gazebo_spawn_arm.launch.py')), launch_arguments={ 'gym': 'True', 'gui': f'{use_gui}' }.items()) return LaunchDescription([params_server, arm_spawner])
def generate_launch_description(): # Get the launch directory exp_bringup_dir = get_package_share_directory('social_nav2_exp_bringup') social_bringup_dir = get_package_share_directory('social_nav2_bringup') launch_dir = os.path.join(social_bringup_dir, 'launch') # Declare the launch options frame_id = LaunchConfiguration('frame_id') # Create the launch configuration variables frame_id_cmd = DeclareLaunchArgument('frame_id', default_value='map', description='Reference frame') sim_cmd = IncludeLaunchDescription(PythonLaunchDescriptionSource( os.path.join(exp_bringup_dir, 'launch', 'sim_launch.py')), launch_arguments={'headless': "True"}.items()) dummytf2_cmd = Node(package='measuring_tools', executable='dummy_tf2_node', name='dummy_tf2_node', output='screen') agent_spawner_cmd = Node(package='pedsim_gazebo_plugin', executable='spawn_single_agent.py', name='spawn_single_agent', output='screen') pedsim_visualizer_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('pedsim_visualizer'), 'launch', 'visualizer_launch.py')), launch_arguments={'frame_id': frame_id}.items()) # Create the launch description and populate ld = LaunchDescription() ld.add_action(frame_id_cmd) ld.add_action(dummytf2_cmd) ld.add_action(pedsim_visualizer_cmd) ld.add_action(agent_spawner_cmd) ld.add_action(sim_cmd) return ld