unitree_ros_to_real/README.md

93 lines
3.2 KiB
Markdown
Raw Permalink Normal View History

2022-10-21 14:40:06 +08:00
Packages Version: v3.8.0
2021-09-01 20:58:06 +08:00
# Introduction
This package can send control command to real robot from ROS. You can do low-level control(namely control all joints on robot) and high-level control(namely control the walking direction and speed of robot).
This version is suitable for unitree_legged_sdk v3.5.1, namely Go1 robot.
2021-09-01 20:58:06 +08:00
## Packages:
Basic message function: `unitree_legged_msgs`
The interface between ROS and real robot: `unitree_legged_real`
2022-05-24 16:05:24 +08:00
## Environment
We recommand users to run this package in Ubuntu 18.04 and ROS melodic environment
## Dependencies
* [unitree_legged_sdk](https://github.com/unitreerobotics/unitree_legged_sdk/releases)
### Notice
The newest release [v3.8.0](https://github.com/unitreerobotics/unitree_legged_sdk/releases/tag/3.8.0) only supports for robot: Go1.
Check release [v3.3.4](https://github.com/unitreerobotics/unitree_legged_sdk/releases/tag/3.3.4) for A1 support.
2021-09-01 20:58:06 +08:00
# Configuration
Before compiling this package, please download the corresponding unitree_legged_sdk as noted above, and put it to your own workspace's source folder(e.g. `~/catkin_ws/src`). Be careful with the sdk folder name. It should be "unitree_legged_sdk" without version tag.
2021-09-01 20:58:06 +08:00
# Build
You can use catkin_make to build ROS packages. First copy the package folder to `~/catkin_ws/src`, then:
```
cd ~/catkin_ws
catkin_make
```
# Setup the net connection
First, please connect the network cable between your PC and robot. Then run `ifconfig` in a terminal, you will find your port name. For example, `enx000ec6612921`.
Then, open the `ipconfig.sh` file under the folder `unitree_legged_real`, modify the port name to your own. And run the following commands:
```
sudo chmod +x ipconfig.sh
sudo ./ipconfig.sh
```
If you run the `ifconfig` again, you will find that port has `inet` and `netmask` now.
In order to set your port automatically, you can modify `interfaces`:
```
sudo gedit /etc/network/interfaces
```
And add the following 4 lines at the end:
```
auto enx000ec6612921
iface enx000ec6612921 inet static
address 192.168.123.162
netmask 255.255.255.0
```
Where the port name have to be changed to your own.
# Run the package
2021-09-02 18:27:42 +08:00
You can control your real Go1 robot from ROS by this package.
2021-09-01 20:58:06 +08:00
2022-05-24 16:05:24 +08:00
Before you run expamle program, please run command
2021-09-01 20:58:06 +08:00
```
2021-09-02 18:27:42 +08:00
roslaunch unitree_legged_real real.launch ctrl_level:=highlevel
2021-09-01 20:58:06 +08:00
```
2022-05-24 16:05:24 +08:00
or
```
roslaunch unitree_legged_real real.launch ctrl_level:=lowlevel
```
It depends which control mode you want to use.
Then, if you want to run high-level control mode, you can run example_walk node like this
```
2023-06-27 21:23:33 +08:00
rosrun unitree_legged_real ros_example_walk
2022-05-24 16:05:24 +08:00
```
2021-09-01 20:58:06 +08:00
2022-05-24 16:05:24 +08:00
If you want to run low-level control mode, you can run example_position program node like this
2021-09-01 20:58:06 +08:00
```
2023-06-27 21:23:33 +08:00
rosrun unitree_legged_real ros_example_postion
2021-09-01 20:58:06 +08:00
```
2022-05-24 16:05:24 +08:00
You can also run the node state_sub to subscribe the feedback information from Go1 robot
2021-09-01 20:58:06 +08:00
```
2022-05-24 16:05:24 +08:00
rosrun unitree_legged_real state_sub
2021-09-01 20:58:06 +08:00
```
2022-05-27 11:24:44 +08:00
You can also run the launch file that enables you control robot via keyboard like you can do in turtlesim package
```
roslaunch unitree_legged_real keyboard_control.launch
```
2022-05-24 16:05:24 +08:00
And before you do the low-level control, please press L2+A to sit the robot down and then press L1+L2+start to make the robot into
mode in which you can do joint-level control, finally make sure you hang the robot up before you run low-level control.