1. robocup3D 教程

1.1. 系统要求

比赛环境运行于ubuntu16.04 STL。电脑需要有独显,笔记本最好是游戏本。如果安装双系统有困难,在电脑性能较强的情况下可以使用win10 的 WSL来运行。

1.2. 平台安装

2019/6 robocup更新了server

1.2.1. 下载源码

https://gitlab.com/robocup-sim/SimSpark

下载

1.2.2. 安装server

先安装依赖
sudo apt-get install g++ git cmake libfreetype6-dev libode-dev libsdl-dev ruby ruby-dev libdevil-dev libboost-dev libboost-thread-dev libboost-regex-dev libboost-system-dev qt4-default

  1. 将下载后的代码放在home目录下
  2. 打开项目目录,在终端运行 bulid.sh
  3. 安装完成

1.2.3. 安装roboviz monitor

下载地址:

https://github.com/magmaOffenburg/RoboViz

cd RoboViz-dev/scripts/
./build-linux64.sh

运行 roboviz

cd RoboViz-dev/bin/
./roboviz.sh

1.3. win10平台运行robocup3d

win10的linux子系统不断完善,现在我们可以在win10 中安装robocup3d平台。

1.3.1. 安装linux子系统

  1. 打开win10的开发者模式

    打开win10设置:-> 系统设置 -> 更新和安全 -> 针对开发人员 -> 选择开发者模式
    在这里插入图片描述

  2. 安装win10的linux子系统组件

    顺序: -> 系统设置 -> 应用 -> 右侧的程序和功能 -> 启动或关闭windows功能 -> 勾选适用于 Linux 的 Windows 子系统

    确定后,重启电脑,系统更新配置
    在这里插入图片描述

  3. 安装 Linux 子系统

    在win10应用商店搜索Ubuntu, 安装Ubuntu18.04 LTS(因为我安装的是这个版本,严格说来,安装16.04LTS更合适,读者可执行尝试).
    在这里插入图片描述

  4. 安装完成后设置用户名和密码

在这里插入图片描述

  1. 安装完成后,我们需要更改镜像源,因为默认镜像源在国内网速感人.

    首先备份镜像源文件

    sudo cp /etc/apt/sources.list /etc/apt/sources.list.20181013
    

    然后使用vim打开, 使用vim的全局替换功能将源地址替换

    :%s/security.ubuntu/mirrors.aliyun/g
    :%s/archive.ubuntu/mirrors.aliyun/g
    

    或者用如下内容替换/etc/apt/sources.list文件中的内容

    deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    

    最后执行更新命令

    sudo apt update
    

1.3.2. 安装robocup3d平台

  1. 安装依赖程序

    sudo apt-get install g++ git cmake libfreetype6-dev libode-dev libsdl-dev ruby ruby-dev libdevil-dev libboost-dev libboost-thread-dev libboost-regex-dev libboost-system-dev qt4-default
    
  2. 下载simspark 和 rcsserver3d、

    下载地址

    在这里插入图片描述

  3. 将文件复制到ubuntu子系统的home路径下

    打开ubuntu子系统(默认为home路径), 使用命令复制下载的文件

    cp /mnt/c/xxx/simspark_xxx .
    cp /mnt/c/xxx/rcsserver3d_xxx .
    

    复制完成后解压文件夹

    tar xvf simspark_xxx
    tar xvf rcsserver3d_xx
    
  4. 编译并安装

    # 安装simspark
    cd simspark
    mkdir build
    cd build
    cmake ..
    make -j10
    sudo make install
    sudo ldconfig
    
    # 安装rcsserver3d
    cd ~/rcsserver3d
    mkdir build
    cd build
    cmake ..
    make
    sudo make install
    sudo ldconfig
    
  5. 确保链接器可以找到您的共享库:

    # add the lines '/usr/local/lib/simspark' and '/usr/local/lib/rcssserver3d' to /etc/ld.so.conf.d/   spark.conf
    echo -e '/usr/local/lib/simspark\n/usr/local/lib/rcssserver3d' | sudo tee /etc/ld.so.conf.d/spark.conf
    sudo ldconfig
    

测试是否安装成功

rcsserver3d命令启动server

1.3.3. 安装监视器(roboviz)

