Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy in A1 #2

Open
D-jojo opened this issue May 5, 2023 · 22 comments
Open

deploy in A1 #2

D-jojo opened this issue May 5, 2023 · 22 comments

Comments

@D-jojo
Copy link

D-jojo commented May 5, 2023

Hi,
Thank you very much for sharing the code. I want to deploy the policy to the A1 robot now, but I have encountered a problem. After running the following two commands:
roslaunch agile_locomotion cms_ros.launch
rostopic pub /agile_locomotion/walk std_msgs/Empty "{}" -1
I encountered an error as follows:lock memory failed.
What's going on here? I look forward to your reply.
Thank you again!

@antonilo
Copy link
Owner

antonilo commented May 6, 2023

Hi @D-jojo

As it is written in the readme, you need to follow these steps to avoid memory locking:

Since the Unitree SDK requires memory locking and high-priority process, which is not usually granted without sudo, add the following lines to /etc/security/limits.conf (reboot the robot afterwards):

unitree soft memlock unlimited
unitree hard memlock unlimited
unitree soft nice eip
unitree hard nice eip 
unitree soft rtprio 99
unitree hard rtprio 99

If that does not work for you, do these steps

su
source /PATH/TO/WORKSPACE/devel/setup.sh
roslaunch agile_locomotion cms_ros.launch

@D-jojo
Copy link
Author

D-jojo commented May 6, 2023

Hi,
I tried again according to your step, but still failed. The error log file is as follows:
master.log
roslaunch-ubuntu-3765.log
rosout.log
rosout-1-stdout.log
I think it's possible that the server node access was refused. I would like to ask for your opinion.
I look forward to your reply.
Thank you again!

@empty814 empty814 mentioned this issue May 14, 2023
@antonilo
Copy link
Owner

Hi @D-jojo,

