概述
从GITHUB上下载源码(https://github.com/orocos/orocos_kinematics_dynamics)
1、在orocos_kdl目录下
`ccmake .`
2、配置为如下形式
BUILD_MODELS ON
BUILD_MODELS_DEMO OFF
BUILD_SHARED_LIBS ON
CATKIN_ENABLE_TESTING ON
CATKIN_PACKAGE_PREFIX
CATKIN_SKIP_TESTING OFF
CATKIN_SYMLINK_INSTALL OFF
CMAKE_BUILD_TYPE Release
CMAKE_INSTALL_PREFIX /usr/local
CPPUNIT /usr/lib/x86_64-linux-gnu/libcppunit.so
CPPUNIT_HEADERS /usr/include
DOXYGEN_EXECUTABLE DOXYGEN_EXECUTABLE-NOTFOUND
EMPY_EXECUTABLE /usr/bin/empy
EMPY_SCRIPT /usr/bin/empy
ENABLE_EXAMPLES ON
ENABLE_TESTS OFF
Eigen3_DIR /usr/lib/cmake/eigen3
GMock_DIR GMock_DIR-NOTFOUND
KDL_USE_NEW_TREE_INTERFACE OFF
LSB_FOUND ON
LSB_RELEASE_EXECUTABLE /usr/bin/lsb_release
NOSETESTS /usr/bin/nosetests-2.7
PYTHON_VERSION 2
RT_LIBRARY /usr/lib/x86_64-linux-gnu/librt.so
SETUPTOOLS_DEB_LAYOUT ON
SITE fgs
UBUNTU ON
UBUNTU_XENIAL ON
_gmock_INCLUDES /usr/include/gmock/gmock.h
_gmock_SOURCES /usr/src/gmock/src/gmock.cc
_gtest_INCLUDES /usr/include/gtest/gtest.h
_gtest_SOURCES /usr/src/gtest/src/gtest.cc
catkin_DIR /opt/ros/kinetic/share/catkin/cmake
gmock_build_tests OFF
gtest_build_samples OFF
gtest_build_tests OFF
点击键盘c键,配置之前的修改,
之后点击g键,从而生成配置信息
3、在orocos_kdl目录下:
fgs@fgs:~/kdl_test/src/orocos_kinematics_dynamics-master/orocos_kdl$ make
[ 88%] Built target orocos-kdl
[ 92%] Built target orocos-kdl-models
[ 94%] Built target geometry
[ 97%] Built target trajectory_example
[100%] Built target chainiksolverpos_lma_demo
4、生成可执行文件,注意是下述文件的位置:
fgs@fgs:~/kdl_test/src/orocos_kinematics_dynamics-master/orocos_kdl/devel/lib/orocos_kdl$ ls
chainiksolverpos_lma_demo geometry trajectory_example
5、./执行即可,下面式执行结果
fgs@fgs:~/kdl_test/src/orocos_kinematics_dynamics-master/orocos_kdl/devel/lib/orocos_kdl$ ./geometry
v1 =[ 0, 0, 0]
v2 = [ 1, 2, 3]
v3 = [ 1, 2, 3]
v4 = [ 0, 0, 0]
v1: 4, 5, 6
v2: 7, 8, 9
v3: 10, 11, 12
2*v2 = [ 14, 16, 18]
v1*2 = [ 8, 10, 12]
v1/2 = [ 2, 2.5, 3]
v1+v2 = [ 11, 13, 15]
v3-v1 = [ 6, 6, 6]
v3-=v1; v3 = [ 6, 6, 6]
v2+=v1; v2 = [ 11, 13, 15]
cross(v1,v2) = [ -3, 6, -3]
dot(v1,v2) = 199
v1=-v2; v1=[ -11, -13, -15]
v1.ReverseSign(); v1 = [ 11, 13, 15]
v1==v2 ? 1
v1!=v2 ? 0
Equal(v1,v2,1e-6) ? 1
norm(v3): 10.3923
Normalize(v3)[ 0.57735, 0.57735, 0.57735]
SetToZero(v1); v1 = [ 0, 0, 0]
r1: [ 1, 0, 0;
0, 1, 0;
0, 0, 1]
r2: [ 0, 0, -1;
0, -1, 0;
1, 0, 0]
r3: [ 0, 0, -1;
1, 0, 0;
0, -1, 0]
r4: [ 1, 0, 0;
0, 1, 0;
0, 0, 1]
r5: [ 1, 0, 0;
0, 0.5, -0.866025;
0, 0.866025, 0.5]
r6: [ 0.5, 0, 0.866025;
0, 1, 0;
-0.866025, 0, 0.5]
r7: [ 0.5, -0.866025, 0;
0.866025, 0.5, 0;
0, 0, 1]
r8: [ 0.728028, -0.525105, 0.440727;
0.608789, 0.790791, -0.0634566;
-0.315202, 0.314508, 0.895395]
r9: [ 0.765682, -0.428256, 0.4799;
0.571734, 0.794968, -0.202787;
-0.294665, 0.429649, 0.853551]
r10: [ 0.103847, 0.86478, 0.491295;
0.422919, -0.485478, 0.765147;
0.900198, 0.12832, -0.416147]
r11: [ -0.224845, 0.902382, -0.36763;
-0.350175, -0.426918, -0.833738;
-0.909297, -0.0587266, 0.411982]
r12: [ 0.411982, -0.833738, -0.36763;
-0.0587266, -0.426918, 0.902382;
-0.909297, -0.350175, -0.224845]
r8(1,2): -0.0634566
equiv rot vector of r11: [ 1.10589, 0.772924, -1.78732]
equiv rot vector of r10:[ -0.72668, -0.466596, -0.504206]and angle: 2.68802
EulerZYZ: -0.399803, 0.548013, 0.969646
EulerZYX: 0.641385, 0.299109, 0.466338
Roll-Pitch-Yaw: 0.466338, 0.299109, 0.641385
UnitX of r8:[ -0.72668, -0.466596, -0.504206]
Unity of r8:[ -0.72668, -0.466596, -0.504206]
UnitZ of r8:[ -0.72668, -0.466596, -0.504206]
要搞明白上述运行结果的意义的话,可以查看example文件下的geometry.cpp,这个程序是为了展示其定义的类Vector(包含向量的多种运算,加减乘除、交积、叉积)和类Rotation。Rotation表示机器人的旋转矩阵(姿态),机器人学中表示机器人姿态有多种方法,orocos中定义的方法有RPY方法,角-轴,欧拉角方法,四元数方法。
最后
以上就是纯情宝贝为你收集整理的KDL学习之路的全部内容,希望文章能够帮你解决KDL学习之路所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复