改程序是java写的可以直接安装在win10上,所以下面的安装操作非常简单

  1. 改githu上下载roboiz的安装包

  2. 解压缩,文件夹内容如下:

    在这里插入图片描述

  3. 打开scripts文件夹,运行build-windows64.bat

  4. 之后在根目录下多出一个bin目录,打开bin>windows-amd64, 双击RoboViz.bat文件,即可运行.
    在这里插入图片描述

1.4. 球队开源底层代码

我们的开源代码来自得克萨斯大学奥斯汀分校,该实验室的官网:http://www.cs.utexas.edu/~AustinVilla/sim/3dsimulation/

ut的底层代码 https://github.com/LARG/utaustinvilla3d

robocup官方的可下载文档http://archive.robocup.info/Soccer/Simulation/3D/

https://ssim.robocup.org/2018/12/13/3d-robocup-2019-call-for-participation/

robocup邮件列表https://mailman.cc.gatech.edu/mailman/listinfo/robocup-sim

1.5. 球队的代码编译与执行

hehaviors/strategy.cc文件中的selectSkill()函数中有实例。

编译代码:

cmake .
make -j$(nproc)

代码的根目录下的start.sh文件为启动脚本。注意: 在启动之前应该先打开rcsserver3d,否则会启动失败。

在该文件中可以修改球队的名称,球员数量等。建议学习一下linux shell。

比赛中我们会使用干净的可执行程序(要删掉源码,只保留必要的可执行文件、动态库和参数文件)。在./scripts/文件夹下有两个脚本:

  1. 执行copy_libs.sh将代码运行所需要的动态库复制到./libs/文件夹下(这一步是必须的,虽然在自己的电脑上没有加入动态库可以运行,但是不保证在比赛的电脑上可以运行)。

  2. 执行copy_files_needed_to_run.sh path_name将自动把干净的可执行程序复制到path_name参数设置的目录下。

1.6. 球员动作设计

球员动作编辑器:https://github.com/AIUT3D/aiut3d-motion-editor

skills/***.skl目录下保存机器人踢球动作文件。观察发现其中有些参数是以变量形式保存在paramfiles/文件夹下。

动作编辑器编辑的动作是以数字的形式保存的。将动作加入到代码中,需要手动或者自己编写脚本将其翻译成球队代码所需要的格式。

1.7. 使用机器学习优化球员的动作

paramfiles/文件夹下的文件保存了每种类型球员的参数。程序运行时将会从这里读取参数(走路,踢球,带球,跌倒后重新站立等参数)。使用机器学习的算法进行优化参数。建议先学习机器学习的基础知识。

阅读在代码中的optimization文件夹下readme.md文件了解详情。

将server该为优化模式,需要手动更改server程序的参数。如果没有更改server的默认安装路径,那么要更改的内容如下:

我们需要修改四个地方 /usr/local/share/

  1. <server_install_dir>/share/rcssserver3d/rsg/agent/nao/naoneckhead.rsg

    为了运行优化以获得准确的测量值和正确的值

    setSenseMyPos, setSenseMyOrien, and setSenseBallPos values to true

  2. ~/.simspark/spark.rb

    关闭实时模式并打开同步模式以加快运行速度。

    set $agentSyncMode to true

  3. <server_install_dir>/share/rcssserver3d/rcssserver3d.rb

    关闭实时模式并打开同步模式以加快运行速度。

    set $enableRealTimeMode to false

  4. <server_install_dir>/share/rcssserver3d/naosoccersim.rb

    如果正在检查光束代理的位置,您可能需要关闭光束噪声

    set BeamNoiseXY and BeamNoiseAngle to 0 (原本是0.05 10.0)

详细信息查看optimization/readme.md文件。

1.8. 球队介绍

该仿真平台仿真了nao机器人,和gazobe机器人(现在比赛中只用nao机器人)。nao机器人有5种类型,他们的身高、体重不同。可以查看paramfiles/文件夹下的参数文件,对应了不同型号的机器人。

比赛种需要至少使用三种类型的nao机器人,每种至少两个。详细的比赛规则可以查看robocup3d世界杯的官方规则,我们国内的比赛基本和世界杯保持一致。

1.9. 总结

总之,仔细阅读代码每个模块的readme文件。阅读ut官网的论文。

另一点是paramfiles/文件中的参数名之间是用tab键分割的,使用空格分割会报错。在有些IDE下,默认会将tab键转换成4个空格。解决方法是注意IDE的设置,或者修该源代码使其兼容空格分割。

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