def generate_launch_description(): model, plugin, media = GazeboRosPaths.get_paths() if 'GAZEBO_MODEL_PATH' in environ: model += ':' + environ['GAZEBO_MODEL_PATH'] if 'GAZEBO_PLUGIN_PATH' in environ: plugin += ':' + environ['GAZEBO_PLUGIN_PATH'] if 'GAZEBO_RESOURCE_PATH' in environ: media += ':' + environ['GAZEBO_RESOURCE_PATH'] model += path.abspath(path.join(path.dirname(__file__), '../models')) env = { 'GAZEBO_MODEL_PATH': model, 'GAZEBO_PLUGIN_PATH': plugin, 'GAZEBO_RESOURCE_PATH': media } #environ['GAZEBO_MODEL_PATH'] = model #model += ':' + environ['GAZEBO_MODEL_PATH'] env = {'GAZEBO_MODEL_PATH': model} spawner = Node( package='robot_spawner', node_executable='spawner', node_name='spawner', output='screen' ## output option for debug ) gazebo = ExecuteProcess( cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so'], #additional_env=env, output='screen') #gzserver = IncludeLaunchDescription( # PythonLaunchDescriptionSource( # '/opt/ros/eloquent/share/gazebo_ros/launch/gzserver.launch.py'), #) return LaunchDescription([ gazebo, spawner, #gzserver ])
def generate_launch_description(): model, plugin, media = GazeboRosPaths.get_paths() if 'GAZEBO_MODEL_PATH' in environ: model += ':' + environ['GAZEBO_MODEL_PATH'] if 'GAZEBO_PLUGIN_PATH' in environ: plugin += ':' + environ['GAZEBO_PLUGIN_PATH'] if 'GAZEBO_RESOURCE_PATH' in environ: media += ':' + environ['GAZEBO_RESOURCE_PATH'] env = { 'GAZEBO_MODEL_PATH': model, 'GAZEBO_PLUGIN_PATH': plugin, 'GAZEBO_RESOURCE_PATH': media } return LaunchDescription([ DeclareLaunchArgument( 'version', default_value='false', description='Set "true" to output version information'), DeclareLaunchArgument( 'verbose', default_value='false', description='Set "true" to increase messages written to terminal'), DeclareLaunchArgument( 'help', default_value='false', description='Set "true" to produce gzclient help message'), DeclareLaunchArgument( 'extra_gazebo_args', default_value='', description='Extra arguments to be passed to Gazebo'), # Specific to gazebo_ros DeclareLaunchArgument( 'gdb', default_value='false', description='Set "true" to run gzserver with gdb'), DeclareLaunchArgument( 'valgrind', default_value='false', description='Set "true" to run gzserver with valgrind'), # Execute ExecuteProcess( cmd=[[ 'gzclient', _boolean_command('version'), ' ', _boolean_command('verbose'), ' ', _boolean_command('help'), ' ', LaunchConfiguration('extra_gazebo_args'), ]], output='screen', additional_env=env, shell=True, prefix=PythonExpression([ '"gdb -ex run --args" if "true" == "', LaunchConfiguration('gdb'), '"else "valgrind" if "true" == "', LaunchConfiguration('valgrind'), '"else ""' ]), ) ])
def generate_launch_description(): model, plugin, media = GazeboRosPaths.get_paths() if 'GAZEBO_MODEL_PATH' in environ: model += ':' + environ['GAZEBO_MODEL_PATH'] if 'GAZEBO_PLUGIN_PATH' in environ: plugin += ':' + environ['GAZEBO_PLUGIN_PATH'] if 'GAZEBO_RESOURCE_PATH' in environ: media += ':' + environ['GAZEBO_RESOURCE_PATH'] env = { 'GAZEBO_MODEL_PATH': model, 'GAZEBO_PLUGIN_PATH': plugin, 'GAZEBO_RESOURCE_PATH': media } return LaunchDescription([ DeclareLaunchArgument('world', default_value='', description='Specify world file name'), DeclareLaunchArgument( 'version', default_value='false', description='Set "true" to output version information.'), DeclareLaunchArgument( 'verbose', default_value='false', description='Set "true" to increase messages written to terminal.' ), DeclareLaunchArgument( 'help', default_value='false', description='Set "true" to produce gzserver help message.'), DeclareLaunchArgument( 'pause', default_value='false', description='Set "true" to start the server in a paused state.'), DeclareLaunchArgument( 'physics', default_value='', description='Specify a physics engine (ode|bullet|dart|simbody).'), DeclareLaunchArgument('play', default_value='', description='Play the specified log file.'), DeclareLaunchArgument('record', default_value='false', description='Set "true" to record state data.'), DeclareLaunchArgument( 'record_encoding', default_value='', description='Specify compression encoding format for log data ' '(zlib|bz2|txt).'), DeclareLaunchArgument( 'record_path', default_value='', description='Absolute path in which to store state data.'), DeclareLaunchArgument( 'record_period', default_value='', description='Specify recording period (seconds).'), DeclareLaunchArgument('record_filter', default_value='', description='Specify recording filter ' '(supports wildcard and regular expression).'), DeclareLaunchArgument( 'seed', default_value='', description='Start with a given a random number seed.'), DeclareLaunchArgument( 'iters', default_value='', description='Specify number of iterations to simulate.'), DeclareLaunchArgument( 'minimal_comms', default_value='false', description='Set "true" to reduce TCP/IP traffic output.'), DeclareLaunchArgument( 'profile', default_value='', description='Specify physics preset profile name from the options ' 'in the world file.'), DeclareLaunchArgument( 'extra_gazebo_args', default_value='', description='Extra arguments to be passed to Gazebo'), # Specific to gazebo_ros DeclareLaunchArgument( 'gdb', default_value='false', description='Set "true" to run gzserver with gdb'), DeclareLaunchArgument( 'valgrind', default_value='false', description='Set "true" to run gzserver with valgrind'), DeclareLaunchArgument( 'init', default_value='true', description='Set "false" not to load "libgazebo_ros_init.so"'), DeclareLaunchArgument( 'factory', default_value='true', description='Set "false" not to load "libgazebo_ros_factory.so"'), # Wait for (https://github.com/ros-simulation/gazebo_ros_pkgs/pull/941) # DeclareLaunchArgument('force_system', default_value='true', # description='Set "false" not to load \ # "libgazebo_ros_force_system.so"'), ExecuteProcess( cmd=[ 'gzserver', # Pass through arguments to gzserver LaunchConfiguration('world'), ' ', _boolean_command('version'), ' ', _boolean_command('verbose'), ' ', _boolean_command('help'), ' ', _boolean_command('pause'), ' ', _arg_command('physics'), ' ', LaunchConfiguration('physics'), ' ', _arg_command('play'), ' ', LaunchConfiguration('play'), ' ', _boolean_command('record'), ' ', _arg_command('record_encoding'), ' ', LaunchConfiguration('record_encoding'), ' ', _arg_command('record_path'), ' ', LaunchConfiguration('record_path'), ' ', _arg_command('record_period'), ' ', LaunchConfiguration('record_period'), ' ', _arg_command('record_filter'), ' ', LaunchConfiguration('record_filter'), ' ', _arg_command('seed'), ' ', LaunchConfiguration('seed'), ' ', _arg_command('iters'), ' ', LaunchConfiguration('iters'), ' ', _boolean_command('minimal_comms'), _plugin_command('init'), ' ', _plugin_command('factory'), ' ', # Wait for (https://github.com/ros-simulation/gazebo_ros_pkgs/pull/941) # _plugin_command('force_system'), ' ', _arg_command('profile'), ' ', LaunchConfiguration('profile'), LaunchConfiguration('extra_gazebo_args'), ], output='screen', additional_env=env, shell=True, prefix=PythonExpression([ '"gdb -ex run --args" if "true" == "', LaunchConfiguration('gdb'), '" else "valgrind" if "true" == "', LaunchConfiguration('valgrind'), '" else ""' ]), ) ])
def generate_launch_description(): gazebo_package_prefix = get_package_share_directory("gazebo_ros") package_prefix = get_package_share_directory("halodi-controller-gazebo") model, plugin, media = GazeboRosPaths.get_paths() return LaunchDescription([ DeclareLaunchArgument( "world", default_value=os.path.join(package_prefix, "worlds", "eve_flat_ground.world"), description="Set world to launch", ), DeclareLaunchArgument( "verbose", default_value="true", description="Enable verbosity", ), # Note that the Halodi Controller publishes /clock and therefore conflicts with gazebo_ros_init # Also, resetting the world state is not currently supported by the controller. # Therefore, we disable the gazebo_ros_init plugin DeclareLaunchArgument( "init", default_value="false", description='Set "false" not to load "libgazebo_ros_init.so"', ), DeclareLaunchArgument( "factory", default_value="true", description='Set "false" not to load "libgazebo_ros_factory.so"', ), DeclareLaunchArgument( "trajectory-api", default_value="true", description= 'Set "false" to disable trajectory api and use realtime api', ), DeclareLaunchArgument( "headless", default_value="false", description='Set "true" to disable the visual UI', ), SetEnvironmentVariable("HALODI_TRAJECTORY_API", LaunchConfiguration("trajectory-api")), DeclareLaunchArgument( "variable-server", default_value="false", description= 'Set "true" to enable the variable server and use SCSVisualizer to tune variables', ), SetEnvironmentVariable("SCS_VARIABLE_SERVER", LaunchConfiguration("variable-server")), IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(gazebo_package_prefix, "launch", "gzserver.launch.py"))), IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(gazebo_package_prefix, "launch", "gzclient.launch.py")), condition=UnlessCondition(LaunchConfiguration("headless")), ), ])
def generate_launch_description(): cmd = [[ 'gzclient', _boolean_command('version'), ' ', _boolean_command('verbose'), ' ', _boolean_command('help'), ' ', LaunchConfiguration('extra_gazebo_args'), ]] model, plugin, media = GazeboRosPaths.get_paths() if 'GAZEBO_MODEL_PATH' in environ: model += pathsep + environ['GAZEBO_MODEL_PATH'] if 'GAZEBO_PLUGIN_PATH' in environ: plugin += pathsep + environ['GAZEBO_PLUGIN_PATH'] if 'GAZEBO_RESOURCE_PATH' in environ: media += pathsep + environ['GAZEBO_RESOURCE_PATH'] env = { 'GAZEBO_MODEL_PATH': model, 'GAZEBO_PLUGIN_PATH': plugin, 'GAZEBO_RESOURCE_PATH': media, } prefix = PythonExpression([ '"gdb -ex run --args" if "true" == "', LaunchConfiguration('gdb'), '"else "valgrind" if "true" == "', LaunchConfiguration('valgrind'), '"else ""', ]) return LaunchDescription([ DeclareLaunchArgument( 'version', default_value='false', description='Set "true" to output version information'), DeclareLaunchArgument( 'verbose', default_value='false', description='Set "true" to increase messages written to terminal'), DeclareLaunchArgument( 'help', default_value='false', description='Set "true" to produce gzclient help message'), DeclareLaunchArgument( 'extra_gazebo_args', default_value='', description='Extra arguments to be passed to Gazebo'), # Specific to gazebo_ros DeclareLaunchArgument( 'gdb', default_value='false', description='Set "true" to run gzserver with gdb'), DeclareLaunchArgument( 'valgrind', default_value='false', description='Set "true" to run gzserver with valgrind'), DeclareLaunchArgument( 'gui_required', default_value='false', description= 'Set "true" to shut down launch script when GUI is terminated'), # Execute node with on_exit=Shutdown if gui_required is specified. # See ros-simulation/gazebo_ros_pkgs#1086. Simplification of logic # would be possible pending ros2/launch#290. ExecuteProcess( cmd=cmd, output='screen', additional_env=env, shell=True, prefix=prefix, on_exit=Shutdown(), condition=IfCondition(LaunchConfiguration('gui_required')), ), # Execute node with default on_exit if the node is not required ExecuteProcess( cmd=cmd, output='screen', additional_env=env, shell=True, prefix=prefix, condition=UnlessCondition(LaunchConfiguration('gui_required')), ), ])