orocos安装,在CPP中使用orocos-kdl和kdl_parser

在尝试在C++中使用OROCOS-KDL和KDL_Parser时遇到编译问题,出现多个未定义引用错误。通过调整g++编译命令,将库路径添加到-L选项,并确保链接库的顺序正确,问题得到解决。最终编译命令为:g++ -L/opt/ros/indigo/lib -I/opt/ros/indigo/include -I/usr/include/eigen3 test.cpp -lorocos-kdl -lkdl_parser -o test。此外,还需要设置LD_LIBRARY_PATH环境变量,使其包含/or/ros/indigo/lib。
摘要由CSDN通过智能技术生成

I am using orocos-kdl and kdl_parser in CPP. Since, ROS is installed in my pc, I can get these files /opt/ros/indigo/lib/libkdl_parser.so and

/opt/ros/indigo/lib/liborocos-kdl.so.1.3.0. Below is the main code i.e., test.cpp-

#include

#include

#include

#include

#include

int main(int argc, char** argv)

{

std::string urdf_file = "robot.urdf";

std::string base_link = "base";

std::string tip_link = "end_effector";

KDL::Tree tree;

if (!kdl_parser::treeFromFile(urdf_file, tree)) {

printf("Failed to construct kdl tree\n");

return -1;

}

KDL::Chain chain;

if (!tree.getChain(base_link, tip_link, chain))

printf("Couldn't find chain from %s to %s\n", base_link.c_str(), tip_li

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值