It seems that the problem is in the sdk. I am using this sdk version (https://github.com/unitreerobotics/unitree_legged_sdk/releases/tag/v3.3.1). Can you try to reinstall the sdk and put the lib files in this directory https://github.com/antonilo/vision_locomotion/tree/master/controller/lib? Also, can you launch the examples from the SDK?
If you have an old SDK, remove the InitEnvironment() function.

@xyyl
Copy link

xyyl commented Aug 1, 2023

Hi @antonilo

I’m studying this repo CMS and your pre-work RMA, both work attractive to me. No issues encountered when I trainning a model with the later , but encountering the same problem with Deng when catkin build the former, I try to rewrite the CMakeLists.txt with catkin instead of catkin_simple, and got the same error. I cannot figure out the problem, could you give me some help? Thanks a lot!

the error as following:

Errors << agile_locomotion:make /home/xy/cms_ws/catkin_cms/logs/agile_locomotion/build.make.000.log
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::loadParameters()': agile_locomotion.cpp:(.text+0x751): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x852): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /usr/bin/ld: agile_locomotion.cpp:(.text+0x913): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x9d4): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /usr/bin/ld: agile_locomotion.cpp:(.text+0xa95): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o:agile_locomotion.cpp:(.text+0xb56): more undefined references to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' follow /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::loadParameters()':
agile_locomotion.cpp:(.text+0x172a): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text+0x195c): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x19ce): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /usr/bin/ld: agile_locomotion.cpp:(.text+0x1a76): undefined reference to ros::NodeHandle::getParam(std::string const&, std::string&) const'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::AgileLocomotion(ros::NodeHandle const&, ros::NodeHandle const&)': agile_locomotion.cpp:(.text+0x37da): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x3863): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text+0x38e8): undefined reference to ros::this_node::getName()'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::updateState()': agile_locomotion.cpp:(.text+0x4d56): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::startWalking()': agile_locomotion.cpp:(.text+0x6377): undefined reference to logging::Logging::createDirectories(std::string, std::string*)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x63bd): undefined reference to logging::Logging::newLog(std::string const&)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::startExecutionCallback(boost::shared_ptr<std_msgs::Empty_<std::allocator > const> const&)':
agile_locomotion.cpp:(.text+0x6864): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function void ros::Publisher::publish<visualoco_msgs::Proprioception_<std::allocator > >(visualoco_msgs::Proprioception_<std::allocator > const&) const':
agile_locomotion.cpp:(.text.ZNK3ros9Publisher7publishIN14visualoco_msgs15Proprioception_ISaIvEEEEEvRKT[ZNK3ros9Publisher7publishIN14visualoco_msgs15Proprioception_ISaIvEEEEEvRKT]+0x2e1): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function bool quadrotor_common::getParamstd::string(std::string const&, std::string&, ros::NodeHandle const&)':
agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE]+0x3e): undefined reference to ros::NodeHandle::getParam(std::string const&, std::string&) const' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE]+0x13e): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE]+0x1f5): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE]+0x265): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE]+0x37b): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> > const&, char const*, int, char const*)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function bool quadrotor_common::getParam(std::string const&, float&, ros::NodeHandle const&)':
agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE]+0x3e): undefined reference to ros::NodeHandle::getParam(std::string const&, float&) const' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE]+0x140): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE]+0x1f5): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE]+0x265): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE]+0x37b): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> > const&, char const*, int, char const*)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function bool quadrotor_common::getParam(std::string const&, double&, double const&, ros::NodeHandle const&)':
agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x3d): undefined reference to ros::NodeHandle::getParam(std::string const&, double&) const' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x12c): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x1e5): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x255): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x36e): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> > const&, char const*, int, char const*)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function bool quadrotor_common::getParam(std::string const&, int&, int const&, ros::NodeHandle const&)':
agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x3d): undefined reference to ros::NodeHandle::getParam(std::string const&, int&) const' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x12a): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x1e5): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x255): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x36c): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> > const&, char const*, int, char const*)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function bool quadrotor_common::getParam(std::string const&, bool&, bool const&, ros::NodeHandle const&)':
agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x3d): undefined reference to ros::NodeHandle::getParam(std::string const&, bool&) const' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x12b): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x1e5): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x255): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x372): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> > const&, char const*, int, char const*)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function ros::SubscriptionCallbackHelperT<boost::shared_ptr<std_msgs::Empty<std::allocator > const> const&, void>::deserialize(ros::SubscriptionCallbackHelperDeserializeParams const&)':
agile_locomotion.cpp:(.text._ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN8std_msgs6Empty_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE[_ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN8std_msgs6Empty_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE]+0x1e4): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::AgileLocomotion()':
agile_locomotion.cpp:(.text._ZN16agile_locomotion15AgileLocomotionC2Ev[_ZN16agile_locomotion15AgileLocomotionC5Ev]+0x84): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16agile_locomotion15AgileLocomotionC2Ev[_ZN16agile_locomotion15AgileLocomotionC5Ev]+0xd6): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function main': agile_locomotion.cpp:(.text.startup+0x4f): undefined reference to ros::init(int&, char**, std::string const&, unsigned int)'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function ros::SubscriptionCallbackHelperT<boost::shared_ptr<visualoco_msgs::VisuaLatent_<std::allocator<void> > const> const&, void>::deserialize(ros::SubscriptionCallbackHelperDeserializeParams const&)': agile_locomotion.cpp:(.text._ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN14visualoco_msgs12VisuaLatent_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE[_ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN14visualoco_msgs12VisuaLatent_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE]+0x44c): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/agile_locomotion.dir/build.make:436:/home/xy/cms_ws/catkin_cms/devel/lib/agile_locomotion/agile_locomotion] 错误 1
make[1]: *** [CMakeFiles/Makefile2:1579:CMakeFiles/agile_locomotion.dir/all] 错误 2
make: *** [Makefile:146:all] 错误 2

@antonilo
Copy link
Owner

antonilo commented Aug 1, 2023

Can you describe your setup? Which compute and ROS are you using?

@xyyl
Copy link

xyyl commented Aug 1, 2023

Hi @antonilo
Thank you for your applying!
I deployed with a Lenovo ThinkBook 16p laptop, with Ubuntu20.04 and ROS-Noetic respectively. I carried out the commands as the repo described. But before that, I installed nvidia-driver-535, CUDA Toolkit 11.8 and torch 2.0.1(with the command: pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118) for Issac Gym environment. In addition, I install Raisim1.001 as RMA required, and opencv4.
I found the command: conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
with the version of pytorch-cuda=11.7 which is different from CUDA Toolkit 11.8? If this get any impact on catkin build?

@antonilo
Copy link
Owner

antonilo commented Aug 2, 2023

it looks like you have a problem with ROS. Can you build other packages? Can you try to run one of the ros tutorials and see if everything works?

@xyyl
Copy link

xyyl commented Aug 3, 2023

I have solved this problem with the help of Deng, Because I didn't expect that must download a c++ type of torch(named libtorch) and placed in the path:/home/xx/. Thank you anyway.

@antonilo
Copy link
Owner

what exactly did you download/change? Would you mind adding a pull request on the README?

@boyuandeng
Copy link

