roslaunch Commandline Tools 官方文檔 翻譯

 

The roslaunch package comes with roslaunch tool as well as several support tools to assist in the process of launching ROS Nodes.

roslaunch軟件包隨附roslaunch工具以及一些支持工具,以協助啓動ROS節點。

目錄

  1. roslaunch
    1. Launch syntax
    2. Passing in args
    3. Non-launch options
    4. Internal-use only options
    5. Environment Variables (advanced users)
  2. roslaunch-deps
    1. Usage
  3. roslaunch-check
  4. roslaunch-logs
    1. Usage

 

 

roslaunch

roslaunch is an important tool that manages the start and stop of ROS nodes. It takes one or more .launch files as arguments.

roslaunch是管理ROS節點的開始和停止的重要工具。 它需要一個或多個.launch文件作爲參數。

Launch syntax

launch 語法

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 roslaunch example.launch
or
$ roscd roslaunch
$ roslaunch example.launch

roslaunch <package-name> <launch-filename> [args]

  • Launch <launch-filename> located in <package-name>, e.g.:

  •  

    啓動<package-name>中的 <launch-filename> 文件

    $ roslaunch rospy_tutorials talker_listener.launch

    roslaunch will find a file with the matching name inside the specified package and run it.

  • roslaunch將在指定的包中找到具有匹配名稱的文件並運行它。

roslaunch <launch-file-paths...> [args]

  • 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.

  •  

    啓動作爲標準輸入傳遞的roslaunch XML,例如.

    $ 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.

  •  

    如果您使用-p選項在不同的端口上啓動了roscore,則還需要將-p標誌傳遞給roslaunch,例如。

    $ roslaunch -p 1234 package filename.launch

    This will dynamically override the port setting in your ROS_MASTER_URI.

  • 這將動態覆蓋ROS_MASTER_URI中的端口設置。

--wait

  • Delay the launch until a roscore is detected.

  • 延遲啓動,直到檢測到roscore。

--local

  • Launch of the local nodes only. Nodes on remote machines will not be run.
  • 僅啓動本地節點。 遠程計算機上的節點將不會運行。

--screen

  • Force all node output to screen. Useful for node debugging.
  • 強制所有節點輸出到屏幕。 對於節點調試很有用。

--log New in Melodic

  • Force all node output to log file. Also useful for node debugging.
  • 強制所有節點輸出到日誌文件。 對於節點調試也很有用。

-v

  • Enable verbose printing. Useful for tracing roslaunch file parsing.
  • 啓用詳細打印。 對於跟蹤roslaunch文件解析很有用。

--dump-params

  • Print parameters in launch file in YAML format.
  • 以YAML格式在啓動文件中打印參數。

 

Passing in args

傳入參數

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.:

如果您要啓動的文件指定了需要設置的args,則可以使用與ROS重新映射參數相同的語法來進行設置,例如:

roslaunch my_file.launch arg:=value

Non-launch options

非啓動項

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命令相同的啓動文件分辨率。可以指定啓動文件的文件路徑,也可以指定該包中的包名稱和啓動文件,例如,對於roslaunch包中的example.launch文件,可以使用:

  • roslaunch --nodes roslaunch $ROS_ROOT/tools/roslaunch/example.launch

    or

    roslaunch --nodes roslaunch example.launch

--nodes <package-name> <launch-file>
--nodes <launch-file>

  • List nodes by 'name' that are in <launch-file>. This is useful for figuring out the node name to pass to --args.

  • 按<名稱>列出<launch-file>中的節點。 這對於確定要傳遞給--args的節點名稱很有用。

--args <node-name> <package-name> <launch-file>
--args <node-name> <launch-file>

  • Display the command-line arguments that roslaunch uses when launching the node in <launch-file> named <node-name>. This is handy if you just want to launch that particular node for debugging, e.g.

  •  

    顯示roslaunch使用的命令行參數(在啓動<launch file>文件中,名爲<node name>的啓動節點時)。如果您只想啓動特定節點進行調試,這很方便,例如。

    $ 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):

  •  

    您還可以將此選項與替換args一起使用(對於bash,必須小心使用單引號而不是雙引號):

    $ roslaunch --args '$(anon my_node)' file.launch

--find <node-name> <package-name> <launch-file>
--find <node-name> <launch-file>

  • Print name of launch file that the node named <node-name> is defined in. Launch files often have many includes, which can make it difficult to find where an actual <node> definition resides. For example:

  •  

    定義節點<node name>的啓動文件的打印名。啓動文件通常包含許多包含文件,這可能使得很難找到實際的<node>定義所在的位置。 例如:

    $ roslaunch --find /included/talker roslaunch example.launch

--files <filename>

  • Print all files included in processing <filename>, including the file itself. This is useful for passing to other command line tools, e.g.

  •  

    打印處理<filename>中包含的所有文件,包括文件本身。這對於傳遞給其他命令行工具很有用,例如。

    $ roslaunch --files foo.launch | xargs grep stuff

--ros-args

  • Display command-line arguments for this launch file
  • 顯示此啓動文件的命令行參數
    <launch>
      <!-- ros_args.launch -->
      <arg name="foo" default="true" doc="I pity the foo'."/>
      <arg name="bar" doc="Someone walks into this."/>
      <arg name="baz" default="false"/>
      <arg name="nop"/>
      <arg name="fix" value="true"/>
    </launch>
    
    $> 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'.

 

Internal-use only options

僅供內部使用的選項

roslaunch uses several command-line options that are for internal use only, including -c, -u, and --core.

roslaunch使用幾個僅供內部使用的命令行選項,包括-c,-u和--core。

 

Environment Variables (advanced users)

環境變量(高級用戶)

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.

    • 在遠程計算機上啓動時,SSH要求將遠程計算機的密鑰存儲在本地known_hosts文件中。 您可以將roslaunch設置爲忽略此約束,並允許連接到您尚未爲其建立密鑰的計算機。 這是一個危險的選擇,因爲它會引入安全漏洞,只有在您瞭解後果後纔可以使用。

 

roslaunch-deps

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.

roslaunch-deps報告ROS打包.launch文件所依賴的文件。 它還可以跟蹤命令生成問題,例如程序包清單中缺少相關性或語法錯誤。

 

Usage

To get warnings about dependencies missing in manifest files, run with the -w warn option:

要獲取有關清單文件中缺少依賴項的警告,請使用-w warn選項運行:

$ 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:

要獲取更多詳細輸出以幫助跟蹤依賴項的來源,請使用-v詳細選項運行:

$ roslaunch-deps -v file.launch

 

roslaunch-check

roslaunch-check is a command-line version of launch file checking. You can run by the follwoing:

roslaunch-check是啓動文件檢查的命令行版本。 您可以按以下方式運行:

$ 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-logs

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.

Roslaunch將特定運行的日誌文件存儲在ROS日誌目錄的子目錄($ ROS_ROOT / log或$ ROS_LOG_DIR)中。 通常,日誌文件存儲在ROS_LOG_DIR / run_id中,其中run_id是與roscore的特定運行關聯的唯一ID。

Example:

# roslaunch-logs                                                                                               
/root/.ros/log/eef4c2b6-2c3f-11ea-96bb-0242ac110003

 

Usage

roslaunch-logs is meant to be used together with the 'cd' command, e.g.

roslaunch日誌應該與“cd”命令一起使用,例如。

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.

您可以鍵入此命令以快速轉到包含節點日誌文件的目錄。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章