Skip to content

IntelligentRoboticsLabs/go2_robot

Repository files navigation

Unitree GO2 Robot ROS 2

Go2 point cloud

License distro distro humble humble-devel

In this package is our integration for the Unitee Go2 robot.

Checklist

  • robot description
  • odom
  • pointcloud
  • joint_states
  • Visualization in rviz
  • cmd_vel
  • go2_interfaces
  • Change modes
  • Change configuration for robot
  • SLAM (working in progress)
  • Nav2 (working in progress)
  • Ros2cli
  • Hardware interface
  • Gazebo simulation

Installation

You need to have previously installed ROS2. Please follow this guide if you don't have it.

source /opt/ros/humble/setup.bash

Create workspace and clone the repository

mkdir ~/go2_ws/src
cd ~/go2_ws/src
git clone https://github.com/IntelligentRoboticsLabs/go2_robot.git -b humble

Install dependencies and build workspace

cd ~/go2_ws
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install 

Setup the workspace

source ~/ros2_ws/install/setup.bash

Sensor installation

If you have purchased a hesai lidar 3d, or a realsense d435i, follow the following steps inside the robot.

Hesai Lidar

sudo apt-get install libboost-all-dev
sudo apt-get install -y libyaml-cpp-dev
git clone --recurse-submodules https://github.com/HesaiTechnology/HesaiLidar_ROS_2.0.git
cd ..
source /opt/ros/$ROS_DISTRO/setup.bash
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
source install/setup.bash

Set the lidar IP to config/config.yaml

lidar:
- driver:
    udp_port: 2368                                       #UDP port of lidar
    ptc_port: 9347                                       #PTC port of lidar
    device_ip_address: <Device IP>                       #IP address of lidar
    pcap_path: "<Your PCAP file path>"                   #The path of pcap file (set during offline playback)
    correction_file_path: "<Your correction file path>"  #LiDAR angle file, required for offline playback of pcap/packet rosbag
    firetimes_path: "<Your firetime file path>"          #The path of firetimes file
    source_type: 2                                       #The type of data source, 1: real-time lidar connection, 2: pcap, 3: packet rosbag
    pcap_play_synchronization: true                      #Pcap play rate synchronize with the host time
    x: 0                                                 #Calibration parameter
    y: 0                                                 #Calibration parameter
    z: 0                                                 #Calibration parameter
    roll: 0                                              #Calibration parameter
    pitch: 0                                             #Calibration parameter
    yaw: 0                                               #Calibration parameter
ros:
    ros_frame_id: hesai_lidar                            #Frame id of packet message and point cloud message
    ros_recv_packet_topic: /lidar_packets                #Topic used to receive lidar packets from ROS
    ros_send_packet_topic: /lidar_packets                #Topic used to send lidar packets through ROS
    ros_send_point_cloud_topic: /lidar_points            #Topic used to send point cloud through ROS
    send_packet_ros: true                                #true: Send packets through ROS 
    send_point_cloud_ros: true                           #true: Send point cloud through ROS 

Realsense d435i

sudo apt install ros-humble-realsense2-camera

Usage

Bringup the robot

Either from your computer, or from inside the robot, execute the following:

ros2 launch go2_bringup go2.launch.py

If you have a realsense and a lidar inside the robot, use the lidar or realsense parameters. It will only work if you throw everything inside the robot

If you want to see your robot through rviz, do it as follows:

ros2 launch go2_bringup go2.launch.py rviz:=True

Change modes

If what you want is for your robot to be able to change modes, thus performing the movements predefined by the controller, use the following service:

ros2 service call /mode go2_interfaces/srv/Mode "mode: 'hello'"
Available modes ``` damp balance_stand stop_move stand_up stand_down sit rise_sit hello stretch wallow scrape front_flip front_jump front_pounce dance1 dance2 finger_heart ```

Change configurations for robot

If you want, you can modify the ways the robot walks, the height of the base, the height of the legs when walking... I show you the different parameters that can be modified:

  • BodyHeight: Set the relative height of the body above the ground when standing and walking. [0.3 ~ 0.5]
    ros2 service call /body_height go2_interfaces/srv/BodyHeight  "height: 0.0"
  • ContinuousGait: Continuous movement
    ros2 service call /continuous_gait go2_interfaces/srv/ContinuousGait  "flag: false"
  • Euler: Posture when standing and walking. [-0.75 ~ 0.75] [-0.75 ~ 0.75] [-1.5 ~ 1.5]
    ros2 service call /euler go2_interfaces/srv/Euler "roll: 0.0 pitch: 0.0 yaw: 0.0"
  • FootRaiseHeight: Set the relative height of foot lift during movement [-0.06 ~ 0.03]
    ros2 service call /foot_raise_height go2_interfaces/srv/FootRaiseHeight "height: 0.0"
  • Pose: Set true to pose and false to restore
    ros2 service call /pose go2_interfaces/srv/Pose "flag: false"
  • SpeedLevel: Set the speed range [-1 ~ 1]
    ros2 service call /speed_level go2_interfaces/srv/SpeedLevel "level: 0"
  • SwitchGait: Switch gait [0 - 4]
    ros2 service call /switch_gait go2_interfaces/srv/SwitchGait  "d: 0"
  • SwitchJoystick: Native remote control response switch
    ros2 service call /switch_joystick go2_interfaces/srv/SwitchJoystick "flag: false"

SLAM

In the future, work in progress.

NAVIGATION

In the future, work in progress.

Demos

Robot description

go2_tf.webm

Robot PointCloud

go2_lidar.mp4

Acknowledgment

Thanks to unitree for providing the support and communication interfaces with the robot.

About

This is a project made by the Intelligent Robotics Lab, a research group from the Universidad Rey Juan Carlos. Copyright © 2024.

Maintainers:

License

This project is licensed under the BSD 3-clause License - see the LICENSE file for details.