> For the complete documentation index, see [llms.txt](https://idminer.gitbook.io/robotis/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://idminer.gitbook.io/robotis/part-1-turtlebot3/13.-autonomous-driving-zi-dong-jia-shi/13.6.-yi-gazebo-lai-zuo-autorace-tiao-zhan-sai-mo-ni.md).

# 13.6. 以 Gazebo 模擬器來模擬 AutoRace 挑戰賽

此 AutoRace 挑戰賽是用 Gazebo 模擬器模擬。我們在 R-BIZ Challenge 中創建了TurtleBot3 AutoRace 2017 比賽環境。

* 建議使用電腦規格
  * CPU : Intel Core i5 / 2 GHz Dual Core Processor
  * RAM : 4GB
  * 硬碟 : 最少 20GB 可用空間
  * GPU : NVIDIA GeForce GTX 9 series

{% hint style="info" %}
警示：不要混淆您的真實相機校準配置文件和 Gazebo 上的校準配置文件。
{% endhint %}

{% hint style="info" %}
備註：turtlebot3\_autorace 套件需要事先安裝好 turtlebot3\_simulations 套件作為先決條件。請先安裝它。
{% endhint %}

1\. **\[Remote PC 端]** 執行 AutoRace Gazebo。你會在 Gazebo 模擬器看到 AutoRace 2017 地圖，如下。

```
 $ roslaunch turtlebot3_gazebo turtlebot3_autorace.launch
```

![](/files/-Ll5OthO5cWLAHbTLRBx)

2\. **\[Remote PC 端]** 執行 Mission launch 指令。你可在 Gazebo 內看到 Traffic Light，Parked TurtleBot3，及 Toll Gate。當 TB3 接近任務區域時，它們會自動啟動。

```
 $ roslaunch turtlebot3_gazebo turtlebot3_autorace_mission.launch
```

![](/files/-Ll5PiYoZW07eipI64df)

3\. **\[Remote PC 端]** 執行 AutoRace launch。如果要實際運行 AutoRace，則必須校準相機。

```
 $ export GAZEBO_MODE=true
 $ export AUTO_IN_CALIB=action
 $ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_intrinsic_camera_calibration.launch
```

4\. **\[Remote PC 端]** 開新的 terminal 視窗，輸入

```
 $ export AUTO_EX_CALIB=action
 $ export AUTO_DT_CALIB=action
 $ export TURTLEBOT3_MODEL=burger
 $ roslaunch turtlebot3_autorace_core turtlebot3_autorace_core.launch
```

5\. **\[Remote PC 端]** 開新的 terminal 視窗，輸入

```
 $ rostopic pub -1 /core/decided_mode std_msgs/UInt8 "data: 2"
```

* [**AutoRace with Gazebo 影片**](https://youtu.be/5fZmuPxMZz0)
