unitreerobotics / unitree_ros

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

Problem with building unitree_controller package #53

Open wongearth opened 1 year ago

wongearth commented 1 year ago

my system ubuntu 18.04 unitree_legged_sdk: 3.8.0 cmake 3.10.2 lcm 1.4.0 g++ 8.4.0

I have problem with building the unitree_controller package. Can not get pass these error. Please.

Errors << unitree_controller:make /home/wong/catkin_ws/logs/unitree_controller/build.make.011.log /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp: In member function ‘void multiThread::FRfootCallback(const WrenchStamped&)’: /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:170:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[0].x = msg.wrench.force.x; ^~~ footForce /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:171:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[0].y = msg.wrench.force.y; ^~~ footForce /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:172:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[0].z = msg.wrench.force.z; ^~~ footForce /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp: In member function ‘void multiThread::FLfootCallback(const WrenchStamped&)’: /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:178:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[1].x = msg.wrench.force.x; ^~~ footForce /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:179:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[1].y = msg.wrench.force.y; ^~~ footForce /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:180:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[1].z = msg.wrench.force.z; ^~~ footForce /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp: In member function ‘void multiThread::RRfootCallback(const WrenchStamped&)’: /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:186:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[2].x = msg.wrench.force.x; ^~~ footForce /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:187:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[2].y = msg.wrench.force.y; ^~~ footForce /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:188:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[2].z = msg.wrench.force.z; ^~~ footForce /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp: In member function ‘void multiThread::RLfootCallback(const WrenchStamped&)’: /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:194:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[3].x = msg.wrench.force.x; ^~~ footForce /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:195:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[3].y = msg.wrench.force.y; ^~~ footForce /home/wong/catkin_ws/src/unitree_ros/unitree_controller/src/servo.cpp:196:18: error: ‘unitree_legged_msgs::LowState’ {aka ‘struct unitree_leggedmsgs::LowState<std::allocator >’} has no member named ‘eeForce’; did you mean ‘footForce’? lowState.eeForce[3].z = msg.wrench.force.z; ^~~ footForce make[2]: [CMakeFiles/unitree_servo.dir/src/servo.cpp.o] Error 1 make[1]: [CMakeFiles/unitree_servo.dir/all] Error 2 make: *** [all] Error 2 cd /home/wong/catkin_ws/build/unitree_controller; catkin build --get-env unitree_controller | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd - ............................................................................... Failed << unitree_controller:make [ Exited with code 2 ]
Failed <<< unitree_controller [ 7.4 seconds ]

DrStoop commented 1 year ago

Hi, I am having the same problem which is related to the change of the LowState.msg in the unitreerobotics/unitree_ros_to_real-repository. eeForce was removed from LowState.msg in the @ZKBian's commit and it was even pointed out by @andrewhstovell that eeForce is still used by servo.cpp. @ZKBian or @andrewhstovell, do you know how to resolve this issue/bug?

Thanks a lot in advance!

andrewhstovell commented 1 year ago

Hi @DrStoop and @ZKBian, Yes i did figure this out.

Technically this isn't an issue, it comes down to the versions of the packages used.

Please use the following package releases:

unitree_legged_sdk v3.4.2 commit: b5d6db22d08de59b0d1da835b40559b073fce415

unitree_ros_to_real v3.4.0 commit: 3c0fe3c97d048464869074c90719997731333841

unitree_ros (Most recent at time) commit: 2e8877329ccb3b5b24d71f04f8ee9df68b3372e9

I actually compiled a complete list of instructions for cloning, setting up and building on Ubuntu 18.04, you may find it useful :)

ROS Build instructions for Ubuntu.pdf


EDIT:

i've learned that my tutorial is very incomplete. I will make a point to update it, perhaps even put out a guide video.

My tutorial focuses on unitree_ros_to_real v3.4.0 in combination with unitree_legged_sdk v3.4.2

However, i've since learned that more recently made Go1 robots likely aren't compatible with this SDK version, as they have newer software installed (sport mode). So make sure to check your robot is compatible with unitree_legged_sdk v3.4.2 either by connecting to it via wifi and checking the currently installed software and firmware against the ReadME, or better yet, by running the example_walk after building unitree_legged_sdk v3.4.2 with CMake as per readME. Assuming that you've set up your ethernet connection correctly and have been able to ping 192.168.123.161 successfully, the quadruped should perform a range of movements, if nothing happens, it's likely to be a compatibility thing.

unitree_ros_to_real has recently had some bug fixes for v3.5.1 and has released v3.8.0 (compatible with unitree_legged_sdk of same versions) so, when I do re-write the tutorial I'll be sure to include instructions depending on the combination people need/want to use, and will also be sure in include LCM and CMake build instructions, along with connection instructions which are currently missing. :)

wongearth commented 1 year ago

@andrewhstovell Thank you. I could now built unitree_controller successfully. But there seems to be others errors building unitree_legged_real. A long list of errors... some are below. It seems to relate to lcm. Anyone has this problem? I installed lcm 1.4.0.

