unitreerobotics / unitree_ros

BSD 3-Clause "New" or "Revised" License
463 stars 224 forks source link

ROS Noetic Error: cannot find -lunitree_legged_sdk #34

Closed dbaldwin closed 2 years ago

dbaldwin commented 2 years ago

@ZKBian and Unitree team, I'm wondering if I can get some assistance with building the ROS packages for Gazebo simulation. I'm running into the following error in the screenshot below:

cannot find -lunitree_legged_sdk

Screenshot from 2022-02-08 07-52-11

I've gone through all the steps in the README file as well as several of the GitHub Issues. Here is what I've done:

  1. Cloned unitree_ros and unitree_ros_to_real into ~/catkin_ws/src
  2. Cloned unitree_legged_sdk into my home directory ~/
  3. Successfully built unitree_legged_sdk as you can see here:

Screenshot from 2022-02-08 07-58-54

  1. Added the UNITREE_LEGGED_SDK_PATH environment variable as suggested by @Zhaiweiwei0 here
  2. But running catkin build in my workspace yields the error I posted above

Could this possibly be a ROS Noetic issue? Any help would be greatly appreciated.

Thank you.

dbaldwin commented 2 years ago

I was able to get this to build by changing this line:

https://github.com/unitreerobotics/unitree_ros_to_real/blob/master/unitree_legged_real/CMakeLists.txt#L24

string(CONCAT LEGGED_SDK_NAME libunitree_legged_sdk.so)

to:

string(CONCAT LEGGED_SDK_NAME libunitree_legged_sdk_amd64.so)

Since my architecture is amd64. But I'd still like to understand why the normal build process didn't work for me.

cyoahs commented 1 year ago

Just for future travellers:

I came across the similar issue again with latest version of unitree_ros_to_real and unitree_legged_sdk, and solved with a similar change:

from

set(LEGGED_SDK_NAME -pthread libunitree_legged_sdk_${ARCH}.so lcm)

link_directories(${CMAKE_SOURCE_DIR}/unitree_legged_sdk-master/lib)

to

set(LEGGED_SDK_NAME -pthread libunitree_legged_sdk.a lcm)

link_directories(${CMAKE_SOURCE_DIR}/unitree_legged_sdk/lib/cpp/${ARCH})

Perhaps lcm can be removed too, because Go1 no longer depends on it.