Skip to content

Commit

Permalink
docs: update the post of f1tenth_online
Browse files Browse the repository at this point in the history
  • Loading branch information
sujit-168 committed Mar 29, 2024
1 parent 1b0476c commit 9ad3815
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 81 deletions.
1 change: 1 addition & 0 deletions docs/.vitepress/config/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export const sidebar: DefaultTheme.Config['sidebar'] = {
collapsed: true,
items: [
{ text: '环境搭建', link: '/competition/f1tenth_online/env-config' },
{ text: '代码更新', link: '/competition/f1tenth_online/update-upstream' },
{ text: '修改代码', link: '/competition/f1tenth_online/modify-code' },
{ text: '运行测试', link: '/competition/f1tenth_online/run-and-test' },
{ text: '作品提交', link: '/competition/f1tenth_online/submit-works' },
Expand Down
83 changes: 4 additions & 79 deletions docs/competition/f1tenth_online/env-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
- ROS Noetic
- Gazebo 11

## 代码更新 {#code-update}

参考 [代码更新](./update-upstream)

## 使用新版 ROS2GO 随身系统(开箱即用){#noinstall-env-by-ros2go}

[如何购买 ROS2GO 随身系统](https://item.taobao.com/item.htm?spm=a1z10.1-c.w4001-24162858428.1.52a159deQziaYp&id=683432188936&scene=taobao_shop)
Expand Down Expand Up @@ -144,85 +148,6 @@ rosrun tianracer_gazebo judge_system_node.py

![](https://tianbot-pic.oss-cn-beijing.aliyuncs.com/tianbot-pic/Tianbot-Docimage-20231119223227225.png)

### 更新比赛环境 {#update-racer-env}

切换到仿真系统源码目录,运行如下命令:
```shell
cd ~/tianbot_ws/src/tianracer
```

#### 更新仿真系统源码 {#update-source-code}

使用`git pull`命令更新仿真系统源码。
```shell
git fetch && git pull
```

如果 `git fetch``git pull` 长时间无响应,可以尝试使用如下命令:
```shell
git remote set-url origin https://mirror.ghproxy.com/https://github.com/tianbot/tianracer.git
```
#### 确认当前分支 {#confirm-current-branch}

使用`git branch`命令查看当前分支,确保当前分支为`dev`分支。

```shell
git branch
````

输出结果

```shell
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git branch
* dev # 可以看到当前分支为 dev
```

#### 切换分支 {#switch-branch}

切换到`dev`分支,运行如下命令:
```shell
git switch dev
```

#### 检查是否需要更新 {#check-update}
::: info 提示
如需获取最新的仿真系统源码和特性,请切换到`dev`分支,并定期检查是否有新的更新。
```shell
git fetch && git status
```
:::

其他操作细节参考

```shell
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git status
On branch dev
Your branch is up to date with 'origin/dev'.
...........
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git remote set-url origin https://mirror.ghproxy.com/https://github.com/tianbot/tianracer.git
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git remote -v
origin https://mirror.ghproxy.com/https://github.com/tianbot/tianracer.git (fetch)
origin https://mirror.ghproxy.com/https://github.com/tianbot/tianracer.git (push)
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git fetch
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), 915 bytes | 915.00 KiB/s, done.
From https://mirror.ghproxy.com/https://github.com/tianbot/tianracer
6e8e3f3..4524f75 dev -> origin/dev
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git pull
Updating 6e8e3f3..4524f75
Fast-forward
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git switch dev
......
Your branch is up to date with 'origin/dev'
```

### 安装录制环境

`OBS Studio`(Open Broadcaster Software Studio)是一款开源的跨平台录制和直播软件,具有以下特点和相比其他软件的优势:
Expand Down
4 changes: 4 additions & 0 deletions docs/competition/f1tenth_online/modify-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
修改代码时建议拷贝 1 份,进行修改,不建议在模板代码上直接修改。
:::

::: tip 提示
关于代码模板的详细解释,此处不再赘述,无论是 `multi_goal.py` 还是 `follow_the_gap.py`,其速度控制消息均通过话题 `robot_name` + `/ackermann_cmd_stamped`进行下发,其消息类型 `ackermann_msgs` 中的[AckermannDriveStamped](https://docs.ros.org/en/jade/api/ackermann_msgs/html/msg/AckermannDriveStamped.html)
:::

运行如下命令,即可查看测试样例代码,关于[`vi`的使用](https://www.runoob.com/linux/linux-vim.html),请自行学习。

- multi_goals.py
Expand Down
7 changes: 5 additions & 2 deletions docs/competition/f1tenth_online/run-and-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ rosrun tianracer_gazebo judge_system_node.py
开启终端,输入上述 2 行命令即可启动比赛环境,比赛过程中,请勿关闭上述两个命令行窗口,或执行其他操作
:::


## 紧急制动 {#emergency-brake}

::: tip 提示
Expand Down Expand Up @@ -124,4 +123,8 @@ rosservice call /tianracer/emergency_brake

::: info 注意
按钮按下顺序不可颠倒,否则会出现小车前轮歪向一侧,无法正常运动的情况
:::
:::

## 常见问题 {#problem}

如遇奇怪的问题,请关闭和结束已打开的所有终端,然后重新操作
112 changes: 112 additions & 0 deletions docs/competition/f1tenth_online/update-upstream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# 更新比赛环境

切换到仿真系统源码目录,运行如下命令:
```shell
roscd tianracer/..
```

## 检查更新 {#check-update}

如需获取最新的仿真系统源码和特性,请切换到`dev`分支,并定期检查是否有新的更新。
```shell
git fetch
```

## 本地修改暂存 {#local-modification-staged}

使用`git status`命令查看当前工作区状态,确保当前工作区没有未暂存的修改。

若输出信息显示中包含

`nothing to commit ,working tree clean`

则可以跳过这一步,进行下一步更新仿真系统源码。

::: tip 提示
注意这一步非常关键,不可省略,如果对某些文件中的代码做过修改
,则应先保存修改并储藏,避免修改丢失
:::

```shell
git add . && git stash
```
检查暂存状态,有输出则代表暂存成功
```shell
git stash list
```

然后继续进行下一步

## 更新仿真系统源码 {#update-source-code}

使用`git pull`命令更新仿真系统源码。
```shell
git fetch && git pull
```

如果 `git fetch``git pull` 长时间无响应,可以尝试使用如下命令:
```shell
git remote set-url origin https://mirror.ghproxy.com/https://github.com/tianbot/tianracer.git
```

## 恢复本地修改 {#restore-local-modification}

使用下面的命令恢复本地修改。
```shell
git stash pop
```

## 分支操作

#### 确认当前分支 {#confirm-current-branch}

使用`git branch`命令查看当前分支,确保当前分支为`dev`分支。

```shell
git branch
````

输出结果

```shell
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git branch
* dev # 可以看到当前分支为 dev
```

#### 切换分支 {#switch-branch}

切换到`dev`分支,运行如下命令:
```shell
git switch dev
```

## 其他操作细节参考

```shell
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git status
On branch dev
Your branch is up to date with 'origin/dev'.
...........
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git remote set-url origin https://mirror.ghproxy.com/https://github.com/tianbot/tianracer.git
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git remote -v
origin https://mirror.ghproxy.com/https://github.com/tianbot/tianracer.git (fetch)
origin https://mirror.ghproxy.com/https://github.com/tianbot/tianracer.git (push)
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git fetch
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), 915 bytes | 915.00 KiB/s, done.
From https://mirror.ghproxy.com/https://github.com/tianbot/tianracer
6e8e3f3..4524f75 dev -> origin/dev
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git pull
Updating 6e8e3f3..4524f75
Fast-forward
tianbot@ros2go:~/tianracer_ws/src/tianracer$ git switch dev
......
Your branch is up to date with 'origin/dev'
```

0 comments on commit 9ad3815

Please sign in to comment.