The roslaunch package comes with roslaunch tool as well as several support tools to assist in the process of launching ROS Nodes.
目录
roslaunch is an important tool that manages the start and stop of ROS nodes. It takes one or more .launch files as arguments.
Most roslaunch commands require the name of a launch file. You can either specify the file path of the launch file, or you can specify a package name and launch file in that package, e.g.
$ roslaunch roslaunch example.launchor
$ roscd roslaunch $ roslaunch example.launch
roslaunch
Launch
$ roslaunch rospy_tutorials talker_listener.launch
roslaunch will find a file with the matching name inside the specified package and run it.
roslaunch
Launch the file(s) specified by relative or absolute paths, e.g.
$ roslaunch pr2_robot/pr2_bringup/pr2.launch
roslaunch - [args] New in Indigo
Launch the roslaunch XML passed as standard input, e.g.
$ rosrun package generate_launch | roslaunch -
-p port
If you launched roscore on a different port using the -p option, you need to pass in the -p flag to roslaunch as well, e.g.
$ roslaunch -p 1234 package filename.launch
This will dynamically override the port setting in your ROS_MASTER_URI.
--wait
Delay the launch until a roscore is detected.
--local
--screen
--log New in Melodic
-v
--dump-params
--sigint-timeout=SIGINT_TIMEOUT New in Melodic
--sigterm-timeout=SIGTERM_TIMEOUT New in Melodic
If the file you are launching specifies args that require setting, you can do so using an identical syntax to ROS remapping arguments, e.g.:
roslaunch my_file.launch arg:=value
The following options provide information about a launch file without actually doing a launch. These options use the same launch-file resolution as the regular roslaunch command. You can either specify the file path of the launch file, or you can specify a package name and launch file in that package, e.g. for the example.launch file in the roslaunch package, you can use:
roslaunch --nodes roslaunch $ROS_ROOT/tools/roslaunch/example.launch
or
roslaunch --nodes roslaunch example.launch
--nodes
--nodes
List nodes by 'name' that are in
--args
--args
Display the command-line arguments that roslaunch uses when launching the node in
$ roslaunch --args my_node file.launch | bash
You can also use this option with substitution args (for bash, you have to be careful to use single-quotes instead of double-quotes):
$ roslaunch --args '$(anon my_node)' file.launch
--find
--find
Print name of launch file that the node named
$ roslaunch --find /included/talker roslaunch example.launch
--files
Print all files included in processing
$ roslaunch --files foo.launch | xargs grep stuff
--ros-args
$> roslaunch --ros-args ros_args.launch Required Arguments: bar: Someone walks into this. nop: undocumented Optional Arguments: baz (default "false"): undocumented foo (default "true"): I pity the foo'.
roslaunch uses several command-line options that are for internal use only, including -c, -u, and --core.
NOTE: this section is intended for advanced users only
ROSLAUNCH_SSH_UNKNOWN
When launching on remote machines, SSH requires that the remote machine's key be stored in the local known_hosts file. You can set roslaunch to ignore this constraint and allow connections to machines for which you don't have keys established. This is a dangerous option as it introduces a security hole and should only be used if you understand the consequences.
roslaunch-deps reports which ROS Packages a .launch file depends on. It can also track down command build problems, such as missing dependencies in package manifests or syntax errors.
To get warnings about dependencies missing in manifest files, run with the -w warn option:
$ roslaunch-deps -w file.launch
To get more verbose output to help track where a dependency is coming from, run with the -v verbose option:
$ roslaunch-deps -v file.launch
roslaunch-check is a command-line version of launch file checking. You can run by the follwoing:
$ rosrun roslaunch roslaunch-check launch (passing a directory) $ rosrun roslaunch roslaunch-check test/launch (passing a sub directory) $ rosrun roslaunch roslaunch-check launch/aa.launch (passing a file)
Roslaunch stores log files for a particular run together in a subdirectory of the ROS log directory ($ROS_ROOT/log or $ROS_LOG_DIR). In general, logs files are stored in ROS_LOG_DIR/run_id, where run_id is a unique ID associated with a particular run of a roscore.
Example:
# roslaunch-logs /root/.ros/log/eef4c2b6-2c3f-11ea-96bb-0242ac110003
roslaunch-logs is meant to be used together with the 'cd' command, e.g.
cd `roslaunch-logs` root@ea57f5de462a:~/.ros/log/eef4c2b6-2c3f-11ea-96bb-0242ac110003#
You can type this command to quickly go to the directory with the log files for your nodes.
Wiki: roslaunch/Commandline Tools (2022-03-21 09:26:01由Martin Pecka编辑)
Except where otherwise noted, the ROS wiki is licensed under the
Creative Commons Attribution 3.0