Skip to content

Commit 3ff13ea

Browse files
committed
build(deps): add deps yaml-cpp
1 parent c344db5 commit 3ff13ea

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

README _zh.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ git clone https://github.com/unitreerobotics/unitree_ros2
3737
```bash
3838
sudo apt install ros-foxy-rmw-cyclonedds-cpp
3939
sudo apt install ros-foxy-rosidl-generator-dds-idl
40+
sudo apt install libyaml-cpp-dev
4041
```
4142
### 2. 编译cyclone-dds(如果使用 Humble 可跳过此步骤)
4243
由于 Unitree 机器人(sdk2 版本) 使用的是cyclonedds 0.10.2,因此需要先更改ROS2的dds实现。见:https://docs.ros.org/en/foxy/Concepts/About-Different-Middleware-Vendors.html

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ where:
4141
```bash
4242
sudo apt install ros-foxy-rmw-cyclonedds-cpp
4343
sudo apt install ros-foxy-rosidl-generator-dds-idl
44+
sudo apt install libyaml-cpp-dev
4445
```
4546

4647
### 2. Compile cyclone dds (If using Humble, this step can be skipped)

example/src/CMakeLists.txt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ target_compile_features(g1_loco_client_example PRIVATE cxx_std_20)
7171
add_executable(g1_ankle_swing_example src/g1/lowlevel/g1_ankle_swing_example.cpp src/common/motor_crc_hg.cpp)
7272
target_compile_features(g1_ankle_swing_example PRIVATE cxx_std_20)
7373

74-
add_executable(g1_dual_arm_example src/g1/lowlevel/g1_dual_arm_example.cpp src/common/motor_crc_hg.cpp)
75-
target_compile_features(g1_dual_arm_example PRIVATE cxx_std_20)
76-
7774
add_executable(g1_audio_client_example src/g1/audio_client/g1_audio_client_example.cpp)
7875
target_compile_features(g1_audio_client_example PRIVATE cxx_std_20)
7976

@@ -109,7 +106,7 @@ ament_target_dependencies(g1_dex3_example ${DEPENDENCY_LIST})
109106
target_include_directories(g1_dex3_example PRIVATE ${EIGEN3_INCLUDE_DIR})
110107
ament_target_dependencies(g1_loco_client_example ${DEPENDENCY_LIST})
111108
ament_target_dependencies(g1_ankle_swing_example ${DEPENDENCY_LIST})
112-
ament_target_dependencies(g1_dual_arm_example ${DEPENDENCY_LIST})
109+
113110
ament_target_dependencies(g1_audio_client_example ${DEPENDENCY_LIST})
114111

115112
ament_target_dependencies(b2w_sport_client ${DEPENDENCY_LIST})
@@ -118,6 +115,17 @@ ament_target_dependencies(b2w_stand_example ${DEPENDENCY_LIST})
118115
ament_target_dependencies(b2_sport_client ${DEPENDENCY_LIST})
119116
ament_target_dependencies(b2_stand_example ${DEPENDENCY_LIST})
120117

118+
find_package(yaml-cpp QUIET)
119+
if(yaml-cpp_FOUND)
120+
if (${yaml-cpp_VERSION} VERSION_GREATER_EQUAL "0.6")
121+
message(STATUS "Found yaml-cpp version ${yaml-cpp_VERSION}")
122+
add_executable(g1_dual_arm_example src/g1/lowlevel/g1_dual_arm_example.cpp src/common/motor_crc_hg.cpp)
123+
target_compile_features(g1_dual_arm_example PRIVATE cxx_std_20)
124+
ament_target_dependencies(g1_dual_arm_example yaml-cpp ${DEPENDENCY_LIST})
125+
else()
126+
message(STATUS "yaml-cpp version ${yaml-cpp_VERSION} is too old, skipping build of g1_dual_arm_example.")
127+
endif()
128+
endif()
121129

122130
install(TARGETS
123131
low_level_ctrl
@@ -138,7 +146,13 @@ install(TARGETS g1_arm_action_example)
138146
install(TARGETS g1_dex3_example)
139147
install(TARGETS g1_loco_client_example)
140148
install(TARGETS g1_ankle_swing_example)
141-
install(TARGETS g1_dual_arm_example)
149+
150+
if(yaml-cpp_FOUND)
151+
if (${yaml-cpp_VERSION} VERSION_GREATER_EQUAL "0.6")
152+
install(TARGETS g1_dual_arm_example)
153+
endif()
154+
endif()
155+
142156
install(TARGETS g1_audio_client_example)
143157

144158

example/src/src/g1/lowlevel/g1_dual_arm_example.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ inline uint32_t Crc32Core(const uint32_t *ptr, uint32_t len) {
118118
}
119119
}
120120
return CRC32;
121-
};
121+
}
122122

123123
float GetMotorKp(MotorType type) {
124124
switch (type) {

0 commit comments

Comments
 (0)