# ocs2_learning **Repository Path**: learing8hard/ocs2_learning ## Basic Information - **Project Name**: ocs2_learning - **Description**: 本仓库仅仅是对ocs2库的学习,如果使用了ocs2库,请进行相应的引用。 - **Primary Language**: C++ - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-03-13 - **Last Updated**: 2025-05-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ocs2_learning #### 介绍 本仓库仅仅是对ocs2库的学习,如果使用了ocs2库,请进行相应的引用。 #### 软件架构 软件架构说明 #### 安装教程 ## Preparation Before installation, make sure you have ROS noetic installed in Ubuntu 20.04. Install [catkin tools](https://catkin-tools.readthedocs.io/en/latest/) to use `catkin build` instead of `catkin_make`. ```bash sudo apt-get install python3-catkin-tools ``` Create a catkin workspace: ```bash mkdir -p ~/bipedal_ws/src cd ~/bipedal_ws/src ``` others: ```bash sudo apt install ros-noetic-effort-controllers ``` ## 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. ```bash # Under the src directory of your catkin workspace # Clone OCS2 git clone https://github.com/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 sudo apt install ros-noetic-grid-map-rviz-plugin ``` 2. Compile the `ocs2_legged_robot_ros` package with [catkin tools](https://catkin-tools.readthedocs.io/en/latest/) instead of `catkin_make`. It will take you several minutes. ```bash # Under catkin workspace cd ~/bipedal_ws catkin config -DCMAKE_BUILD_TYPE=RelWithDebInfo catkin build ocs2_legged_robot_ros ocs2_self_collision_visualization ``` 3. Launch the example to test whether ocs2 is installed correctly. ```bash # Under catkin workspace # Source workspace source devel/setup.bash # Launch the example for DDP roslaunch ocs2_legged_robot_ros legged_robot_ddp.launch ``` Ensure you can command the ANYmal as shown in the [document](https://leggedrobotics.github.io/ocs2/robotic_examples.html#legged-robot) and below. ![](https://leggedrobotics.github.io/ocs2/_images/legged_robot.gif) ## Build and simulate in Gazebo Clone the repository to the `src` folder of your catkin workspace. ```bash cd ~/bipedal_ws/src git clone https://github.com/zitongbai/bipedal_control.git ``` Build the source code of `bipedal_control`. ```bash cd ~/bipedal_ws catkin build bipedal_controllers h1_description h1_ocs2_config ``` run the simulation in Gazebo: ```bash # in terminal 1 roslaunch h1_ocs2_config bringup_gazebo.launch rviz:=true # wait for gazebo to start # in terminal 2 rosrun h1_ocs2_config restart_gazebo.py ``` Sometimes the robot might fall down after reset, in which case you can run the restart command again. And it is recommended to switch to the 'trot' gait as soon as possible to prevent the robot from falling down. (It is a known issue and should be fixed in the future.) #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)