启动Webots
首次启动Webots时,它将打开“欢迎使用Webots!”。菜单,其中包含可能的起点列表。
Linux
打开一个终端,然后键入webots以启动Webots。
macOS
打开安装Webots软件包的目录,然后双击Webots图标。
Windows
在Windows 10和Windows 7上,打开Start菜单,转到Program Files / Cyberbotics菜单,然后单击Webots R2021a菜单项。
在Windows 8上,打开Start屏幕,滚动到屏幕的右侧,直到找到Cyberbotics部分,然后单击Webots图标。
您也可以cmd.exe通过键入webots或从DOS控制台()启动Webots webots.exe。该命令仅在从C:\Program Files\Webots\msys64\mingw64\bin目录执行时才有效(假定在中安装了Webots C:\Program Files)。如果将上述目录添加到您的Path环境变量中,则它也可以在任何目录中工作。 注意:webots-bin.exe从DOS控制台进行的调用可能无法工作,因为某些设置可能会丢失。 注意:webotsw.exe从DOS控制台进行调用会在后台启动Webots并立即返回。
命令行参数
从终端(Linux / Mac)或命令提示符(Windows)启动Webot时,可以使用以下命令行选项:
Usage: webots [options] [worldfile]
Options:
--help
Display this help message and exit.
--version
Display version information and exit.
--sysinfo
Display information about the system and exit.
--mode=<mode>
Choose the startup mode, overriding application preferences. The <mode>
argument must be either pause, realtime, run or fast.
--fullscreen
Start Webots in fullscreen.
--minimize
Minimize the Webots window on startup.
--batch
Prevent Webots from creating blocking pop-up windows.
--stdout
Redirect the stdout of the controllers to the terminal.
--stderr
Redirect the stderr of the controllers to the terminal.
--stream[="key[=value];..."]
Start the Webots streaming server. Parameters may be
given as an option:
port=1234 - Start the streaming server on port 1234.
mode=<x3d|mjpeg> - Specify the streaming mode: x3d (default) or mjpeg.
monitorActivity - Print a dot '.' on stdout every 5 seconds.
disableTextStreams - Disable the streaming of stdout and stderr.
--log-performance=<file>[,<steps>]
Measure the performance of Webots and log it in the file specified in the
<file> argument. The optional <steps> argument is an integer value that
specifies how many steps are logged. If the --sysinfo option is used, the
system information is prepended into the log file.
Please report any bug to https://cyberbotics.com/bug
可选worldfile参数指定要打开的.wbt文件的名称。如果未指定,则Webots尝试打开最近打开的文件。
该--minimize选项用于在启动时最小化(图标化)Webots窗口。这也将跳过初始屏幕和最终的“欢迎对话框”。从脚本自动启动Webot时,可以使用此选项来避免窗口使屏幕混乱。请注意,WebotsFast在--minimize指定时自动使用该模式。
该--mode=<mode>选项可用于以指定的仿真模式启动Webots。四种可能的模拟模式为:pause,realtime,run和fast; 它们对应于Webots图形用户界面的模拟控制按钮。该选项将覆盖但不修改Webots首选项中保存的启动模式。例如,键入webots --mode=pause filename.wbt以pause模式启动Webots 。
该--sysinfo选项在标准输出流上显示有关当前系统的杂项信息,并退出Webots。
在--stdout和--stderr选项具有Webots控制台输出重定向到主叫终端或处理的效果。例如,这可用于将控制器输出重定向到文件或将其通过管道传递给Shell命令。 --stdout重定向控制器的stdout流,同时--stderr重定向stderr流。请注意,stderr流还可能包含Webots错误或警告消息。
该--stream选项启动Webots流服务器。可以提供一个选项来更改流服务器的默认参数。此选项是一个字符串,其中包含参数键及其值的列表,并用分号分隔。下表描述了受支持的选项。
Key | Value example | Description |
port | 1234 | The port on which the streaming server is open. |
mode | x3d or mjpeg | The streaming mode used by the streaming server. |
monitorActivity |
| Print a dot '.' on stdout every 5 seconds. |
disableTextStreams |
| Disable the streaming of stdout and stderr. |
Streaming server options
例如,以下命令将在TCP端口'1234'上启用服务器的情况下启动Webots,并将禁用stdout和stderr的流: webots --stream="port:1234;disableTextStreams"
您可以在本节中获取有关Web流的更多信息。
安全模式
Webots可能无法启动,因为它被阻止在导致Webots或OpenGL崩溃的世界上。在这种情况下,可以在安全模式下启动Webots。安全模式强制Webots从一个空白的世界开始,减少所有OpenGL选项并存储这些首选项。为此,只需WEBOTS_SAFE_MODE在运行Webots的环境中设置环境变量。
以这种方式成功启动后,您必须取消设置此环境变量,再次打开您的世界并增加OpenGL首选项。此操作可能会导致新的崩溃。
在Windows上
1.打开Environment Variables系统对话框。为此,请在search barWindows的中查找“环境变量” start menu,单击Edit the system environment variables,这将打开System Properties对话框至Advanced选项卡。单击Environment Variables底部的按钮。
2.添加一个新的WEBOTS_SAFE_MODE用户环境变量。要做到这一点,在user variables面板中,点击New按钮,添加一个New User Variable名为WEBOTS_SAFE_MODE用的价值true。
3.照常启动Webots。
在Linux和macOS上