Skip to content

GTLIDAR/legged_software

Repository files navigation

Legged Software

Introduction

This repo is built upon the Cheetah-Software, but allows more convenient integration with other catkin packages such as OCS2 or other perception modules.

IMPORTANT!!

If you are SkyMul member, use the SkyMul repo, i.e., change the url name git@github.gatech.edu:GeorgiaTechLIDARGroup to git@github.com:SkyMul(except for the BT package which is public on SkyMul github).

Installation

Git Dependencies

This repository uses Git Large File Storage to maintain robot meshes. Follow the directions here to install Git LFS.

ROS Dependencies

The following packages are required:

sudo apt install ros-noetic-controller-manager ros-noetic-control-toolbox ros-noetic-realtime-tools ros-noetic-joint-state-controller ros-noetic-gazebo-ros

Dependencies for OCS2

To run the legged_software, you only need to compile the dependencies for ocs2_legged_robot_ros.

  1. Clone pinocchio, and hpp-fcl following the documentation of OCS2. Note that pinocchio and hpp-fcl need to be installed as regular libraries.

    # Install dependencies
    sudo apt install liburdfdom-dev liboctomap-dev libassimp-dev
    
    # Clone hpp-fcl
    git clone --recurse-submodules https://github.com/leggedrobotics/hpp-fcl.git
    cd hpp-fcl
    mkdir build && cd build
    cmake .. && make -j4
    sudo make install
    
    # Clone pinocchio
    git clone --recurse-submodules https://github.com/leggedrobotics/pinocchio.git
    cd pinocchio
    mkdir build && cd build
    cmake .. && make -j4
    sudo make install
    

    Copy the following lines to your ~/.bashrc:

    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
    export PYTHONPATH=/usr/local/lib/python3/dist-packages:$PYTHONPATH
    export CMAKE_PREFIX_PATH=/usr/local/lib:$CMAKE_PREFIX_PATH
    
  2. Clone OCS2 to your ROS workspace

    # Clone OCS2
    cd /path/to/workspace/src
    git clone git@github.gatech.edu:GeorgiaTechLIDARGroup/ocs2.git
    
    # Clone ocs2_robotic_assets
    git clone https://github.com/leggedrobotics/ocs2_robotic_assets.git
    
  3. Compile the ocs2_legged_robot_ros package with catkin tools instead of catkin_make. It will take you several minutes.

    cd /path/to/workspace
    catkin config -DCMAKE_BUILD_TYPE=Release
    catkin build ocs2_legged_robot_ros
    

Legged software

  1. Install proxsuite as a QP solver for WBC:

    cd /any/path/outside/ws
    git clone --recurse-submodules git@github.gatech.edu:GeorgiaTechLIDARGroup/proxsuite.git
    cd proxsuite
    mkdir build && cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DBUILD_WITH_VECTORIZATION_SUPPORT=OFF
    make
    sudo make install
    
  2. (Only for GO1 Air) For SkyMul GO1 Air (Dobby), install the Free Dog SDK separately:

    cd /any/path/outside/ws
    git clone git@github.com:SkyMul/free-dog-cpp-sdk.git
    cd free-dog-cpp-sdk
    mkdir build && cd build
    cmake .. && make
    sudo make install
    
  3. (Only for GO2) To use the Go2, you must install the Unitree robot SDK version 2. Follow the instructions for installation here, and make sure that the place you install the library is under /usr/local which is the default installation path.

  4. Clone ocs2_quadruped and ocs2_quadruped_ros from the lab github / public one.

    cd /path/to/workspace/src
    git clone git@github.gatech.edu:GeorgiaTechLIDARGroup/ocs2_quadruped.git // master branch
    git clone git@github.gatech.edu:GeorgiaTechLIDARGroup/ocs2_quadruped_ros.git // master branch
    
  5. Now you can build the legged_software. If you put OCS2 and legged_software under the same workspace, don't build the entire workspace since some packages of OCS2 might fail to be built. Note that you need to build in Release/RelWithDebInfo mode, otherwise the real-time performance is not guaranteed.

    Then, build the legged_software:

    cd /path/to/workspace
    catkin config -DCMAKE_BUILD_TYPE=Release
    
    cd /path/to/workspace/src
    git clone git@github.gatech.edu:GeorgiaTechLIDARGroup/legged_software.git
    cd legged_software && git lfs pull # some mesh files are too large and stored as lfs files
    catkin build rname_interface // a1_interface for A1; go1_interface for SkyMul GO1 (Chotu); go1_air_interface for SkyMul GO1 Air (Dobby); go2_interface for GO2; b1_interface for B1
    
  6. (Optional; only for SkyMul GO1) To run the legged_autonomy, install the behavior tree cpp v3.8:

    cd /path/to/workspace
    git clone git@github.com:SkyMul/BehaviorTree.CPP.git
    cd BehaviorTree.CPP && git checkout v3.8
    catkin build legged_autonomy
    

    To visualize the BT on the fly, install Groot

Run A1 examples

(Skip this if not testing specific environment) To run customized world such as rebar.world, add the absolute path to your ~/.bashrc:

export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/path/to/yourworkspace/src/legged_software/legged_interfaces/unitree_ros/unitree_gazebo/worlds/building_editor_models

To run gazebo simulation:

roslaunch a1_interface run_gazebo.launch

Rviz will not show anything since the estimator has not started yet. In another terminal:

rosrun a1_interface a1_gazebo_main

Note that it will take some time to compile the CppAD files depedning on the powerfulness of your computer. The robot will then enter the passive mode. You need to manually send ros service to change the mode:

rosservice call /ControlMode 1 // 0 passive; 1 standup; 2 balancestand; 3 locomotion; 4 locomotion OCS2

To run hardware, make sure the IP address is on the same subnet with the hardware. For example:

sudo ifconfig eno1 down
sudo ifconfig eno1 up 192.168.123.162 netmask 255.255.255.0
ping 192.168.123.10

Once the ping test succeeds, launch the controller:

roslaunch a1_interface run_hardware.launch

This will run a similar node as the gazebo one (you don't need to run a1_gazebo_main node any more), and the command for sending control signal is the same.

Run GO2 examples

The overall steps are the same as A1 including the hardware operations. To run gazebo simulation:

roslaunch go2_interface run_gazebo.launch

Rviz will not show anything since the estimator has not started yet. In another terminal:

rosrun go2_interface go2_gazebo_main

Note that it will take some time to compile the CppAD files depending on the powerfulness of your computer. The robot will then enter the passive mode. You need to manually send ros service to change the mode:

rosservice call /ControlMode 1 // 0 passive; 1 standup; 2 balancestand; 3 locomotion; 4 locomotion OCS2

Run Skymul Demos

Note Chotu (GO1) is for marking demo, while Dobby (GO1 Air) is for tying demo. The code might be compatible, but is not thoroughly tested. As a result, to run specific demos, i.e., marking or tying, please make sure the code and the robot are correspond. Besides, you'll need to make sure all the repos are in the same version, not only this one, but SkyMul/ocs2_quadruped_ros repo and SkyMul/ocs2_quadruped repo as well.

Run SkyMul GO1 (Chotu) examples

All the steps are the same other than changing the name a1 to be go1.

roslaunch go1_interface run_gazebo_marking.launch
roslaunch waypoint_marker rebar_marking.launch 
roslaunch move_base_nav go1_move_base_mocap_sim.launch
rosrun go1_interface go1_gazebo_main

Run SkyMul GO1 Air (Dobby) examples

All the steps are the same other than changing the name a1 to be go1_air. Make sure you have installed the Free Dog SDK. We don't directly add it to the legged_software same as the other robots since the Free Dog SDK is being actively maintained.

// pull the repo metioned above

catkin build mocap_simulator
catkin build waypoint_marker
catkin build gamepad_ctrl

// also you need to install move_base packages

roslaunch go1_air_interface run_gazebo_tying.launch
rosrun legged_autonomy bt_runner
rosrun go1_air_interface go1_air_gazebo_main
rosrun mocap_simulator mocap_simulator_node.py

Then you can using rosservice call /ControlMode to change the mode. Note always change back to mode 1 before switching different modes.

Controller setup

Quick note: the ControlMode 3 uses the convex MPC, whereas ControlMode 4 uses a nonlinear MPC based on OCS2. The latter requires more computational power but leverages the full-body kinematics plus centroidal dynamics.

Run move_base navigation

Perform the previous steps to put the desired quadruped into ControlMode 1 (stand up).

Then, put the quadruped into the desired locomotion mode (if you want to do ControlMode 4, you must set foot_step_planning_config.referenceType to 0 in the task file in ocs2_quadruped_ros so that it tracks command velocities):

rosservice call /ControlMode 3 // change to 4 for nonlinear MPC

Then, run the move_base launch script:

roslaunch legged_move_base quadruped_move_base.launch

Now, you can use the "Set Nav Goal" feature in Rviz, and A1 will navigate to it.

Run legged teleoperation

Perform the previous steps to put the desired quadruped into ControlMode 1 (stand up).

Then, put the quadruped into the desired locomotion mode (if you want to do ControlMode 4, you must set foot_step_planning_config.referenceType to 0 in the task file in ocs2_quadruped_ros so that it tracks command velocities):

rosservice call /ControlMode 3 // change to 4 for nonlinear MPC

Then, set the desired gait in the gait terminal.

Then, open up a new terminal and run the teleoperation launch script:

rosrun legged_teleop LeggedTeleoperation.py

You can use the WASD keys to translate, QE to rotate, X to stop moving, and Z to quit.

ToDo list

  • Add OCS2 modules.
  • Replace the rigid body dynamics utilities with pinocchio.
  • Add navigation planner such as gap based planners.
  • Add elevation mapping and terrain segmentation.
  • Add digit/cassie.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors