Unitree A1 catkin_make error

I tried controlling my robot by using the control example in the A1 software guide, but a compile error occurred when using catkin_make in catkin_ws, so I can’t use a1_real with rosrun.

Here is what the guide says:
4.4.2 control examples
Here take low-level control as an example, and we need three terminals here. Firstly, copy a1_real to ~/catkin_ws/src, and compile it:

cd ~/catkin_ws
catkin_make

Terminal-1, run ‘lcm server’ in sdk:

sudo ~/unitree_legged_sdk/build/sdk_lcm_server_low

Terminal-2, run ros master node:

roscore

Terminal-3, run user logic with rosrun:

rosrun a1_real position_lcm_publisher

Here is the CMakeErrorLog:
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/unitree/catkin_ws/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" “cmTC_f623b/fast”
/usr/bin/make -f CMakeFiles/cmTC_f623b.dir/build.make CMakeFiles/cmTC_f623b.dir/build
make[1]: Entering directory ‘/home/unitree/catkin_ws/build/CMakeFiles/CMakeTmp’
Building C object CMakeFiles/cmTC_f623b.dir/CheckSymbolExists.c.o
/usr/bin/cc -o CMakeFiles/cmTC_f623b.dir/CheckSymbolExists.c.o -c /home/unitree/catkin_ws/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_f623b
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f623b.dir/link.txt --verbose=1
/usr/bin/cc -rdynamic CMakeFiles/cmTC_f623b.dir/CheckSymbolExists.c.o -o cmTC_f623b
CMakeFiles/cmTC_f623b.dir/CheckSymbolExists.c.o: In function main': CheckSymbolExists.c:(.text+0x14): undefined reference to pthread_create’
CheckSymbolExists.c:(.text+0x18): undefined reference to `pthread_create’
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_f623b.dir/build.make:97: recipe for target ‘cmTC_f623b’ failed
make[1]: *** [cmTC_f623b] Error 1
make[1]: Leaving directory ‘/home/unitree/catkin_ws/build/CMakeFiles/CMakeTmp’
Makefile:126: recipe for target ‘cmTC_f623b/fast’ failed
make: *** [cmTC_f623b/fast] Error 2

File /home/unitree/catkin_ws/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/unitree/catkin_ws/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" “cmTC_b0f66/fast”
/usr/bin/make -f CMakeFiles/cmTC_b0f66.dir/build.make CMakeFiles/cmTC_b0f66.dir/build
make[1]: Entering directory ‘/home/unitree/catkin_ws/build/CMakeFiles/CMakeTmp’
Building C object CMakeFiles/cmTC_b0f66.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_b0f66.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.10/Modules/CheckFunctionExists.c
Linking C executable cmTC_b0f66
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b0f66.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_b0f66.dir/CheckFunctionExists.c.o -o cmTC_b0f66 -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_b0f66.dir/build.make:97: recipe for target ‘cmTC_b0f66’ failed
make[1]: *** [cmTC_b0f66] Error 1
make[1]: Leaving directory ‘/home/unitree/catkin_ws/build/CMakeFiles/CMakeTmp’
Makefile:126: recipe for target ‘cmTC_b0f66/fast’ failed
make: *** [cmTC_b0f66/fast] Error 2

I hope you can help me with this problem.

Can you please share where is a1_real package and from where you got these commands to run because to me it seems like the procedure is not the correct may be you can share a little details.

So the commands are from the A1 software developer guide (it’s called Unitree_A1_Software_Guide_v2.0.pdf in chapter 4.4.2). I don’t really know where the a1_real package is comming from, but according to this guide it should be copied to the build folder in catkin_ws with the catkin_make command.

Hi,

Please follow the quadruped docs as we are able to provide support on that. The Unitree regularly performs updates for their software that break certain old builds due to which we have not tested it.

Ah, alright, thank you.