Skip to content

Commit

Permalink
translate
Browse files Browse the repository at this point in the history
  • Loading branch information
fan-ziqi committed Mar 7, 2024
1 parent a6cf322 commit 825b7c7
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 12 deletions.
39 changes: 27 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
# rl_sim2sim

## 准备
[中文文档](README_CN.md)

在任意位置下载并部署`libtorch`
## Preparation

Pull the code (synchronously pull submodules)

```bash
git clone --recursive https://github.com/fan-ziqi/rl_sim2sim.git
```

If there are updates:

```bash
git pull
git submodule update --remote --recursive
```

Download and deploy `libtorch` at any location

```bash
cd /path/to/your/torchlib
Expand All @@ -11,52 +26,52 @@ unzip libtorch-cxx11-abi-shared-with-deps-2.0.1+cpu.zip -d ./
echo 'export Torch_DIR=/path/to/your/torchlib' >> ~/.bashrc
```

安装 `teleop-twist-keyboard`
Install `teleop-twist-keyboard`

```bash
sudo apt install ros-noetic-teleop-twist-keyboard
```

## 编译
## Compilation

自定义代码中的以下两个函数,以适配不同的模型:
Customize the following two functions in the code to adapt to different models:

```cpp
torch::Tensor forward() override;
torch::Tensor compute_observation() override;
```

然后到根目录编译
Then compile in the root directory

```bash
cd ..
catkin build
```

## 运行
## Run

将训练好的pt模型文件拷贝到`sim2sim/src/unitree_rl/models`
Copy the trained pt model file to `sim2sim/src/unitree_rl/models`

新建终端,启动gazebo仿真环境
Open a new terminal, start the gazebo simulation environment

```bash
source devel/setup.bash
roslaunch unitree_rl start_env.launch
```

新建终端,启动控制程序
Open a new terminal, start the control program

```bash
source devel/setup.bash
rosrun unitree_rl unitree_rl
```

新建终端,键盘控制程序
Open a new terminal, keyboard control program

```bash
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
```



> 部分代码参考https://github.com/mertgungor/unitree_model_control
> Part of the code refers to https://github.com/mertgungor/unitree_model_control
77 changes: 77 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# rl_sim2sim

[English document](README.md)

## 准备

拉取代码(同步拉取子模块)

```bash
git clone --recursive https://github.com/fan-ziqi/rl_sim2sim.git
```

如有更新:

```bash
git pull
git submodule update --remote --recursive
```

在任意位置下载并部署`libtorch`

```bash
cd /path/to/your/torchlib
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcpu.zip
unzip libtorch-cxx11-abi-shared-with-deps-2.0.1+cpu.zip -d ./
echo 'export Torch_DIR=/path/to/your/torchlib' >> ~/.bashrc
```

安装 `teleop-twist-keyboard`

```bash
sudo apt install ros-noetic-teleop-twist-keyboard
```

## 编译

自定义代码中的以下两个函数,以适配不同的模型:

```cpp
torch::Tensor forward() override;
torch::Tensor compute_observation() override;
```

然后到根目录编译

```bash
cd ..
catkin build
```

## 运行

将训练好的pt模型文件拷贝到`sim2sim/src/unitree_rl/models`

新建终端,启动gazebo仿真环境

```bash
source devel/setup.bash
roslaunch unitree_rl start_env.launch
```

新建终端,启动控制程序

```bash
source devel/setup.bash
rosrun unitree_rl unitree_rl
```

新建终端,键盘控制程序

```bash
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
```



> 部分代码参考https://github.com/mertgungor/unitree_model_control

0 comments on commit 825b7c7

Please sign in to comment.