there are some steps for it.
1 download the c-torch 11 version, then replace the original libtorch(include dir and ..)
2 donot forget edit CMakeList.txt: delete set(CXXflag....Torchflag)
may be you will successful after those steps, but the libtorch will report one bug in some header-files(hardly to remeber)
For this situation, just add "c10::" on bug site.

@xyyl
Copy link

xyyl commented Aug 15, 2023

found some differences between desktop(with one GPU at least) and robot computer(without GPU):
(1) a cuda version libtorch is needed on the desktop , with this link to download: https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcu118.zip . a cpu version on the robot, with this link: https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcpu.zip . place the package libtorch to the path: /home/xx/.
(2) I run the command: export Torch_DIR=/home/.../torch on the desktop, but did not on the robot computer. both passed when catkin build. I have deployed the repo on a Unitree-A1,it works well.

@D-jojo
Copy link
Author

D-jojo commented Oct 20, 2023

@antonilo

Hi @D-jojo,

It seems that the problem is in the sdk. I am using this sdk version (https://github.com/unitreerobotics/unitree_legged_sdk/releases/tag/v3.3.1). Can you try to reinstall the sdk and put the lib files in this directory https://github.com/antonilo/vision_locomotion/tree/master/controller/lib? Also, can you launch the examples from the SDK? If you have an old SDK, remove the InitEnvironment() function.

Thank you for your reply. I have solved my problem according to your prompt. Thank you very much!

@D-jojo
Copy link
Author

D-jojo commented Oct 20, 2023

Hi, @xyyl @boyuandeng
Thank you for your reply. I also encountered similar errors during the subsequent process of configuring the workstation.

The error is as follows:
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::loadParameters()': agile_locomotion.cpp:(.text+0x150c): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x1606): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /usr/bin/ld: agile_locomotion.cpp:(.text+0x16c7): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x1788): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /usr/bin/ld: agile_locomotion.cpp:(.text+0x1849): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o:agile_locomotion.cpp:(.text+0x190a): more undefined references to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' follow /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::loadParameters()':
agile_locomotion.cpp:(.text+0x24cf): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text+0x26b7): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x2727): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /usr/bin/ld: agile_locomotion.cpp:(.text+0x27c3): undefined reference to ros::NodeHandle::getParam(std::string const&, std::string&) const'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::AgileLocomotion(ros::NodeHandle const&, ros::NodeHandle const&)': agile_locomotion.cpp:(.text+0x3a21): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x3a73): undefined reference to ros::this_node::getName()' /usr/bin/ld: agile_locomotion.cpp:(.text+0x3b03): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::updateState()': agile_locomotion.cpp:(.text+0x4fe4): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::startWalking()': agile_locomotion.cpp:(.text+0x6223): undefined reference to logging::Logging::createDirectories(std::string, std::string*)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x6285): undefined reference to logging::Logging::newLog(std::string const&)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::startExecutionCallback(boost::shared_ptr<std_msgs::Empty_<std::allocator > const> const&)':
agile_locomotion.cpp:(.text+0x65d2): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function bool quadrotor_common::getParamstd::string(std::string const&, std::string&, ros::NodeHandle const&)':
agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE]+0x3e): undefined reference to ros::NodeHandle::getParam(std::string const&, std::string&) const' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE]+0x1c8): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE]+0x235): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE]+0x337): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamISsEEbRKSsRT_RKN3ros10NodeHandleE]+0x3a5): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function bool quadrotor_common::getParam(std::string const&, float&, ros::NodeHandle const&)':
agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE]+0x3e): undefined reference to ros::NodeHandle::getParam(std::string const&, float&) const' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE]+0x1ca): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE]+0x235): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE]+0x337): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIfEEbRKSsRT_RKN3ros10NodeHandleE]+0x3a5): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function bool quadrotor_common::getParam(std::string const&, double&, double const&, ros::NodeHandle const&)':
agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x3b): undefined reference to ros::NodeHandle::getParam(std::string const&, double&) const' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x1b6): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x245): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x33d): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIdEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x3a5): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function bool quadrotor_common::getParam(std::string const&, int&, int const&, ros::NodeHandle const&)':
agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x3b): undefined reference to ros::NodeHandle::getParam(std::string const&, int&) const' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x1b0): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x23d): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x33b): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIiEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x39d): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function bool quadrotor_common::getParam(std::string const&, bool&, bool const&, ros::NodeHandle const&)':
agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x3b): undefined reference to ros::NodeHandle::getParam(std::string const&, bool&) const' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x1b2): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x23d): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[_ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x33c): undefined reference to ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*)'
/usr/bin/ld: agile_locomotion.cpp:(.text._ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE[ZN16quadrotor_common8getParamIbEEbRKSsRT_RKS3_RKN3ros10NodeHandleE]+0x39d): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function ros::SubscriptionCallbackHelperT<boost::shared_ptr<std_msgs::Empty<std::allocator > const> const&, void>::deserialize(ros::SubscriptionCallbackHelperDeserializeParams const&)':
agile_locomotion.cpp:(.text.ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN8std_msgs6Empty_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE[ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN8std_msgs6Empty_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE]+0x1e4): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function void ros::Publisher::publish<visualoco_msgs::Proprioception<std::allocator > >(visualoco_msgs::Proprioception<std::allocator > const&) const':
agile_locomotion.cpp:(.text.ZNK3ros9Publisher7publishIN14visualoco_msgs15Proprioception_ISaIvEEEEEvRKT[ZNK3ros9Publisher7publishIN14visualoco_msgs15Proprioception_ISaIvEEEEEvRKT]+0x2ef): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::AgileLocomotion()':
agile_locomotion.cpp:(.text._ZN16agile_locomotion15AgileLocomotionC2Ev[_ZN16agile_locomotion15AgileLocomotionC5Ev]+0x81): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /usr/bin/ld: agile_locomotion.cpp:(.text._ZN16agile_locomotion15AgileLocomotionC2Ev[_ZN16agile_locomotion15AgileLocomotionC5Ev]+0xd3): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function main': agile_locomotion.cpp:(.text.startup+0x4e): undefined reference to ros::init(int&, char**, std::string const&, unsigned int)'
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function ros::SubscriptionCallbackHelperT<boost::shared_ptr<visualoco_msgs::VisuaLatent_<std::allocator<void> > const> const&, void>::deserialize(ros::SubscriptionCallbackHelperDeserializeParams const&)': agile_locomotion.cpp:(.text._ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN14visualoco_msgs12VisuaLatent_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE[_ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN14visualoco_msgs12VisuaLatent_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE]+0x427): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/agile_locomotion.dir/build.make:414: /home/xyb/lhz/cms_ws/catkin_cms/devel/lib/agile_locomotion/agile_locomotion] Error 1
make[1]: *** [CMakeFiles/Makefile2:320: CMakeFiles/agile_locomotion.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

I downloaded libtorch according to your method, but the above error still occurred,,can you help me solve this error?

@boyuandeng
Copy link

@D-jojo Hi
Did you changed your CMakeList?
https://github.com/antonilo/vision_locomotion/blob/master/controller/CMakeLists.txt
Line 14, you can comment out that line,
or do not add catkin* config --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fdiagnostics-color*
during setting compile configuration.

@D-jojo
Copy link
Author

D-jojo commented Oct 23, 2023

@boyuandeng Hi,
I tried the two methods you mentioned, but still reported an error in the catkin build step, and the error is still the same.

@D-jojo
Copy link
Author

D-jojo commented Oct 24, 2023

@boyuandeng Hi,
I downloaded libtorch as you said, but now a new error appears.

CMake Error at /home/xyb/anaconda3/envs/cms/lib/python3.8/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:59 (find_package):
By not providing "FindCUDAToolkit.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"CUDAToolkit", but CMake did not find one.

Could not find a package configuration file provided by "CUDAToolkit" with
any of the following names:

CUDAToolkitConfig.cmake
cudatoolkit-config.cmake

Add the installation prefix of "CUDAToolkit" to CMAKE_PREFIX_PATH or set
"CUDAToolkit_DIR" to a directory containing one of the above files. If
"CUDAToolkit" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
/home/xyb/anaconda3/envs/cms/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
/home/xyb/anaconda3/envs/cms/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
CMakeLists.txt:10 (find_package)
How should I solve this problem?

@boyuandeng
Copy link

@D-jojo Hi
It seems like that you donot install CUDAToolkit or forget add the path of it to CMAKE_PREFIX_PATH

Could you show me your CMakeList?

@D-jojo
Copy link
Author

D-jojo commented Oct 24, 2023

@boyuandeng Hi,
This is my CMakeList.
cmake_minimum_required(VERSION 2.8.3)
project(agile_locomotion)

add_compile_options(-std=c++17)
add_compile_options(-O3)

find_package(catkin_simple REQUIRED COMPONENTS)

list(APPEND CMAKE_PREFIX_PATH "~/libtorch")
find_package(Torch REQUIRED)
find_package(Boost COMPONENTS thread system filesystem REQUIRED )
include_directories( ${Boost_INCLUDE_DIRS} )
find_package(Threads)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

catkin_package(
LIBRARIES
CATKIN_DEPENDS
)
catkin_simple(ALL_DEPS_REQUIRED)

#include_directories(include)

include_directories("~/libtorch/include")
link_directories("lib")

set(EXTRA_LIBS -pthread libunitree_legged_sdk_amd64.so lcm)

cs_add_library(low_level src/low_level.cpp)
target_link_libraries(low_level
"${catkin_LIBRARIES}"
"${EXTRA_LIBS}")

cs_add_library(cpp_policy src/cpp_policy.cpp)
target_link_libraries(cpp_policy
"${EXTRA_LIBS}"
"${TORCH_LIBRARIES}"
"${Boost_LIBRARIES}"
"${catkin_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT}")

cs_add_executable(agile_locomotion src/agile_locomotion.cpp)
target_link_libraries(agile_locomotion
low_level
cpp_policy
"${EXTRA_LIBS}"
"${Boost_LIBRARIES}"
"${catkin_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT}")
target_include_directories(agile_locomotion PUBLIC "${PROJECT_SOURCE_DIR}")

cs_install()
cs_export()

@boyuandeng
Copy link

@D-jojo Hi, sorry for reply you too late.(busy with other things

It's seem like that your cmakelist without any error.

but as I mentioned previously, please make sure install CUDAToolkit or add the path of it to CMAKE_PREFIX_PATH

@dstx123
Copy link

dstx123 commented Oct 31, 2023

I have solved this problem with the help of Deng, Because I didn't expect that must download a c++ type of torch(named libtorch) and placed in the path:/home/xx/. Thank you anyway.

@xyyl @boyuandeng @D-jojo Hello, I tried to download the libtorch and place it in the path:/home/xx/.
Then, I tried to comment out line 14 in the CMakeLists.txt
or avoid adding catkin* config --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fdiagnostics-color*.

However, the problem "agile_locomotion::AgileLocomotion::loadParameters()': agile_locomotion.cpp:(.text+0x751): undefined reference to" still happened.
Did I do something wrong? Looking forward to your answers.

@D-jojo
Copy link
Author

D-jojo commented Nov 11, 2023

I have solved this problem with the help of Deng, Because I didn't expect that must download a c++ type of torch(named libtorch) and placed in the path:/home/xx/. Thank you anyway.

@xyyl @boyuandeng @D-jojo Hello, I tried to download the libtorch and place it in the path:/home/xx/. Then, I tried to comment out line 14 in the CMakeLists.txt or avoid adding catkin* config --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fdiagnostics-color*.

However, the problem "agile_locomotion::AgileLocomotion::loadParameters()': agile_locomotion.cpp:(.text+0x751): undefined reference to" still happened. Did I do something wrong? Looking forward to your answers.

@antonilo @boyuandeng Hi,
I also did what you said, but it still didn’t solve the problem. Do you have any solutions?
My error is still like this:
agile_locomotion.cpp:(.text+0x791): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /usr/bin/ld: agile_locomotion.cpp:(.text+0x892): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x953): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /usr/bin/ld: agile_locomotion.cpp:(.text+0xa14): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0xad5): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o:agile_locomotion.cpp:(.text+0xb96): more undefined references to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)' follow
/usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::loadParameters()': agile_locomotion.cpp:(.text+0x176a): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x199c): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' /usr/bin/ld: agile_locomotion.cpp:(.text+0x1a0e): undefined reference to ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::lessstd::string, std::allocator<std::pair<std::string const, std::string> > > const&)'
/usr/bin/ld: agile_locomotion.cpp:(.text+0x1ab6): undefined reference to ros::NodeHandle::getParam(std::string const&, std::string&) const' /usr/bin/ld: CMakeFiles/agile_locomotion.dir/src/agile_locomotion.cpp.o: in function agile_locomotion::AgileLocomotion::AgileLocomotion(ros::NodeHandle const&, ros::NodeHandle const&)':
agile_locomotion.cpp:(.text+0x381a): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'

@D-jojo
Copy link
Author

D-jojo commented Nov 11, 2023

@antonilo @boyuandeng @xyyl
link.txt

Here is file (link.txt) which we fetched from our project working folder (build/agile_locomotion/CMakeFiles/agile_locomotion.dir/link.txt), we found there are too many redundant library path,
does that cause the link error as my previous info mentioned?

I don't know how to modify the "CMakefile.txt" (in 'src/agile_locomotion/controller'?? ) or some other file to fix this issue.

Does anyone have the idea? Thank you for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants