GithubHelp home page GithubHelp logo

stan-32 / nmpc4dog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qiayuanl/legged_control

1.0 0.0 0.0 4.43 MB

Nonlinear MPC and WBC for legged robot based on OCS2 and ros-controls

License: BSD 3-Clause "New" or "Revised" License

C++ 89.47% CMake 10.53%

nmpc4dog's Introduction

legged_control

Introduction

legged_control is an NMPC-WBC legged robot control stack and framework based on OCS2 and ros-control. To the author’s best knowledge, this framework is probably the best-performing open-source legged robot MPC control framework. Thanks to the ros-control interface, you can easily use this framework for your robot.

Installation

Source code

The source code is hosted on GitHub: qiayuanliao/legged_control.

# Clone legged_control
git clone [email protected]:qiayuanliao/legged_control.git

OCS2

OCS2 is a huge monorepo; DO NOT try to compile the whole repo. You only need to compile ocs2_legged_robot_ros and its dependencies following the step below.

  1. You are supposed to clone the OCS2, pinocchio, and hpp-fcl as described in the documentation of OCS2.
    # Clone OCS2
    git clone [email protected]:leggedrobotics/ocs2.git
    # Clone pinocchio
    git clone --recurse-submodules https://github.com/leggedrobotics/pinocchio.git
    # Clone hpp-fcl
    git clone --recurse-submodules https://github.com/leggedrobotics/hpp-fcl.git
    # Clone ocs2_robotic_assets
    git clone https://github.com/leggedrobotics/ocs2_robotic_assets.git
    # Install dependencies
    sudo apt install liburdfdom-dev liboctomap-dev libassimp-dev
    
  2. Compile the ocs2_legged_robot_ros package with catkin tools instead of catkin_make. It will take you about ten minutes.
    catkin build ocs2_legged_robot_ros
    
    Ensure you can command the ANYmal as shown in the document and below.

Build

Build the source code of legged_control by:

catkin build legged_controllers

Build the simulation (DO NOT run on the onboard computer)

catkin build legged_gazebo

Build the hardware interface real robot. If you use your computer only for simulation, you DO NOT need to compile unitree_hw (TODO: add legged prefix to the package name)

catkin build unitree_hw

Quick Start

  1. Set your robot type as an environment variable: ROBOT_TYPE
export ROBOT_TYPE=a1
  1. Run the simulation:
roslaunch unitree_description empty_world.launch

Or on the robot hardware:

roslaunch unitree_hw unitree_hw.launch
  1. Load the controller:
roslaunch legged_controllers load_controller.launch cheater:=false
  1. You can start the controller using rqt_controller_manager
sudo apt install ros-noetic-rqt-controller-manager
rosrun rqt_controller_manager rqt_controller_manager
  1. Start the legged_controller or legged_cheater_controller, NOTE that you are not allowed to start the legged_cheater_controller in real hardware!

  2. Set the gait in the terminal of load_controller.launch, then use RViz and other tools to control the robot

ezgif-5-684a1e1e23.gif

Statistics

The table below shows the labs successfully deploy this repo in their real A1, feel free to open a PR for update these infos.

Lab XPeng Robotics Unitree Geely Auto Hybrid Robotics
Spend Time 1 day - 3 hours 2 hours

nmpc4dog's People

Contributors

qiayuanl avatar

Stargazers

warm tan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.