diff --git a/.images/gazebo_classic.png b/.images/gazebo_classic.png new file mode 100644 index 0000000..097e52a Binary files /dev/null and b/.images/gazebo_classic.png differ diff --git a/README.md b/README.md index f0e79d3..769f4b1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ # Quadruped ROS2 Control -This repository contains the ros2-control based controllers for the quadruped robot. -* [Controllers](controllers): contains the ros2-control controllers +This repository contains the ros2-control based controllers for the quadruped robot. + +* [Controllers](controllers): contains the ros2-control controllers * [Commands](commands): contains command node used to send command to the controller * [Descriptions](descriptions): contains the urdf model of the robot * [Hardwares](hardwares): contains the ros2-control hardware interface for the robot Todo List: + - [x] [Mujoco Simulation](hardwares/hardware_unitree_mujoco) - [x] [Unitree Guide Controller](controllers/unitree_guide_controller) - [x] [Gazebo Simulation](descriptions/quadruped_gazebo) @@ -23,8 +25,8 @@ Video for Unitree Guide Controller: Video for OCS2 Quadruped Controller: [![](http://i0.hdslb.com/bfs/archive/e758ce019587032449a153cf897a543443b64bba.jpg)](https://www.bilibili.com/video/BV1UcxieuEmH/) - ## 1. Quick Start + * rosdep ```bash cd ~/ros2_ws @@ -36,9 +38,13 @@ Video for OCS2 Quadruped Controller: ``` ### 1.1 Mujoco Simulator -Please use this [Mujoco Simulation](https://github.com/legubiao/unitree_mujoco) for more robot models and contact sensor. -> **Warning:** CycloneDDS ROS2 RMW may conflict with unitree_sdk2. If you cannot launch unitree mujoco simulation without `sudo`, then you cannot used `unitree_mujoco_hardware`. You can switch to gazebo, or try to solve the conflict by uninstall CycloneDDS ROS2 RMW. +Please use this [Mujoco Simulation](https://github.com/legubiao/unitree_mujoco) for more robot models and contact +sensor. + +> **Warning:** CycloneDDS ROS2 RMW may conflict with unitree_sdk2. If you cannot launch unitree mujoco simulation +> without `sudo`, then you cannot used `unitree_mujoco_hardware`. You can switch to gazebo, or try to solve the conflict +> by uninstall CycloneDDS ROS2 RMW. * Launch the unitree mujoco go2 simulation * Launch the ros2-control @@ -53,22 +59,10 @@ Please use this [Mujoco Simulation](https://github.com/legubiao/unitree_mujoco) ``` ### 1.2 Gazebo Classic Simulator (ROS2 Humble) -* Compile Leg PD Controller - ```bash - colcon build --packages-up-to leg_pd_controller - ``` -* Launch the ros2-control - ```bash - source ~/ros2_ws/install/setup.bash - ros2 launch unitree_guide_controller gazebo.launch.py - ``` -* Run the keyboard control node - ```bash - source ~/ros2_ws/install/setup.bash - ros2 run keyboard_input keyboard_input - ``` - -### 1.3 Gazebo Harmonic Simulator (ROS2 Jazzy) +* Install Gazebo Classic + ```bash + sudo apt-get install ros-humble-gazebo-ros ros-humble-gazebo-ros2-control + ``` * Compile Leg PD Controller ```bash colcon build --packages-up-to leg_pd_controller @@ -84,16 +78,51 @@ Please use this [Mujoco Simulation](https://github.com/legubiao/unitree_mujoco) ros2 run keyboard_input keyboard_input ``` -For more details, please refer to the [unitree guide controller](controllers/unitree_guide_controller/) and [go2 description](descriptions/unitree/go2_description/). +![gazebo classic](.images/gazebo_classic.png) + + +### 1.3 Gazebo Harmonic Simulator (ROS2 Jazzy) + +* Install Gazebo + ```bash + sudo apt-get install ros-jazzy-ros-gz ros-jazzy-gz-ros2-control + ``` + +* Compile Leg PD Controller + ```bash + colcon build --packages-up-to leg_pd_controller + ``` +* Launch the ros2-control + ```bash + source ~/ros2_ws/install/setup.bash + ros2 launch unitree_guide_controller gazebo.launch.py + ``` +* Run the keyboard control node + ```bash + source ~/ros2_ws/install/setup.bash + ros2 run keyboard_input keyboard_input + ``` + +For more details, please refer to the [unitree guide controller](controllers/unitree_guide_controller/) +and [go2 description](descriptions/unitree/go2_description/). ## Reference ### Conference Paper -[1] Liao, Qiayuan, et al. "Walking in narrow spaces: Safety-critical locomotion control for quadrupedal robots with duality-based optimization." In *2023 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)*, pp. 2723-2730. IEEE, 2023. + +[1] Liao, Qiayuan, et al. "Walking in narrow spaces: Safety-critical locomotion control for quadrupedal robots with +duality-based optimization." In *2023 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)*, pp. +2723-2730. IEEE, 2023. ### Miscellaneous -[1] Unitree Robotics. *unitree\_guide: An open source project for controlling the quadruped robot of Unitree Robotics, and it is also the software project accompanying 《四足机器人控制算法--建模、控制与实践》 published by Unitree Robotics*. [Online]. Available: [https://github.com/unitreerobotics/unitree_guide](https://github.com/unitreerobotics/unitree_guide) -[2] Qiayuan Liao. *legged\_control: An open-source NMPC, WBC, state estimation, and sim2real framework for legged robots*. [Online]. Available: [https://github.com/qiayuanl/legged_control](https://github.com/qiayuanl/legged_control) +[1] Unitree Robotics. *unitree\_guide: An open source project for controlling the quadruped robot of Unitree Robotics, +and it is also the software project accompanying 《四足机器人控制算法--建模、控制与实践》 published by Unitree +Robotics*. [Online]. +Available: [https://github.com/unitreerobotics/unitree_guide](https://github.com/unitreerobotics/unitree_guide) -[3] Ziqi Fan. *rl\_sar: Simulation Verification and Physical Deployment of Robot Reinforcement Learning Algorithm.* 2024. Available: [https://github.com/fan-ziqi/rl_sar](https://github.com/fan-ziqi/rl_sar) \ No newline at end of file +[2] Qiayuan Liao. *legged\_control: An open-source NMPC, WBC, state estimation, and sim2real framework for legged +robots*. [Online]. Available: [https://github.com/qiayuanl/legged_control](https://github.com/qiayuanl/legged_control) + +[3] Ziqi Fan. *rl\_sar: Simulation Verification and Physical Deployment of Robot Reinforcement Learning Algorithm.* +2024. Available: [https://github.com/fan-ziqi/rl_sar](https://github.com/fan-ziqi/rl_sar) \ No newline at end of file diff --git a/controllers/leg_pd_controller/CMakeLists.txt b/controllers/leg_pd_controller/CMakeLists.txt index 0c07275..b06f7f5 100644 --- a/controllers/leg_pd_controller/CMakeLists.txt +++ b/controllers/leg_pd_controller/CMakeLists.txt @@ -22,11 +22,11 @@ foreach (Dependency IN ITEMS ${CONTROLLER_INCLUDE_DEPENDS}) endforeach () # check ros2 control version -find_package(controller_manager 3.0.0) +find_package(controller_manager REQUIRED) # Handle the case where the required version is not found -if(NOT controller_manager_FOUND) +if(controller_manager_VERSION VERSION_LESS "3.0.0") add_definitions(-DROS2_CONTROL_VERSION_LT_3) - message(FATAL_ERROR "ros2_control version below 3.0.0. " + message(STATUS "ros2_control version below 3.0.0. " "Change the implementation to support ros2_control version 2.") endif()