fix for leg pd controller under ubuntu 24

This commit is contained in:
Huang Zhenbiao 2024-10-28 10:55:35 +08:00
parent 514958edb9
commit 1a5baa354d
5 changed files with 10 additions and 4 deletions

BIN
.images/gazebo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 KiB

After

Width:  |  Height:  |  Size: 329 KiB

BIN
.images/mujoco.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 KiB

View File

@ -34,18 +34,23 @@ Video for OCS2 Quadruped Controller:
```
* Compile the package
```bash
colcon build --packages-up-to unitree_guide_controller go2_description keyboard_input hardware_unitree_mujoco
colcon build --packages-up-to unitree_guide_controller go2_description keyboard_input
```
### 1.1 Mujoco Simulator
Please use this [Mujoco Simulation](https://github.com/legubiao/unitree_mujoco) for more robot models and contact
Please use **C++ Simulation** in 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.
* Compile Unitree Hardware Interfaces
```bash
cd ~/ros2_ws
colcon build --packages-up-to hardware_unitree_mujoco
```
* Launch the unitree mujoco go2 simulation
* Launch the ros2-control
```bash
@ -58,6 +63,8 @@ sensor.
ros2 run keyboard_input keyboard_input
```
![mujoco](.images/mujoco.png)
### 1.2 Gazebo Classic Simulator (ROS2 Humble)
* Install Gazebo Classic
```bash
@ -102,6 +109,7 @@ sensor.
source ~/ros2_ws/install/setup.bash
ros2 run keyboard_input keyboard_input
```
![gazebo](.images/gazebo.png)
For more details, please refer to the [unitree guide controller](controllers/unitree_guide_controller/)
and [go2 description](descriptions/unitree/go2_description/).

View File

@ -53,9 +53,7 @@ namespace leg_pd_controller {
controller_interface::CallbackReturn LegPdController::on_configure(
const rclcpp_lifecycle::State & /*previous_state*/) {
#ifdef ROS2_CONTROL_VERSION_LT_3
reference_interfaces_.resize(joint_names_.size() * 5, std::numeric_limits<double>::quiet_NaN());
#endif
return CallbackReturn::SUCCESS;
}