Webots安装

文章目录

    • Webots安装 
      1. Webots简介 
      2. Webots安装 
      2.1 系统要求 
      2.2 验证显卡驱动 
      2.3 安装 
      3. Webots仿真 
      3.1 world文件 
      3.2 Controller文件 
      3.3 Supervisor Controller 
      4. 启动方式 

1. Webots简介

webots是一个开源3D移动机器人仿真框架。其为Cyberbotics公司旗下研发开源框架,为机器人的建模、编程和仿真提供了完整的开发环境。Webots内核基于开源动力学引擎ODE和OpenGL,可以在Windows、Linux和macOS上运行,并且支持多种编程语言(C/C++,Python,Java,MATLAB)。

Webots的主要功能是机器人的建模、控制与仿真,用于开发、测试和验证机器人算法。其内核基于ODE引擎,动力学仿真效果较为真实。

Webots支持多种不同类型的机器人仿真,如工业机械臂,轮式机器人,足式机器人,履带式机器人,汽车,无人机,水下机器人,航天器等。Webots支持多种虚拟传感器,如相机,雷达,力传感器,位置传感器,陀螺仪,惯性单元,GPS等。Webots还支持多种复杂环境的模拟,如室内,室外,崎岖路面,空中环境,水下环境等。

Webots场景采用OpenGL渲染,画面展示效果很棒。Webots可将仿真过程导出为动画或交互式HTML用于展示。

官方链接:Cyberbotics: Robotics simulation with Webots

Webots应用举例

  • 移动机器人原型(学术研究、自动化工业、玩具工业等等)
  • 机器人运动学研究(四足、腿式、人形等等)
  • 多智能体研究(集群、协同等等)
  • 适应性行为研究(遗传算法、神经网络等等)
  • 教学机器人(机器人课程)

2. Webots安装

2.1 系统要求

需求项 最低要求
内存 2G
主频 2GHz
NVIDIA or AMD OpenGL V3.3
显存 512MB

对于Linux系统只推荐NVIDIA系列。

典型适配系统:

  • Linux系列
    支持近期x86-64架构的Linux系统,例如Ubuntu20.04LTS,早于20.04之前的Ubuntu不支持。
  • Windows系列
    Windows10、Windows11
  • Mac系列
    macOS 11 “Big Sur” and 12 “Monterey”

在早期版本系列运行Webots可能会出现不兼容的问题。

2.2 验证显卡驱动

Ubuntu参考

Ubuntu20.04、22.04安装nvidia显卡驱动_ubuntu install xianka qudong_xianrenli38的博客-CSDN博客

Windows参考

windows10安装NVIDIA显卡驱动+cuda10.0教程

2.3 安装

注意:安装版安装之后,核心的模块功能均能使用,但是第三方工具(如Java、Python、MatLab)需要对指定项目进行运行和编译。

Deabin系列

wget -qO- https://cyberbotics.com/Cyberbotics.asc | sudo apt-key add -
sudo apt-add-repository 'deb https://cyberbotics.com/debian/ binary-amd64/'
sudo apt-get update
sudo apt-get install webots

Windows系列

官网下载安装

3. Webots仿真

一个Webots仿真由以下部分组成:

  • 一个world文件(.wbt),world文件定义了一个或多个环境中的机器人,.wbt文件有时也取决于额外的原型文件(PROTO,文件后缀为.proto)和一些纹理配置组成。
  • 机器人控制程序(C/C++/JAVA/PYTHON/MATLAB)
  • 可选物理插件约束webots的物理行为

3.1 world文件

其包含每个对象位置、方向、几何、外观的描述,包含物理属性,world按照层次结构构建组织对象包含其他对象(VRML97),例如一个wbt文件包含一个机器人,机器人有两个轮子、一个距离传感器和一个包含摄像头的关节,这些都保存再.wbt文件中,其不包含控制代码,.wbt文件中仅指定每个机器人的控制器名,.wbt文件放置再worlds的子目录中。

3.2 Controller文件

一个controller控制器是指定机器人的电脑程序,支持C,C++,Java,Python或者MatLab编写,仿真开启,webots启动指定的控制器,每一个作为独立的进程,并且每个独立的进程都和仿真环境中的机器人联系起来,请注意,多个机器人可以使用相同的控制器代码,但是将为每个机器人启动不同的进程。

不同的语言会有不同的编译过程和过程文件,解释器语言没有执行文件,所有控制器的源文件和二进制文件都存放在controller文件夹中,每个机器人的控制器文件夹都作为controllers的子目录存放。

3.3 Supervisor Controller

监管控制器当supervisor域设定为TRUE的时候生效,它可以执行一些人为干预操作,其也可以被上述任何一种语言编写,不同于有规则的机器人控制器,监管控制器拥有权限操作,包括仿真控制等,例如,将机器人设定到随机点位,或者对仿真进行视频截取等。

4. 启动方式

对于Linux系列,可以直接终端输入webots命令直接启动

对于Windows用户双击桌面图标即可

选择主题后进入仿真软件。

对于Windows如果有DOS命令的需求,可以将主程序所在路径添加到环境变量中。

webots命令的用法如下所示:

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 or fast.

  --no-rendering
    Disable rendering in the main 3D view.

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

  --port
    Change the TCP port used by Webots (default value is 1234).

  --stream[=<mode>]
    Start the Webots streaming server. The <mode> argument should be either
    x3d (default) or mjpeg.

  --extern-urls
    Print on stdout the URL of extern controllers that should be started.

  --heartbeat[=<time>]
    Print a dot (.) on stdout every second or <time> milliseconds if specified.

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

  convert
    Convert a PROTO file to a URDF, WBO, or WRL file.

Please report any bug to https://cyberbotics.com/bug