In file included from /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/src/exe/velocity_mode.cpp:13: /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h: In function ‘unitree_legged_msgs::LowState ToRos(UNITREE_LEGGED_SDK::LowState&)’: /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h:108:27: error: ‘struct UNITREE_LEGGED_SDK::LowState’ has no member named ‘commVersion’; did you mean ‘version’? ros.commVersion = lcm.commVersion; ^~~ version /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h:109:23: error: ‘struct UNITREE_LEGGED_SDK::LowState’ has no member named ‘robotID’ ros.robotID = lcm.robotID; ^~~ /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h:110:18: error: cannot convert ‘std::array<unsigned int, 2>’ to ‘unitree_leggedmsgs::LowState<std::allocator >::_SN_type’ {aka ‘unsigned int’} in assignment ros.SN = lcm.SN; ^~ /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h: In function ‘UNITREE_LEGGED_SDK::LowCmd ToLcm(unitree_legged_msgs::LowCmd&, UNITREE_LEGGED_SDK::LowCmd)’: /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h:134:9: error: ‘struct UNITREE_LEGGED_SDK::LowCmd’ has no member named ‘commVersion’; did you mean ‘version’? lcm.commVersion = ros.commVersion; ^~~ version /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h:135:9: error: ‘struct UNITREE_LEGGED_SDK::LowCmd’ has no member named ‘robotID’ lcm.robotID = ros.robotID; ^~~ /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h:136:18: error: no match for ‘operator=’ (operand types are ‘std::array<unsigned int, 2>’ and ‘unitree_leggedmsgs::LowCmd<std::allocator >::_SN_type’ {aka ‘unsigned int’}) lcm.SN = ros.SN; ^~ In file included from /usr/include/c++/8/tuple:39, from /usr/include/c++/8/bits/unique_ptr.h:37, from /usr/include/c++/8/bits/locale_conv.h:41, from /usr/include/c++/8/locale:43, from /usr/include/c++/8/iomanip:43, from /usr/include/boost/math/policies/error_handling.hpp:12, from /usr/include/boost/math/special_functions/round.hpp:14, from /opt/ros/melodic/include/ros/time.h:58, from /opt/ros/melodic/include/ros/ros.h:38, from /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/src/exe/velocity_mode.cpp:6: /usr/include/c++/8/array:94:12: note: candidate: ‘std::array<unsigned int, 2>& std::array<unsigned int, 2>::operator=(const std::array<unsigned int, 2>&)’ struct array ^~~~~ /usr/include/c++/8/array:94:12: note: no known conversion for argument 1 from ‘unitree_leggedmsgs::LowCmd<std::allocator >::_SN_type’ {aka ‘unsigned int’} to ‘const std::array<unsigned int, 2>&’ /usr/include/c++/8/array:94:12: note: candidate: ‘std::array<unsigned int, 2>& std::array<unsigned int, 2>::operator=(std::array<unsigned int, 2>&&)’ /usr/include/c++/8/array:94:12: note: no known conversion for argument 1 from ‘unitree_leggedmsgs::LowCmd<std::allocator >::_SN_type’ {aka ‘unsigned int’} to ‘std::array<unsigned int, 2>&&’ In file included from /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/src/exe/velocity_mode.cpp:13: /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h: In function ‘unitree_legged_msgs::HighState ToRos(UNITREE_LEGGED_SDK::HighState&)’: /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h:154:27: error: ‘struct UNITREE_LEGGED_SDK::HighState’ has no member named ‘commVersion’; did you mean ‘version’? ros.commVersion = lcm.commVersion; ^~~ version /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h:155:23: error: ‘struct UNITREE_LEGGED_SDK::HighState’ has no member named ‘robotID’ ros.robotID = lcm.robotID; ^~~ /home/mclab/catkin_ws/src/unitree_ros_to_real/unitree_legged_real/include/convert.h:156:18: error: cannot convert ‘std::array<unsigned int, 2>’ to ‘unitree_leggedmsgs::HighState<std::allocator >::_SN_type’ {aka ‘unsigned int’} in assignment ros.SN = lcm.SN;

DrStoop commented 1 year ago

thanks a lot @andrewhstovell, works perfectly for me 👌

andrewhstovell commented 1 year ago

"A long list of errors"

@wongearth I do remember having this issue. But i cannot remember exactly how i resolved it.

I think it was resolved by changing the executable path to the lcm_server in the CMakeLists file. (See section 7 of the pdf i posted)

also did you: sudo apt intall liblcm-dev ?

snijders-tjm commented 1 year ago

@andrewhstovell Thank you for your detailed instruction file. I have followed it step by step and it worked, at least that is what I wonder.

In the final step, after "roslaunch unitree_gazebo normal.launch rname:=go1 wname:=stairs", the simulation indeed starts and I see the go1 robot in the stairs environment. However, over time it shifts and falls of the platform, is this normal? I would have expected it to stay in place in order to initiate, for instance, the stand controller as in the Readme example.

Is this normal behaviour or did I possibly make an error anyway?

Thanks in advance!

andrewhstovell commented 1 year ago

Hi @snijders-tjm This is indeed normal behaviour on startup and i experience every single time.

You need to run the untree_servo node, which will initialize the robots motors (so to speak) and make the robot stand as defined in unitree_controller/src/servo.cpp and unitree_controller/src/body.cpp

After launching Gazebo, in a new terminal:

source /home/USERNAME/catkin_ws/devel/setup.bash
rosrun unitree_controller unitree_servo

The robot will now stand (or possibly do a backflip depending on how far it has slidden [slided? slid?]). At this point the publisher & subscriber loop is active, so just refresh Gazebo "CTRL + R", and your ready to go.

This is about as far as the functionality that unitree provides, and it will now be up to you to determine how to develop further.

Good luck :)

xyq1223 commented 1 year ago

Hello,this is caused by using the wrong version of unitree_legged_msgs. Please select unitree_legged_msgs from the unitree_ros_to_real (v3.2.1) package https://github.com/unitreerobotics/unitree_ros_to_real/tree/v3.2.1 and put it under ~/catkin_ws/src and recompile it.

xyq1223 commented 1 year ago

Or you can choose to add the following statement to the unitree_legged_msgs/msg/LowState.msg file and recompile.

Cartesian[4] eeForceRaw Cartesian[4] eeForce