A1 Driver v3.2

_images/a1_teleop.gif

A1 is intended mostly for academic community. Unitree Robotics has provided an SDK for their robots in C++ and a demo is also provided in ROS. But this ROS driver lacks several ROS features. To cover them this driver is provided.

Requirements

This driver requires a system setup with ROS. It is recommended to use Ubuntu 18.04/Ubuntu 20.04 with ROS melodic/noetic.

To make sure that robot control isn’t affected by system latencies, it is highly recommended to connect the robot via lan. The driver should run intially on remote PC but can also be run on Rasberry Pi/Nvidia board on robot.

Building

Please follow the pre-requisite section.

Furthermore unitree_legged_sdk has the following dependencies.

  • Boost (version 1.5.4 or higher)

  • CMake (version 2.8.3 or higher)

  • LCM (version 1.4.0 or higher)

Attention

It is important to check your CPU type via executing lscpu in the terminal. If you have Architecture:x86_64 then nothing is to be changed, if you have Architecture:aarch64 then in the utils/qre_unitree_envs.bash, you must change it to the cpu from amd64 to arm64. Also in unitree_legged_sdk_3.2, you must change the processor type from amd64 to arm64.

A script can be found below for automatic installation of all the required dependencies mentioned above and the provided software installation. After downloading and changing directory to the downloaded folder, installation script can be run by the following command:

Note

For the A1 installation package please email support@mybotshop.de

You first have to give the script root permission via:

sudo chmod +x a1_installation_script.bash
./a1_installation_script.bash

Now everything should be installed and built (assuming ROS and Gazebo installed prior to following this tutorial). If there is any issues please contact support@mybotshop.de.

Software Overview

Quadruped robots work in two modes:

  1. High level mode

  2. Low level mode

User can be in one of these modes and they can not be switched after running.

High level mode

_images/a1_launch.gif

High level mode is mainly for walking and running. This mode too has two modes normal and motion mode which can be distinguished from their ips(For more details see Quadruped software guide). At the moment this driver is working with default configuration.

In high level mode the robot can walk/run. To run the robot in high level mode run the following command as root user(after turning on the robot and connecting through lan, the robot will be standing):

sudo su
source ~/catkin_ws/devel/setup.bash
roslaunch qre_ros high_level_mode.launch

With high_level_mode.launch unitree_legged_real/real.launch launches a communication channel between the robot and remote PC. Then later in qre_unitree_ros/high_level_mode a ROS node is run.

Node [high_level_driver]

Publications: state [unitree_legged_msgs/HighState]

Subscriptions: cmd_vel [geometry_msgs/Twist]

Services: set_body_pose [qre_msgs/SetBodyPose]

The robot pose can be set using the robot set_body_pose service. Robot state is published in state topic. This message contains a lot of information. For more information see high state message message.

Using the driver

The node subscribes to cmd_vel topic. Here special attention needs to be paid. As the robot is holonimic so different Twist message fields determine different movement. A nice tool here would be teleop_twist_keyboard. Here in the teleop holonomic and non holonomic modes can be used(Be aware key strokes and their usage).

Body height and walking

Body height and walking demo

Low level mode

In this mode all the motors can be controlled directly. For that one needs to first change the operation mode either to Servo mode or Electronic brake mode. Low level mode has again three control modes:

  1. Position

  2. Velocity

  3. Torque

In low level mode joint level control can be achieved. In Quadruped A1 this low level mode can be in three different levels i.e. Position, Velocity, Torque. All three of them can be used with this driver by publishing appropriate messages. Unlike high level mode robot communication is achieved inside the driver node so no seperate node should run.

After turning on the robot and connecting through lan run the following command:

sudo su
source ~/catkin_ws/devel/setup.bash
roslaunch qre_ros low_level_mode.launch

A node with follwoing information will be run:

Node [low_level_driver]

Publications: state [unitree_legged_msgs/LowState]
              joint_states [sensor_msgs/JointState]

Subscriptions: joint_cmd [qre_msgs/JointCMD]

Services: set_body_pose [qre_msgs/SetBodyPose] -> Not implemented yet
          set_control [qre_msgs/SetControl]
PositionControl VelocityControlFast TorqueControl
             Position control              Velocity control              Torque control

The node subscribes to joint_cmd topic. Again here special attention to be paid as well for the joints. For joint sequence see qre_msgs README. The driver publishes two topics state topic pubslihes the information from the robot. For more details see low state message. Joint state messages are also published. set_control service is can change the robot three modes namely i.e. Position, Velocity, Torque(Case sensitive). For every control level here similar joint messages need to be filled in joint_cmd topic other fields are not considered.

Position -> JointCMD.q
            JointCMD.Kd
            JointCMD.Kd
Velocity -> JointCMD.dq
            JointCMD.Kp
            JointCMD.Kd
Torque   -> JointCMD.tau

Using the driver

For velocity and torque control communication can done easily by just publishing the respected values e.g. by using rqt topic publisher, in terminal:

rqt

For position control mode the same control can be used through rqt, but to get smoother motions and communication a demo is provided for some predefined joint values. After running the low_level_driver.launch, execute the following command:

rosrun qre_ros llm_demo.py
PositionControlExample

Low level position control demo with ROS